From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web10.67.1583451741067757216 for ; Thu, 05 Mar 2020 15:42:21 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KtVVDNdi; spf=pass (domain: redhat.com, ip: 205.139.110.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583451740; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KBSgQ2+X+fgzhEdjQeV65JUkcL1dL8sY8tsyim/sVj8=; b=KtVVDNdicMq/ssI9VJyYYZrJL0jDLEF2sts2zFsWFfsyn5wXpkFCTjYUAf1zKQ1dN+icuU J89EMWEgKrZNgXiTLLTGVRBxQHzuedv8OH0LOLtUQAKhTWovGz4VjD3kBS/msoYXUEhLiY dmpmm/+okdxYj2Y8BZOfZ78MNbQnUio= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-218-bavZXZC5MzKlWF0JwA4_5w-1; Thu, 05 Mar 2020 18:42:15 -0500 X-MC-Unique: bavZXZC5MzKlWF0JwA4_5w-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 493728017CC; Thu, 5 Mar 2020 23:42:14 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-117-216.ams2.redhat.com [10.36.117.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id ADFB873896; Thu, 5 Mar 2020 23:42:13 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v3 12/14] OvmfPkg/PlatformBootManagerLib: switch to QemuLoadImageLib To: Ard Biesheuvel Cc: edk2-devel-groups-io References: <20200305134607.20125-1-ard.biesheuvel@linaro.org> <20200305134607.20125-13-ard.biesheuvel@linaro.org> <5c7e3e2d-d47c-200a-f489-569abec4547d@redhat.com> From: "Laszlo Ersek" Message-ID: <80efccdc-2bdc-90fd-8edb-f247e77a1d67@redhat.com> Date: Fri, 6 Mar 2020 00:42:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 03/05/20 22:20, Ard Biesheuvel wrote: > 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. Right. Such surprises are going to disappear after is fixed, hopefully around August 2020. > Being able to drop LoadLinuxLib from the Xen build is a win in itself, Good point, I didn't realize! > so I will leave the Null library class for another day, if you don't > mind. > Sure, that's absolutely fine. Thanks! Laszlo