From nobody Tue May 7 00:39:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1520976165371587.8653018258514; Tue, 13 Mar 2018 14:22:45 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 38951224CCC00; Tue, 13 Mar 2018 14:16:19 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CFCFF22448883 for ; Tue, 13 Mar 2018 14:16:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4025F84256; Tue, 13 Mar 2018 21:22:38 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-124-72.rdu2.redhat.com [10.10.124.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49D1B50335; Tue, 13 Mar 2018 21:22:37 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 13 Mar 2018 22:22:28 +0100 Message-Id: <20180313212233.19215-2-lersek@redhat.com> In-Reply-To: <20180313212233.19215-1-lersek@redhat.com> References: <20180313212233.19215-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 13 Mar 2018 21:22:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 13 Mar 2018 21:22:38 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [edk2] [PATCH 1/6] OvmfPkg/QemuBootOrderLib: wrap overlong line X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Xiang Zheng , Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 81 characters is too many. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Shannon Zhao Cc: Xiang Zheng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Tested-by: Ard Biesheuvel # ArmVirtQemu Tested-by: Xiang Zheng --- OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/= Library/QemuBootOrderLib/QemuBootOrderLib.c index 366104adf535..682cc7a4dca5 100644 --- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c +++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c @@ -1909,7 +1909,8 @@ SetBootOrderFromQemu ( BootOrder.Data ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: setting BootOrder: %r\n", __FUNCTION__, St= atus)); + DEBUG ((DEBUG_ERROR, "%a: setting BootOrder: %r\n", __FUNCTION__, + Status)); goto ErrorFreeExtraPciRoots; } =20 --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue May 7 00:39:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1520976165796283.68684704295606; Tue, 13 Mar 2018 14:22:45 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id AA8AA224CCC03; Tue, 13 Mar 2018 14:16:21 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4B29E223CDC22 for ; Tue, 13 Mar 2018 14:16:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CEC95C33F; Tue, 13 Mar 2018 21:22:41 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-124-72.rdu2.redhat.com [10.10.124.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7C386352B; Tue, 13 Mar 2018 21:22:40 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 13 Mar 2018 22:22:29 +0100 Message-Id: <20180313212233.19215-3-lersek@redhat.com> In-Reply-To: <20180313212233.19215-1-lersek@redhat.com> References: <20180313212233.19215-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 13 Mar 2018 21:22:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 13 Mar 2018 21:22:41 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [edk2] [PATCH 2/6] OvmfPkg/QemuBootOrderLib: add missing EFIAPI specifiers X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Xiang Zheng , Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Public library APIs should be declared as EFIAPI. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Shannon Zhao Cc: Xiang Zheng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Tested-by: Ard Biesheuvel # ArmVirtQemu Tested-by: Xiang Zheng --- OvmfPkg/Include/Library/QemuBootOrderLib.h | 2 ++ OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/OvmfPkg/Include/Library/QemuBootOrderLib.h b/OvmfPkg/Include/L= ibrary/QemuBootOrderLib.h index 743a71782471..874344a95d80 100644 --- a/OvmfPkg/Include/Library/QemuBootOrderLib.h +++ b/OvmfPkg/Include/Library/QemuBootOrderLib.h @@ -49,6 +49,7 @@ =20 **/ RETURN_STATUS +EFIAPI SetBootOrderFromQemu ( VOID ); @@ -61,6 +62,7 @@ SetBootOrderFromQemu ( @return The TimeoutDefault argument for PlatformBdsEnterFrontPage(). **/ UINT16 +EFIAPI GetFrontPageTimeoutFromQemu ( VOID ); diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/= Library/QemuBootOrderLib/QemuBootOrderLib.c index 682cc7a4dca5..b699970b12ab 100644 --- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c +++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c @@ -1763,6 +1763,7 @@ PruneBootVariables ( =20 **/ RETURN_STATUS +EFIAPI SetBootOrderFromQemu ( VOID ) @@ -1946,6 +1947,7 @@ ErrorFreeFwCfg: @return The TimeoutDefault argument for PlatformBdsEnterFrontPage(). **/ UINT16 +EFIAPI GetFrontPageTimeoutFromQemu ( VOID ) --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue May 7 00:39:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1520976169800654.3580491714246; Tue, 13 Mar 2018 14:22:49 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 20558224CCC08; Tue, 13 Mar 2018 14:16:23 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6FEBA2248729A for ; Tue, 13 Mar 2018 14:16:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0D92C20CC6; Tue, 13 Mar 2018 21:22:43 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-124-72.rdu2.redhat.com [10.10.124.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16B9D50335; Tue, 13 Mar 2018 21:22:41 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 13 Mar 2018 22:22:30 +0100 Message-Id: <20180313212233.19215-4-lersek@redhat.com> In-Reply-To: <20180313212233.19215-1-lersek@redhat.com> References: <20180313212233.19215-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 13 Mar 2018 21:22:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 13 Mar 2018 21:22:43 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [edk2] [PATCH 3/6] OvmfPkg/QemuBootOrderLib: clean up translation of virtio-net over MMIO X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Xiang Zheng , Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The "/MAC(" suffix of the translated UEFI devpath prefix is unnecessary for matching, because the virtio-mmio base address in VenHwString is unique anyway. Furthermore, the partial string "MAC(" cannot be processed by ConvertTextToDevicePath(), which will become relevant later in this series. Remove "/MAC(". While at it, remove a bogus comment on PCI. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Shannon Zhao Cc: Xiang Zheng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Tested-by: Ard Biesheuvel # ArmVirtQemu Tested-by: Xiang Zheng --- OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/= Library/QemuBootOrderLib/QemuBootOrderLib.c index b699970b12ab..a4213cf6d267 100644 --- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c +++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c @@ -1217,14 +1217,14 @@ TranslateMmioOfwNodes ( // | fixed // base address of virtio-mmio register block // - // UEFI device path prefix (dependent on presence of nonzero PCI funct= ion): + // UEFI device path prefix: // - // /MAC( + // // Written =3D UnicodeSPrintAsciiFormat ( Translated, *TranslatedSize * sizeof (*Translated), // BufferSize in b= ytes - "%s/MAC(", + "%s", VenHwString ); } else { --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue May 7 00:39:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1520976170765620.5830036958286; Tue, 13 Mar 2018 14:22:50 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 88D18224CCC0F; Tue, 13 Mar 2018 14:16:25 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B3477223CDC22 for ; Tue, 13 Mar 2018 14:16:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4243F4023BB3; Tue, 13 Mar 2018 21:22:44 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-124-72.rdu2.redhat.com [10.10.124.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AA4A50335; Tue, 13 Mar 2018 21:22:43 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 13 Mar 2018 22:22:31 +0100 Message-Id: <20180313212233.19215-5-lersek@redhat.com> In-Reply-To: <20180313212233.19215-1-lersek@redhat.com> References: <20180313212233.19215-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 13 Mar 2018 21:22:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 13 Mar 2018 21:22:44 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [edk2] [PATCH 4/6] OvmfPkg/QemuBootOrderLib: add ConnectDevicesFromQemu() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Xiang Zheng , Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" QemuBootOrderLib expects PlatformBootManagerLib to call the following triplet: (1) EfiBootManagerConnectAll(), (2) EfiBootManagerRefreshAllBootOption(), (3) SetBootOrderFromQemu(). This leads to bad performance, when many devices exist such that the firmware can drive them, but they aren't marked for booting in the "bootorder" fw_cfg file. Namely, (1) EfiBootManagerConnectAll() talks to all hardware, which takes long. Plus some DriverBindingStart() functions write NV variables, which is also slow. (For example, the IP config policy for each NIC is stored in an NV var that is named after the MAC). (2) EfiBootManagerRefreshAllBootOption() generates boot options from the protocol instances produced by (1). Writing boot options is slow. (3) Under the above circumstances, SetBootOrderFromQemu() removes most of the boot options produced by (2). Erasing boot options is slow. Introduce ConnectDevicesFromQemu() as a replacement for (1): only connect devices that the QEMU user actually wants to boot off of. (There's a slight loss of compatibility when a platform switches from EfiBootManagerConnectAll() to ConnectDevicesFromQemu(). EfiBootManagerConnectAll() may produce UEFI device paths that are unknown to QemuBootOrderLib (that is, for neither PCI- nor virtio-mmio-based devices). The BootOrderComplete() function lets such unmatched boot options survive at the end of the boot order. With ConnectDevicesFromQemu(), these options will not be auto-generated in the first place. They may still be produced by other means. SetBootOrderFromQemu() is not modified in any way; reordering+filtering boot options remains a separate task.) Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Shannon Zhao Cc: Xiang Zheng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Tested-by: Ard Biesheuvel # ArmVirtQemu Tested-by: Xiang Zheng --- OvmfPkg/Include/Library/QemuBootOrderLib.h | 39 ++++- OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c | 154 ++++++++++++++++= +++- 2 files changed, 189 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/Include/Library/QemuBootOrderLib.h b/OvmfPkg/Include/L= ibrary/QemuBootOrderLib.h index 874344a95d80..d17de3bb8fae 100644 --- a/OvmfPkg/Include/Library/QemuBootOrderLib.h +++ b/OvmfPkg/Include/Library/QemuBootOrderLib.h @@ -20,6 +20,41 @@ #include =20 =20 +/** + Connect devices based on the boot order retrieved from QEMU. + + Attempt to retrieve the "bootorder" fw_cfg file from QEMU. Translate the + OpenFirmware device paths therein to UEFI device path fragments. Connect= the + devices identified by the UEFI devpath prefixes as narrowly as possible,= then + connect all their child devices, recursively. + + If this function fails, then platform BDS should fall back to + EfiBootManagerConnectAll(), or some other method for connecting any expe= cted + boot devices. + + @retval RETURN_SUCCESS The "bootorder" fw_cfg file has been + parsed, and the referenced device-subt= rees + have been connected. + + @retval RETURN_UNSUPPORTED QEMU's fw_cfg is not supported. + + @retval RETURN_NOT_FOUND Empty or nonexistent "bootorder" fw_cfg + file. + + @retval RETURN_INVALID_PARAMETER Parse error in the "bootorder" fw_cfg = file. + + @retval RETURN_OUT_OF_RESOURCES Memory allocation failed. + + @return Error statuses propagated from underly= ing + functions. +**/ +RETURN_STATUS +EFIAPI +ConnectDevicesFromQemu ( + VOID + ); + + /** =20 Set the boot order based on configuration retrieved from QEMU. @@ -29,8 +64,8 @@ translated fragments against the current list of boot options, and rewri= te the BootOrder NvVar so that it corresponds to the order described in fw_= cfg. =20 - Platform BDS should call this function after EfiBootManagerConnectAll ()= and - EfiBootManagerRefreshAllBootOption () return. + Platform BDS should call this function after connecting any expected boot + devices and calling EfiBootManagerRefreshAllBootOption (). =20 @retval RETURN_SUCCESS BootOrder NvVar rewritten. =20 diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c b/OvmfPkg/= Library/QemuBootOrderLib/QemuBootOrderLib.c index a4213cf6d267..15e4c67e48c5 100644 --- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c +++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c @@ -1453,6 +1453,156 @@ TranslateOfwPath ( } =20 =20 +/** + Connect devices based on the boot order retrieved from QEMU. + + Attempt to retrieve the "bootorder" fw_cfg file from QEMU. Translate the + OpenFirmware device paths therein to UEFI device path fragments. Connect= the + devices identified by the UEFI devpath prefixes as narrowly as possible,= then + connect all their child devices, recursively. + + If this function fails, then platform BDS should fall back to + EfiBootManagerConnectAll(), or some other method for connecting any expe= cted + boot devices. + + @retval RETURN_SUCCESS The "bootorder" fw_cfg file has been + parsed, and the referenced device-subt= rees + have been connected. + + @retval RETURN_UNSUPPORTED QEMU's fw_cfg is not supported. + + @retval RETURN_NOT_FOUND Empty or nonexistent "bootorder" fw_cfg + file. + + @retval RETURN_INVALID_PARAMETER Parse error in the "bootorder" fw_cfg = file. + + @retval RETURN_OUT_OF_RESOURCES Memory allocation failed. + + @return Error statuses propagated from underly= ing + functions. +**/ +RETURN_STATUS +EFIAPI +ConnectDevicesFromQemu ( + VOID + ) +{ + RETURN_STATUS Status; + FIRMWARE_CONFIG_ITEM FwCfgItem; + UINTN FwCfgSize; + CHAR8 *FwCfg; + EFI_STATUS EfiStatus; + EXTRA_ROOT_BUS_MAP *ExtraPciRoots; + CONST CHAR8 *FwCfgPtr; + UINTN NumConnected; + UINTN TranslatedSize; + CHAR16 Translated[TRANSLATION_OUTPUT_SIZE]; + + Status =3D QemuFwCfgFindFile ("bootorder", &FwCfgItem, &FwCfgSize); + if (RETURN_ERROR (Status)) { + return Status; + } + + if (FwCfgSize =3D=3D 0) { + return RETURN_NOT_FOUND; + } + + FwCfg =3D AllocatePool (FwCfgSize); + if (FwCfg =3D=3D NULL) { + return RETURN_OUT_OF_RESOURCES; + } + + QemuFwCfgSelectItem (FwCfgItem); + QemuFwCfgReadBytes (FwCfgSize, FwCfg); + if (FwCfg[FwCfgSize - 1] !=3D '\0') { + Status =3D RETURN_INVALID_PARAMETER; + goto FreeFwCfg; + } + DEBUG ((DEBUG_VERBOSE, "%a: FwCfg:\n", __FUNCTION__)); + DEBUG ((DEBUG_VERBOSE, "%a\n", FwCfg)); + DEBUG ((DEBUG_VERBOSE, "%a: FwCfg: \n", __FUNCTION__)); + + if (FeaturePcdGet (PcdQemuBootOrderPciTranslation)) { + EfiStatus =3D CreateExtraRootBusMap (&ExtraPciRoots); + if (EFI_ERROR (EfiStatus)) { + Status =3D (RETURN_STATUS)EfiStatus; + goto FreeFwCfg; + } + } else { + ExtraPciRoots =3D NULL; + } + + // + // Translate each OpenFirmware path to a UEFI devpath prefix. + // + FwCfgPtr =3D FwCfg; + NumConnected =3D 0; + TranslatedSize =3D ARRAY_SIZE (Translated); + Status =3D TranslateOfwPath (&FwCfgPtr, ExtraPciRoots, Translated, + &TranslatedSize); + while (!RETURN_ERROR (Status)) { + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + EFI_HANDLE Controller; + + // + // Convert the UEFI devpath prefix to binary representation. + // + ASSERT (Translated[TranslatedSize] =3D=3D L'\0'); + DevicePath =3D ConvertTextToDevicePath (Translated); + if (DevicePath =3D=3D NULL) { + Status =3D RETURN_OUT_OF_RESOURCES; + goto FreeExtraPciRoots; + } + // + // Advance along DevicePath, connecting the nodes individually, and as= king + // drivers not to produce sibling nodes. Retrieve the controller handle + // associated with the full DevicePath -- this is the device that QEMU= 's + // OFW devpath refers to. + // + EfiStatus =3D EfiBootManagerConnectDevicePath (DevicePath, &Controller= ); + FreePool (DevicePath); + if (EFI_ERROR (EfiStatus)) { + Status =3D (RETURN_STATUS)EfiStatus; + goto FreeExtraPciRoots; + } + // + // Because QEMU's OFW devpaths have lesser expressive power than UEFI + // devpaths (i.e., DevicePath is considered a prefix), connect the tree + // rooted at Controller, recursively. If no children are produced + // (EFI_NOT_FOUND), that's OK. + // + EfiStatus =3D gBS->ConnectController (Controller, NULL, NULL, TRUE); + if (EFI_ERROR (EfiStatus) && EfiStatus !=3D EFI_NOT_FOUND) { + Status =3D (RETURN_STATUS)EfiStatus; + goto FreeExtraPciRoots; + } + ++NumConnected; + // + // Move to the next OFW devpath. + // + TranslatedSize =3D ARRAY_SIZE (Translated); + Status =3D TranslateOfwPath (&FwCfgPtr, ExtraPciRoots, Translated, + &TranslatedSize); + } + + if (Status =3D=3D RETURN_NOT_FOUND && NumConnected > 0) { + DEBUG ((DEBUG_INFO, "%a: %Lu OpenFirmware device path(s) connected\n", + __FUNCTION__, (UINT64)NumConnected)); + Status =3D RETURN_SUCCESS; + } + +FreeExtraPciRoots: + if (ExtraPciRoots !=3D NULL) { + DestroyExtraRootBusMap (ExtraPciRoots); + } + +FreeFwCfg: + FreePool (FwCfg); + + return Status; +} + + /** =20 Convert the UEFI DevicePath to full text representation with DevPathToTe= xt, @@ -1743,8 +1893,8 @@ PruneBootVariables ( translated fragments against the current list of boot options, and rewri= te the BootOrder NvVar so that it corresponds to the order described in fw_= cfg. =20 - Platform BDS should call this function after EfiBootManagerConnectAll ()= and - EfiBootManagerRefreshAllBootOption () return. + Platform BDS should call this function after connecting any expected boot + devices and calling EfiBootManagerRefreshAllBootOption (). =20 @retval RETURN_SUCCESS BootOrder NvVar rewritten. =20 --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue May 7 00:39:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1520976178231740.2839775348655; Tue, 13 Mar 2018 14:22:58 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E4795224CCC11; Tue, 13 Mar 2018 14:16:25 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 102A22249275A for ; Tue, 13 Mar 2018 14:16:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7687E406E8BD; Tue, 13 Mar 2018 21:22:45 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-124-72.rdu2.redhat.com [10.10.124.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FB0C50334; Tue, 13 Mar 2018 21:22:44 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 13 Mar 2018 22:22:32 +0100 Message-Id: <20180313212233.19215-6-lersek@redhat.com> In-Reply-To: <20180313212233.19215-1-lersek@redhat.com> References: <20180313212233.19215-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 13 Mar 2018 21:22:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 13 Mar 2018 21:22:45 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [edk2] [PATCH 5/6] OvmfPkg/PlatformBootManagerLib: minimize the set of connected devices X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Xiang Zheng , Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Prefer ConnectDevicesFromQemu() to EfiBootManagerConnectAll(). Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Shannon Zhao Cc: Xiang Zheng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Tested-by: Ard Biesheuvel # ArmVirtQemu Tested-by: Xiang Zheng --- OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.c index 025252e72b39..5ef0e828900d 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -1346,7 +1346,8 @@ Returns: =20 --*/ { - UINTN Index; + UINTN Index; + RETURN_STATUS Status; =20 DEBUG ((EFI_D_INFO, "PlatformBdsConnectSequence\n")); =20 @@ -1365,11 +1366,14 @@ Returns: Index++; } =20 - // - // Just use the simple policy to connect all devices - // - DEBUG ((EFI_D_INFO, "EfiBootManagerConnectAll\n")); - EfiBootManagerConnectAll (); + Status =3D ConnectDevicesFromQemu (); + if (RETURN_ERROR (Status)) { + // + // Just use the simple policy to connect all devices + // + DEBUG ((DEBUG_INFO, "EfiBootManagerConnectAll\n")); + EfiBootManagerConnectAll (); + } =20 PciAcpiInitialization (); } --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Tue May 7 00:39:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1520976176303993.0270326556575; Tue, 13 Mar 2018 14:22:56 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5D9E1224CCC19; Tue, 13 Mar 2018 14:16:28 -0700 (PDT) Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1CF37224CCC06 for ; Tue, 13 Mar 2018 14:16:25 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A97DA4040073; Tue, 13 Mar 2018 21:22:46 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-124-72.rdu2.redhat.com [10.10.124.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id B39366352B; Tue, 13 Mar 2018 21:22:45 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org From: Laszlo Ersek To: edk2-devel-01 Date: Tue, 13 Mar 2018 22:22:33 +0100 Message-Id: <20180313212233.19215-7-lersek@redhat.com> In-Reply-To: <20180313212233.19215-1-lersek@redhat.com> References: <20180313212233.19215-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 13 Mar 2018 21:22:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 13 Mar 2018 21:22:46 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [edk2] [PATCH 6/6] ArmVirtPkg/PlatformBootManagerLib: minimize the set of connected devices X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen , Xiang Zheng , Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Prefer ConnectDevicesFromQemu() to EfiBootManagerConnectAll(). Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Shannon Zhao Cc: Xiang Zheng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel Tested-by: Ard Biesheuvel # ArmVirtQemu Tested-by: Xiang Zheng --- ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVi= rtPkg/Library/PlatformBootManagerLib/PlatformBm.c index f9591964d577..36e0eed2384a 100644 --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -663,15 +663,23 @@ PlatformBootManagerAfterConsole ( VOID ) { + RETURN_STATUS Status; + // // Show the splash screen. // BootLogoEnableLogo (); =20 // - // Connect the rest of the devices. + // Connect the purported boot devices. // - EfiBootManagerConnectAll (); + Status =3D ConnectDevicesFromQemu (); + if (RETURN_ERROR (Status)) { + // + // Connect the rest of the devices. + // + EfiBootManagerConnectAll (); + } =20 // // Process QEMU's -kernel command line option. Note that the kernel boot= ed --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel