From nobody Sat Nov 2 14:35:04 2024 Delivered-To: importer@patchew.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; Authentication-Results: mx.zoho.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; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1489783687827282.74050054565; Fri, 17 Mar 2017 13:48:07 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2AB4080456; Fri, 17 Mar 2017 13:47:55 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 2264480439 for ; Fri, 17 Mar 2017 13:47:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8CF7F8048A; Fri, 17 Mar 2017 20:47:54 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-70.phx2.redhat.com [10.3.116.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 948A717AC2; Fri, 17 Mar 2017 20:47:53 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8CF7F8048A Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lersek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8CF7F8048A From: Laszlo Ersek To: edk2-devel-01 Date: Fri, 17 Mar 2017 21:47:30 +0100 Message-Id: <20170317204731.31488-12-lersek@redhat.com> In-Reply-To: <20170317204731.31488-1-lersek@redhat.com> References: <20170317204731.31488-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 17 Mar 2017 20:47:54 +0000 (UTC) Subject: [edk2] [PATCH v2 11/12] ArmVirtPkg/PlatformHasAcpiDtDxe: don't expose DT if QEMU provides ACPI X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leif Lindholm , 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" This will let QEMU's "-no-acpi" option exclusively expose DT vs. ACPI to the guest. Showing both is never needed (it is actually detrimental to the adoption of standards, such as SBSA / SBBR). * Without "-no-acpi", the firmware logs (from PlatformHasAcpiDtDxe) > Found FwCfg @ 0x9020008/0x9020000 > Found FwCfg DMA @ 0x9020010 > InstallProtocolInterface: [EdkiiPlatformHasAcpiProtocol] 0 plus the usual messages. Later the guest kernel logs > [ 0.000000] efi: SMBIOS 3.0=3D0x13bdb0000 ACPI 2.0=3D0x138440000 before it lists the ACPI tables one by one. * With "-no-acpi", the firmware logs: > PlatformHasAcpiDtDxe | Found FwCfg @ 0x9020008/0x9020000 > PlatformHasAcpiDtDxe | Found FwCfg DMA @ 0x9020010 > PlatformHasAcpiDtDxe | InstallProtocolInterface: > PlatformHasAcpiDtDxe | [EdkiiPlatformHasDeviceTreeProtocol] 0 > FdtClientDxe | OnPlatformHasDeviceTree: exposing DTB @ > FdtClientDxe | 0x13FFBF000 to OS > ... > DXE_CORE | Driver [AcpiTableDxe] was discovered but not > DXE_CORE | loaded!! > DXE_CORE | Driver [QemuFwCfgAcpiPlatform] was discovered but > DXE_CORE | not loaded!! > ... > RamDiskDxe | RamDiskAcpiCheck: Cannot locate the EFI ACPI > RamDiskDxe | Table Protocol, unable to publish RAM disks to > RamDiskDxe | NFIT. (BootGraphicsResourceTableDxe's ReadyToBoot callback -- InstallBootGraphicsResourceTable() -- handles the lack of EFI_ACPI_TABLE_PROTOCOL silently.) Later the guest kernel logs > [ 0.000000] efi: SMBIOS 3.0=3D0x13bdb0000 MEMATTR=3D0x138b3c018 Cc: Ard Biesheuvel Cc: Leif Lindholm Ref: https://bugzilla.redhat.com/show_bug.cgi?id=3D1430262 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel --- ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf | 6 +-- ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c | 45 ++++++++++++= -------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf b/Arm= VirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf index 7724cf215dda..95a56a10bb5c 100644 --- a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf +++ b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf @@ -28,11 +28,12 @@ [Packages] ArmPkg/ArmPkg.dec ArmVirtPkg/ArmVirtPkg.dec MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec =20 [LibraryClasses] BaseLib DebugLib - PcdLib + QemuFwCfgLib UefiBootServicesTableLib UefiDriverEntryPoint =20 @@ -40,8 +41,5 @@ [Protocols] gEdkiiPlatformHasAcpiProtocolGuid ## SOMETIMES_PRODUCES gEdkiiPlatformHasDeviceTreeProtocolGuid ## SOMETIMES_PRODUCES =20 -[FeaturePcd] - gArmVirtTokenSpaceGuid.PcdPureAcpiBoot ## CONSUMES - [Depex] TRUE diff --git a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c b/ArmVi= rtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c index 8681f813a6b5..46f96401632c 100644 --- a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c +++ b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c @@ -15,7 +15,7 @@ =20 #include #include -#include +#include #include #include #include @@ -27,18 +27,27 @@ PlatformHasAcpiDt ( IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_STATUS Status; - - Status =3D EFI_SUCCESS; + EFI_STATUS Status; + FIRMWARE_CONFIG_ITEM FwCfgItem; + UINTN FwCfgSize; =20 // // If we fail to install any of the necessary protocols below, the OS wi= ll be // unbootable anyway (due to lacking hardware description), so tolerate = no // errors here. // - // Always make ACPI available on 64-bit systems. - // - if (MAX_UINTN =3D=3D MAX_UINT64) { + if (MAX_UINTN =3D=3D MAX_UINT64 && + !EFI_ERROR ( + QemuFwCfgFindFile ( + "etc/table-loader", + &FwCfgItem, + &FwCfgSize + ) + )) { + // + // Only make ACPI available on 64-bit systems, and only if QEMU genera= tes + // (a subset of) the ACPI tables. + // Status =3D gBS->InstallProtocolInterface ( &ImageHandle, &gEdkiiPlatformHasAcpiProtocolGuid, @@ -48,21 +57,21 @@ PlatformHasAcpiDt ( if (EFI_ERROR (Status)) { goto Failed; } + + return Status; } =20 // - // Expose the Device Tree unless PcdPureAcpiBoot is set. + // Expose the Device Tree otherwise. // - if (!FeaturePcdGet (PcdPureAcpiBoot)) { - Status =3D gBS->InstallProtocolInterface ( - &ImageHandle, - &gEdkiiPlatformHasDeviceTreeProtocolGuid, - EFI_NATIVE_INTERFACE, - NULL - ); - if (EFI_ERROR (Status)) { - goto Failed; - } + Status =3D gBS->InstallProtocolInterface ( + &ImageHandle, + &gEdkiiPlatformHasDeviceTreeProtocolGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + if (EFI_ERROR (Status)) { + goto Failed; } =20 return Status; --=20 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel