From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7999E80436 for ; Fri, 17 Mar 2017 14:10:36 -0700 (PDT) Received: by mail-it0-x236.google.com with SMTP id m27so36019153iti.0 for ; Fri, 17 Mar 2017 14:10:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NiyktQgMuIwIPxjs6YsgzUBgGzYUVYysPAqLq6FRVRc=; b=YvfFbogkfLQoRwaKPlPMg7hhahZLQLTjsR8z60DGWBYxqE1cB6jx4KP1jf7KkTSfxx nOn/SX8GhedwCMwrJhjS0RsVA8aX7II1XkSWXN+yLF7Ps7upDsmcgSbYU+66LM/2JuZU jajJPwEBLfttO+b2WGzEmclblpFoySAKrOibk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=NiyktQgMuIwIPxjs6YsgzUBgGzYUVYysPAqLq6FRVRc=; b=le9A5zSuL7M9aq/yy7Sl4ZHab6kD0rcIM5c5Nyz/I+zQ/3JIk103dQnEeIzf/dRucl b42MtmXEMJ9gn4rIJdijhTD1vOv8twC+1J4hlJXlSy66U0FS2DdobWIJoNLhBUitF0L3 mqvE4u0vQ3Kv2bMif4ewoyK5SWuTltqeOJXDZBqSHk3t9Oq5s3TdA8j4YU6URanG4nf/ jd/C7WaLhmZcPPWPdSXNYv5f8aXfqXfPTj157KVePa0nkk7NZmLmZj4MZbOJX4a5uukW FNNpY3+a3xThA53zNlvp37xGv6lWvDpiABoGA1sMaxzWeBgopE7hAk58C7nvFfqw/U1w 7FIA== X-Gm-Message-State: AFeK/H0ejTPLW2SYw53Qu/bN5krGD8zSEotE/ufAk7d9wCLVnn37uWjqcDM3Cj979UT3BBUs0P3Z0F3bO0eBaVNo X-Received: by 10.36.23.74 with SMTP id 71mr276370ith.37.1489785035616; Fri, 17 Mar 2017 14:10:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.10.27 with HTTP; Fri, 17 Mar 2017 14:10:35 -0700 (PDT) In-Reply-To: <20170317204731.31488-12-lersek@redhat.com> References: <20170317204731.31488-1-lersek@redhat.com> <20170317204731.31488-12-lersek@redhat.com> From: Ard Biesheuvel Date: Fri, 17 Mar 2017 21:10:35 +0000 Message-ID: To: Laszlo Ersek Cc: edk2-devel-01 , Leif Lindholm Subject: Re: [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: , X-List-Received-Date: Fri, 17 Mar 2017 21:10:36 -0000 Content-Type: text/plain; charset=UTF-8 On 17 March 2017 at 20:47, Laszlo Ersek wrote: > 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=0x13bdb0000 ACPI 2.0=0x138440000 Why is there no MEMATTR table in this case? Or was it omitted for brevity? > > 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=0x13bdb0000 MEMATTR=0x138b3c018 > > Cc: Ard Biesheuvel > Cc: Leif Lindholm > Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1430262 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Laszlo Ersek > --- > 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/ArmVirtPkg/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 > > [LibraryClasses] > BaseLib > DebugLib > - PcdLib > + QemuFwCfgLib > UefiBootServicesTableLib > UefiDriverEntryPoint > > @@ -40,8 +41,5 @@ [Protocols] > gEdkiiPlatformHasAcpiProtocolGuid ## SOMETIMES_PRODUCES > gEdkiiPlatformHasDeviceTreeProtocolGuid ## SOMETIMES_PRODUCES > > -[FeaturePcd] > - gArmVirtTokenSpaceGuid.PcdPureAcpiBoot ## CONSUMES > - > [Depex] > TRUE > diff --git a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c > index 8681f813a6b5..46f96401632c 100644 > --- a/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c > +++ b/ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.c > @@ -15,7 +15,7 @@ > > #include > #include > -#include > +#include > #include > #include > #include > @@ -27,18 +27,27 @@ PlatformHasAcpiDt ( > IN EFI_SYSTEM_TABLE *SystemTable > ) > { > - EFI_STATUS Status; > - > - Status = EFI_SUCCESS; > + EFI_STATUS Status; > + FIRMWARE_CONFIG_ITEM FwCfgItem; > + UINTN FwCfgSize; > > // > // If we fail to install any of the necessary protocols below, the OS will be > // unbootable anyway (due to lacking hardware description), so tolerate no > // errors here. > // > - // Always make ACPI available on 64-bit systems. > - // > - if (MAX_UINTN == MAX_UINT64) { > + if (MAX_UINTN == MAX_UINT64 && > + !EFI_ERROR ( > + QemuFwCfgFindFile ( > + "etc/table-loader", > + &FwCfgItem, > + &FwCfgSize > + ) > + )) { > + // > + // Only make ACPI available on 64-bit systems, and only if QEMU generates > + // (a subset of) the ACPI tables. > + // > Status = gBS->InstallProtocolInterface ( > &ImageHandle, > &gEdkiiPlatformHasAcpiProtocolGuid, > @@ -48,21 +57,21 @@ PlatformHasAcpiDt ( > if (EFI_ERROR (Status)) { > goto Failed; > } > + > + return Status; > } > > // > - // Expose the Device Tree unless PcdPureAcpiBoot is set. > + // Expose the Device Tree otherwise. > // > - if (!FeaturePcdGet (PcdPureAcpiBoot)) { > - Status = gBS->InstallProtocolInterface ( > - &ImageHandle, > - &gEdkiiPlatformHasDeviceTreeProtocolGuid, > - EFI_NATIVE_INTERFACE, > - NULL > - ); > - if (EFI_ERROR (Status)) { > - goto Failed; > - } > + Status = gBS->InstallProtocolInterface ( > + &ImageHandle, > + &gEdkiiPlatformHasDeviceTreeProtocolGuid, > + EFI_NATIVE_INTERFACE, > + NULL > + ); > + if (EFI_ERROR (Status)) { > + goto Failed; > } > > return Status; > -- > 2.9.3 > >