From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web11.2301.1583443220112981428 for ; Thu, 05 Mar 2020 13:20:20 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=a0sS+qbx; spf=pass (domain: linaro.org, ip: 209.85.221.67, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wr1-f67.google.com with SMTP id n7so8752257wrt.11 for ; Thu, 05 Mar 2020 13:20:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iMkAtMOtsk03TD/CHBztW4GuKpODyC08LlIEFE9zwuQ=; b=a0sS+qbxhWijJAz19RQvkEnz+/0jhL+JYUg9b5lGADtNZLH2C6UP/nqmeNhBPH3ZTg 5U7VwRrg1HPMBV1eoNByz+DBcRUfFf5HCMWUtVZE7njoZdD7Z6ZJVd9nXg2U5gRHKVmu ozhFJwqFnWOU6bSbIonPWzVDZC4+3GSHpyPq1fmita12XX7gMoTcCxnEEPY8Fgazd+5f ClOwl5Jzccd/k1sdos1rfM+fS8oNXgqejfY09IULrQ4puFIKGMdsgCHgd0SbCDcA3mjT 1t+c1Ekbiw4f8HoQUfbQZBfbDc2ajmm+GZkBQQHmpkGTYvtnx3+uWp2nMwvnZcI5G+G2 2Tww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iMkAtMOtsk03TD/CHBztW4GuKpODyC08LlIEFE9zwuQ=; b=po8X5tz2bnv8oIUHE6k5EzY9hJMfQa7GmABKpj3a0hZGFw5kNamOC2FxnF0AW3zHkd COjfiWTD0QyKIiShVeV0GzN81tvmgz9hKjF9CcD1r2r+Aioc7xaAg9hB/wZKHzrC0uR4 1yIGQcopjq3OxKfXiqkzqcRtwSONsHQS+M55Kkk5GHt8bWETYm8GOjfOl02YJisS6zEC 3ZX4cKnynMchctSf6WPPB+x3H972w2w0CBd7N8BOhCF7SODSBXWcJu0sYSiW8fIaUcrB bpZciTFS1zGAWZ2fDsXJkpL4jf1xClU4v/V7Lf9wvG5XO7ThX62DYJhP8avDOdw+9WBw +m+g== X-Gm-Message-State: ANhLgQ3L7Uxeb8Sd++QVoSC/cO2FXL0HTwXX522LJNzwQD2AET8XBISy Etl3R9j7alavKx79QphEBMDzA2a6nxKbeX2LW5hT8Q== X-Google-Smtp-Source: ADFU+vtrn6A5Wd7hBSVvUYPE03Po8+cgJvA9wWewrXeia6eMJfinoZbceksYSHkLDfiJSNaagbiGQ59GLUtGN7U+JtQ= X-Received: by 2002:adf:f84a:: with SMTP id d10mr861798wrq.208.1583443218632; Thu, 05 Mar 2020 13:20:18 -0800 (PST) MIME-Version: 1.0 References: <20200305134607.20125-1-ard.biesheuvel@linaro.org> <20200305134607.20125-13-ard.biesheuvel@linaro.org> <5c7e3e2d-d47c-200a-f489-569abec4547d@redhat.com> In-Reply-To: <5c7e3e2d-d47c-200a-f489-569abec4547d@redhat.com> From: "Ard Biesheuvel" Date: Thu, 5 Mar 2020 22:20:07 +0100 Message-ID: Subject: Re: [edk2-devel] [PATCH v3 12/14] OvmfPkg/PlatformBootManagerLib: switch to QemuLoadImageLib To: Laszlo Ersek Cc: edk2-devel-groups-io Content-Type: text/plain; charset="UTF-8" On Thu, 5 Mar 2020 at 22:15, Laszlo Ersek wrote: > > Hi Ard, > > On 03/05/20 14:46, Ard Biesheuvel wrote: > > Replace the open coded sequence to load Linux on x86 with a short and > > generic sequence invoking QemuLoadImageLib, which can be provided by > > a generic version that only supports the LoadImage and StartImage boot > > services, and one that incorporates the entire legacy loading sequence > > as well. > > > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2566 > > Signed-off-by: Ard Biesheuvel > > Reviewed-by: Laszlo Ersek > > --- > > OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 2 +- > > OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c | 144 ++------------------ > > 2 files changed, 14 insertions(+), 132 deletions(-) > > > > diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf > > index c479f113b92b..e470b9a6a3e5 100644 > > --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf > > +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf > > @@ -49,7 +49,7 @@ [LibraryClasses] > > NvVarsFileLib > > QemuFwCfgLib > > QemuFwCfgS3Lib > > - LoadLinuxLib > > + QemuLoadImageLib > > QemuBootOrderLib > > ReportStatusCodeLib > > UefiLib > > This hunk (in commit 859b55443a42) seems to break the OvmfXen platform build: > > Active Platform = OvmfPkg/OvmfXen.dsc > > build.py... > OvmfPkg/OvmfXen.dsc(...): error 4000: Instance of library class [QemuLoadImageLib] is not found > in [OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf] [X64] > consumed by module [MdeModulePkg/Universal/BdsDxe/BdsDxe.inf] > > Can you please send a patch? > > I think resolving the lib class to the generic instance suffices. gBS->LoadImage() will return EFI_NOT_FOUND from QemuLoadKernelImage(), because OvmfPkg/QemuKernelLoaderFsDxe is not included in the Xen platform. > > An alternative fix that's larger in source code, but lighter in binary code, would be to add a Null instance of QemuLoadImageLib, and use that in the Xen platform. > > For the future, please include OvmfXen.dsc in your build / CI scripts. > Apologies - I will fix it right away. It never occurred to me that 'TryRunningQemuKernel ()' is live code on OvmfXen. Being able to drop LoadLinuxLib from the Xen build is a win in itself, so I will leave the Null library class for another day, if you don't mind.