Bug 1430262

Summary: AAVMF: forward QEMU's DT to the guest OS only if ACPI payload is unavailable
Product: Red Hat Enterprise Linux 7 Reporter: Laszlo Ersek <lersek>
Component: ovmfAssignee: Laszlo Ersek <lersek>
Status: CLOSED CURRENTRELEASE QA Contact: FuXiangChun <xfu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: areis, chayang, jbastian, jinzhao, juzhang, michen, mrezanin, xfu
Target Milestone: rcKeywords: OtherQA
Target Release: ---   
Hardware: aarch64   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovmf-20170228-3.gitc325e41585e3.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-10 10:55:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1429247, 1438912    

Description Laszlo Ersek 2017-03-08 08:47:27 UTC
ArmVirtQemu can be built with and without -D PURE_ACPI_BOOT_ENABLE at the moment. We should replace that build-time setting with a dynamic one. Forward the DT from QEMU to the guest kernel if and only if

  the guest architecture is arm32, or
  ACPI payload is not available from QEMU

This will let QEMU's "-no-acpi" option show *either* ACPI *or* DT to the guest.

Showing both is never needed (it is actually detrimental to the adoption of standards, such as SBSA / SBBR), and showing none renders an aarch64 guest unbootable (unlike x86, which can sort of limp along without any kind of hardware description from the firmware).

Comment 1 Laszlo Ersek 2017-03-08 19:06:54 UTC
Patches posted:
[edk2] [PATCH 0/6] ArmVirtPkg: don't forward the DT to the OS if QEMU provides
                   ACPI
Message-Id: <20170308190511.31195-1-lersek>
URL: https://lists.01.org/pipermail/edk2-devel/2017-March/008308.html

Comment 2 Laszlo Ersek 2017-03-09 18:04:14 UTC
Ultimately we went with Ard's series instead.
https://lists.01.org/pipermail/edk2-devel/2017-March/008358.html
https://lists.01.org/pipermail/edk2-devel/2017-March/008371.html

Patches to backport:

$ git log --oneline --reverse 198a46d768fb..78c41ff519b1
eec1ba7dab8b ArmVirtPkg/FdtClientDxe: supplement missing EFIAPI calling conv
             specifiers
d5256ba932ed ArmVirtPkg/ArmVirtPL031FdtClientLib: unconditionally disable DT
             node
18f6d4df9ece ArmVirtPkg/FdtClientDxe: install DT configuration table at
             ReadyToBoot
78c41ff519b1 ArmVirtPkg/FdtClientDxe: make DT table installation !ACPI
             dependent

Comment 3 Laszlo Ersek 2017-03-14 14:05:56 UTC
New design:
https://lists.01.org/pipermail/edk2-devel/2017-March/008482.html

Comment 4 Laszlo Ersek 2017-03-17 20:49:09 UTC
Posted v2 (on top of the patches listed in comment 2):
[edk2] [PATCH v2 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU
                        provides ACPI
Message-Id: <20170317204731.31488-1-lersek>
URL: https://lists.01.org/pipermail/edk2-devel/2017-March/008684.html

Comment 5 Laszlo Ersek 2017-03-20 10:12:10 UTC
76874be3d411 MdeModulePkg/RamDiskDxe: fix C string literal catenation in info
             messages

The rest of the v2 series is still under discussion.

Comment 6 Laszlo Ersek 2017-03-24 22:40:15 UTC
Posted v3 (on top of the patches listed in comment 2 and comment 5):
[edk2] [PATCH v3 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU
                        provides ACPI
Message-Id: <20170324223819.11377-1-lersek>
URL: https://lists.01.org/pipermail/edk2-devel/2017-March/009000.html

Comment 7 Laszlo Ersek 2017-03-28 13:51:40 UTC
Posted v4 (replaces v3 in comment 6, keeps the same dependencies):
[edk2] [PATCH v4 00/12] ArmVirtPkg: don't forward the DT to the OS if QEMU
                        provides ACPI
Message-Id: <20170328135033.24238-1-lersek>
URL: https://lists.01.org/pipermail/edk2-devel/2017-March/009154.html

Comment 8 Laszlo Ersek 2017-03-28 14:11:51 UTC
The v4 series has been pushed, completing the upstream work:

30cb1485b1df Revert "ArmVirtPkg/FdtClientDxe: make DT table installation !ACPI
             dependent"
a00601c6de65 Revert "ArmVirtPkg/FdtClientDxe: install DT configuration table at
             ReadyToBoot"
6244c8924e72 ArmVirtPkg/XenAcpiPlatformDxe: don't cast UINT64 to pointer
             directly
05db0948cc60 EmbeddedPkg: introduce EDKII Platform Has ACPI GUID
786f476323a6 EmbeddedPkg: introduce PlatformHasAcpiLib
65a69b214840 EmbeddedPkg: introduce EDKII Platform Has Device Tree GUID
2558bfe3e907 ArmVirtPkg: add PlatformHasAcpiDtDxe
a61418344018 ArmVirtPkg: add XenPlatformHasAcpiDtDxe
3a2c1548fe2d ArmVirtPkg: enable AcpiTableDxe and EFI_ACPI_TABLE_PROTOCOL
             dynamically
51b09a2c50c6 ArmVirtPkg/FdtClientDxe: install DT as sysconfig table in protocol
             notify
110316a995ed ArmVirtPkg/PlatformHasAcpiDtDxe: don't expose DT if QEMU provides
             ACPI
89ad870fbff0 ArmVirtPkg: remove PURE_ACPI_BOOT_ENABLE and PcdPureAcpiBoot

Comment 9 Laszlo Ersek 2017-03-28 14:39:46 UTC
Full list of patches to backport (comment 2, comment 5, comment 8):

  eec1ba7dab8b ArmVirtPkg/FdtClientDxe: supplement missing EFIAPI calling
               conv specifiers
  d5256ba932ed ArmVirtPkg/ArmVirtPL031FdtClientLib: unconditionally disable
               DT node
R 18f6d4df9ece ArmVirtPkg/FdtClientDxe: install DT configuration table at
               ReadyToBoot
R 78c41ff519b1 ArmVirtPkg/FdtClientDxe: make DT table installation !ACPI
               dependent

  76874be3d411 MdeModulePkg/RamDiskDxe: fix C string literal catenation in
               info messages

R 30cb1485b1df Revert "ArmVirtPkg/FdtClientDxe: make DT table installation
               !ACPI dependent"
R a00601c6de65 Revert "ArmVirtPkg/FdtClientDxe: install DT configuration
               table at ReadyToBoot"
X 6244c8924e72 ArmVirtPkg/XenAcpiPlatformDxe: don't cast UINT64 to pointer
               directly
  05db0948cc60 EmbeddedPkg: introduce EDKII Platform Has ACPI GUID
  786f476323a6 EmbeddedPkg: introduce PlatformHasAcpiLib
  65a69b214840 EmbeddedPkg: introduce EDKII Platform Has Device Tree GUID
  2558bfe3e907 ArmVirtPkg: add PlatformHasAcpiDtDxe
X a61418344018 ArmVirtPkg: add XenPlatformHasAcpiDtDxe
  3a2c1548fe2d ArmVirtPkg: enable AcpiTableDxe and EFI_ACPI_TABLE_PROTOCOL
               dynamically
  51b09a2c50c6 ArmVirtPkg/FdtClientDxe: install DT as sysconfig table in
               protocol notify
  110316a995ed ArmVirtPkg/PlatformHasAcpiDtDxe: don't expose DT if QEMU
               provides ACPI
  89ad870fbff0 ArmVirtPkg: remove PURE_ACPI_BOOT_ENABLE and PcdPureAcpiBoot

The patches marked with R should not be backported, as they form
patch+revert sequences.

The patches marked with X should also not be backported *in theory*, as they
are related to Xen only, and we don't even build the code being patched.

However, I prefer to diverge from upstream as little as possible -- not
necessarily (or not only) for avoiding conflicts in later backports, but for
direct diff-ability against upstream (and then for git-blaming the
differences). If downstream reviewers strongly disagree, we can simply
dequeue the backports of the X-marked patches.

Comment 10 Laszlo Ersek 2017-03-29 07:50:51 UTC
I've decided to skip the X-marked (Xen-only) patches.

Comment 13 Laszlo Ersek 2017-03-30 22:10:22 UTC
FuXiangChun, testing instructions can be gleaned from the following commit message:

https://github.com/tianocore/edk2/commit/110316a995ed

Thanks.

Comment 14 Miroslav Rezanina 2017-04-04 13:44:23 UTC
Fix included in ovmf-20170228-3.gitc325e41585e3.el7

Comment 15 Laszlo Ersek 2017-10-10 10:55:11 UTC
Fixed in RHEL-ALT-7.4.