public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc
@ 2021-05-26 20:14 Laszlo Ersek
  2021-05-26 20:14 ` [PATCH 01/43] OvmfPkg: remove the Xen drivers from the IA32, IA32X64, and X64 platforms Laszlo Ersek
                   ` (45 more replies)
  0 siblings, 46 replies; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Andrew Fish, Anthony Perard, Ard Biesheuvel, Brijesh Singh,
	Erdem Aktas, James Bottomley, Jiewen Yao, Jordan Justen,
	Julien Grall, Leif Lindholm, Michael D Kinney, Min Xu,
	Peter Grehan, Philippe Mathieu-Daudé, Rebecca Cran,
	Tom Lendacky

Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Repo:     https://pagure.io/lersek/edk2.git
Branch:   xen_split_bz_2122

This patch set removes dynamic Xen enlightenment from the following
platforms:

  OvmfPkg/OvmfPkgIa32.dsc
  OvmfPkg/OvmfPkgIa32X64.dsc
  OvmfPkg/OvmfPkgX64.dsc

In Xen guests, the following platform should be used:

  OvmfPkg/OvmfXen.dsc

Please see more details / references in the bugzilla ticket.

NOOPT build savings:

- Ia32:    PEIFV 1536 bytes, DXEFV 130288 bytes
- Ia32X64: PEIFV 1536 bytes, DXEFV 140912 bytes
- X64:     PEIFV 1664 bytes, DXEFV 140912 bytes
- Xen:     PEIFV  256 bytes, DXEFV  69504 bytes

Functional testing:

- Booted a Fedora guest on OvmfPkgIa32X64 on QEMU/KVM, compared verbose
  logs before-after. Memory allocations were satisfied at different
  addresses, as expected, plus the Xen drivers were absent. No
  differences otherwise.

- Booted a RHEL guest on ArmVirtQemu on AARCH64. Memory allocations were
  satisfied at different addresses, as expected.

- Xen regression-testing was not done; I'm requesting feedback.

Build testing / bisectability: at every stage, the series builds with
the following script:

> #!/bin/bash
> set -e -u -C
>
> build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc            -a AARCH64
> build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc    -a ARM
> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc               -a AARCH64
> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc       -a ARM
> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc         -a AARCH64
> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc -a ARM
> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc                -a AARCH64
> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc        -a ARM
> build -b NOOPT -t GCC5 -p OvmfPkg/AmdSev/AmdSevX64.dsc             -a X64
> build -b NOOPT -t GCC5 -p OvmfPkg/Bhyve/BhyveX64.dsc               -a X64
> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32.dsc          -a IA32
> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32X64.dsc       -a IA32 -a X64
> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc                   -a X64
> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfXen.dsc                      -a X64

The patches in the series were formatted with the following options, for
posting:

  --stat=1000 --stat-graph-width=20 --find-copies-harder -U6

(The option "--find-copies-harder" is not the best for presenting every
single patch in the series, in isolation, but taken globally for the
entire series, it is the most helpful option.)

Some patches advance with really small steps, in order to cut down on a
subsequent "meaty" patch. Personally I don't like reviewing code
movement patches, so I did my best to (a) keep that to a minimum, and
(b) present it as unintrusively as possible.

The CC list is a bit long; the reason is that I kept touching up
"Maintainers.txt", and the "OvmfPkg/Bhyve" and "OvmfPkg/AmdSev"
platforms as well (whenever it made sense).

Cc: Andrew Fish <afish@apple.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>

Thanks,
Laszlo

Laszlo Ersek (43):
  OvmfPkg: remove the Xen drivers from the IA32, IA32X64, and X64
    platforms
  OvmfPkg: remove the Xen drivers from the AmdSev platform
  OvmfPkg: switch IA32, IA32X64, X64 to the fw_cfg-only ACPI platform
    driver
  OvmfPkg: switch the AmdSev platform to the fw_cfg-only ACPI platform
    driver
  OvmfPkg/README: bump minimum QEMU version to 1.7.1, machine types to
    1.7
  OvmfPkg/AcpiPlatformDxe: fix header file warts
  OvmfPkg/AcpiPlatformDxe: sort #includes and [LibraryClasses]
  OvmfPkg/AcpiPlatformDxe/QemuLoader.h: remove QemuFwCfgLib class
    dependency
  OvmfPkg/AcpiPlatformDxe: move "QemuLoader.h" to IndustryStandard
  OvmfPkg/AcpiPlatformDxe: consolidate #includes and [LibraryClasses]
  OvmfPkg/XenAcpiPlatformDxe: create from AcpiPlatformDxe
  OvmfPkg/AcpiPlatformDxe: remove the "AcpiPlatformDxe.inf" driver
  OvmfPkg/XenAcpiPlatformDxe: remove the QEMU ACPI linker/loader client
  OvmfPkg/XenAcpiPlatformDxe: remove QEMU fw_cfg dependency
  OvmfPkg/XenAcpiPlatformDxe: remove the InstallAcpiTable() helper
    function
  OvmfPkg/XenAcpiPlatformDxe: remove OVMF's built-in ACPI tables
  OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment
  OvmfPkg/AcpiTables: remove unused module
  OvmfPkg/OvmfXen: make "PcdPciDisableBusEnumeration" Fixed-at-Build
  OvmfPkg/XenAcpiPlatformDxe: remove delayed ACPI table installation
  OvmfPkg/PlatformPei: remove Xen support
  OvmfPkg: drop PcdPciDisableBusEnumeration from the IA32, IA32X64, X64
    DSCs
  OvmfPkg: drop PcdPciDisableBusEnumeration from the AmdSev platform
  OvmfPkg/Bhyve: make "PcdPciDisableBusEnumeration" Fixed-at-Build
  OvmfPkg/OvmfXen: remove IncompatiblePciDeviceSupport DXE driver
  OvmfPkg/Bhyve: remove IncompatiblePciDeviceSupport DXE driver
  OvmfPkg/IncompatiblePciDeviceSupportDxe: remove
    PcdPciDisableBusEnumeration
  OvmfPkg/PciHostBridgeLib: consolidate #includes and INF file sections
  OvmfPkg/PciHostBridgeLibScan: create from PciHostBridgeLib
  OvmfPkg/Bhyve: consume PciHostBridgeLibScan
  OvmfPkg/OvmfXen: consume PciHostBridgeLibScan
  OvmfPkg/PciHostBridgeLib: remove Bhyve and Xen support
  OvmfPkg/PciHostBridgeLibScan: remove QEMU (fw_cfg) support
  OvmfPkg/PciHostBridgeLibScan: remove PcdOvmfHostBridgePciDevId
  OvmfPkg/PciHostBridgeLibScan: clean up file names and file-top
    comments
  OvmfPkg/SmbiosPlatformDxe: clean up #includes and INF
  OvmfPkg/SmbiosPlatformDxe: return EFI_NOT_FOUND if there is no SMBIOS
    data
  OvmfPkg/SmbiosPlatformDxe: locate SMBIOS protocol in
    InstallAllStructures()
  OvmfPkg/SmbiosPlatformDxe: split GetXenSmbiosTables() decl. to new
    header
  OvmfPkg/SmbiosPlatformDxe: declare InstallAllStructures() in header
    file
  OvmfPkg/SmbiosPlatformDxe: create Xen-specific module INF file
  OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point
  OvmfPkg: restrict XenPlatformLib to BdsDxe in the IA32, IA32X64, X64
    DSCs

 Maintainers.txt                                                                                          |  10 +-
 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c                                                                   | 262 --------
 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h                                                                   |  50 +-
 OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf                                                              |  71 --
 OvmfPkg/AcpiPlatformDxe/BootScript.c                                                                     |   7 +-
 OvmfPkg/AcpiPlatformDxe/EntryPoint.c                                                                     |   7 +-
 OvmfPkg/AcpiPlatformDxe/PciDecoding.c                                                                    |   4 +-
 OvmfPkg/AcpiPlatformDxe/Qemu.c                                                                           | 511 ---------------
 OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c                                                                  |  21 +-
 OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf                                                     |   5 +-
 OvmfPkg/AcpiTables/AcpiTables.inf                                                                        |  38 --
 OvmfPkg/AcpiTables/Dsdt.asl                                                                              | 692 --------------------
 OvmfPkg/AcpiTables/Facp.aslc                                                                             |  89 ---
 OvmfPkg/AcpiTables/Facs.aslc                                                                             |  78 ---
 OvmfPkg/AcpiTables/Madt.aslc                                                                             | 153 -----
 OvmfPkg/AcpiTables/Platform.h                                                                            |  68 --
 OvmfPkg/AcpiTables/Ssdt.asl                                                                              |  13 -
 OvmfPkg/AmdSev/AmdSevX64.dsc                                                                             |   9 +-
 OvmfPkg/AmdSev/AmdSevX64.fdf                                                                             |  12 +-
 OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c                                                             |   2 +-
 OvmfPkg/Bhyve/BhyveX64.dsc                                                                               |   5 +-
 OvmfPkg/Bhyve/BhyveX64.fdf                                                                               |   1 -
 OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf                                                                |   1 -
 OvmfPkg/{AcpiPlatformDxe => Include/IndustryStandard}/QemuLoader.h                                       |   8 +-
 OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c                                   |  10 +-
 OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf                                 |   2 -
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c                                                      |  28 +-
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf                                                    |   8 +-
 OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridge.h                               |   4 +-
 OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c                                                  |  74 +++
 OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.inf => PciHostBridgeLibScan/PciHostBridgeLibScan.inf} |  24 +-
 OvmfPkg/Library/{PciHostBridgeLib/XenSupport.c => PciHostBridgeLibScan/ScanForRootBridges.c}             |  27 +-
 OvmfPkg/OvmfPkgIa32.dsc                                                                                  |  10 +-
 OvmfPkg/OvmfPkgIa32.fdf                                                                                  |  12 +-
 OvmfPkg/OvmfPkgIa32X64.dsc                                                                               |  10 +-
 OvmfPkg/OvmfPkgIa32X64.fdf                                                                               |  12 +-
 OvmfPkg/OvmfPkgX64.dsc                                                                                   |  10 +-
 OvmfPkg/OvmfPkgX64.fdf                                                                                   |  12 +-
 OvmfPkg/OvmfXen.dsc                                                                                      |  10 +-
 OvmfPkg/OvmfXen.fdf                                                                                      |  12 +-
 OvmfPkg/PlatformPei/MemDetect.c                                                                          |  10 +-
 OvmfPkg/PlatformPei/Platform.c                                                                           | 162 +++--
 OvmfPkg/PlatformPei/Platform.h                                                                           |  17 -
 OvmfPkg/PlatformPei/PlatformPei.inf                                                                      |   4 -
 OvmfPkg/PlatformPei/Xen.c                                                                                | 222 -------
 OvmfPkg/PlatformPei/Xen.h                                                                                |  39 --
 OvmfPkg/README                                                                                           |  43 +-
 OvmfPkg/SmbiosPlatformDxe/ArmXen.c                                                                       |   2 +-
 OvmfPkg/SmbiosPlatformDxe/Qemu.c                                                                         |  41 +-
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c                                                            |  79 +--
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h                                                            |  37 +-
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf                                                          |  23 +-
 OvmfPkg/SmbiosPlatformDxe/X86Xen.c                                                                       |   8 +-
 OvmfPkg/SmbiosPlatformDxe/Xen.c                                                                          |  49 ++
 OvmfPkg/SmbiosPlatformDxe/{ArmXen.c => XenSmbiosPlatformDxe.h}                                           |  20 +-
 OvmfPkg/SmbiosPlatformDxe/{SmbiosPlatformDxe.inf => XenSmbiosPlatformDxe.inf}                            |  32 +-
 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c                                                                |  41 ++
 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h                                                                |  28 +
 OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c                                                                  |  43 ++
 OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Xen.c                                                    |  66 +-
 OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf                                                        |  45 ++
 OvmfPkg/XenPlatformPei/Platform.c                                                                        |   1 -
 OvmfPkg/XenPlatformPei/Platform.h                                                                        |   5 -
 OvmfPkg/XenPlatformPei/Xen.c                                                                             |  20 -
 OvmfPkg/XenPlatformPei/XenPlatformPei.inf                                                                |   1 -
 65 files changed, 593 insertions(+), 2827 deletions(-)
 delete mode 100644 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
 delete mode 100644 OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
 delete mode 100644 OvmfPkg/AcpiPlatformDxe/Qemu.c
 delete mode 100644 OvmfPkg/AcpiTables/AcpiTables.inf
 delete mode 100644 OvmfPkg/AcpiTables/Dsdt.asl
 delete mode 100644 OvmfPkg/AcpiTables/Facp.aslc
 delete mode 100644 OvmfPkg/AcpiTables/Facs.aslc
 delete mode 100644 OvmfPkg/AcpiTables/Madt.aslc
 delete mode 100644 OvmfPkg/AcpiTables/Platform.h
 delete mode 100644 OvmfPkg/AcpiTables/Ssdt.asl
 rename OvmfPkg/{AcpiPlatformDxe => Include/IndustryStandard}/QemuLoader.h (94%)
 rename OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridge.h (57%)
 create mode 100644 OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
 copy OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.inf => PciHostBridgeLibScan/PciHostBridgeLibScan.inf} (51%)
 rename OvmfPkg/Library/{PciHostBridgeLib/XenSupport.c => PciHostBridgeLibScan/ScanForRootBridges.c} (91%)
 delete mode 100644 OvmfPkg/PlatformPei/Xen.c
 delete mode 100644 OvmfPkg/PlatformPei/Xen.h
 create mode 100644 OvmfPkg/SmbiosPlatformDxe/Xen.c
 copy OvmfPkg/SmbiosPlatformDxe/{ArmXen.c => XenSmbiosPlatformDxe.h} (56%)
 copy OvmfPkg/SmbiosPlatformDxe/{SmbiosPlatformDxe.inf => XenSmbiosPlatformDxe.inf} (65%)
 create mode 100644 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
 create mode 100644 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
 create mode 100644 OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
 rename OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Xen.c (82%)
 create mode 100644 OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf


base-commit: cfa6ffb113f2c0d922034cc77c0d6c52eea05497
-- 
2.19.1.3.g30247aa5d201


^ permalink raw reply	[flat|nested] 102+ messages in thread

* [PATCH 01/43] OvmfPkg: remove the Xen drivers from the IA32, IA32X64, and X64 platforms
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:22   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 02/43] OvmfPkg: remove the Xen drivers from the AmdSev platform Laszlo Ersek
                   ` (44 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

Remove the three Xen drivers as the first step for removing Xen support
from the historical OvmfPkg* platforms. Xen (HVM and PVH) guests are
supported by the dedicated OvmfXen platform.

No module remains dependent on XenHypercallLib, so remove the
XenHypercallLib class resolutions too, from the DSC files.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/OvmfPkgIa32.dsc    | 4 ----
 OvmfPkg/OvmfPkgIa32X64.dsc | 4 ----
 OvmfPkg/OvmfPkgX64.dsc     | 4 ----
 OvmfPkg/OvmfPkgIa32.fdf    | 3 ---
 OvmfPkg/OvmfPkgIa32X64.fdf | 3 ---
 OvmfPkg/OvmfPkgX64.fdf     | 3 ---
 6 files changed, 21 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 33fbd767903e..472cdd4d8a46 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -223,13 +223,12 @@ [LibraryClasses]
 
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
   S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
-  XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf
   XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 
 !if $(TPM_ENABLE) == TRUE
   Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
   Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
   Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
@@ -791,15 +790,12 @@ [Components]
   OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
   OvmfPkg/Virtio10Dxe/Virtio10.inf
   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioRngDxe/VirtioRng.inf
-  OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
-  OvmfPkg/XenBusDxe/XenBusDxe.inf
-  OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
 !if $(PVSCSI_ENABLE) == TRUE
   OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
 !if $(MPT_SCSI_ENABLE) == TRUE
   OvmfPkg/MptScsiDxe/MptScsiDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index b13e5cfd9047..af7d66455fb5 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -227,13 +227,12 @@ [LibraryClasses]
 
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
   S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
-  XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf
   XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 
 !if $(TPM_ENABLE) == TRUE
   Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
   Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
   Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
@@ -805,15 +804,12 @@ [Components.X64]
   OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
   OvmfPkg/Virtio10Dxe/Virtio10.inf
   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioRngDxe/VirtioRng.inf
-  OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
-  OvmfPkg/XenBusDxe/XenBusDxe.inf
-  OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
 !if $(PVSCSI_ENABLE) == TRUE
   OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
 !if $(MPT_SCSI_ENABLE) == TRUE
   OvmfPkg/MptScsiDxe/MptScsiDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 999738dc39cd..fc236cecfdf0 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -227,13 +227,12 @@ [LibraryClasses]
 
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
   S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
-  XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf
   XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 
 !if $(TPM_ENABLE) == TRUE
   Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
   Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
   Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
@@ -803,15 +802,12 @@ [Components]
   OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
   OvmfPkg/Virtio10Dxe/Virtio10.inf
   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioRngDxe/VirtioRng.inf
-  OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
-  OvmfPkg/XenBusDxe/XenBusDxe.inf
-  OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
 !if $(PVSCSI_ENABLE) == TRUE
   OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
 !if $(MPT_SCSI_ENABLE) == TRUE
   OvmfPkg/MptScsiDxe/MptScsiDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index b3c8b56f3b60..eb7f04a28257 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -225,15 +225,12 @@ [FV.DXEFV]
 
 INF  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
 INF  OvmfPkg/Virtio10Dxe/Virtio10.inf
 INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
 INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
 INF  OvmfPkg/VirtioRngDxe/VirtioRng.inf
-INF  OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
-INF  OvmfPkg/XenBusDxe/XenBusDxe.inf
-INF  OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
 !if $(PVSCSI_ENABLE) == TRUE
 INF  OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
 !if $(MPT_SCSI_ENABLE) == TRUE
 INF  OvmfPkg/MptScsiDxe/MptScsiDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 86592c2364a3..f10108d7ee62 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -226,15 +226,12 @@ [FV.DXEFV]
 
 INF  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
 INF  OvmfPkg/Virtio10Dxe/Virtio10.inf
 INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
 INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
 INF  OvmfPkg/VirtioRngDxe/VirtioRng.inf
-INF  OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
-INF  OvmfPkg/XenBusDxe/XenBusDxe.inf
-INF  OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
 !if $(PVSCSI_ENABLE) == TRUE
 INF  OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
 !if $(MPT_SCSI_ENABLE) == TRUE
 INF  OvmfPkg/MptScsiDxe/MptScsiDxe.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index d6be798fcadd..eb19a9e41502 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -238,15 +238,12 @@ [FV.DXEFV]
 
 INF  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
 INF  OvmfPkg/Virtio10Dxe/Virtio10.inf
 INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
 INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
 INF  OvmfPkg/VirtioRngDxe/VirtioRng.inf
-INF  OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
-INF  OvmfPkg/XenBusDxe/XenBusDxe.inf
-INF  OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
 !if $(PVSCSI_ENABLE) == TRUE
 INF  OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
 !if $(MPT_SCSI_ENABLE) == TRUE
 INF  OvmfPkg/MptScsiDxe/MptScsiDxe.inf
 !endif
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 02/43] OvmfPkg: remove the Xen drivers from the AmdSev platform
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
  2021-05-26 20:14 ` [PATCH 01/43] OvmfPkg: remove the Xen drivers from the IA32, IA32X64, and X64 platforms Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:22   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 03/43] OvmfPkg: switch IA32, IA32X64, X64 to the fw_cfg-only ACPI platform driver Laszlo Ersek
                   ` (43 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Brijesh Singh, Erdem Aktas, James Bottomley,
	Jiewen Yao, Jordan Justen, Min Xu, Philippe Mathieu-Daudé,
	Tom Lendacky

For symmetry with the historical OvmfPkg* platforms, remove the three Xen
drivers from the remotely attested, QEMU/KVM-only, AmdSev platform. Xen
(HVM and PVH) guests are supported by the dedicated OvmfXen platform.

No module remains dependent on XenHypercallLib, so remove the
XenHypercallLib class resolution too, from the DSC file.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/AmdSev/AmdSevX64.dsc | 4 ----
 OvmfPkg/AmdSev/AmdSevX64.fdf | 3 ---
 2 files changed, 7 deletions(-)

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 66bbbc80cd18..c5400ff6ab6c 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -198,13 +198,12 @@ [LibraryClasses]
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
 !endif
 
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
-  XenHypercallLib|OvmfPkg/Library/XenHypercallLib/XenHypercallLib.inf
   XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 
 !if $(TPM_ENABLE) == TRUE
   Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
   Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
   Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
@@ -698,15 +697,12 @@ [Components]
   OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
   OvmfPkg/Virtio10Dxe/Virtio10.inf
   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
   OvmfPkg/VirtioRngDxe/VirtioRng.inf
-  OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
-  OvmfPkg/XenBusDxe/XenBusDxe.inf
-  OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
 !if $(PVSCSI_ENABLE) == TRUE
   OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
 !if $(MPT_SCSI_ENABLE) == TRUE
   OvmfPkg/MptScsiDxe/MptScsiDxe.inf
 !endif
diff --git a/OvmfPkg/AmdSev/AmdSevX64.fdf b/OvmfPkg/AmdSev/AmdSevX64.fdf
index dd0030dbf189..1c4bc076ffc8 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.fdf
+++ b/OvmfPkg/AmdSev/AmdSevX64.fdf
@@ -209,15 +209,12 @@ [FV.DXEFV]
 
 INF  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
 INF  OvmfPkg/Virtio10Dxe/Virtio10.inf
 INF  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
 INF  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
 INF  OvmfPkg/VirtioRngDxe/VirtioRng.inf
-INF  OvmfPkg/XenIoPciDxe/XenIoPciDxe.inf
-INF  OvmfPkg/XenBusDxe/XenBusDxe.inf
-INF  OvmfPkg/XenPvBlkDxe/XenPvBlkDxe.inf
 !if $(PVSCSI_ENABLE) == TRUE
 INF  OvmfPkg/PvScsiDxe/PvScsiDxe.inf
 !endif
 !if $(MPT_SCSI_ENABLE) == TRUE
 INF  OvmfPkg/MptScsiDxe/MptScsiDxe.inf
 !endif
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 03/43] OvmfPkg: switch IA32, IA32X64, X64 to the fw_cfg-only ACPI platform driver
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
  2021-05-26 20:14 ` [PATCH 01/43] OvmfPkg: remove the Xen drivers from the IA32, IA32X64, and X64 platforms Laszlo Ersek
  2021-05-26 20:14 ` [PATCH 02/43] OvmfPkg: remove the Xen drivers from the AmdSev platform Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27 10:15   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 04/43] OvmfPkg: switch the AmdSev platform " Laszlo Ersek
                   ` (42 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

Switch the historical OvmfPkg* platforms from the AcpiPlatformDxe driver
to the QemuFwCfgAcpiPlatformDxe driver. (The latter is used by the
ArmVirtQemu* platforms as well.)

The change effectively replaces the following call tree:

  InstallAcpiTables                [AcpiPlatform.c]

    XenDetected                    [XenPlatformLib] *
    InstallXenTables               [Xen.c]          *
      GetXenAcpiRsdp               [Xen.c]          *

    InstallQemuFwCfgTables         [QemuFwCfgAcpi.c]
      ...

    InstallOvmfFvTables            [AcpiPlatform.c] *
      QemuDetected                 [Qemu.c]         *
      LocateFvInstanceWithTables   [AcpiPlatform.c] *
        QemuInstallAcpiTable       [Qemu.c]         *
          QemuInstallAcpiMadtTable [Qemu.c]         *
            CountBits16            [Qemu.c]         *
          QemuInstallAcpiSsdtTable [Qemu.c]         *
            GetSuspendStates       [Qemu.c]         *
            PopulateFwData         [Qemu.c]         *

with the one below:

  InstallAcpiTables        [QemuFwCfgAcpiPlatform.c]
    InstallQemuFwCfgTables [QemuFwCfgAcpi.c]
      ...

eliminating the sub-trees highlighted with "*".

There are two consequences:

(1) Xen compatibility is removed from the ACPI platform driver of the
   historical OvmfPkg* platforms.

(2) The ACPI tables that are statically built into OVMF (via
    "OvmfPkg/AcpiTables/AcpiTables.inf") are never installed. In
    particular, OVMF's own runtime preparation of the MADT and SSDT is
    eliminated.

Because of (2), remove the "OvmfPkg/AcpiTables/AcpiTables.inf" module as
well -- and then the ACPITABLE build rule too.

Note that (2) only removes effectively dead code; the QEMU ACPI
linker-loader has taken priority since QEMU 1.7.1 (2014). References:

- https://wiki.qemu.org/Planning/1.7
- https://wiki.qemu.org/Features/ACPITableGeneration
- edk2 commit 96bbdbc85693 ("OvmfPkg: AcpiPlatformDxe: download ACPI
                            tables from QEMU", 2014-03-31)
- edk2 commit 387536e472aa ("OvmfPkg: AcpiPlatformDxe: implement QEMU's
                            full ACPI table loader interface", 2014-09-22)

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/OvmfPkgIa32.dsc    | 3 +--
 OvmfPkg/OvmfPkgIa32X64.dsc | 3 +--
 OvmfPkg/OvmfPkgX64.dsc     | 3 +--
 OvmfPkg/OvmfPkgIa32.fdf    | 9 +--------
 OvmfPkg/OvmfPkgIa32X64.fdf | 9 +--------
 OvmfPkg/OvmfPkgX64.fdf     | 9 +--------
 6 files changed, 6 insertions(+), 30 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 472cdd4d8a46..4b7e1c731ef5 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -859,14 +859,13 @@ [Components]
   OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 
   #
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
-  OvmfPkg/AcpiTables/AcpiTables.inf
+  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
   MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
   MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
   MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
   #
   # Network Support
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index af7d66455fb5..1d1dea4b19cd 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -873,14 +873,13 @@ [Components.X64]
   OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 
   #
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
-  OvmfPkg/AcpiTables/AcpiTables.inf
+  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
   MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
   MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
   MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
   #
   # Network Support
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index fc236cecfdf0..d71edd6b2272 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -871,14 +871,13 @@ [Components]
   OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 
   #
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
-  OvmfPkg/AcpiTables/AcpiTables.inf
+  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
   MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
   MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
   MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
   #
   # Network Support
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index eb7f04a28257..04b41445ca34 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -277,14 +277,13 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf
 
 INF  MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
 INF  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 
 INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-INF  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
-INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
+INF  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
 INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
 INF  FatPkg/EnhancedFatDxe/Fat.inf
 INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
@@ -484,18 +483,12 @@ [Rule.Common.UEFI_APPLICATION.BINARY]
   FILE APPLICATION = $(NAMED_GUID) {
     PE32      PE32                    |.efi
     UI        STRING="$(MODULE_NAME)" Optional
     VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
   }
 
-[Rule.Common.USER_DEFINED.ACPITABLE]
-  FILE FREEFORM = $(NAMED_GUID) {
-    RAW ACPI               |.acpi
-    RAW ASL                |.aml
-  }
-
 [Rule.Common.USER_DEFINED.CSM]
   FILE FREEFORM = $(NAMED_GUID) {
     RAW BIN                |.bin
   }
 
 [Rule.Common.SEC.RESET_VECTOR]
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index f10108d7ee62..02fd8f0c413e 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -278,14 +278,13 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf
 
 INF  MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
 INF  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 
 INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-INF  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
-INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
+INF  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
 INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
 INF  FatPkg/EnhancedFatDxe/Fat.inf
 INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
@@ -487,18 +486,12 @@ [Rule.Common.UEFI_APPLICATION.BINARY]
   FILE APPLICATION = $(NAMED_GUID) {
     PE32      PE32                    |.efi
     UI        STRING="$(MODULE_NAME)" Optional
     VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
   }
 
-[Rule.Common.USER_DEFINED.ACPITABLE]
-  FILE FREEFORM = $(NAMED_GUID) {
-    RAW ACPI               |.acpi
-    RAW ASL                |.aml
-  }
-
 [Rule.Common.USER_DEFINED.CSM]
   FILE FREEFORM = $(NAMED_GUID) {
     RAW BIN                |.bin
   }
 
 [Rule.Common.SEC.RESET_VECTOR]
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index eb19a9e41502..5fa8c0895808 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -290,14 +290,13 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf
 
 INF  MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
 INF  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 
 INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-INF  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
-INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
+INF  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
 INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
 INF  FatPkg/EnhancedFatDxe/Fat.inf
 INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
@@ -499,18 +498,12 @@ [Rule.Common.UEFI_APPLICATION.BINARY]
   FILE APPLICATION = $(NAMED_GUID) {
     PE32      PE32                    |.efi
     UI        STRING="$(MODULE_NAME)" Optional
     VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
   }
 
-[Rule.Common.USER_DEFINED.ACPITABLE]
-  FILE FREEFORM = $(NAMED_GUID) {
-    RAW ACPI               |.acpi
-    RAW ASL                |.aml
-  }
-
 [Rule.Common.USER_DEFINED.CSM]
   FILE FREEFORM = $(NAMED_GUID) {
     RAW BIN                |.bin
   }
 
 [Rule.Common.SEC.RESET_VECTOR]
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 04/43] OvmfPkg: switch the AmdSev platform to the fw_cfg-only ACPI platform driver
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (2 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 03/43] OvmfPkg: switch IA32, IA32X64, X64 to the fw_cfg-only ACPI platform driver Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27 10:15   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 05/43] OvmfPkg/README: bump minimum QEMU version to 1.7.1, machine types to 1.7 Laszlo Ersek
                   ` (41 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Brijesh Singh, Erdem Aktas, James Bottomley,
	Jiewen Yao, Jordan Justen, Min Xu, Philippe Mathieu-Daudé,
	Tom Lendacky

For consistency with the historical OvmfPkg* platforms, switch the
remotely attested, QEMU/KVM-only, AmdSev platform from the AcpiPlatformDxe
driver to the QemuFwCfgAcpiPlatformDxe driver.

No module remains dependent on XenPlatformLib, so remove the
XenPlatformLib class resolution too, from the DSC file.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/AmdSev/AmdSevX64.dsc | 4 +---
 OvmfPkg/AmdSev/AmdSevX64.fdf | 9 +--------
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index c5400ff6ab6c..9e7c459e9a8b 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -198,13 +198,12 @@ [LibraryClasses]
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
 !endif
 
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
-  XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 
 !if $(TPM_ENABLE) == TRUE
   Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
   Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
   Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
   Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
@@ -763,14 +762,13 @@ [Components]
   OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 
   #
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
-  OvmfPkg/AcpiTables/AcpiTables.inf
+  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
   MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
   #
   # Usb Support
   #
   MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf
diff --git a/OvmfPkg/AmdSev/AmdSevX64.fdf b/OvmfPkg/AmdSev/AmdSevX64.fdf
index 1c4bc076ffc8..9977b0f00a18 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.fdf
+++ b/OvmfPkg/AmdSev/AmdSevX64.fdf
@@ -257,14 +257,13 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf
 
 INF  MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
 INF  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 
 INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-INF  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
-INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
+INF  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
 INF  FatPkg/EnhancedFatDxe/Fat.inf
 INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
 
 !if $(TOOL_CHAIN_TAG) != "XCODE5" && $(BUILD_SHELL) == TRUE
@@ -427,18 +426,12 @@ [Rule.Common.UEFI_APPLICATION.BINARY]
   FILE APPLICATION = $(NAMED_GUID) {
     PE32      PE32                    |.efi
     UI        STRING="$(MODULE_NAME)" Optional
     VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
   }
 
-[Rule.Common.USER_DEFINED.ACPITABLE]
-  FILE FREEFORM = $(NAMED_GUID) {
-    RAW ACPI               |.acpi
-    RAW ASL                |.aml
-  }
-
 [Rule.Common.SEC.RESET_VECTOR]
   FILE RAW = $(NAMED_GUID) {
     RAW BIN   Align = 16   |.bin
   }
 
 [Rule.Common.SMM_CORE]
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 05/43] OvmfPkg/README: bump minimum QEMU version to 1.7.1, machine types to 1.7
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (3 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 04/43] OvmfPkg: switch the AmdSev platform " Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:24   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 06/43] OvmfPkg/AcpiPlatformDxe: fix header file warts Laszlo Ersek
                   ` (40 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

Due to switching to the QemuFwCfgAcpiPlatformDxe driver earlier in this
series, require QEMU version 1.7.1 in the "OvmfPkg/README" file, and
require 1.7 or later machine types too.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/README | 43 ++++----------------
 1 file changed, 8 insertions(+), 35 deletions(-)

diff --git a/OvmfPkg/README b/OvmfPkg/README
index 70f0c4152686..815e66528cb4 100644
--- a/OvmfPkg/README
+++ b/OvmfPkg/README
@@ -8,16 +8,16 @@ code base.  More information can be found at:
 http://www.tianocore.org/ovmf/
 
 === STATUS ===
 
 Current capabilities:
 * IA32 and X64 architectures
-* QEMU (0.10.0 or later)
+* QEMU (version 1.7.1 or later, with 1.7 or later machine types)
   - Video, keyboard, IDE, CD-ROM, serial
   - Runs UEFI shell
-  - Optional NIC support.  Requires QEMU (0.12.2 or later)
+  - Optional NIC support.
 * UEFI Linux boots
 * UEFI Windows 8 boots
 * UEFI Windows 7 & Windows 2008 Server boot (see important notes below!)
 
 === FUTURE PLANS ===
 
@@ -56,17 +56,16 @@ these binary outputs:
 More information on building OVMF can be found at:
 
 https://github.com/tianocore/tianocore.github.io/wiki/How%20to%20build%20OVMF
 
 === RUNNING OVMF on QEMU ===
 
-* QEMU 0.12.2 or later is required.
 * Be sure to use qemu-system-x86_64, if you are using and X64 firmware.
   (qemu-system-x86_64 works for the IA32 firmware as well, of course.)
 * Use OVMF for QEMU firmware (3 options available)
-  - Option 1: QEMU 1.6 or newer; Use QEMU -pflash parameter
+  - Option 1: Use QEMU -pflash parameter
     * QEMU/OVMF will use emulated flash, and fully support UEFI variables
     * Run qemu with: -pflash path/to/OVMF.fd
     * Note that this option is required for running SecureBoot-enabled builds
       (-D SECURE_BOOT_ENABLE).
   - Option 2: Use QEMU -bios parameter
     * Note that UEFI variables will be partially emulated, and non-volatile
@@ -181,47 +180,21 @@ when OVMF boots.
 (If a NIC is configured for the virtual machine, and -- dependent on boot order
 -- PXE booting is attempted, but no DHCP server responds to OVMF's DHCP
 DISCOVER message at startup, the boot process may take approx. 3 seconds
 longer.)
 
 * For each NIC emulated by qemu, a GPLv2 licensed UEFI driver is available from
-  the iPXE project. The qemu source distribution, starting with version 1.5,
-  contains prebuilt binaries of these drivers (and of course allows one to
-  rebuild them from source as well). This is the recommended set of drivers.
+  the iPXE project. The qemu source distribution contains prebuilt binaries of
+  these drivers (and of course allows one to rebuild them from source as well).
+  This is the recommended set of drivers.
 
 * Use the qemu -netdev and -device options, or the legacy -net option, to
   enable NIC support: <http://wiki.qemu.org/Documentation/Networking>.
 
-* For a qemu >= 1.5 binary running *without* any "-M machine" option where
-  "machine" would identify a < qemu-1.5 configuration (for example: "-M
-  pc-i440fx-1.4" or "-M pc-0.13"), the iPXE drivers are automatically available
-  to and configured for OVMF in the default qemu installation.
-
-* For a qemu binary in [0.13, 1.5), or a qemu >= 1.5 binary with an "-M
-  machine" option where "machine" selects a < qemu-1.5 configuration:
-
-  - download a >= 1.5.0-rc1 source tarball from <http://wiki.qemu.org/Download>,
-
-  - extract the following iPXE driver files from the tarball and install them
-    in a location that is accessible to qemu processes (this may depend on your
-    SELinux configuration, for example):
-
-    qemu-VERSION/pc-bios/efi-e1000.rom
-    qemu-VERSION/pc-bios/efi-ne2k_pci.rom
-    qemu-VERSION/pc-bios/efi-pcnet.rom
-    qemu-VERSION/pc-bios/efi-rtl8139.rom
-    qemu-VERSION/pc-bios/efi-virtio.rom
-
-  - extend the NIC's -device option on the qemu command line with a matching
-    "romfile=" optarg:
-
-    -device e1000,...,romfile=/full/path/to/efi-e1000.rom
-    -device ne2k_pci,...,romfile=/full/path/to/efi-ne2k_pci.rom
-    -device pcnet,...,romfile=/full/path/to/efi-pcnet.rom
-    -device rtl8139,...,romfile=/full/path/to/efi-rtl8139.rom
-    -device virtio-net-pci,...,romfile=/full/path/to/efi-virtio.rom
+* The iPXE drivers are automatically available to and configured for OVMF in
+  the default qemu installation.
 
 * Independently of the iPXE NIC drivers, the default OVMF build provides a
   basic virtio-net driver, located in OvmfPkg/VirtioNetDxe.
 
 * Also independently of the iPXE NIC drivers, Intel's proprietary E1000 NIC
   driver (from the BootUtil distribution) can be embedded in the OVMF image at
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 06/43] OvmfPkg/AcpiPlatformDxe: fix header file warts
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (4 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 05/43] OvmfPkg/README: bump minimum QEMU version to 1.7.1, machine types to 1.7 Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:24   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 07/43] OvmfPkg/AcpiPlatformDxe: sort #includes and [LibraryClasses] Laszlo Ersek
                   ` (39 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

- Remove the leading underscores from the #include guard macro names;
  clean up the names in general.

- Remove the useless "Include/" directory prefix from the public header
  pathnames.

- Fix incorrect file-top comment.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h | 6 +++---
 OvmfPkg/AcpiPlatformDxe/QemuLoader.h   | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
index 9597e028e4a7..c8dee8ab7a3c 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
@@ -1,16 +1,16 @@
 /** @file
-  Sample ACPI Platform Driver
+  OVMF ACPI Platform Driver
 
   Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#ifndef _ACPI_PLATFORM_H_INCLUDED_
-#define _ACPI_PLATFORM_H_INCLUDED_
+#ifndef ACPI_PLATFORM_H_
+#define ACPI_PLATFORM_H_
 
 #include <PiDxe.h>
 
 #include <Protocol/AcpiTable.h>
 #include <Protocol/FirmwareVolume2.h>
 #include <Protocol/PciIo.h>
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuLoader.h b/OvmfPkg/AcpiPlatformDxe/QemuLoader.h
index 70e0ebc33beb..bb3978e900ed 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuLoader.h
+++ b/OvmfPkg/AcpiPlatformDxe/QemuLoader.h
@@ -4,16 +4,16 @@
   Copyright (C) 2014, Red Hat, Inc.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#ifndef __QEMU_LOADER_H__
-#define __QEMU_LOADER_H__
+#ifndef QEMU_LOADER_H_
+#define QEMU_LOADER_H_
 
-#include <Include/Base.h>
+#include <Base.h>
 #include <Library/QemuFwCfgLib.h>
 
 //
 // The types and the documentation reflects the SeaBIOS interface.
 //
 #define QEMU_LOADER_FNAME_SIZE QEMU_FW_CFG_FNAME_SIZE
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 07/43] OvmfPkg/AcpiPlatformDxe: sort #includes and [LibraryClasses]
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (5 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 06/43] OvmfPkg/AcpiPlatformDxe: fix header file warts Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:25   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 08/43] OvmfPkg/AcpiPlatformDxe/QemuLoader.h: remove QemuFwCfgLib class dependency Laszlo Ersek
                   ` (38 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

Place all public #includes first, all module-private #includes second.
Separate them with a single empty line. Keep each section sorted in
itself.

Sort all sections in both INF files.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf          | 18 +++++++++---------
 OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf |  2 +-
 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h               | 15 ++++++---------
 OvmfPkg/AcpiPlatformDxe/EntryPoint.c                 |  1 +
 OvmfPkg/AcpiPlatformDxe/Qemu.c                       | 11 ++++++-----
 OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c              | 12 ++++++------
 OvmfPkg/AcpiPlatformDxe/Xen.c                        |  3 ++-
 7 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
index e486b8afa56d..4522d7f6110c 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -29,30 +29,30 @@ [Sources]
   Qemu.c
   QemuFwCfgAcpi.c
   QemuLoader.h
   Xen.c
 
 [Packages]
-  MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
   UefiCpuPkg/UefiCpuPkg.dec
 
 [LibraryClasses]
-  UefiLib
-  PcdLib
+  BaseLib
   BaseMemoryLib
   DebugLib
-  UefiBootServicesTableLib
-  UefiDriverEntryPoint
-  QemuFwCfgLib
-  QemuFwCfgS3Lib
-  MemoryAllocationLib
-  BaseLib
   DxeServicesTableLib
+  MemoryAllocationLib
   OrderedCollectionLib
+  PcdLib
+  QemuFwCfgLib
+  QemuFwCfgS3Lib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+  UefiLib
   XenPlatformLib
 
 [Protocols]
   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
   gEfiFirmwareVolume2ProtocolGuid               # PROTOCOL SOMETIMES_CONSUMED
   gEfiPciIoProtocolGuid                         # PROTOCOL SOMETIMES_CONSUMED
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
index c9ec4f60bc78..cc24f35bd83a 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
+++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
@@ -27,14 +27,14 @@ [Sources]
   PciDecoding.c
   QemuFwCfgAcpi.c
   QemuFwCfgAcpiPlatform.c
   QemuLoader.h
 
 [Packages]
-  MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
   BaseLib
   DebugLib
   MemoryAllocationLib
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
index c8dee8ab7a3c..511a30782f6d 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
@@ -6,25 +6,22 @@
 
 **/
 
 #ifndef ACPI_PLATFORM_H_
 #define ACPI_PLATFORM_H_
 
-#include <PiDxe.h>
-
-#include <Protocol/AcpiTable.h>
-#include <Protocol/FirmwareVolume2.h>
-#include <Protocol/PciIo.h>
-
+#include <IndustryStandard/Acpi.h>
 #include <Library/BaseLib.h>
-#include <Library/UefiBootServicesTableLib.h>
 #include <Library/DebugLib.h>
 #include <Library/PcdLib.h>
+#include <Library/UefiBootServicesTableLib.h>
 #include <Library/XenPlatformLib.h>
-
-#include <IndustryStandard/Acpi.h>
+#include <PiDxe.h>
+#include <Protocol/AcpiTable.h>
+#include <Protocol/FirmwareVolume2.h>
+#include <Protocol/PciIo.h>
 
 typedef struct {
   EFI_PCI_IO_PROTOCOL *PciIo;
   UINT64              PciAttributes;
 } ORIGINAL_ATTRIBUTES;
 
diff --git a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
index f66f89291157..fb07ed85373d 100644
--- a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
+++ b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
@@ -5,12 +5,13 @@
   Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
 #include <Guid/RootBridgesConnectedEventGroup.h>
+
 #include "AcpiPlatform.h"
 
 STATIC
 EFI_ACPI_TABLE_PROTOCOL *
 FindAcpiTableProtocol (
   VOID
diff --git a/OvmfPkg/AcpiPlatformDxe/Qemu.c b/OvmfPkg/AcpiPlatformDxe/Qemu.c
index 7fb42270043f..bed3b16159a6 100644
--- a/OvmfPkg/AcpiPlatformDxe/Qemu.c
+++ b/OvmfPkg/AcpiPlatformDxe/Qemu.c
@@ -6,20 +6,21 @@
   Copyright (C) 2012-2014, Red Hat, Inc.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include "AcpiPlatform.h"
+#include <IndustryStandard/Acpi.h>
 #include <Library/BaseMemoryLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/QemuFwCfgLib.h>
 #include <Library/DxeServicesTableLib.h>
-#include <Library/PcdLib.h>
+#include <Library/MemoryAllocationLib.h>
 #include <Library/OrderedCollectionLib.h>
-#include <IndustryStandard/Acpi.h>
+#include <Library/PcdLib.h>
+#include <Library/QemuFwCfgLib.h>
+
+#include "AcpiPlatform.h"
 
 BOOLEAN
 QemuDetected (
   VOID
   )
 {
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
index b62027db6e66..c07b84a21385 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
+++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
@@ -5,23 +5,23 @@
   Copyright (C) 2012-2014, Red Hat, Inc.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include "AcpiPlatform.h"
-#include "QemuLoader.h"
+#include <IndustryStandard/Acpi.h>
 #include <Library/BaseMemoryLib.h>
+#include <Library/DxeServicesTableLib.h>
 #include <Library/MemoryAllocationLib.h>
+#include <Library/OrderedCollectionLib.h>
+#include <Library/PcdLib.h>
 #include <Library/QemuFwCfgLib.h>
 #include <Library/QemuFwCfgS3Lib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/PcdLib.h>
-#include <Library/OrderedCollectionLib.h>
-#include <IndustryStandard/Acpi.h>
 
+#include "AcpiPlatform.h"
+#include "QemuLoader.h"
 
 //
 // The user structure for the ordered collection that will track the fw_cfg
 // blobs under processing.
 //
 typedef struct {
diff --git a/OvmfPkg/AcpiPlatformDxe/Xen.c b/OvmfPkg/AcpiPlatformDxe/Xen.c
index 289ef971c4b8..1d69989042c6 100644
--- a/OvmfPkg/AcpiPlatformDxe/Xen.c
+++ b/OvmfPkg/AcpiPlatformDxe/Xen.c
@@ -5,15 +5,16 @@
   Copyright (c) 2012, Bei Guan <gbtju85@gmail.com>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include "AcpiPlatform.h"
 #include <Library/BaseLib.h>
 
+#include "AcpiPlatform.h"
+
 #define XEN_ACPI_PHYSICAL_ADDRESS         0x000EA020
 #define XEN_BIOS_PHYSICAL_END             0x000FFFFF
 
 EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER  *XenAcpiRsdpStructurePtr = NULL;
 
 /**
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 08/43] OvmfPkg/AcpiPlatformDxe/QemuLoader.h: remove QemuFwCfgLib class dependency
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (6 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 07/43] OvmfPkg/AcpiPlatformDxe: sort #includes and [LibraryClasses] Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:26   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 09/43] OvmfPkg/AcpiPlatformDxe: move "QemuLoader.h" to IndustryStandard Laszlo Ersek
                   ` (37 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

"QemuLoader.h" needs the QEMU_FW_CFG_FNAME_SIZE macro. This macro used to
live in the QemuFwCfgLib class header, but we moved it to the more
foundational IndustryStandard include file called "QemuFwCfg.h" in commit
5583a8a4ffd0 ("OvmfPkg/QemuFwCfgLib: move types/macros from lib class to
IndustryStandard", 2017-02-22).

Replace the lib class dependency with the more basic IndustryStandard
dependency in "QemuLoader.h".

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/AcpiPlatformDxe/QemuLoader.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OvmfPkg/AcpiPlatformDxe/QemuLoader.h b/OvmfPkg/AcpiPlatformDxe/QemuLoader.h
index bb3978e900ed..5782a23c4398 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuLoader.h
+++ b/OvmfPkg/AcpiPlatformDxe/QemuLoader.h
@@ -8,13 +8,13 @@
 **/
 
 #ifndef QEMU_LOADER_H_
 #define QEMU_LOADER_H_
 
 #include <Base.h>
-#include <Library/QemuFwCfgLib.h>
+#include <IndustryStandard/QemuFwCfg.h>
 
 //
 // The types and the documentation reflects the SeaBIOS interface.
 //
 #define QEMU_LOADER_FNAME_SIZE QEMU_FW_CFG_FNAME_SIZE
 
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 09/43] OvmfPkg/AcpiPlatformDxe: move "QemuLoader.h" to IndustryStandard
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (7 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 08/43] OvmfPkg/AcpiPlatformDxe/QemuLoader.h: remove QemuFwCfgLib class dependency Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:26   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 10/43] OvmfPkg/AcpiPlatformDxe: consolidate #includes and [LibraryClasses] Laszlo Ersek
                   ` (36 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

Turn the "QemuLoader.h" header into a public (IndustryStandard) one. The
QEMU ACPI linker-loader interface is stable between QEMU and multiple
guest firmwares.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/{AcpiPlatformDxe => Include/IndustryStandard}/QemuLoader.h | 0
 OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf                        | 1 -
 OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf               | 1 -
 OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c                            | 2 +-
 4 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/OvmfPkg/AcpiPlatformDxe/QemuLoader.h b/OvmfPkg/Include/IndustryStandard/QemuLoader.h
similarity index 100%
rename from OvmfPkg/AcpiPlatformDxe/QemuLoader.h
rename to OvmfPkg/Include/IndustryStandard/QemuLoader.h
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
index 4522d7f6110c..3daeb2ee42d2 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -25,13 +25,12 @@ [Sources]
   AcpiPlatform.h
   BootScript.c
   EntryPoint.c
   PciDecoding.c
   Qemu.c
   QemuFwCfgAcpi.c
-  QemuLoader.h
   Xen.c
 
 [Packages]
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
index cc24f35bd83a..48c8269a8b6f 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
+++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
@@ -24,13 +24,12 @@ [Sources]
   AcpiPlatform.h
   BootScript.c
   EntryPoint.c
   PciDecoding.c
   QemuFwCfgAcpi.c
   QemuFwCfgAcpiPlatform.c
-  QemuLoader.h
 
 [Packages]
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
 
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
index c07b84a21385..621e69410da9 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
+++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
@@ -6,22 +6,22 @@
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #include <IndustryStandard/Acpi.h>
+#include <IndustryStandard/QemuLoader.h>
 #include <Library/BaseMemoryLib.h>
 #include <Library/DxeServicesTableLib.h>
 #include <Library/MemoryAllocationLib.h>
 #include <Library/OrderedCollectionLib.h>
 #include <Library/PcdLib.h>
 #include <Library/QemuFwCfgLib.h>
 #include <Library/QemuFwCfgS3Lib.h>
 
 #include "AcpiPlatform.h"
-#include "QemuLoader.h"
 
 //
 // The user structure for the ordered collection that will track the fw_cfg
 // blobs under processing.
 //
 typedef struct {
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 10/43] OvmfPkg/AcpiPlatformDxe: consolidate #includes and [LibraryClasses]
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (8 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 09/43] OvmfPkg/AcpiPlatformDxe: move "QemuLoader.h" to IndustryStandard Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:41   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 11/43] OvmfPkg/XenAcpiPlatformDxe: create from AcpiPlatformDxe Laszlo Ersek
                   ` (35 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

- #include only such public headers in "AcpiPlatform.h" that are required
  by the function declarations and type definitions introduced in
  "AcpiPlatform.h". Don't use "AcpiPlatform.h" as a convenience #include
  file.

- In every file, list every necessary public #include individually, with
  an example identifier that's actually consumed.

- Remove unnecessary lib classes, add unlisted lib classes.

- Remove unnecessary #include directives, add unlisted #include
  directives.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf          |  1 -
 OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf |  2 ++
 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h               | 12 ++----------
 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c               |  5 +++++
 OvmfPkg/AcpiPlatformDxe/BootScript.c                 |  7 ++++---
 OvmfPkg/AcpiPlatformDxe/EntryPoint.c                 |  6 +++++-
 OvmfPkg/AcpiPlatformDxe/PciDecoding.c                |  4 +++-
 OvmfPkg/AcpiPlatformDxe/Qemu.c                       | 14 +++++++-------
 OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c              | 19 ++++++++++---------
 OvmfPkg/AcpiPlatformDxe/Xen.c                        |  4 +++-
 10 files changed, 41 insertions(+), 33 deletions(-)

diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
index 3daeb2ee42d2..77607298cbea 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -45,13 +45,12 @@ [LibraryClasses]
   OrderedCollectionLib
   PcdLib
   QemuFwCfgLib
   QemuFwCfgS3Lib
   UefiBootServicesTableLib
   UefiDriverEntryPoint
-  UefiLib
   XenPlatformLib
 
 [Protocols]
   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
   gEfiFirmwareVolume2ProtocolGuid               # PROTOCOL SOMETIMES_CONSUMED
   gEfiPciIoProtocolGuid                         # PROTOCOL SOMETIMES_CONSUMED
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
index 48c8269a8b6f..dac25d1505be 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
+++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
@@ -32,15 +32,17 @@ [Packages]
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
   BaseLib
+  BaseMemoryLib
   DebugLib
   MemoryAllocationLib
   OrderedCollectionLib
+  PcdLib
   QemuFwCfgLib
   QemuFwCfgS3Lib
   UefiBootServicesTableLib
   UefiDriverEntryPoint
 
 [Protocols]
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
index 511a30782f6d..d98b79baab40 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
@@ -6,22 +6,14 @@
 
 **/
 
 #ifndef ACPI_PLATFORM_H_
 #define ACPI_PLATFORM_H_
 
-#include <IndustryStandard/Acpi.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/XenPlatformLib.h>
-#include <PiDxe.h>
-#include <Protocol/AcpiTable.h>
-#include <Protocol/FirmwareVolume2.h>
-#include <Protocol/PciIo.h>
+#include <Protocol/AcpiTable.h> // EFI_ACPI_TABLE_PROTOCOL
+#include <Protocol/PciIo.h>     // EFI_PCI_IO_PROTOCOL
 
 typedef struct {
   EFI_PCI_IO_PROTOCOL *PciIo;
   UINT64              PciAttributes;
 } ORIGINAL_ATTRIBUTES;
 
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
index f872d91aea72..efbbfab89d2b 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
@@ -3,12 +3,17 @@
 
   Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
+#include <Library/DebugLib.h>                 // ASSERT_EFI_ERROR()
+#include <Library/UefiBootServicesTableLib.h> // gBS
+#include <Library/XenPlatformLib.h>           // XenDetected()
+#include <Protocol/FirmwareVolume2.h>         // gEfiFirmwareVolume2Protocol...
+
 #include "AcpiPlatform.h"
 
 EFI_STATUS
 EFIAPI
 InstallAcpiTable (
   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
diff --git a/OvmfPkg/AcpiPlatformDxe/BootScript.c b/OvmfPkg/AcpiPlatformDxe/BootScript.c
index 7b1b9586da41..f2d1089e91ce 100644
--- a/OvmfPkg/AcpiPlatformDxe/BootScript.c
+++ b/OvmfPkg/AcpiPlatformDxe/BootScript.c
@@ -4,15 +4,16 @@
 
   Copyright (C) 2017, Red Hat, Inc.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
-#include <Library/MemoryAllocationLib.h>
-#include <Library/QemuFwCfgLib.h>
-#include <Library/QemuFwCfgS3Lib.h>
+#include <Library/BaseLib.h>             // CpuDeadLoop()
+#include <Library/DebugLib.h>            // DEBUG()
+#include <Library/MemoryAllocationLib.h> // AllocatePool()
+#include <Library/QemuFwCfgS3Lib.h>      // QemuFwCfgS3ScriptSkipBytes()
 
 #include "AcpiPlatform.h"
 
 
 //
 // Condensed structure for capturing the fw_cfg operations -- select, skip,
diff --git a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
index fb07ed85373d..bb5fe82c18d4 100644
--- a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
+++ b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
@@ -4,13 +4,17 @@
   Copyright (C) 2015, Red Hat, Inc.
   Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
-#include <Guid/RootBridgesConnectedEventGroup.h>
+#include <Guid/RootBridgesConnectedEventGroup.h> // gRootBridgesConnectedEve...
+#include <Library/DebugLib.h>                    // DEBUG()
+#include <Library/PcdLib.h>                      // PcdGetBool()
+#include <Library/UefiBootServicesTableLib.h>    // gBS
+#include <Protocol/AcpiTable.h>                  // EFI_ACPI_TABLE_PROTOCOL
 
 #include "AcpiPlatform.h"
 
 STATIC
 EFI_ACPI_TABLE_PROTOCOL *
 FindAcpiTableProtocol (
diff --git a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c b/OvmfPkg/AcpiPlatformDxe/PciDecoding.c
index 73894106c9ec..6ba4c936ad8e 100644
--- a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c
+++ b/OvmfPkg/AcpiPlatformDxe/PciDecoding.c
@@ -4,13 +4,15 @@
 
   Copyright (C) 2016, Red Hat, Inc.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
-#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>                  // DEBUG()
+#include <Library/MemoryAllocationLib.h>       // AllocatePool()
+#include <Library/UefiBootServicesTableLib.h>  // gBS
 
 #include "AcpiPlatform.h"
 
 
 /**
   Collect all PciIo protocol instances in the system. Save their original
diff --git a/OvmfPkg/AcpiPlatformDxe/Qemu.c b/OvmfPkg/AcpiPlatformDxe/Qemu.c
index bed3b16159a6..bdcc46b7186a 100644
--- a/OvmfPkg/AcpiPlatformDxe/Qemu.c
+++ b/OvmfPkg/AcpiPlatformDxe/Qemu.c
@@ -6,19 +6,19 @@
   Copyright (C) 2012-2014, Red Hat, Inc.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include <IndustryStandard/Acpi.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/OrderedCollectionLib.h>
-#include <Library/PcdLib.h>
-#include <Library/QemuFwCfgLib.h>
+#include <IndustryStandard/Acpi.h>        // EFI_ACPI_1_0_IO_APIC_STRUCTURE
+#include <Library/BaseMemoryLib.h>        // CopyMem()
+#include <Library/DebugLib.h>             // DEBUG()
+#include <Library/DxeServicesTableLib.h>  // gDS
+#include <Library/MemoryAllocationLib.h>  // AllocatePool()
+#include <Library/PcdLib.h>               // PcdGet16()
+#include <Library/QemuFwCfgLib.h>         // QemuFwCfgIsAvailable()
 
 #include "AcpiPlatform.h"
 
 BOOLEAN
 QemuDetected (
   VOID
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
index 621e69410da9..df800b149275 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
+++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
@@ -5,21 +5,22 @@
   Copyright (C) 2012-2014, Red Hat, Inc.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include <IndustryStandard/Acpi.h>
-#include <IndustryStandard/QemuLoader.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/OrderedCollectionLib.h>
-#include <Library/PcdLib.h>
-#include <Library/QemuFwCfgLib.h>
-#include <Library/QemuFwCfgS3Lib.h>
+#include <IndustryStandard/Acpi.h>            // EFI_ACPI_DESCRIPTION_HEADER
+#include <IndustryStandard/QemuLoader.h>      // QEMU_LOADER_FNAME_SIZE
+#include <Library/BaseLib.h>                  // AsciiStrCmp()
+#include <Library/BaseMemoryLib.h>            // CopyMem()
+#include <Library/DebugLib.h>                 // DEBUG()
+#include <Library/MemoryAllocationLib.h>      // AllocatePool()
+#include <Library/OrderedCollectionLib.h>     // OrderedCollectionMin()
+#include <Library/QemuFwCfgLib.h>             // QemuFwCfgFindFile()
+#include <Library/QemuFwCfgS3Lib.h>           // QemuFwCfgS3Enabled()
+#include <Library/UefiBootServicesTableLib.h> // gBS
 
 #include "AcpiPlatform.h"
 
 //
 // The user structure for the ordered collection that will track the fw_cfg
 // blobs under processing.
diff --git a/OvmfPkg/AcpiPlatformDxe/Xen.c b/OvmfPkg/AcpiPlatformDxe/Xen.c
index 1d69989042c6..be2c5d695846 100644
--- a/OvmfPkg/AcpiPlatformDxe/Xen.c
+++ b/OvmfPkg/AcpiPlatformDxe/Xen.c
@@ -5,13 +5,15 @@
   Copyright (c) 2012, Bei Guan <gbtju85@gmail.com>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include <Library/BaseLib.h>
+#include <Library/BaseLib.h>        // CpuDeadLoop()
+#include <Library/DebugLib.h>       // DEBUG()
+#include <Library/XenPlatformLib.h> // XenGetInfoHOB()
 
 #include "AcpiPlatform.h"
 
 #define XEN_ACPI_PHYSICAL_ADDRESS         0x000EA020
 #define XEN_BIOS_PHYSICAL_END             0x000FFFFF
 
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 11/43] OvmfPkg/XenAcpiPlatformDxe: create from AcpiPlatformDxe
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (9 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 10/43] OvmfPkg/AcpiPlatformDxe: consolidate #includes and [LibraryClasses] Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27 10:16   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 12/43] OvmfPkg/AcpiPlatformDxe: remove the "AcpiPlatformDxe.inf" driver Laszlo Ersek
                   ` (34 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Andrew Fish, Anthony Perard, Ard Biesheuvel, Jordan Justen,
	Julien Grall, Leif Lindholm, Michael D Kinney,
	Philippe Mathieu-Daudé

Create an almost verbatim copy of the
"OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf" driver for the OvmfXen
platform. We're going to trim the driver in subsequent patches.
Ultimately, the XenAcpiPlatformDxe driver will duplicate a negligible
amount of code that is currently present in the QemuFwCfgAcpiPlatformDxe
driver.

List the new driver in "Maintainers.txt", in the "OvmfPkg: Xen-related
modules" section.

Switch the OvmfXen platform to the new driver at once.

This patch should be reviewed with "git show --find-copies-harder".

Cc: Andrew Fish <afish@apple.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/OvmfXen.dsc                                                                        | 2 +-
 OvmfPkg/OvmfXen.fdf                                                                        | 2 +-
 OvmfPkg/{AcpiPlatformDxe/AcpiPlatformDxe.inf => XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf} | 7 ++++---
 Maintainers.txt                                                                            | 1 +
 OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/AcpiPlatform.h                             | 3 ++-
 OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/AcpiPlatform.c                             | 3 ++-
 OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/BootScript.c                               | 2 +-
 OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/EntryPoint.c                               | 4 ++--
 OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/PciDecoding.c                              | 2 +-
 OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Qemu.c                                     | 3 +--
 OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/QemuFwCfgAcpi.c                            | 2 +-
 OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Xen.c                                      | 1 +
 12 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index e535503e385d..4d5171cd43c1 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -649,13 +649,13 @@ [Components]
   OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 
   #
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
+  OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
   OvmfPkg/AcpiTables/AcpiTables.inf
   MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
   MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
   MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
   #
diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf
index c7d4d1853027..85306245b50f 100644
--- a/OvmfPkg/OvmfXen.fdf
+++ b/OvmfPkg/OvmfXen.fdf
@@ -349,13 +349,13 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf
 
 INF  MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
 INF  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 
 INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
-INF  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
+INF  OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
 INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
 INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
 INF  FatPkg/EnhancedFatDxe/Fat.inf
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
similarity index 85%
copy from OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
copy to OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
index 77607298cbea..379b5d56d565 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
@@ -1,18 +1,19 @@
 ## @file
-#  OVMF ACPI Platform Driver
+#  OVMF ACPI Platform Driver for Xen guests
 #
+#  Copyright (C) 2021, Red Hat, Inc.
 #  Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR>
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
 [Defines]
   INF_VERSION                    = 0x00010005
-  BASE_NAME                      = AcpiPlatform
-  FILE_GUID                      = 49970331-E3FA-4637-9ABC-3B7868676970
+  BASE_NAME                      = XenAcpiPlatform
+  FILE_GUID                      = fa0a48ac-767d-4c88-b70c-ec54c8b900c4
   MODULE_TYPE                    = DXE_DRIVER
   VERSION_STRING                 = 1.0
   ENTRY_POINT                    = AcpiPlatformEntryPoint
 
 #
 # The following information is for reference only and not required by the build tools.
diff --git a/Maintainers.txt b/Maintainers.txt
index cafe6b1ab85d..50c87d1ac29a 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -503,12 +503,13 @@ F: OvmfPkg/Library/XenRealTimeClockLib/
 F: OvmfPkg/OvmfXen.*
 F: OvmfPkg/OvmfXenElfHeaderGenerator.c
 F: OvmfPkg/PlatformPei/MemDetect.c
 F: OvmfPkg/PlatformPei/Platform.*
 F: OvmfPkg/PlatformPei/Xen.*
 F: OvmfPkg/SmbiosPlatformDxe/*Xen.c
+F: OvmfPkg/XenAcpiPlatformDxe/
 F: OvmfPkg/XenBusDxe/
 F: OvmfPkg/XenIoPciDxe/
 F: OvmfPkg/XenIoPvhDxe/
 F: OvmfPkg/XenPlatformPei/
 F: OvmfPkg/XenPvBlkDxe/
 F: OvmfPkg/XenResetVector/
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
similarity index 91%
copy from OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
copy to OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
index d98b79baab40..6259697c4b2d 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
@@ -1,9 +1,10 @@
 /** @file
-  OVMF ACPI Platform Driver
+  OVMF ACPI Platform Driver for Xen guests
 
+  Copyright (C) 2021, Red Hat, Inc.
   Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #ifndef ACPI_PLATFORM_H_
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
similarity index 95%
copy from OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
copy to OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
index efbbfab89d2b..2b2dc576754b 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
@@ -1,9 +1,10 @@
 /** @file
-  OVMF ACPI Platform Driver
+  OVMF ACPI Platform Driver for Xen guests
 
+  Copyright (C) 2021, Red Hat, Inc.
   Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #include <Library/DebugLib.h>                 // ASSERT_EFI_ERROR()
diff --git a/OvmfPkg/AcpiPlatformDxe/BootScript.c b/OvmfPkg/XenAcpiPlatformDxe/BootScript.c
similarity index 96%
copy from OvmfPkg/AcpiPlatformDxe/BootScript.c
copy to OvmfPkg/XenAcpiPlatformDxe/BootScript.c
index f2d1089e91ce..14d1e68694cb 100644
--- a/OvmfPkg/AcpiPlatformDxe/BootScript.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/BootScript.c
@@ -1,11 +1,11 @@
 /** @file
   Append an ACPI S3 Boot Script fragment from the QEMU_LOADER_WRITE_POINTER
   commands of QEMU's fully processed table linker/loader script.
 
-  Copyright (C) 2017, Red Hat, Inc.
+  Copyright (C) 2017-2021, Red Hat, Inc.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
 #include <Library/BaseLib.h>             // CpuDeadLoop()
 #include <Library/DebugLib.h>            // DEBUG()
diff --git a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c b/OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
similarity index 93%
copy from OvmfPkg/AcpiPlatformDxe/EntryPoint.c
copy to OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
index bb5fe82c18d4..b6d0835fe3d4 100644
--- a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
@@ -1,10 +1,10 @@
 /** @file
-  Entry point of OVMF ACPI Platform Driver
+  Entry point of OVMF ACPI Platform Driver for Xen guests
 
-  Copyright (C) 2015, Red Hat, Inc.
+  Copyright (C) 2015-2021, Red Hat, Inc.
   Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
 #include <Guid/RootBridgesConnectedEventGroup.h> // gRootBridgesConnectedEve...
diff --git a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c b/OvmfPkg/XenAcpiPlatformDxe/PciDecoding.c
similarity index 96%
copy from OvmfPkg/AcpiPlatformDxe/PciDecoding.c
copy to OvmfPkg/XenAcpiPlatformDxe/PciDecoding.c
index 6ba4c936ad8e..00fc57eb13eb 100644
--- a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/PciDecoding.c
@@ -1,11 +1,11 @@
 /** @file
   Temporarily enable IO and MMIO decoding for all PCI devices while QEMU
   regenerates the ACPI tables.
 
-  Copyright (C) 2016, Red Hat, Inc.
+  Copyright (C) 2016-2021, Red Hat, Inc.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
 #include <Library/DebugLib.h>                  // DEBUG()
 #include <Library/MemoryAllocationLib.h>       // AllocatePool()
diff --git a/OvmfPkg/AcpiPlatformDxe/Qemu.c b/OvmfPkg/XenAcpiPlatformDxe/Qemu.c
similarity index 96%
copy from OvmfPkg/AcpiPlatformDxe/Qemu.c
copy to OvmfPkg/XenAcpiPlatformDxe/Qemu.c
index bdcc46b7186a..b4a407c41b71 100644
--- a/OvmfPkg/AcpiPlatformDxe/Qemu.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/Qemu.c
@@ -1,13 +1,12 @@
 /** @file
   OVMF ACPI QEMU support
 
+  Copyright (C) 2012-2021, Red Hat, Inc.
   Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
 
-  Copyright (C) 2012-2014, Red Hat, Inc.
-
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #include <IndustryStandard/Acpi.h>        // EFI_ACPI_1_0_IO_APIC_STRUCTURE
 #include <Library/BaseMemoryLib.h>        // CopyMem()
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/XenAcpiPlatformDxe/QemuFwCfgAcpi.c
similarity index 97%
copy from OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
copy to OvmfPkg/XenAcpiPlatformDxe/QemuFwCfgAcpi.c
index df800b149275..521c06cf546f 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/QemuFwCfgAcpi.c
@@ -1,11 +1,11 @@
 /** @file
   OVMF ACPI support using QEMU's fw-cfg interface
 
+  Copyright (C) 2012-2021, Red Hat, Inc.
   Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
-  Copyright (C) 2012-2014, Red Hat, Inc.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #include <IndustryStandard/Acpi.h>            // EFI_ACPI_DESCRIPTION_HEADER
diff --git a/OvmfPkg/AcpiPlatformDxe/Xen.c b/OvmfPkg/XenAcpiPlatformDxe/Xen.c
similarity index 96%
copy from OvmfPkg/AcpiPlatformDxe/Xen.c
copy to OvmfPkg/XenAcpiPlatformDxe/Xen.c
index be2c5d695846..e8395db548d9 100644
--- a/OvmfPkg/AcpiPlatformDxe/Xen.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/Xen.c
@@ -1,9 +1,10 @@
 /** @file
   OVMF ACPI Xen support
 
+  Copyright (C) 2021, Red Hat, Inc.
   Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
   Copyright (c) 2012, Bei Guan <gbtju85@gmail.com>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 12/43] OvmfPkg/AcpiPlatformDxe: remove the "AcpiPlatformDxe.inf" driver
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (10 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 11/43] OvmfPkg/XenAcpiPlatformDxe: create from AcpiPlatformDxe Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27 10:17   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 13/43] OvmfPkg/XenAcpiPlatformDxe: remove the QEMU ACPI linker/loader client Laszlo Ersek
                   ` (33 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Andrew Fish, Ard Biesheuvel, Jordan Justen, Leif Lindholm,
	Michael D Kinney, Philippe Mathieu-Daudé

The "OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf" module is no longer
referenced in any platform DSC file; remove it.

That orphans the "AcpiPlatform.c", "Qemu.c" and "Xen.c" files in the
"OvmfPkg/AcpiPlatformDxe/" directory; remove them.

That in turn removes the only definitions of the InstallAcpiTable(),
QemuDetected(), QemuInstallAcpiTable(), InstallXenTables() functions in
the "OvmfPkg/AcpiPlatformDxe/" directory, so remove their declarations
from "AcpiPlatform.h".

Remove "OvmfPkg/AcpiPlatformDxe/Xen.c" from the "OvmfPkg: Xen-related
modules" section of "Maintainers.txt", as well.

Cc: Andrew Fish <afish@apple.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf |  69 ---
 Maintainers.txt                             |   1 -
 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h      |  29 --
 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c      | 267 ----------
 OvmfPkg/AcpiPlatformDxe/Qemu.c              | 512 --------------------
 OvmfPkg/AcpiPlatformDxe/Xen.c               | 315 ------------
 6 files changed, 1193 deletions(-)

diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
deleted file mode 100644
index 77607298cbea..000000000000
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ /dev/null
@@ -1,69 +0,0 @@
-## @file
-#  OVMF ACPI Platform Driver
-#
-#  Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.<BR>
-#  SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
-  INF_VERSION                    = 0x00010005
-  BASE_NAME                      = AcpiPlatform
-  FILE_GUID                      = 49970331-E3FA-4637-9ABC-3B7868676970
-  MODULE_TYPE                    = DXE_DRIVER
-  VERSION_STRING                 = 1.0
-  ENTRY_POINT                    = AcpiPlatformEntryPoint
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-#  VALID_ARCHITECTURES           = IA32 X64 EBC
-#
-
-[Sources]
-  AcpiPlatform.c
-  AcpiPlatform.h
-  BootScript.c
-  EntryPoint.c
-  PciDecoding.c
-  Qemu.c
-  QemuFwCfgAcpi.c
-  Xen.c
-
-[Packages]
-  MdeModulePkg/MdeModulePkg.dec
-  MdePkg/MdePkg.dec
-  OvmfPkg/OvmfPkg.dec
-  UefiCpuPkg/UefiCpuPkg.dec
-
-[LibraryClasses]
-  BaseLib
-  BaseMemoryLib
-  DebugLib
-  DxeServicesTableLib
-  MemoryAllocationLib
-  OrderedCollectionLib
-  PcdLib
-  QemuFwCfgLib
-  QemuFwCfgS3Lib
-  UefiBootServicesTableLib
-  UefiDriverEntryPoint
-  XenPlatformLib
-
-[Protocols]
-  gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
-  gEfiFirmwareVolume2ProtocolGuid               # PROTOCOL SOMETIMES_CONSUMED
-  gEfiPciIoProtocolGuid                         # PROTOCOL SOMETIMES_CONSUMED
-
-[Guids]
-  gRootBridgesConnectedEventGroupGuid
-
-[Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
-  gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress
-  gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel
-  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress
-
-[Depex]
-  gEfiAcpiTableProtocolGuid
diff --git a/Maintainers.txt b/Maintainers.txt
index 50c87d1ac29a..82008a0046c6 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -481,13 +481,12 @@ F: OvmfPkg/Library/Tcg2PhysicalPresenceLib*/
 F: OvmfPkg/PlatformPei/ClearCache.c
 F: OvmfPkg/Tcg/
 R: Marc-André Lureau <marcandre.lureau@redhat.com>
 R: Stefan Berger <stefanb@linux.ibm.com>
 
 OvmfPkg: Xen-related modules
-F: OvmfPkg/AcpiPlatformDxe/Xen.c
 F: OvmfPkg/Include/Guid/XenBusRootDevice.h
 F: OvmfPkg/Include/Guid/XenInfo.h
 F: OvmfPkg/Include/IndustryStandard/Xen/
 F: OvmfPkg/Include/Library/XenHypercallLib.h
 F: OvmfPkg/Include/Library/XenIoMmioLib.h
 F: OvmfPkg/Include/Library/XenPlatformLib.h
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
index d98b79baab40..bd4c26f07fcd 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
@@ -16,41 +16,12 @@ typedef struct {
   EFI_PCI_IO_PROTOCOL *PciIo;
   UINT64              PciAttributes;
 } ORIGINAL_ATTRIBUTES;
 
 typedef struct S3_CONTEXT S3_CONTEXT;
 
-EFI_STATUS
-EFIAPI
-InstallAcpiTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  );
-
-BOOLEAN
-QemuDetected (
-  VOID
-  );
-
-EFI_STATUS
-EFIAPI
-QemuInstallAcpiTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  );
-
-EFI_STATUS
-EFIAPI
-InstallXenTables (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
-  );
-
 EFI_STATUS
 EFIAPI
 InstallQemuFwCfgTables (
   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
   );
 
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
deleted file mode 100644
index efbbfab89d2b..000000000000
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/** @file
-  OVMF ACPI Platform Driver
-
-  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Library/DebugLib.h>                 // ASSERT_EFI_ERROR()
-#include <Library/UefiBootServicesTableLib.h> // gBS
-#include <Library/XenPlatformLib.h>           // XenDetected()
-#include <Protocol/FirmwareVolume2.h>         // gEfiFirmwareVolume2Protocol...
-
-#include "AcpiPlatform.h"
-
-EFI_STATUS
-EFIAPI
-InstallAcpiTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  )
-{
-  return AcpiProtocol->InstallAcpiTable (
-                         AcpiProtocol,
-                         AcpiTableBuffer,
-                         AcpiTableBufferSize,
-                         TableKey
-                         );
-}
-
-
-/**
-  Locate the first instance of a protocol.  If the protocol requested is an
-  FV protocol, then it will return the first FV that contains the ACPI table
-  storage file.
-
-  @param  Instance      Return pointer to the first instance of the protocol
-
-  @return EFI_SUCCESS           The function completed successfully.
-  @return EFI_NOT_FOUND         The protocol could not be located.
-  @return EFI_OUT_OF_RESOURCES  There are not enough resources to find the protocol.
-
-**/
-EFI_STATUS
-LocateFvInstanceWithTables (
-  OUT EFI_FIRMWARE_VOLUME2_PROTOCOL **Instance
-  )
-{
-  EFI_STATUS                    Status;
-  EFI_HANDLE                    *HandleBuffer;
-  UINTN                         NumberOfHandles;
-  EFI_FV_FILETYPE               FileType;
-  UINT32                        FvStatus;
-  EFI_FV_FILE_ATTRIBUTES        Attributes;
-  UINTN                         Size;
-  UINTN                         Index;
-  EFI_FIRMWARE_VOLUME2_PROTOCOL *FvInstance;
-
-  FvStatus = 0;
-
-  //
-  // Locate protocol.
-  //
-  Status = gBS->LocateHandleBuffer (
-                   ByProtocol,
-                   &gEfiFirmwareVolume2ProtocolGuid,
-                   NULL,
-                   &NumberOfHandles,
-                   &HandleBuffer
-                   );
-  if (EFI_ERROR (Status)) {
-    //
-    // Defined errors at this time are not found and out of resources.
-    //
-    return Status;
-  }
-
-  //
-  // Looking for FV with ACPI storage file
-  //
-  for (Index = 0; Index < NumberOfHandles; Index++) {
-    //
-    // Get the protocol on this handle
-    // This should not fail because of LocateHandleBuffer
-    //
-    Status = gBS->HandleProtocol (
-                     HandleBuffer[Index],
-                     &gEfiFirmwareVolume2ProtocolGuid,
-                     (VOID**) &FvInstance
-                     );
-    ASSERT_EFI_ERROR (Status);
-
-    //
-    // See if it has the ACPI storage file
-    //
-    Status = FvInstance->ReadFile (
-                           FvInstance,
-                           (EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
-                           NULL,
-                           &Size,
-                           &FileType,
-                           &Attributes,
-                           &FvStatus
-                           );
-
-    //
-    // If we found it, then we are done
-    //
-    if (Status == EFI_SUCCESS) {
-      *Instance = FvInstance;
-      break;
-    }
-  }
-
-  //
-  // Our exit status is determined by the success of the previous operations
-  // If the protocol was found, Instance already points to it.
-  //
-
-  //
-  // Free any allocated buffers
-  //
-  gBS->FreePool (HandleBuffer);
-
-  return Status;
-}
-
-
-/**
-  Find ACPI tables in an FV and install them.
-
-  This is now a fall-back path. Normally, we will search for tables provided
-  by the VMM first.
-
-  If that fails, we use this function to load the ACPI tables from an FV. The
-  sources for the FV based tables is located under OvmfPkg/AcpiTables.
-
-  @param  AcpiTable     Protocol instance pointer
-
-**/
-EFI_STATUS
-EFIAPI
-InstallOvmfFvTables (
-  IN  EFI_ACPI_TABLE_PROTOCOL     *AcpiTable
-  )
-{
-  EFI_STATUS                           Status;
-  EFI_FIRMWARE_VOLUME2_PROTOCOL        *FwVol;
-  INTN                                 Instance;
-  EFI_ACPI_COMMON_HEADER               *CurrentTable;
-  UINTN                                TableHandle;
-  UINT32                               FvStatus;
-  UINTN                                TableSize;
-  UINTN                                Size;
-  EFI_ACPI_TABLE_INSTALL_ACPI_TABLE    TableInstallFunction;
-
-  Instance     = 0;
-  CurrentTable = NULL;
-  TableHandle  = 0;
-
-  if (QemuDetected ()) {
-    TableInstallFunction = QemuInstallAcpiTable;
-  } else {
-    TableInstallFunction = InstallAcpiTable;
-  }
-
-  //
-  // set FwVol (and use an ASSERT() below) to suppress incorrect
-  // compiler/analyzer warnings
-  //
-  FwVol = NULL;
-  //
-  // Locate the firmware volume protocol
-  //
-  Status = LocateFvInstanceWithTables (&FwVol);
-  if (EFI_ERROR (Status)) {
-    return EFI_ABORTED;
-  }
-  ASSERT (FwVol != NULL);
-
-  //
-  // Read tables from the storage file.
-  //
-  while (Status == EFI_SUCCESS) {
-
-    Status = FwVol->ReadSection (
-                      FwVol,
-                      (EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
-                      EFI_SECTION_RAW,
-                      Instance,
-                      (VOID**) &CurrentTable,
-                      &Size,
-                      &FvStatus
-                      );
-    if (!EFI_ERROR (Status)) {
-      //
-      // Add the table
-      //
-      TableHandle = 0;
-
-      TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
-      ASSERT (Size >= TableSize);
-
-      //
-      // Install ACPI table
-      //
-      Status = TableInstallFunction (
-                 AcpiTable,
-                 CurrentTable,
-                 TableSize,
-                 &TableHandle
-                 );
-
-      //
-      // Free memory allocated by ReadSection
-      //
-      gBS->FreePool (CurrentTable);
-
-      if (EFI_ERROR (Status)) {
-        return EFI_ABORTED;
-      }
-
-      //
-      // Increment the instance
-      //
-      Instance++;
-      CurrentTable = NULL;
-    }
-  }
-
-  return EFI_SUCCESS;
-}
-
-/**
-  Effective entrypoint of Acpi Platform driver.
-
-  @param  ImageHandle
-  @param  SystemTable
-
-  @return EFI_SUCCESS
-  @return EFI_LOAD_ERROR
-  @return EFI_OUT_OF_RESOURCES
-
-**/
-EFI_STATUS
-EFIAPI
-InstallAcpiTables (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiTable
-  )
-{
-  EFI_STATUS                         Status;
-
-  if (XenDetected ()) {
-    Status = InstallXenTables (AcpiTable);
-  } else {
-    Status = InstallQemuFwCfgTables (AcpiTable);
-  }
-
-  if (EFI_ERROR (Status)) {
-    Status = InstallOvmfFvTables (AcpiTable);
-  }
-
-  return Status;
-}
-
diff --git a/OvmfPkg/AcpiPlatformDxe/Qemu.c b/OvmfPkg/AcpiPlatformDxe/Qemu.c
deleted file mode 100644
index bdcc46b7186a..000000000000
--- a/OvmfPkg/AcpiPlatformDxe/Qemu.c
+++ /dev/null
@@ -1,512 +0,0 @@
-/** @file
-  OVMF ACPI QEMU support
-
-  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
-
-  Copyright (C) 2012-2014, Red Hat, Inc.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <IndustryStandard/Acpi.h>        // EFI_ACPI_1_0_IO_APIC_STRUCTURE
-#include <Library/BaseMemoryLib.h>        // CopyMem()
-#include <Library/DebugLib.h>             // DEBUG()
-#include <Library/DxeServicesTableLib.h>  // gDS
-#include <Library/MemoryAllocationLib.h>  // AllocatePool()
-#include <Library/PcdLib.h>               // PcdGet16()
-#include <Library/QemuFwCfgLib.h>         // QemuFwCfgIsAvailable()
-
-#include "AcpiPlatform.h"
-
-BOOLEAN
-QemuDetected (
-  VOID
-  )
-{
-  if (!QemuFwCfgIsAvailable ()) {
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-
-STATIC
-UINTN
-CountBits16 (
-  UINT16 Mask
-  )
-{
-  //
-  // For all N >= 1, N bits are enough to represent the number of bits set
-  // among N bits. It's true for N == 1. When adding a new bit (N := N+1),
-  // the maximum number of possibly set bits increases by one, while the
-  // representable maximum doubles.
-  //
-  Mask = ((Mask & 0xAAAA) >> 1) + (Mask & 0x5555);
-  Mask = ((Mask & 0xCCCC) >> 2) + (Mask & 0x3333);
-  Mask = ((Mask & 0xF0F0) >> 4) + (Mask & 0x0F0F);
-  Mask = ((Mask & 0xFF00) >> 8) + (Mask & 0x00FF);
-
-  return Mask;
-}
-
-
-STATIC
-EFI_STATUS
-EFIAPI
-QemuInstallAcpiMadtTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  )
-{
-  UINTN                                               CpuCount;
-  UINTN                                               PciLinkIsoCount;
-  UINTN                                               NewBufferSize;
-  EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *Madt;
-  EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE         *LocalApic;
-  EFI_ACPI_1_0_IO_APIC_STRUCTURE                      *IoApic;
-  EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE    *Iso;
-  EFI_ACPI_1_0_LOCAL_APIC_NMI_STRUCTURE               *LocalApicNmi;
-  VOID                                                *Ptr;
-  UINTN                                               Loop;
-  EFI_STATUS                                          Status;
-
-  ASSERT (AcpiTableBufferSize >= sizeof (EFI_ACPI_DESCRIPTION_HEADER));
-
-  QemuFwCfgSelectItem (QemuFwCfgItemSmpCpuCount);
-  CpuCount = QemuFwCfgRead16 ();
-  ASSERT (CpuCount >= 1);
-
-  //
-  // Set Level-tiggered, Active High for these identity mapped IRQs. The bitset
-  // corresponds to the union of all possible interrupt assignments for the LNKA,
-  // LNKB, LNKC, LNKD PCI interrupt lines. See the DSDT.
-  //
-  PciLinkIsoCount = CountBits16 (PcdGet16 (Pcd8259LegacyModeEdgeLevel));
-
-  NewBufferSize = 1                     * sizeof (*Madt) +
-                  CpuCount              * sizeof (*LocalApic) +
-                  1                     * sizeof (*IoApic) +
-                  (1 + PciLinkIsoCount) * sizeof (*Iso) +
-                  1                     * sizeof (*LocalApicNmi);
-
-  Madt = AllocatePool (NewBufferSize);
-  if (Madt == NULL) {
-    return EFI_OUT_OF_RESOURCES;
-  }
-
-  CopyMem (&(Madt->Header), AcpiTableBuffer, sizeof (EFI_ACPI_DESCRIPTION_HEADER));
-  Madt->Header.Length    = (UINT32) NewBufferSize;
-  Madt->LocalApicAddress = PcdGet32 (PcdCpuLocalApicBaseAddress);
-  Madt->Flags            = EFI_ACPI_1_0_PCAT_COMPAT;
-  Ptr = Madt + 1;
-
-  LocalApic = Ptr;
-  for (Loop = 0; Loop < CpuCount; ++Loop) {
-    LocalApic->Type            = EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC;
-    LocalApic->Length          = sizeof (*LocalApic);
-    LocalApic->AcpiProcessorId = (UINT8) Loop;
-    LocalApic->ApicId          = (UINT8) Loop;
-    LocalApic->Flags           = 1; // enabled
-    ++LocalApic;
-  }
-  Ptr = LocalApic;
-
-  IoApic = Ptr;
-  IoApic->Type             = EFI_ACPI_1_0_IO_APIC;
-  IoApic->Length           = sizeof (*IoApic);
-  IoApic->IoApicId         = (UINT8) CpuCount;
-  IoApic->Reserved         = EFI_ACPI_RESERVED_BYTE;
-  IoApic->IoApicAddress    = 0xFEC00000;
-  IoApic->SystemVectorBase = 0x00000000;
-  Ptr = IoApic + 1;
-
-  //
-  // IRQ0 (8254 Timer) => IRQ2 (PIC) Interrupt Source Override Structure
-  //
-  Iso = Ptr;
-  Iso->Type                        = EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE;
-  Iso->Length                      = sizeof (*Iso);
-  Iso->Bus                         = 0x00; // ISA
-  Iso->Source                      = 0x00; // IRQ0
-  Iso->GlobalSystemInterruptVector = 0x00000002;
-  Iso->Flags                       = 0x0000; // Conforms to specs of the bus
-  ++Iso;
-
-  //
-  // Set Level-triggered, Active High for all possible PCI link targets.
-  //
-  for (Loop = 0; Loop < 16; ++Loop) {
-    if ((PcdGet16 (Pcd8259LegacyModeEdgeLevel) & (1 << Loop)) == 0) {
-      continue;
-    }
-    Iso->Type                        = EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE;
-    Iso->Length                      = sizeof (*Iso);
-    Iso->Bus                         = 0x00; // ISA
-    Iso->Source                      = (UINT8) Loop;
-    Iso->GlobalSystemInterruptVector = (UINT32) Loop;
-    Iso->Flags                       = 0x000D; // Level-triggered, Active High
-    ++Iso;
-  }
-  ASSERT (
-    (UINTN) (Iso - (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE *)Ptr) ==
-      1 + PciLinkIsoCount
-    );
-  Ptr = Iso;
-
-  LocalApicNmi = Ptr;
-  LocalApicNmi->Type            = EFI_ACPI_1_0_LOCAL_APIC_NMI;
-  LocalApicNmi->Length          = sizeof (*LocalApicNmi);
-  LocalApicNmi->AcpiProcessorId = 0xFF; // applies to all processors
-  //
-  // polarity and trigger mode of the APIC I/O input signals conform to the
-  // specifications of the bus
-  //
-  LocalApicNmi->Flags           = 0x0000;
-  //
-  // Local APIC interrupt input LINTn to which NMI is connected.
-  //
-  LocalApicNmi->LocalApicInti   = 0x01;
-  Ptr = LocalApicNmi + 1;
-
-  ASSERT ((UINTN) ((UINT8 *)Ptr - (UINT8 *)Madt) == NewBufferSize);
-  Status = InstallAcpiTable (AcpiProtocol, Madt, NewBufferSize, TableKey);
-
-  FreePool (Madt);
-
-  return Status;
-}
-
-
-#pragma pack(1)
-
-typedef struct {
-  UINT64 Base;
-  UINT64 End;
-  UINT64 Length;
-} PCI_WINDOW;
-
-typedef struct {
-  PCI_WINDOW PciWindow32;
-  PCI_WINDOW PciWindow64;
-} FIRMWARE_DATA;
-
-typedef struct {
-  UINT8 BytePrefix;
-  UINT8 ByteValue;
-} AML_BYTE;
-
-typedef struct {
-  UINT8    NameOp;
-  UINT8    RootChar;
-  UINT8    NameChar[4];
-  UINT8    PackageOp;
-  UINT8    PkgLength;
-  UINT8    NumElements;
-  AML_BYTE Pm1aCntSlpTyp;
-  AML_BYTE Pm1bCntSlpTyp;
-  AML_BYTE Reserved[2];
-} SYSTEM_STATE_PACKAGE;
-
-#pragma pack()
-
-
-STATIC
-EFI_STATUS
-EFIAPI
-PopulateFwData(
-  OUT  FIRMWARE_DATA *FwData
-  )
-{
-  EFI_STATUS                      Status;
-  UINTN                           NumDesc;
-  EFI_GCD_MEMORY_SPACE_DESCRIPTOR *AllDesc;
-
-  Status = gDS->GetMemorySpaceMap (&NumDesc, &AllDesc);
-  if (Status == EFI_SUCCESS) {
-    UINT64 NonMmio32MaxExclTop;
-    UINT64 Mmio32MinBase;
-    UINT64 Mmio32MaxExclTop;
-    UINTN CurDesc;
-
-    Status = EFI_UNSUPPORTED;
-
-    NonMmio32MaxExclTop = 0;
-    Mmio32MinBase = BASE_4GB;
-    Mmio32MaxExclTop = 0;
-
-    for (CurDesc = 0; CurDesc < NumDesc; ++CurDesc) {
-      CONST EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Desc;
-      UINT64 ExclTop;
-
-      Desc = &AllDesc[CurDesc];
-      ExclTop = Desc->BaseAddress + Desc->Length;
-
-      if (ExclTop <= (UINT64) PcdGet32 (PcdOvmfFdBaseAddress)) {
-        switch (Desc->GcdMemoryType) {
-          case EfiGcdMemoryTypeNonExistent:
-            break;
-
-          case EfiGcdMemoryTypeReserved:
-          case EfiGcdMemoryTypeSystemMemory:
-            if (NonMmio32MaxExclTop < ExclTop) {
-              NonMmio32MaxExclTop = ExclTop;
-            }
-            break;
-
-          case EfiGcdMemoryTypeMemoryMappedIo:
-            if (Mmio32MinBase > Desc->BaseAddress) {
-              Mmio32MinBase = Desc->BaseAddress;
-            }
-            if (Mmio32MaxExclTop < ExclTop) {
-              Mmio32MaxExclTop = ExclTop;
-            }
-            break;
-
-          default:
-            ASSERT(0);
-        }
-      }
-    }
-
-    if (Mmio32MinBase < NonMmio32MaxExclTop) {
-      Mmio32MinBase = NonMmio32MaxExclTop;
-    }
-
-    if (Mmio32MinBase < Mmio32MaxExclTop) {
-      FwData->PciWindow32.Base   = Mmio32MinBase;
-      FwData->PciWindow32.End    = Mmio32MaxExclTop - 1;
-      FwData->PciWindow32.Length = Mmio32MaxExclTop - Mmio32MinBase;
-
-      FwData->PciWindow64.Base   = 0;
-      FwData->PciWindow64.End    = 0;
-      FwData->PciWindow64.Length = 0;
-
-      Status = EFI_SUCCESS;
-    }
-
-    FreePool (AllDesc);
-  }
-
-  DEBUG ((
-    DEBUG_INFO,
-    "ACPI PciWindow32: Base=0x%08lx End=0x%08lx Length=0x%08lx\n",
-    FwData->PciWindow32.Base,
-    FwData->PciWindow32.End,
-    FwData->PciWindow32.Length
-    ));
-  DEBUG ((
-    DEBUG_INFO,
-    "ACPI PciWindow64: Base=0x%08lx End=0x%08lx Length=0x%08lx\n",
-    FwData->PciWindow64.Base,
-    FwData->PciWindow64.End,
-    FwData->PciWindow64.Length
-    ));
-
-  return Status;
-}
-
-
-STATIC
-VOID
-EFIAPI
-GetSuspendStates (
-  UINTN                *SuspendToRamSize,
-  SYSTEM_STATE_PACKAGE *SuspendToRam,
-  UINTN                *SuspendToDiskSize,
-  SYSTEM_STATE_PACKAGE *SuspendToDisk
-  )
-{
-  STATIC CONST SYSTEM_STATE_PACKAGE Template = {
-    0x08,                   // NameOp
-    '\\',                   // RootChar
-    { '_', 'S', 'x', '_' }, // NameChar[4]
-    0x12,                   // PackageOp
-    0x0A,                   // PkgLength
-    0x04,                   // NumElements
-    { 0x0A, 0x00 },         // Pm1aCntSlpTyp
-    { 0x0A, 0x00 },         // Pm1bCntSlpTyp -- we don't support it
-    {                       // Reserved[2]
-      { 0x0A, 0x00 },
-      { 0x0A, 0x00 }
-    }
-  };
-  RETURN_STATUS                     Status;
-  FIRMWARE_CONFIG_ITEM              FwCfgItem;
-  UINTN                             FwCfgSize;
-  UINT8                             SystemStates[6];
-
-  //
-  // configure defaults
-  //
-  *SuspendToRamSize = sizeof Template;
-  CopyMem (SuspendToRam, &Template, sizeof Template);
-  SuspendToRam->NameChar[2]             = '3'; // S3
-  SuspendToRam->Pm1aCntSlpTyp.ByteValue = 1;   // PIIX4: STR
-
-  *SuspendToDiskSize = sizeof Template;
-  CopyMem (SuspendToDisk, &Template, sizeof Template);
-  SuspendToDisk->NameChar[2]             = '4'; // S4
-  SuspendToDisk->Pm1aCntSlpTyp.ByteValue = 2;   // PIIX4: POSCL
-
-  //
-  // check for overrides
-  //
-  Status = QemuFwCfgFindFile ("etc/system-states", &FwCfgItem, &FwCfgSize);
-  if (Status != RETURN_SUCCESS || FwCfgSize != sizeof SystemStates) {
-    DEBUG ((DEBUG_INFO, "ACPI using S3/S4 defaults\n"));
-    return;
-  }
-  QemuFwCfgSelectItem (FwCfgItem);
-  QemuFwCfgReadBytes (sizeof SystemStates, SystemStates);
-
-  //
-  // Each byte corresponds to a system state. In each byte, the MSB tells us
-  // whether the given state is enabled. If so, the three LSBs specify the
-  // value to be written to the PM control register's SUS_TYP bits.
-  //
-  if (SystemStates[3] & BIT7) {
-    SuspendToRam->Pm1aCntSlpTyp.ByteValue =
-        SystemStates[3] & (BIT2 | BIT1 | BIT0);
-    DEBUG ((DEBUG_INFO, "ACPI S3 value: %d\n",
-            SuspendToRam->Pm1aCntSlpTyp.ByteValue));
-  } else {
-    *SuspendToRamSize = 0;
-    DEBUG ((DEBUG_INFO, "ACPI S3 disabled\n"));
-  }
-
-  if (SystemStates[4] & BIT7) {
-    SuspendToDisk->Pm1aCntSlpTyp.ByteValue =
-        SystemStates[4] & (BIT2 | BIT1 | BIT0);
-    DEBUG ((DEBUG_INFO, "ACPI S4 value: %d\n",
-            SuspendToDisk->Pm1aCntSlpTyp.ByteValue));
-  } else {
-    *SuspendToDiskSize = 0;
-    DEBUG ((DEBUG_INFO, "ACPI S4 disabled\n"));
-  }
-}
-
-
-STATIC
-EFI_STATUS
-EFIAPI
-QemuInstallAcpiSsdtTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  )
-{
-  EFI_STATUS    Status;
-  FIRMWARE_DATA *FwData;
-
-  Status = EFI_OUT_OF_RESOURCES;
-
-  FwData = AllocateReservedPool (sizeof (*FwData));
-  if (FwData != NULL) {
-    UINTN                SuspendToRamSize;
-    SYSTEM_STATE_PACKAGE SuspendToRam;
-    UINTN                SuspendToDiskSize;
-    SYSTEM_STATE_PACKAGE SuspendToDisk;
-    UINTN                SsdtSize;
-    UINT8                *Ssdt;
-
-    GetSuspendStates (&SuspendToRamSize,  &SuspendToRam,
-                      &SuspendToDiskSize, &SuspendToDisk);
-    SsdtSize = AcpiTableBufferSize + 17 + SuspendToRamSize + SuspendToDiskSize;
-    Ssdt = AllocatePool (SsdtSize);
-
-    if (Ssdt != NULL) {
-      Status = PopulateFwData (FwData);
-
-      if (Status == EFI_SUCCESS) {
-        UINT8 *SsdtPtr;
-
-        SsdtPtr = Ssdt;
-
-        CopyMem (SsdtPtr, AcpiTableBuffer, AcpiTableBufferSize);
-        SsdtPtr += AcpiTableBufferSize;
-
-        //
-        // build "OperationRegion(FWDT, SystemMemory, 0x12345678, 0x87654321)"
-        //
-        *(SsdtPtr++) = 0x5B; // ExtOpPrefix
-        *(SsdtPtr++) = 0x80; // OpRegionOp
-        *(SsdtPtr++) = 'F';
-        *(SsdtPtr++) = 'W';
-        *(SsdtPtr++) = 'D';
-        *(SsdtPtr++) = 'T';
-        *(SsdtPtr++) = 0x00; // SystemMemory
-        *(SsdtPtr++) = 0x0C; // DWordPrefix
-
-        //
-        // no virtual addressing yet, take the four least significant bytes
-        //
-        CopyMem(SsdtPtr, &FwData, 4);
-        SsdtPtr += 4;
-
-        *(SsdtPtr++) = 0x0C; // DWordPrefix
-
-        *(UINT32*) SsdtPtr = sizeof (*FwData);
-        SsdtPtr += 4;
-
-        //
-        // add suspend system states
-        //
-        CopyMem (SsdtPtr, &SuspendToRam, SuspendToRamSize);
-        SsdtPtr += SuspendToRamSize;
-        CopyMem (SsdtPtr, &SuspendToDisk, SuspendToDiskSize);
-        SsdtPtr += SuspendToDiskSize;
-
-        ASSERT((UINTN) (SsdtPtr - Ssdt) == SsdtSize);
-        ((EFI_ACPI_DESCRIPTION_HEADER *) Ssdt)->Length = (UINT32) SsdtSize;
-        Status = InstallAcpiTable (AcpiProtocol, Ssdt, SsdtSize, TableKey);
-      }
-
-      FreePool(Ssdt);
-    }
-
-    if (Status != EFI_SUCCESS) {
-      FreePool(FwData);
-    }
-  }
-
-  return Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-QemuInstallAcpiTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  )
-{
-  EFI_ACPI_DESCRIPTION_HEADER        *Hdr;
-  EFI_ACPI_TABLE_INSTALL_ACPI_TABLE  TableInstallFunction;
-
-  Hdr = (EFI_ACPI_DESCRIPTION_HEADER*) AcpiTableBuffer;
-  switch (Hdr->Signature) {
-  case EFI_ACPI_1_0_APIC_SIGNATURE:
-    TableInstallFunction = QemuInstallAcpiMadtTable;
-    break;
-  case EFI_ACPI_1_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE:
-    TableInstallFunction = QemuInstallAcpiSsdtTable;
-    break;
-  default:
-    TableInstallFunction = InstallAcpiTable;
-  }
-
-  return TableInstallFunction (
-           AcpiProtocol,
-           AcpiTableBuffer,
-           AcpiTableBufferSize,
-           TableKey
-           );
-}
diff --git a/OvmfPkg/AcpiPlatformDxe/Xen.c b/OvmfPkg/AcpiPlatformDxe/Xen.c
deleted file mode 100644
index be2c5d695846..000000000000
--- a/OvmfPkg/AcpiPlatformDxe/Xen.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/** @file
-  OVMF ACPI Xen support
-
-  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
-  Copyright (c) 2012, Bei Guan <gbtju85@gmail.com>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <Library/BaseLib.h>        // CpuDeadLoop()
-#include <Library/DebugLib.h>       // DEBUG()
-#include <Library/XenPlatformLib.h> // XenGetInfoHOB()
-
-#include "AcpiPlatform.h"
-
-#define XEN_ACPI_PHYSICAL_ADDRESS         0x000EA020
-#define XEN_BIOS_PHYSICAL_END             0x000FFFFF
-
-EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER  *XenAcpiRsdpStructurePtr = NULL;
-
-/**
-  Get the address of Xen ACPI Root System Description Pointer (RSDP)
-  structure.
-
-  @param  RsdpStructurePtr   Return pointer to RSDP structure
-
-  @return EFI_SUCCESS        Find Xen RSDP structure successfully.
-  @return EFI_NOT_FOUND      Don't find Xen RSDP structure.
-  @return EFI_ABORTED        Find Xen RSDP structure, but it's not integrated.
-
-**/
-EFI_STATUS
-EFIAPI
-GetXenAcpiRsdp (
-  OUT   EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER   **RsdpPtr
-  )
-{
-  EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER   *RsdpStructurePtr;
-  UINT8                                          *XenAcpiPtr;
-  UINT8                                          Sum;
-  EFI_XEN_INFO                                   *XenInfo;
-
-  //
-  // Detect the RSDP structure
-  //
-
-  //
-  // First look for PVH one
-  //
-  XenInfo = XenGetInfoHOB ();
-  ASSERT (XenInfo != NULL);
-  if (XenInfo->RsdpPvh != NULL) {
-    DEBUG ((DEBUG_INFO, "%a: Use ACPI RSDP table at 0x%p\n",
-      gEfiCallerBaseName, XenInfo->RsdpPvh));
-    *RsdpPtr = XenInfo->RsdpPvh;
-    return EFI_SUCCESS;
-  }
-
-  //
-  // Otherwise, look for the HVM one
-  //
-  for (XenAcpiPtr = (UINT8*)(UINTN) XEN_ACPI_PHYSICAL_ADDRESS;
-       XenAcpiPtr < (UINT8*)(UINTN) XEN_BIOS_PHYSICAL_END;
-       XenAcpiPtr += 0x10) {
-
-    RsdpStructurePtr = (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *)
-                         (UINTN) XenAcpiPtr;
-
-    if (!AsciiStrnCmp ((CHAR8 *) &RsdpStructurePtr->Signature, "RSD PTR ", 8)) {
-      //
-      // RSDP ACPI 1.0 checksum for 1.0/2.0/3.0 table.
-      // This is only the first 20 bytes of the structure
-      //
-      Sum = CalculateSum8 (
-              (CONST UINT8 *)RsdpStructurePtr,
-              sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
-              );
-      if (Sum != 0) {
-        return EFI_ABORTED;
-      }
-
-      if (RsdpStructurePtr->Revision >= 2) {
-        //
-        // RSDP ACPI 2.0/3.0 checksum, this is the entire table
-        //
-        Sum = CalculateSum8 (
-                (CONST UINT8 *)RsdpStructurePtr,
-                sizeof (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
-                );
-        if (Sum != 0) {
-          return EFI_ABORTED;
-        }
-      }
-      *RsdpPtr = RsdpStructurePtr;
-      return EFI_SUCCESS;
-    }
-  }
-
-  return EFI_NOT_FOUND;
-}
-
-/**
-  Get Xen Acpi tables from the RSDP structure. And installs Xen ACPI tables
-  into the RSDT/XSDT using InstallAcpiTable. Some signature of the installed
-  ACPI tables are: FACP, APIC, HPET, WAET, SSDT, FACS, DSDT.
-
-  @param  AcpiProtocol           Protocol instance pointer.
-
-  @return EFI_SUCCESS            The table was successfully inserted.
-  @return EFI_INVALID_PARAMETER  Either AcpiTableBuffer is NULL, TableHandle is
-                                 NULL, or AcpiTableBufferSize and the size
-                                 field embedded in the ACPI table pointed to
-                                 by AcpiTableBuffer are not in sync.
-  @return EFI_OUT_OF_RESOURCES   Insufficient resources exist to complete the request.
-
-**/
-EFI_STATUS
-EFIAPI
-InstallXenTables (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
-  )
-{
-  EFI_STATUS                                       Status;
-  UINTN                                            TableHandle;
-
-  EFI_ACPI_DESCRIPTION_HEADER                      *Rsdt;
-  EFI_ACPI_DESCRIPTION_HEADER                      *Xsdt;
-  VOID                                             *CurrentTableEntry;
-  UINTN                                            CurrentTablePointer;
-  EFI_ACPI_DESCRIPTION_HEADER                      *CurrentTable;
-  UINTN                                            Index;
-  UINTN                                            NumberOfTableEntries;
-  EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE        *Fadt2Table;
-  EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE        *Fadt1Table;
-  EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE     *Facs2Table;
-  EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE     *Facs1Table;
-  EFI_ACPI_DESCRIPTION_HEADER                      *DsdtTable;
-
-  Fadt2Table  = NULL;
-  Fadt1Table  = NULL;
-  Facs2Table  = NULL;
-  Facs1Table  = NULL;
-  DsdtTable   = NULL;
-  TableHandle = 0;
-  NumberOfTableEntries = 0;
-
-  //
-  // Try to find Xen ACPI tables
-  //
-  Status = GetXenAcpiRsdp (&XenAcpiRsdpStructurePtr);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  //
-  // If XSDT table is find, just install its tables.
-  // Otherwise, try to find and install the RSDT tables.
-  //
-  if (XenAcpiRsdpStructurePtr->XsdtAddress) {
-    //
-    // Retrieve the addresses of XSDT and
-    // calculate the number of its table entries.
-    //
-    Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN)
-             XenAcpiRsdpStructurePtr->XsdtAddress;
-    NumberOfTableEntries = (Xsdt->Length -
-                             sizeof (EFI_ACPI_DESCRIPTION_HEADER)) /
-                             sizeof (UINT64);
-
-    //
-    // Install ACPI tables found in XSDT.
-    //
-    for (Index = 0; Index < NumberOfTableEntries; Index++) {
-      //
-      // Get the table entry from XSDT
-      //
-      CurrentTableEntry = (VOID *) ((UINT8 *) Xsdt +
-                            sizeof (EFI_ACPI_DESCRIPTION_HEADER) +
-                            Index * sizeof (UINT64));
-      CurrentTablePointer = (UINTN) *(UINT64 *)CurrentTableEntry;
-      CurrentTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTablePointer;
-
-      //
-      // Install the XSDT tables
-      //
-      Status = InstallAcpiTable (
-                 AcpiProtocol,
-                 CurrentTable,
-                 CurrentTable->Length,
-                 &TableHandle
-                 );
-
-      if (EFI_ERROR (Status)) {
-        return Status;
-      }
-
-      //
-      // Get the FACS and DSDT table address from the table FADT
-      //
-      if (!AsciiStrnCmp ((CHAR8 *) &CurrentTable->Signature, "FACP", 4)) {
-        Fadt2Table = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)
-                       (UINTN) CurrentTablePointer;
-        Facs2Table = (EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)
-                       (UINTN) Fadt2Table->FirmwareCtrl;
-        DsdtTable  = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Fadt2Table->Dsdt;
-      }
-    }
-  }
-  else if (XenAcpiRsdpStructurePtr->RsdtAddress) {
-    //
-    // Retrieve the addresses of RSDT and
-    // calculate the number of its table entries.
-    //
-    Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN)
-             XenAcpiRsdpStructurePtr->RsdtAddress;
-    NumberOfTableEntries = (Rsdt->Length -
-                             sizeof (EFI_ACPI_DESCRIPTION_HEADER)) /
-                             sizeof (UINT32);
-
-    //
-    // Install ACPI tables found in XSDT.
-    //
-    for (Index = 0; Index < NumberOfTableEntries; Index++) {
-      //
-      // Get the table entry from RSDT
-      //
-      CurrentTableEntry = (UINT32 *) ((UINT8 *) Rsdt +
-                            sizeof (EFI_ACPI_DESCRIPTION_HEADER) +
-                            Index * sizeof (UINT32));
-      CurrentTablePointer = *(UINT32 *)CurrentTableEntry;
-      CurrentTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTablePointer;
-
-      //
-      // Install the RSDT tables
-      //
-      Status = InstallAcpiTable (
-                 AcpiProtocol,
-                 CurrentTable,
-                 CurrentTable->Length,
-                 &TableHandle
-                 );
-
-      if (EFI_ERROR (Status)) {
-        return Status;
-      }
-
-      //
-      // Get the FACS and DSDT table address from the table FADT
-      //
-      if (!AsciiStrnCmp ((CHAR8 *) &CurrentTable->Signature, "FACP", 4)) {
-        Fadt1Table = (EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE *)
-                       (UINTN) CurrentTablePointer;
-        Facs1Table = (EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)
-                       (UINTN) Fadt1Table->FirmwareCtrl;
-        DsdtTable  = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Fadt1Table->Dsdt;
-      }
-    }
-  }
-
-  //
-  // Install the FACS table.
-  //
-  if (Fadt2Table) {
-    //
-    // FACS 2.0
-    //
-    Status = InstallAcpiTable (
-               AcpiProtocol,
-               Facs2Table,
-               Facs2Table->Length,
-               &TableHandle
-               );
-    if (EFI_ERROR (Status)) {
-      return Status;
-    }
-  }
-  else if (Fadt1Table) {
-    //
-    // FACS 1.0
-    //
-    Status = InstallAcpiTable (
-               AcpiProtocol,
-               Facs1Table,
-               Facs1Table->Length,
-               &TableHandle
-               );
-    if (EFI_ERROR (Status)) {
-      return Status;
-    }
-  }
-
-  //
-  // Install DSDT table. If we reached this point without finding the DSDT,
-  // then we're out of sync with the hypervisor, and cannot continue.
-  //
-  if (DsdtTable == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: no DSDT found\n", __FUNCTION__));
-    ASSERT (FALSE);
-    CpuDeadLoop ();
-  }
-
-  Status = InstallAcpiTable (
-             AcpiProtocol,
-             DsdtTable,
-             DsdtTable->Length,
-             &TableHandle
-             );
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  return EFI_SUCCESS;
-}
-
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 13/43] OvmfPkg/XenAcpiPlatformDxe: remove the QEMU ACPI linker/loader client
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (11 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 12/43] OvmfPkg/AcpiPlatformDxe: remove the "AcpiPlatformDxe.inf" driver Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:38   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 14/43] OvmfPkg/XenAcpiPlatformDxe: remove QEMU fw_cfg dependency Laszlo Ersek
                   ` (32 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Philippe Mathieu-Daudé

The root of the QEMU ACPI linker/loader client in XenAcpiPlatformDxe is
the InstallQemuFwCfgTables() function. This function always fails on Xen,
due to its top-most QemuFwCfgFindFile() call.

Remove the InstallQemuFwCfgTables() function call from XenAcpiPlatformDxe,
along with all dependencies that now become unused.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf |    6 -
 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h         |   51 -
 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c         |    2 +-
 OvmfPkg/XenAcpiPlatformDxe/BootScript.c           |  269 -----
 OvmfPkg/XenAcpiPlatformDxe/PciDecoding.c          |  194 ----
 OvmfPkg/XenAcpiPlatformDxe/QemuFwCfgAcpi.c        | 1196 --------------------
 6 files changed, 1 insertion(+), 1717 deletions(-)

diff --git a/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf b/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
index 379b5d56d565..72132e397dc1 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
+++ b/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
@@ -21,17 +21,14 @@ [Defines]
 #  VALID_ARCHITECTURES           = IA32 X64 EBC
 #
 
 [Sources]
   AcpiPlatform.c
   AcpiPlatform.h
-  BootScript.c
   EntryPoint.c
-  PciDecoding.c
   Qemu.c
-  QemuFwCfgAcpi.c
   Xen.c
 
 [Packages]
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
@@ -40,24 +37,21 @@ [Packages]
 [LibraryClasses]
   BaseLib
   BaseMemoryLib
   DebugLib
   DxeServicesTableLib
   MemoryAllocationLib
-  OrderedCollectionLib
   PcdLib
   QemuFwCfgLib
-  QemuFwCfgS3Lib
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   XenPlatformLib
 
 [Protocols]
   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
   gEfiFirmwareVolume2ProtocolGuid               # PROTOCOL SOMETIMES_CONSUMED
-  gEfiPciIoProtocolGuid                         # PROTOCOL SOMETIMES_CONSUMED
 
 [Guids]
   gRootBridgesConnectedEventGroupGuid
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile
diff --git a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
index 6259697c4b2d..d35143a00d01 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
@@ -8,20 +8,12 @@
 **/
 
 #ifndef ACPI_PLATFORM_H_
 #define ACPI_PLATFORM_H_
 
 #include <Protocol/AcpiTable.h> // EFI_ACPI_TABLE_PROTOCOL
-#include <Protocol/PciIo.h>     // EFI_PCI_IO_PROTOCOL
-
-typedef struct {
-  EFI_PCI_IO_PROTOCOL *PciIo;
-  UINT64              PciAttributes;
-} ORIGINAL_ATTRIBUTES;
-
-typedef struct S3_CONTEXT S3_CONTEXT;
 
 EFI_STATUS
 EFIAPI
 InstallAcpiTable (
   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
   IN   VOID                          *AcpiTableBuffer,
@@ -46,57 +38,14 @@ QemuInstallAcpiTable (
 EFI_STATUS
 EFIAPI
 InstallXenTables (
   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
   );
 
-EFI_STATUS
-EFIAPI
-InstallQemuFwCfgTables (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
-  );
-
 EFI_STATUS
 EFIAPI
 InstallAcpiTables (
   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiTable
   );
 
-VOID
-EnablePciDecoding (
-  OUT ORIGINAL_ATTRIBUTES **OriginalAttributes,
-  OUT UINTN               *Count
-  );
-
-VOID
-RestorePciDecoding (
-  IN ORIGINAL_ATTRIBUTES *OriginalAttributes,
-  IN UINTN               Count
-  );
-
-EFI_STATUS
-AllocateS3Context (
-  OUT S3_CONTEXT **S3Context,
-  IN  UINTN      WritePointerCount
-  );
-
-VOID
-ReleaseS3Context (
-  IN S3_CONTEXT *S3Context
-  );
-
-EFI_STATUS
-SaveCondensedWritePointerToS3Context (
-  IN OUT S3_CONTEXT *S3Context,
-  IN     UINT16     PointerItem,
-  IN     UINT8      PointerSize,
-  IN     UINT32     PointerOffset,
-  IN     UINT64     PointerValue
-  );
-
-EFI_STATUS
-TransferS3ContextToBootScript (
-  IN S3_CONTEXT *S3Context
-  );
-
 #endif
 
diff --git a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
index 2b2dc576754b..9c8b1e0fcffa 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
@@ -253,13 +253,13 @@ InstallAcpiTables (
 {
   EFI_STATUS                         Status;
 
   if (XenDetected ()) {
     Status = InstallXenTables (AcpiTable);
   } else {
-    Status = InstallQemuFwCfgTables (AcpiTable);
+    Status = EFI_UNSUPPORTED;
   }
 
   if (EFI_ERROR (Status)) {
     Status = InstallOvmfFvTables (AcpiTable);
   }
 
diff --git a/OvmfPkg/XenAcpiPlatformDxe/BootScript.c b/OvmfPkg/XenAcpiPlatformDxe/BootScript.c
deleted file mode 100644
index 14d1e68694cb..000000000000
--- a/OvmfPkg/XenAcpiPlatformDxe/BootScript.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/** @file
-  Append an ACPI S3 Boot Script fragment from the QEMU_LOADER_WRITE_POINTER
-  commands of QEMU's fully processed table linker/loader script.
-
-  Copyright (C) 2017-2021, Red Hat, Inc.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#include <Library/BaseLib.h>             // CpuDeadLoop()
-#include <Library/DebugLib.h>            // DEBUG()
-#include <Library/MemoryAllocationLib.h> // AllocatePool()
-#include <Library/QemuFwCfgS3Lib.h>      // QemuFwCfgS3ScriptSkipBytes()
-
-#include "AcpiPlatform.h"
-
-
-//
-// Condensed structure for capturing the fw_cfg operations -- select, skip,
-// write -- inherent in executing a QEMU_LOADER_WRITE_POINTER command.
-//
-typedef struct {
-  UINT16 PointerItem;   // resolved from QEMU_LOADER_WRITE_POINTER.PointerFile
-  UINT8  PointerSize;   // copied as-is from QEMU_LOADER_WRITE_POINTER
-  UINT32 PointerOffset; // copied as-is from QEMU_LOADER_WRITE_POINTER
-  UINT64 PointerValue;  // resolved from QEMU_LOADER_WRITE_POINTER.PointeeFile
-                        //   and QEMU_LOADER_WRITE_POINTER.PointeeOffset
-} CONDENSED_WRITE_POINTER;
-
-
-//
-// Context structure to accumulate CONDENSED_WRITE_POINTER objects from
-// QEMU_LOADER_WRITE_POINTER commands.
-//
-// Any pointers in this structure own the pointed-to objects; that is, when the
-// context structure is released, all pointed-to objects must be released too.
-//
-struct S3_CONTEXT {
-  CONDENSED_WRITE_POINTER *WritePointers; // one array element per processed
-                                          //   QEMU_LOADER_WRITE_POINTER
-                                          //   command
-  UINTN                   Allocated;      // number of elements allocated for
-                                          //   WritePointers
-  UINTN                   Used;           // number of elements populated in
-                                          //   WritePointers
-};
-
-
-//
-// Scratch buffer, allocated in EfiReservedMemoryType type memory, for the ACPI
-// S3 Boot Script opcodes to work on.
-//
-#pragma pack (1)
-typedef union {
-  UINT64 PointerValue; // filled in from CONDENSED_WRITE_POINTER.PointerValue
-} SCRATCH_BUFFER;
-#pragma pack ()
-
-
-/**
-  Allocate an S3_CONTEXT object.
-
-  @param[out] S3Context         The allocated S3_CONTEXT object is returned
-                                through this parameter.
-
-  @param[in] WritePointerCount  Number of CONDENSED_WRITE_POINTER elements to
-                                allocate room for. WritePointerCount must be
-                                positive.
-
-  @retval EFI_SUCCESS            Allocation successful.
-
-  @retval EFI_OUT_OF_RESOURCES   Out of memory.
-
-  @retval EFI_INVALID_PARAMETER  WritePointerCount is zero.
-**/
-EFI_STATUS
-AllocateS3Context (
-  OUT S3_CONTEXT **S3Context,
-  IN  UINTN      WritePointerCount
-  )
-{
-  EFI_STATUS Status;
-  S3_CONTEXT *Context;
-
-  if (WritePointerCount == 0) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  Context = AllocateZeroPool (sizeof *Context);
-  if (Context == NULL) {
-    return EFI_OUT_OF_RESOURCES;
-  }
-
-  Context->WritePointers = AllocatePool (WritePointerCount *
-                             sizeof *Context->WritePointers);
-  if (Context->WritePointers == NULL) {
-    Status = EFI_OUT_OF_RESOURCES;
-    goto FreeContext;
-  }
-
-  Context->Allocated = WritePointerCount;
-  *S3Context = Context;
-  return EFI_SUCCESS;
-
-FreeContext:
-  FreePool (Context);
-
-  return Status;
-}
-
-
-/**
-  Release an S3_CONTEXT object.
-
-  @param[in] S3Context  The object to release.
-**/
-VOID
-ReleaseS3Context (
-  IN S3_CONTEXT *S3Context
-  )
-{
-  FreePool (S3Context->WritePointers);
-  FreePool (S3Context);
-}
-
-
-/**
-  Save the information necessary to replicate a QEMU_LOADER_WRITE_POINTER
-  command during S3 resume, in condensed format.
-
-  This function is to be called from ProcessCmdWritePointer(), after all the
-  sanity checks have passed, and before the fw_cfg operations are performed.
-
-  @param[in,out] S3Context  The S3_CONTEXT object into which the caller wants
-                            to save the information that was derived from
-                            QEMU_LOADER_WRITE_POINTER.
-
-  @param[in] PointerItem    The FIRMWARE_CONFIG_ITEM that
-                            QEMU_LOADER_WRITE_POINTER.PointerFile was resolved
-                            to, expressed as a UINT16 value.
-
-  @param[in] PointerSize    Copied directly from
-                            QEMU_LOADER_WRITE_POINTER.PointerSize.
-
-  @param[in] PointerOffset  Copied directly from
-                            QEMU_LOADER_WRITE_POINTER.PointerOffset.
-
-  @param[in] PointerValue   The base address of the allocated / downloaded
-                            fw_cfg blob that is identified by
-                            QEMU_LOADER_WRITE_POINTER.PointeeFile, plus
-                            QEMU_LOADER_WRITE_POINTER.PointeeOffset.
-
-  @retval EFI_SUCCESS           The information derived from
-                                QEMU_LOADER_WRITE_POINTER has been successfully
-                                absorbed into S3Context.
-
-  @retval EFI_OUT_OF_RESOURCES  No room available in S3Context.
-**/
-EFI_STATUS
-SaveCondensedWritePointerToS3Context (
-  IN OUT S3_CONTEXT *S3Context,
-  IN     UINT16     PointerItem,
-  IN     UINT8      PointerSize,
-  IN     UINT32     PointerOffset,
-  IN     UINT64     PointerValue
-  )
-{
-  CONDENSED_WRITE_POINTER *Condensed;
-
-  if (S3Context->Used == S3Context->Allocated) {
-    return EFI_OUT_OF_RESOURCES;
-  }
-  Condensed = S3Context->WritePointers + S3Context->Used;
-  Condensed->PointerItem   = PointerItem;
-  Condensed->PointerSize   = PointerSize;
-  Condensed->PointerOffset = PointerOffset;
-  Condensed->PointerValue  = PointerValue;
-  DEBUG ((DEBUG_VERBOSE, "%a: 0x%04x/[0x%08x+%d] := 0x%Lx (%Lu)\n",
-    __FUNCTION__, PointerItem, PointerOffset, PointerSize, PointerValue,
-    (UINT64)S3Context->Used));
-  ++S3Context->Used;
-  return EFI_SUCCESS;
-}
-
-
-/**
-  FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION provided to QemuFwCfgS3Lib.
-**/
-STATIC
-VOID
-EFIAPI
-AppendFwCfgBootScript (
-  IN OUT VOID *Context,              OPTIONAL
-  IN OUT VOID *ExternalScratchBuffer
-  )
-{
-  S3_CONTEXT     *S3Context;
-  SCRATCH_BUFFER *ScratchBuffer;
-  UINTN          Index;
-
-  S3Context = Context;
-  ScratchBuffer = ExternalScratchBuffer;
-
-  for (Index = 0; Index < S3Context->Used; ++Index) {
-    CONST CONDENSED_WRITE_POINTER *Condensed;
-    RETURN_STATUS                 Status;
-
-    Condensed = &S3Context->WritePointers[Index];
-
-    Status = QemuFwCfgS3ScriptSkipBytes (Condensed->PointerItem,
-               Condensed->PointerOffset);
-    if (RETURN_ERROR (Status)) {
-      goto FatalError;
-    }
-
-    ScratchBuffer->PointerValue = Condensed->PointerValue;
-    Status = QemuFwCfgS3ScriptWriteBytes (-1, Condensed->PointerSize);
-    if (RETURN_ERROR (Status)) {
-      goto FatalError;
-    }
-  }
-
-  DEBUG ((DEBUG_VERBOSE, "%a: boot script fragment saved\n", __FUNCTION__));
-
-  ReleaseS3Context (S3Context);
-  return;
-
-FatalError:
-  ASSERT (FALSE);
-  CpuDeadLoop ();
-}
-
-
-/**
-  Translate and append the information from an S3_CONTEXT object to the ACPI S3
-  Boot Script.
-
-  The effects of a successful call to this function cannot be undone.
-
-  @param[in] S3Context  The S3_CONTEXT object to translate to ACPI S3 Boot
-                        Script opcodes. If the function returns successfully,
-                        the caller must set the S3Context pointer -- originally
-                        returned by AllocateS3Context() -- immediately to NULL,
-                        because the ownership of S3Context has been transferred.
-
-  @retval EFI_SUCCESS The translation of S3Context to ACPI S3 Boot Script
-                      opcodes has been successfully executed or queued. (This
-                      includes the case when S3Context was empty on input and
-                      no ACPI S3 Boot Script opcodes have been necessary to
-                      produce.)
-
-  @return             Error codes from underlying functions.
-**/
-EFI_STATUS
-TransferS3ContextToBootScript (
-  IN S3_CONTEXT *S3Context
-  )
-{
-  RETURN_STATUS Status;
-
-  if (S3Context->Used == 0) {
-    ReleaseS3Context (S3Context);
-    return EFI_SUCCESS;
-  }
-
-  Status = QemuFwCfgS3CallWhenBootScriptReady (AppendFwCfgBootScript,
-             S3Context, sizeof (SCRATCH_BUFFER));
-  return (EFI_STATUS)Status;
-}
diff --git a/OvmfPkg/XenAcpiPlatformDxe/PciDecoding.c b/OvmfPkg/XenAcpiPlatformDxe/PciDecoding.c
deleted file mode 100644
index 00fc57eb13eb..000000000000
--- a/OvmfPkg/XenAcpiPlatformDxe/PciDecoding.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/** @file
-  Temporarily enable IO and MMIO decoding for all PCI devices while QEMU
-  regenerates the ACPI tables.
-
-  Copyright (C) 2016-2021, Red Hat, Inc.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#include <Library/DebugLib.h>                  // DEBUG()
-#include <Library/MemoryAllocationLib.h>       // AllocatePool()
-#include <Library/UefiBootServicesTableLib.h>  // gBS
-
-#include "AcpiPlatform.h"
-
-
-/**
-  Collect all PciIo protocol instances in the system. Save their original
-  attributes, and enable IO and MMIO decoding for each.
-
-  This is a best effort function; it doesn't return status codes. Its
-  caller is supposed to proceed even if this function fails.
-
-  @param[out] OriginalAttributes  On output, a dynamically allocated array of
-                                  ORIGINAL_ATTRIBUTES elements. The array lists
-                                  the PciIo protocol instances found in the
-                                  system at the time of the call, plus the
-                                  original PCI attributes for each.
-
-                                  Before returning, the function enables IO and
-                                  MMIO decoding for each PciIo instance it
-                                  finds.
-
-                                  On error, or when no such instances are
-                                  found, OriginalAttributes is set to NULL.
-
-  @param[out] Count               On output, the number of elements in
-                                  OriginalAttributes. On error it is set to
-                                  zero.
-**/
-VOID
-EnablePciDecoding (
-  OUT ORIGINAL_ATTRIBUTES **OriginalAttributes,
-  OUT UINTN               *Count
-  )
-{
-  EFI_STATUS          Status;
-  UINTN               NoHandles;
-  EFI_HANDLE          *Handles;
-  ORIGINAL_ATTRIBUTES *OrigAttrs;
-  UINTN               Idx;
-
-  *OriginalAttributes = NULL;
-  *Count              = 0;
-
-  if (PcdGetBool (PcdPciDisableBusEnumeration)) {
-    //
-    // The platform downloads ACPI tables from QEMU in general, but there are
-    // no root bridges in this execution. We're done.
-    //
-    return;
-  }
-
-  Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiPciIoProtocolGuid,
-                  NULL /* SearchKey */, &NoHandles, &Handles);
-  if (Status == EFI_NOT_FOUND) {
-    //
-    // No PCI devices were found on either of the root bridges. We're done.
-    //
-    return;
-  }
-
-  if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_WARN, "%a: LocateHandleBuffer(): %r\n", __FUNCTION__,
-      Status));
-    return;
-  }
-
-  OrigAttrs = AllocatePool (NoHandles * sizeof *OrigAttrs);
-  if (OrigAttrs == NULL) {
-    DEBUG ((DEBUG_WARN, "%a: AllocatePool(): out of resources\n",
-      __FUNCTION__));
-    goto FreeHandles;
-  }
-
-  for (Idx = 0; Idx < NoHandles; ++Idx) {
-    EFI_PCI_IO_PROTOCOL *PciIo;
-    UINT64              Attributes;
-
-    //
-    // Look up PciIo on the handle and stash it
-    //
-    Status = gBS->HandleProtocol (Handles[Idx], &gEfiPciIoProtocolGuid,
-                    (VOID**)&PciIo);
-    ASSERT_EFI_ERROR (Status);
-    OrigAttrs[Idx].PciIo = PciIo;
-
-    //
-    // Stash the current attributes
-    //
-    Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationGet, 0,
-                      &OrigAttrs[Idx].PciAttributes);
-    if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationGet: %r\n",
-        __FUNCTION__, Status));
-      goto RestoreAttributes;
-    }
-
-    //
-    // Retrieve supported attributes
-    //
-    Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationSupported, 0,
-                      &Attributes);
-    if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationSupported: %r\n",
-        __FUNCTION__, Status));
-      goto RestoreAttributes;
-    }
-
-    //
-    // Enable IO and MMIO decoding
-    //
-    Attributes &= EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY;
-    Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationEnable,
-                      Attributes, NULL);
-    if (EFI_ERROR (Status)) {
-      DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationEnable: %r\n",
-        __FUNCTION__, Status));
-      goto RestoreAttributes;
-    }
-  }
-
-  //
-  // Success
-  //
-  FreePool (Handles);
-  *OriginalAttributes = OrigAttrs;
-  *Count              = NoHandles;
-  return;
-
-RestoreAttributes:
-  while (Idx > 0) {
-    --Idx;
-    OrigAttrs[Idx].PciIo->Attributes (OrigAttrs[Idx].PciIo,
-                            EfiPciIoAttributeOperationSet,
-                            OrigAttrs[Idx].PciAttributes,
-                            NULL
-                            );
-  }
-  FreePool (OrigAttrs);
-
-FreeHandles:
-  FreePool (Handles);
-}
-
-
-/**
-  Restore the original PCI attributes saved with EnablePciDecoding().
-
-  @param[in] OriginalAttributes  The array allocated and populated by
-                                 EnablePciDecoding(). This parameter may be
-                                 NULL. If OriginalAttributes is NULL, then the
-                                 function is a no-op; otherwise the PciIo
-                                 attributes will be restored, and the
-                                 OriginalAttributes array will be freed.
-
-  @param[in] Count               The Count value stored by EnablePciDecoding(),
-                                 the number of elements in OriginalAttributes.
-                                 Count may be zero if and only if
-                                 OriginalAttributes is NULL.
-**/
-VOID
-RestorePciDecoding (
-  IN ORIGINAL_ATTRIBUTES *OriginalAttributes,
-  IN UINTN               Count
-  )
-{
-  UINTN Idx;
-
-  ASSERT ((OriginalAttributes == NULL) == (Count == 0));
-  if (OriginalAttributes == NULL) {
-    return;
-  }
-
-  for (Idx = 0; Idx < Count; ++Idx) {
-    OriginalAttributes[Idx].PciIo->Attributes (
-                                     OriginalAttributes[Idx].PciIo,
-                                     EfiPciIoAttributeOperationSet,
-                                     OriginalAttributes[Idx].PciAttributes,
-                                     NULL
-                                     );
-  }
-  FreePool (OriginalAttributes);
-}
diff --git a/OvmfPkg/XenAcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/XenAcpiPlatformDxe/QemuFwCfgAcpi.c
deleted file mode 100644
index 521c06cf546f..000000000000
--- a/OvmfPkg/XenAcpiPlatformDxe/QemuFwCfgAcpi.c
+++ /dev/null
@@ -1,1196 +0,0 @@
-/** @file
-  OVMF ACPI support using QEMU's fw-cfg interface
-
-  Copyright (C) 2012-2021, Red Hat, Inc.
-  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <IndustryStandard/Acpi.h>            // EFI_ACPI_DESCRIPTION_HEADER
-#include <IndustryStandard/QemuLoader.h>      // QEMU_LOADER_FNAME_SIZE
-#include <Library/BaseLib.h>                  // AsciiStrCmp()
-#include <Library/BaseMemoryLib.h>            // CopyMem()
-#include <Library/DebugLib.h>                 // DEBUG()
-#include <Library/MemoryAllocationLib.h>      // AllocatePool()
-#include <Library/OrderedCollectionLib.h>     // OrderedCollectionMin()
-#include <Library/QemuFwCfgLib.h>             // QemuFwCfgFindFile()
-#include <Library/QemuFwCfgS3Lib.h>           // QemuFwCfgS3Enabled()
-#include <Library/UefiBootServicesTableLib.h> // gBS
-
-#include "AcpiPlatform.h"
-
-//
-// The user structure for the ordered collection that will track the fw_cfg
-// blobs under processing.
-//
-typedef struct {
-  UINT8   File[QEMU_LOADER_FNAME_SIZE]; // NUL-terminated name of the fw_cfg
-                                        // blob. This is the ordering / search
-                                        // key.
-  UINTN   Size;                         // The number of bytes in this blob.
-  UINT8   *Base;                        // Pointer to the blob data.
-  BOOLEAN HostsOnlyTableData;           // TRUE iff the blob has been found to
-                                        // only contain data that is directly
-                                        // part of ACPI tables.
-} BLOB;
-
-
-/**
-  Compare a standalone key against a user structure containing an embedded key.
-
-  @param[in] StandaloneKey  Pointer to the bare key.
-
-  @param[in] UserStruct     Pointer to the user structure with the embedded
-                            key.
-
-  @retval <0  If StandaloneKey compares less than UserStruct's key.
-
-  @retval  0  If StandaloneKey compares equal to UserStruct's key.
-
-  @retval >0  If StandaloneKey compares greater than UserStruct's key.
-**/
-STATIC
-INTN
-EFIAPI
-BlobKeyCompare (
-  IN CONST VOID *StandaloneKey,
-  IN CONST VOID *UserStruct
-  )
-{
-  CONST BLOB *Blob;
-
-  Blob = UserStruct;
-  return AsciiStrCmp (StandaloneKey, (CONST CHAR8 *)Blob->File);
-}
-
-
-/**
-  Comparator function for two user structures.
-
-  @param[in] UserStruct1  Pointer to the first user structure.
-
-  @param[in] UserStruct2  Pointer to the second user structure.
-
-  @retval <0  If UserStruct1 compares less than UserStruct2.
-
-  @retval  0  If UserStruct1 compares equal to UserStruct2.
-
-  @retval >0  If UserStruct1 compares greater than UserStruct2.
-**/
-STATIC
-INTN
-EFIAPI
-BlobCompare (
-  IN CONST VOID *UserStruct1,
-  IN CONST VOID *UserStruct2
-  )
-{
-  CONST BLOB *Blob1;
-
-  Blob1 = UserStruct1;
-  return BlobKeyCompare (Blob1->File, UserStruct2);
-}
-
-
-/**
-  Comparator function for two opaque pointers, ordering on (unsigned) pointer
-  value itself.
-  Can be used as both Key and UserStruct comparator.
-
-  @param[in] Pointer1  First pointer.
-
-  @param[in] Pointer2  Second pointer.
-
-  @retval <0  If Pointer1 compares less than Pointer2.
-
-  @retval  0  If Pointer1 compares equal to Pointer2.
-
-  @retval >0  If Pointer1 compares greater than Pointer2.
-**/
-STATIC
-INTN
-EFIAPI
-PointerCompare (
-  IN CONST VOID *Pointer1,
-  IN CONST VOID *Pointer2
-  )
-{
-  if (Pointer1 == Pointer2) {
-    return 0;
-  }
-  if ((UINTN)Pointer1 < (UINTN)Pointer2) {
-    return -1;
-  }
-  return 1;
-}
-
-
-/**
-  Comparator function for two ASCII strings. Can be used as both Key and
-  UserStruct comparator.
-
-  This function exists solely so we can avoid casting &AsciiStrCmp to
-  ORDERED_COLLECTION_USER_COMPARE and ORDERED_COLLECTION_KEY_COMPARE.
-
-  @param[in] AsciiString1  Pointer to the first ASCII string.
-
-  @param[in] AsciiString2  Pointer to the second ASCII string.
-
-  @return  The return value of AsciiStrCmp (AsciiString1, AsciiString2).
-**/
-STATIC
-INTN
-EFIAPI
-AsciiStringCompare (
-  IN CONST VOID *AsciiString1,
-  IN CONST VOID *AsciiString2
-  )
-{
-  return AsciiStrCmp (AsciiString1, AsciiString2);
-}
-
-
-/**
-  Release the ORDERED_COLLECTION structure populated by
-  CollectAllocationsRestrictedTo32Bit() (below).
-
-  This function may be called by CollectAllocationsRestrictedTo32Bit() itself,
-  on the error path.
-
-  @param[in] AllocationsRestrictedTo32Bit  The ORDERED_COLLECTION structure to
-                                           release.
-**/
-STATIC
-VOID
-ReleaseAllocationsRestrictedTo32Bit (
-  IN ORDERED_COLLECTION *AllocationsRestrictedTo32Bit
-)
-{
-  ORDERED_COLLECTION_ENTRY *Entry, *Entry2;
-
-  for (Entry = OrderedCollectionMin (AllocationsRestrictedTo32Bit);
-       Entry != NULL;
-       Entry = Entry2) {
-    Entry2 = OrderedCollectionNext (Entry);
-    OrderedCollectionDelete (AllocationsRestrictedTo32Bit, Entry, NULL);
-  }
-  OrderedCollectionUninit (AllocationsRestrictedTo32Bit);
-}
-
-
-/**
-  Iterate over the linker/loader script, and collect the names of the fw_cfg
-  blobs that are referenced by QEMU_LOADER_ADD_POINTER.PointeeFile fields, such
-  that QEMU_LOADER_ADD_POINTER.PointerSize is less than 8. This means that the
-  pointee blob's address will have to be patched into a narrower-than-8 byte
-  pointer field, hence the pointee blob must not be allocated from 64-bit
-  address space.
-
-  @param[out] AllocationsRestrictedTo32Bit  The ORDERED_COLLECTION structure
-                                            linking (not copying / owning) such
-                                            QEMU_LOADER_ADD_POINTER.PointeeFile
-                                            fields that name the blobs
-                                            restricted from 64-bit allocation.
-
-  @param[in] LoaderStart                    Points to the first entry in the
-                                            linker/loader script.
-
-  @param[in] LoaderEnd                      Points one past the last entry in
-                                            the linker/loader script.
-
-  @retval EFI_SUCCESS           AllocationsRestrictedTo32Bit has been
-                                populated.
-
-  @retval EFI_OUT_OF_RESOURCES  Memory allocation failed.
-
-  @retval EFI_PROTOCOL_ERROR    Invalid linker/loader script contents.
-**/
-STATIC
-EFI_STATUS
-CollectAllocationsRestrictedTo32Bit (
-  OUT ORDERED_COLLECTION     **AllocationsRestrictedTo32Bit,
-  IN CONST QEMU_LOADER_ENTRY *LoaderStart,
-  IN CONST QEMU_LOADER_ENTRY *LoaderEnd
-)
-{
-  ORDERED_COLLECTION      *Collection;
-  CONST QEMU_LOADER_ENTRY *LoaderEntry;
-  EFI_STATUS              Status;
-
-  Collection = OrderedCollectionInit (AsciiStringCompare, AsciiStringCompare);
-  if (Collection == NULL) {
-    return EFI_OUT_OF_RESOURCES;
-  }
-
-  for (LoaderEntry = LoaderStart; LoaderEntry < LoaderEnd; ++LoaderEntry) {
-    CONST QEMU_LOADER_ADD_POINTER *AddPointer;
-
-    if (LoaderEntry->Type != QemuLoaderCmdAddPointer) {
-      continue;
-    }
-    AddPointer = &LoaderEntry->Command.AddPointer;
-
-    if (AddPointer->PointerSize >= 8) {
-      continue;
-    }
-
-    if (AddPointer->PointeeFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0') {
-      DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __FUNCTION__));
-      Status = EFI_PROTOCOL_ERROR;
-      goto RollBack;
-    }
-
-    Status = OrderedCollectionInsert (
-               Collection,
-               NULL,                           // Entry
-               (VOID *)AddPointer->PointeeFile
-               );
-    switch (Status) {
-    case EFI_SUCCESS:
-      DEBUG ((
-        DEBUG_VERBOSE,
-        "%a: restricting blob \"%a\" from 64-bit allocation\n",
-        __FUNCTION__,
-        AddPointer->PointeeFile
-        ));
-      break;
-    case EFI_ALREADY_STARTED:
-      //
-      // The restriction has been recorded already.
-      //
-      break;
-    case EFI_OUT_OF_RESOURCES:
-      goto RollBack;
-    default:
-      ASSERT (FALSE);
-    }
-  }
-
-  *AllocationsRestrictedTo32Bit = Collection;
-  return EFI_SUCCESS;
-
-RollBack:
-  ReleaseAllocationsRestrictedTo32Bit (Collection);
-  return Status;
-}
-
-
-/**
-  Process a QEMU_LOADER_ALLOCATE command.
-
-  @param[in] Allocate                      The QEMU_LOADER_ALLOCATE command to
-                                           process.
-
-  @param[in,out] Tracker                   The ORDERED_COLLECTION tracking the
-                                           BLOB user structures created thus
-                                           far.
-
-  @param[in] AllocationsRestrictedTo32Bit  The ORDERED_COLLECTION populated by
-                                           the function
-                                           CollectAllocationsRestrictedTo32Bit,
-                                           naming the fw_cfg blobs that must
-                                           not be allocated from 64-bit address
-                                           space.
-
-  @retval EFI_SUCCESS           An area of whole AcpiNVS pages has been
-                                allocated for the blob contents, and the
-                                contents have been saved. A BLOB object (user
-                                structure) has been allocated from pool memory,
-                                referencing the blob contents. The BLOB user
-                                structure has been linked into Tracker.
-
-  @retval EFI_PROTOCOL_ERROR    Malformed fw_cfg file name has been found in
-                                Allocate, or the Allocate command references a
-                                file that is already known by Tracker.
-
-  @retval EFI_UNSUPPORTED       Unsupported alignment request has been found in
-                                Allocate.
-
-  @retval EFI_OUT_OF_RESOURCES  Pool allocation failed.
-
-  @return                       Error codes from QemuFwCfgFindFile() and
-                                gBS->AllocatePages().
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-ProcessCmdAllocate (
-  IN CONST QEMU_LOADER_ALLOCATE *Allocate,
-  IN OUT ORDERED_COLLECTION     *Tracker,
-  IN ORDERED_COLLECTION         *AllocationsRestrictedTo32Bit
-  )
-{
-  FIRMWARE_CONFIG_ITEM FwCfgItem;
-  UINTN                FwCfgSize;
-  EFI_STATUS           Status;
-  UINTN                NumPages;
-  EFI_PHYSICAL_ADDRESS Address;
-  BLOB                 *Blob;
-
-  if (Allocate->File[QEMU_LOADER_FNAME_SIZE - 1] != '\0') {
-    DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __FUNCTION__));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  if (Allocate->Alignment > EFI_PAGE_SIZE) {
-    DEBUG ((DEBUG_ERROR, "%a: unsupported alignment 0x%x\n", __FUNCTION__,
-      Allocate->Alignment));
-    return EFI_UNSUPPORTED;
-  }
-
-  Status = QemuFwCfgFindFile ((CHAR8 *)Allocate->File, &FwCfgItem, &FwCfgSize);
-  if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: QemuFwCfgFindFile(\"%a\"): %r\n", __FUNCTION__,
-      Allocate->File, Status));
-    return Status;
-  }
-
-  NumPages = EFI_SIZE_TO_PAGES (FwCfgSize);
-  Address = MAX_UINT64;
-  if (OrderedCollectionFind (
-        AllocationsRestrictedTo32Bit,
-        Allocate->File
-        ) != NULL) {
-    Address = MAX_UINT32;
-  }
-  Status = gBS->AllocatePages (AllocateMaxAddress, EfiACPIMemoryNVS, NumPages,
-                  &Address);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  Blob = AllocatePool (sizeof *Blob);
-  if (Blob == NULL) {
-    Status = EFI_OUT_OF_RESOURCES;
-    goto FreePages;
-  }
-  CopyMem (Blob->File, Allocate->File, QEMU_LOADER_FNAME_SIZE);
-  Blob->Size = FwCfgSize;
-  Blob->Base = (VOID *)(UINTN)Address;
-  Blob->HostsOnlyTableData = TRUE;
-
-  Status = OrderedCollectionInsert (Tracker, NULL, Blob);
-  if (Status == RETURN_ALREADY_STARTED) {
-    DEBUG ((DEBUG_ERROR, "%a: duplicated file \"%a\"\n", __FUNCTION__,
-      Allocate->File));
-    Status = EFI_PROTOCOL_ERROR;
-  }
-  if (EFI_ERROR (Status)) {
-    goto FreeBlob;
-  }
-
-  QemuFwCfgSelectItem (FwCfgItem);
-  QemuFwCfgReadBytes (FwCfgSize, Blob->Base);
-  ZeroMem (Blob->Base + Blob->Size, EFI_PAGES_TO_SIZE (NumPages) - Blob->Size);
-
-  DEBUG ((DEBUG_VERBOSE, "%a: File=\"%a\" Alignment=0x%x Zone=%d Size=0x%Lx "
-    "Address=0x%Lx\n", __FUNCTION__, Allocate->File, Allocate->Alignment,
-    Allocate->Zone, (UINT64)Blob->Size, (UINT64)(UINTN)Blob->Base));
-  return EFI_SUCCESS;
-
-FreeBlob:
-  FreePool (Blob);
-
-FreePages:
-  gBS->FreePages (Address, NumPages);
-
-  return Status;
-}
-
-
-/**
-  Process a QEMU_LOADER_ADD_POINTER command.
-
-  @param[in] AddPointer  The QEMU_LOADER_ADD_POINTER command to process.
-
-  @param[in] Tracker     The ORDERED_COLLECTION tracking the BLOB user
-                         structures created thus far.
-
-  @retval EFI_PROTOCOL_ERROR  Malformed fw_cfg file name(s) have been found in
-                              AddPointer, or the AddPointer command references
-                              a file unknown to Tracker, or the pointer to
-                              relocate has invalid location, size, or value, or
-                              the relocated pointer value is not representable
-                              in the given pointer size.
-
-  @retval EFI_SUCCESS         The pointer field inside the pointer blob has
-                              been relocated.
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-ProcessCmdAddPointer (
-  IN CONST QEMU_LOADER_ADD_POINTER *AddPointer,
-  IN CONST ORDERED_COLLECTION      *Tracker
-  )
-{
-  ORDERED_COLLECTION_ENTRY *TrackerEntry, *TrackerEntry2;
-  BLOB                     *Blob, *Blob2;
-  UINT8                    *PointerField;
-  UINT64                   PointerValue;
-
-  if (AddPointer->PointerFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0' ||
-      AddPointer->PointeeFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0') {
-    DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __FUNCTION__));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  TrackerEntry = OrderedCollectionFind (Tracker, AddPointer->PointerFile);
-  TrackerEntry2 = OrderedCollectionFind (Tracker, AddPointer->PointeeFile);
-  if (TrackerEntry == NULL || TrackerEntry2 == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: invalid blob reference(s) \"%a\" / \"%a\"\n",
-      __FUNCTION__, AddPointer->PointerFile, AddPointer->PointeeFile));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  Blob = OrderedCollectionUserStruct (TrackerEntry);
-  Blob2 = OrderedCollectionUserStruct (TrackerEntry2);
-  if ((AddPointer->PointerSize != 1 && AddPointer->PointerSize != 2 &&
-       AddPointer->PointerSize != 4 && AddPointer->PointerSize != 8) ||
-      Blob->Size < AddPointer->PointerSize ||
-      Blob->Size - AddPointer->PointerSize < AddPointer->PointerOffset) {
-    DEBUG ((DEBUG_ERROR, "%a: invalid pointer location or size in \"%a\"\n",
-      __FUNCTION__, AddPointer->PointerFile));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  PointerField = Blob->Base + AddPointer->PointerOffset;
-  PointerValue = 0;
-  CopyMem (&PointerValue, PointerField, AddPointer->PointerSize);
-  if (PointerValue >= Blob2->Size) {
-    DEBUG ((DEBUG_ERROR, "%a: invalid pointer value in \"%a\"\n", __FUNCTION__,
-      AddPointer->PointerFile));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  //
-  // The memory allocation system ensures that the address of the byte past the
-  // last byte of any allocated object is expressible (no wraparound).
-  //
-  ASSERT ((UINTN)Blob2->Base <= MAX_ADDRESS - Blob2->Size);
-
-  PointerValue += (UINT64)(UINTN)Blob2->Base;
-  if (AddPointer->PointerSize < 8 &&
-      RShiftU64 (PointerValue, AddPointer->PointerSize * 8) != 0) {
-    DEBUG ((DEBUG_ERROR, "%a: relocated pointer value unrepresentable in "
-      "\"%a\"\n", __FUNCTION__, AddPointer->PointerFile));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  CopyMem (PointerField, &PointerValue, AddPointer->PointerSize);
-
-  DEBUG ((DEBUG_VERBOSE, "%a: PointerFile=\"%a\" PointeeFile=\"%a\" "
-    "PointerOffset=0x%x PointerSize=%d\n", __FUNCTION__,
-    AddPointer->PointerFile, AddPointer->PointeeFile,
-    AddPointer->PointerOffset, AddPointer->PointerSize));
-  return EFI_SUCCESS;
-}
-
-
-/**
-  Process a QEMU_LOADER_ADD_CHECKSUM command.
-
-  @param[in] AddChecksum  The QEMU_LOADER_ADD_CHECKSUM command to process.
-
-  @param[in] Tracker      The ORDERED_COLLECTION tracking the BLOB user
-                          structures created thus far.
-
-  @retval EFI_PROTOCOL_ERROR  Malformed fw_cfg file name has been found in
-                              AddChecksum, or the AddChecksum command
-                              references a file unknown to Tracker, or the
-                              range to checksum is invalid.
-
-  @retval EFI_SUCCESS         The requested range has been checksummed.
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-ProcessCmdAddChecksum (
-  IN CONST QEMU_LOADER_ADD_CHECKSUM *AddChecksum,
-  IN CONST ORDERED_COLLECTION       *Tracker
-  )
-{
-  ORDERED_COLLECTION_ENTRY *TrackerEntry;
-  BLOB                     *Blob;
-
-  if (AddChecksum->File[QEMU_LOADER_FNAME_SIZE - 1] != '\0') {
-    DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __FUNCTION__));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  TrackerEntry = OrderedCollectionFind (Tracker, AddChecksum->File);
-  if (TrackerEntry == NULL) {
-    DEBUG ((DEBUG_ERROR, "%a: invalid blob reference \"%a\"\n", __FUNCTION__,
-      AddChecksum->File));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  Blob = OrderedCollectionUserStruct (TrackerEntry);
-  if (Blob->Size <= AddChecksum->ResultOffset ||
-      Blob->Size < AddChecksum->Length ||
-      Blob->Size - AddChecksum->Length < AddChecksum->Start) {
-    DEBUG ((DEBUG_ERROR, "%a: invalid checksum range in \"%a\"\n",
-      __FUNCTION__, AddChecksum->File));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  Blob->Base[AddChecksum->ResultOffset] = CalculateCheckSum8 (
-                                           Blob->Base + AddChecksum->Start,
-                                           AddChecksum->Length
-                                           );
-  DEBUG ((DEBUG_VERBOSE, "%a: File=\"%a\" ResultOffset=0x%x Start=0x%x "
-    "Length=0x%x\n", __FUNCTION__, AddChecksum->File,
-    AddChecksum->ResultOffset, AddChecksum->Start, AddChecksum->Length));
-  return EFI_SUCCESS;
-}
-
-
-/**
-  Process a QEMU_LOADER_WRITE_POINTER command.
-
-  @param[in] WritePointer   The QEMU_LOADER_WRITE_POINTER command to process.
-
-  @param[in] Tracker        The ORDERED_COLLECTION tracking the BLOB user
-                            structures created thus far.
-
-  @param[in,out] S3Context  The S3_CONTEXT object capturing the fw_cfg actions
-                            of successfully processed QEMU_LOADER_WRITE_POINTER
-                            commands, to be replayed at S3 resume. S3Context
-                            may be NULL if S3 is disabled.
-
-  @retval EFI_PROTOCOL_ERROR  Malformed fw_cfg file name(s) have been found in
-                              WritePointer. Or, the WritePointer command
-                              references a file unknown to Tracker or the
-                              fw_cfg directory. Or, the pointer object to
-                              rewrite has invalid location, size, or initial
-                              relative value. Or, the pointer value to store
-                              does not fit in the given pointer size.
-
-  @retval EFI_SUCCESS         The pointer object inside the writeable fw_cfg
-                              file has been written. If S3Context is not NULL,
-                              then WritePointer has been condensed into
-                              S3Context.
-
-  @return                     Error codes propagated from
-                              SaveCondensedWritePointerToS3Context(). The
-                              pointer object inside the writeable fw_cfg file
-                              has not been written.
-**/
-STATIC
-EFI_STATUS
-ProcessCmdWritePointer (
-  IN     CONST QEMU_LOADER_WRITE_POINTER *WritePointer,
-  IN     CONST ORDERED_COLLECTION        *Tracker,
-  IN OUT       S3_CONTEXT                *S3Context OPTIONAL
-  )
-{
-  RETURN_STATUS            Status;
-  FIRMWARE_CONFIG_ITEM     PointerItem;
-  UINTN                    PointerItemSize;
-  ORDERED_COLLECTION_ENTRY *PointeeEntry;
-  BLOB                     *PointeeBlob;
-  UINT64                   PointerValue;
-
-  if (WritePointer->PointerFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0' ||
-      WritePointer->PointeeFile[QEMU_LOADER_FNAME_SIZE - 1] != '\0') {
-    DEBUG ((DEBUG_ERROR, "%a: malformed file name\n", __FUNCTION__));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  Status = QemuFwCfgFindFile ((CONST CHAR8 *)WritePointer->PointerFile,
-             &PointerItem, &PointerItemSize);
-  PointeeEntry = OrderedCollectionFind (Tracker, WritePointer->PointeeFile);
-  if (RETURN_ERROR (Status) || PointeeEntry == NULL) {
-    DEBUG ((DEBUG_ERROR,
-      "%a: invalid fw_cfg file or blob reference \"%a\" / \"%a\"\n",
-      __FUNCTION__, WritePointer->PointerFile, WritePointer->PointeeFile));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  if ((WritePointer->PointerSize != 1 && WritePointer->PointerSize != 2 &&
-       WritePointer->PointerSize != 4 && WritePointer->PointerSize != 8) ||
-      (PointerItemSize < WritePointer->PointerSize) ||
-      (PointerItemSize - WritePointer->PointerSize <
-       WritePointer->PointerOffset)) {
-    DEBUG ((DEBUG_ERROR, "%a: invalid pointer location or size in \"%a\"\n",
-      __FUNCTION__, WritePointer->PointerFile));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  PointeeBlob = OrderedCollectionUserStruct (PointeeEntry);
-  PointerValue = WritePointer->PointeeOffset;
-  if (PointerValue >= PointeeBlob->Size) {
-    DEBUG ((DEBUG_ERROR, "%a: invalid PointeeOffset\n", __FUNCTION__));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  //
-  // The memory allocation system ensures that the address of the byte past the
-  // last byte of any allocated object is expressible (no wraparound).
-  //
-  ASSERT ((UINTN)PointeeBlob->Base <= MAX_ADDRESS - PointeeBlob->Size);
-
-  PointerValue += (UINT64)(UINTN)PointeeBlob->Base;
-  if (WritePointer->PointerSize < 8 &&
-      RShiftU64 (PointerValue, WritePointer->PointerSize * 8) != 0) {
-    DEBUG ((DEBUG_ERROR, "%a: pointer value unrepresentable in \"%a\"\n",
-      __FUNCTION__, WritePointer->PointerFile));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  //
-  // If S3 is enabled, we have to capture the below fw_cfg actions in condensed
-  // form, to be replayed during S3 resume.
-  //
-  if (S3Context != NULL) {
-    EFI_STATUS SaveStatus;
-
-    SaveStatus = SaveCondensedWritePointerToS3Context (
-                   S3Context,
-                   (UINT16)PointerItem,
-                   WritePointer->PointerSize,
-                   WritePointer->PointerOffset,
-                   PointerValue
-                   );
-    if (EFI_ERROR (SaveStatus)) {
-      return SaveStatus;
-    }
-  }
-
-  QemuFwCfgSelectItem (PointerItem);
-  QemuFwCfgSkipBytes (WritePointer->PointerOffset);
-  QemuFwCfgWriteBytes (WritePointer->PointerSize, &PointerValue);
-
-  //
-  // Because QEMU has now learned PointeeBlob->Base, we must mark PointeeBlob
-  // as unreleasable, for the case when the whole linker/loader script is
-  // handled successfully.
-  //
-  PointeeBlob->HostsOnlyTableData = FALSE;
-
-  DEBUG ((DEBUG_VERBOSE, "%a: PointerFile=\"%a\" PointeeFile=\"%a\" "
-    "PointerOffset=0x%x PointeeOffset=0x%x PointerSize=%d\n", __FUNCTION__,
-    WritePointer->PointerFile, WritePointer->PointeeFile,
-    WritePointer->PointerOffset, WritePointer->PointeeOffset,
-    WritePointer->PointerSize));
-  return EFI_SUCCESS;
-}
-
-
-/**
-  Undo a QEMU_LOADER_WRITE_POINTER command.
-
-  This function revokes (zeroes out) a guest memory reference communicated to
-  QEMU earlier. The caller is responsible for invoking this function only on
-  such QEMU_LOADER_WRITE_POINTER commands that have been successfully processed
-  by ProcessCmdWritePointer().
-
-  @param[in] WritePointer  The QEMU_LOADER_WRITE_POINTER command to undo.
-**/
-STATIC
-VOID
-UndoCmdWritePointer (
-  IN CONST QEMU_LOADER_WRITE_POINTER *WritePointer
-  )
-{
-  RETURN_STATUS        Status;
-  FIRMWARE_CONFIG_ITEM PointerItem;
-  UINTN                PointerItemSize;
-  UINT64               PointerValue;
-
-  Status = QemuFwCfgFindFile ((CONST CHAR8 *)WritePointer->PointerFile,
-             &PointerItem, &PointerItemSize);
-  ASSERT_RETURN_ERROR (Status);
-
-  PointerValue = 0;
-  QemuFwCfgSelectItem (PointerItem);
-  QemuFwCfgSkipBytes (WritePointer->PointerOffset);
-  QemuFwCfgWriteBytes (WritePointer->PointerSize, &PointerValue);
-
-  DEBUG ((DEBUG_VERBOSE,
-    "%a: PointerFile=\"%a\" PointerOffset=0x%x PointerSize=%d\n", __FUNCTION__,
-    WritePointer->PointerFile, WritePointer->PointerOffset,
-    WritePointer->PointerSize));
-}
-
-
-//
-// We'll be saving the keys of installed tables so that we can roll them back
-// in case of failure. 128 tables should be enough for anyone (TM).
-//
-#define INSTALLED_TABLES_MAX 128
-
-/**
-  Process a QEMU_LOADER_ADD_POINTER command in order to see if its target byte
-  array is an ACPI table, and if so, install it.
-
-  This function assumes that the entire QEMU linker/loader command file has
-  been processed successfully in a prior first pass.
-
-  @param[in] AddPointer        The QEMU_LOADER_ADD_POINTER command to process.
-
-  @param[in] Tracker           The ORDERED_COLLECTION tracking the BLOB user
-                               structures.
-
-  @param[in] AcpiProtocol      The ACPI table protocol used to install tables.
-
-  @param[in,out] InstalledKey  On input, an array of INSTALLED_TABLES_MAX UINTN
-                               elements, allocated by the caller. On output,
-                               the function will have stored (appended) the
-                               AcpiProtocol-internal key of the ACPI table that
-                               the function has installed, if the AddPointer
-                               command identified an ACPI table that is
-                               different from RSDT and XSDT.
-
-  @param[in,out] NumInstalled  On input, the number of entries already used in
-                               InstalledKey; it must be in [0,
-                               INSTALLED_TABLES_MAX] inclusive. On output, the
-                               parameter is incremented if the AddPointer
-                               command identified an ACPI table that is
-                               different from RSDT and XSDT.
-
-  @param[in,out] SeenPointers  The ORDERED_COLLECTION tracking the absolute
-                               target addresses that have been pointed-to by
-                               QEMU_LOADER_ADD_POINTER commands thus far. If a
-                               target address is encountered for the first
-                               time, and it identifies an ACPI table that is
-                               different from RDST and XSDT, the table is
-                               installed. If a target address is seen for the
-                               second or later times, it is skipped without
-                               taking any action.
-
-  @retval EFI_INVALID_PARAMETER  NumInstalled was outside the allowed range on
-                                 input.
-
-  @retval EFI_OUT_OF_RESOURCES   The AddPointer command identified an ACPI
-                                 table different from RSDT and XSDT, but there
-                                 was no more room in InstalledKey.
-
-  @retval EFI_SUCCESS            AddPointer has been processed. Either its
-                                 absolute target address has been encountered
-                                 before, or an ACPI table different from RSDT
-                                 and XSDT has been installed (reflected by
-                                 InstalledKey and NumInstalled), or RSDT or
-                                 XSDT has been identified but not installed, or
-                                 the fw_cfg blob pointed-into by AddPointer has
-                                 been marked as hosting something else than
-                                 just direct ACPI table contents.
-
-  @return                        Error codes returned by
-                                 AcpiProtocol->InstallAcpiTable().
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-Process2ndPassCmdAddPointer (
-  IN     CONST QEMU_LOADER_ADD_POINTER *AddPointer,
-  IN     CONST ORDERED_COLLECTION      *Tracker,
-  IN     EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN OUT UINTN                         InstalledKey[INSTALLED_TABLES_MAX],
-  IN OUT INT32                         *NumInstalled,
-  IN OUT ORDERED_COLLECTION            *SeenPointers
-  )
-{
-  CONST ORDERED_COLLECTION_ENTRY                     *TrackerEntry;
-  CONST ORDERED_COLLECTION_ENTRY                     *TrackerEntry2;
-  ORDERED_COLLECTION_ENTRY                           *SeenPointerEntry;
-  CONST BLOB                                         *Blob;
-  BLOB                                               *Blob2;
-  CONST UINT8                                        *PointerField;
-  UINT64                                             PointerValue;
-  UINTN                                              Blob2Remaining;
-  UINTN                                              TableSize;
-  CONST EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *Facs;
-  CONST EFI_ACPI_DESCRIPTION_HEADER                  *Header;
-  EFI_STATUS                                         Status;
-
-  if (*NumInstalled < 0 || *NumInstalled > INSTALLED_TABLES_MAX) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  TrackerEntry = OrderedCollectionFind (Tracker, AddPointer->PointerFile);
-  TrackerEntry2 = OrderedCollectionFind (Tracker, AddPointer->PointeeFile);
-  Blob = OrderedCollectionUserStruct (TrackerEntry);
-  Blob2 = OrderedCollectionUserStruct (TrackerEntry2);
-  PointerField = Blob->Base + AddPointer->PointerOffset;
-  PointerValue = 0;
-  CopyMem (&PointerValue, PointerField, AddPointer->PointerSize);
-
-  //
-  // We assert that PointerValue falls inside Blob2's contents. This is ensured
-  // by the Blob2->Size check and later checks in ProcessCmdAddPointer().
-  //
-  Blob2Remaining = (UINTN)Blob2->Base;
-  ASSERT(PointerValue >= Blob2Remaining);
-  Blob2Remaining += Blob2->Size;
-  ASSERT (PointerValue < Blob2Remaining);
-
-  Status = OrderedCollectionInsert (
-             SeenPointers,
-             &SeenPointerEntry, // for reverting insertion in error case
-             (VOID *)(UINTN)PointerValue
-             );
-  if (EFI_ERROR (Status)) {
-    if (Status == RETURN_ALREADY_STARTED) {
-      //
-      // Already seen this pointer, don't try to process it again.
-      //
-      DEBUG ((
-        DEBUG_VERBOSE,
-        "%a: PointerValue=0x%Lx already processed, skipping.\n",
-        __FUNCTION__,
-        PointerValue
-        ));
-      Status = EFI_SUCCESS;
-    }
-    return Status;
-  }
-
-  Blob2Remaining -= (UINTN) PointerValue;
-  DEBUG ((DEBUG_VERBOSE, "%a: checking for ACPI header in \"%a\" at 0x%Lx "
-    "(remaining: 0x%Lx): ", __FUNCTION__, AddPointer->PointeeFile,
-    PointerValue, (UINT64)Blob2Remaining));
-
-  TableSize = 0;
-
-  //
-  // To make our job simple, the FACS has a custom header. Sigh.
-  //
-  if (sizeof *Facs <= Blob2Remaining) {
-    Facs = (EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)(UINTN)PointerValue;
-
-    if (Facs->Length >= sizeof *Facs &&
-        Facs->Length <= Blob2Remaining &&
-        Facs->Signature ==
-                EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) {
-      DEBUG ((DEBUG_VERBOSE, "found \"%-4.4a\" size 0x%x\n",
-        (CONST CHAR8 *)&Facs->Signature, Facs->Length));
-      TableSize = Facs->Length;
-    }
-  }
-
-  //
-  // check for the uniform tables
-  //
-  if (TableSize == 0 && sizeof *Header <= Blob2Remaining) {
-    Header = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)PointerValue;
-
-    if (Header->Length >= sizeof *Header &&
-        Header->Length <= Blob2Remaining &&
-        CalculateSum8 ((CONST UINT8 *)Header, Header->Length) == 0) {
-      //
-      // This looks very much like an ACPI table from QEMU:
-      // - Length field consistent with both ACPI and containing blob size
-      // - checksum is correct
-      //
-      DEBUG ((DEBUG_VERBOSE, "found \"%-4.4a\" size 0x%x\n",
-        (CONST CHAR8 *)&Header->Signature, Header->Length));
-      TableSize = Header->Length;
-
-      //
-      // Skip RSDT and XSDT because those are handled by
-      // EFI_ACPI_TABLE_PROTOCOL automatically.
-      if (Header->Signature ==
-                    EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE ||
-          Header->Signature ==
-                    EFI_ACPI_2_0_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) {
-        return EFI_SUCCESS;
-      }
-    }
-  }
-
-  if (TableSize == 0) {
-    DEBUG ((DEBUG_VERBOSE, "not found; marking fw_cfg blob as opaque\n"));
-    Blob2->HostsOnlyTableData = FALSE;
-    return EFI_SUCCESS;
-  }
-
-  if (*NumInstalled == INSTALLED_TABLES_MAX) {
-    DEBUG ((DEBUG_ERROR, "%a: can't install more than %d tables\n",
-      __FUNCTION__, INSTALLED_TABLES_MAX));
-    Status = EFI_OUT_OF_RESOURCES;
-    goto RollbackSeenPointer;
-  }
-
-  Status = AcpiProtocol->InstallAcpiTable (AcpiProtocol,
-                           (VOID *)(UINTN)PointerValue, TableSize,
-                           &InstalledKey[*NumInstalled]);
-  if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTable(): %r\n", __FUNCTION__,
-      Status));
-    goto RollbackSeenPointer;
-  }
-  ++*NumInstalled;
-  return EFI_SUCCESS;
-
-RollbackSeenPointer:
-  OrderedCollectionDelete (SeenPointers, SeenPointerEntry, NULL);
-  return Status;
-}
-
-
-/**
-  Download, process, and install ACPI table data from the QEMU loader
-  interface.
-
-  @param[in] AcpiProtocol  The ACPI table protocol used to install tables.
-
-  @retval  EFI_UNSUPPORTED       Firmware configuration is unavailable, or QEMU
-                                 loader command with unsupported parameters
-                                 has been found.
-
-  @retval  EFI_NOT_FOUND         The host doesn't export the required fw_cfg
-                                 files.
-
-  @retval  EFI_OUT_OF_RESOURCES  Memory allocation failed, or more than
-                                 INSTALLED_TABLES_MAX tables found.
-
-  @retval  EFI_PROTOCOL_ERROR    Found invalid fw_cfg contents.
-
-  @return                        Status codes returned by
-                                 AcpiProtocol->InstallAcpiTable().
-
-**/
-EFI_STATUS
-EFIAPI
-InstallQemuFwCfgTables (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
-  )
-{
-  EFI_STATUS               Status;
-  FIRMWARE_CONFIG_ITEM     FwCfgItem;
-  UINTN                    FwCfgSize;
-  QEMU_LOADER_ENTRY        *LoaderStart;
-  CONST QEMU_LOADER_ENTRY  *LoaderEntry, *LoaderEnd;
-  CONST QEMU_LOADER_ENTRY  *WritePointerSubsetEnd;
-  ORIGINAL_ATTRIBUTES      *OriginalPciAttributes;
-  UINTN                    OriginalPciAttributesCount;
-  ORDERED_COLLECTION       *AllocationsRestrictedTo32Bit;
-  S3_CONTEXT               *S3Context;
-  ORDERED_COLLECTION       *Tracker;
-  UINTN                    *InstalledKey;
-  INT32                    Installed;
-  ORDERED_COLLECTION_ENTRY *TrackerEntry, *TrackerEntry2;
-  ORDERED_COLLECTION       *SeenPointers;
-  ORDERED_COLLECTION_ENTRY *SeenPointerEntry, *SeenPointerEntry2;
-
-  Status = QemuFwCfgFindFile ("etc/table-loader", &FwCfgItem, &FwCfgSize);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-  if (FwCfgSize % sizeof *LoaderEntry != 0) {
-    DEBUG ((DEBUG_ERROR, "%a: \"etc/table-loader\" has invalid size 0x%Lx\n",
-      __FUNCTION__, (UINT64)FwCfgSize));
-    return EFI_PROTOCOL_ERROR;
-  }
-
-  LoaderStart = AllocatePool (FwCfgSize);
-  if (LoaderStart == NULL) {
-    return EFI_OUT_OF_RESOURCES;
-  }
-  EnablePciDecoding (&OriginalPciAttributes, &OriginalPciAttributesCount);
-  QemuFwCfgSelectItem (FwCfgItem);
-  QemuFwCfgReadBytes (FwCfgSize, LoaderStart);
-  RestorePciDecoding (OriginalPciAttributes, OriginalPciAttributesCount);
-  LoaderEnd = LoaderStart + FwCfgSize / sizeof *LoaderEntry;
-
-  AllocationsRestrictedTo32Bit = NULL;
-  Status = CollectAllocationsRestrictedTo32Bit (
-             &AllocationsRestrictedTo32Bit,
-             LoaderStart,
-             LoaderEnd
-             );
-  if (EFI_ERROR (Status)) {
-    goto FreeLoader;
-  }
-
-  S3Context = NULL;
-  if (QemuFwCfgS3Enabled ()) {
-    //
-    // Size the allocation pessimistically, assuming that all commands in the
-    // script are QEMU_LOADER_WRITE_POINTER commands.
-    //
-    Status = AllocateS3Context (&S3Context, LoaderEnd - LoaderStart);
-    if (EFI_ERROR (Status)) {
-      goto FreeAllocationsRestrictedTo32Bit;
-    }
-  }
-
-  Tracker = OrderedCollectionInit (BlobCompare, BlobKeyCompare);
-  if (Tracker == NULL) {
-    Status = EFI_OUT_OF_RESOURCES;
-    goto FreeS3Context;
-  }
-
-  //
-  // first pass: process the commands
-  //
-  // "WritePointerSubsetEnd" points one past the last successful
-  // QEMU_LOADER_WRITE_POINTER command. Now when we're about to start the first
-  // pass, no such command has been encountered yet.
-  //
-  WritePointerSubsetEnd = LoaderStart;
-  for (LoaderEntry = LoaderStart; LoaderEntry < LoaderEnd; ++LoaderEntry) {
-    switch (LoaderEntry->Type) {
-    case QemuLoaderCmdAllocate:
-      Status = ProcessCmdAllocate (
-                 &LoaderEntry->Command.Allocate,
-                 Tracker,
-                 AllocationsRestrictedTo32Bit
-                 );
-      break;
-
-    case QemuLoaderCmdAddPointer:
-      Status = ProcessCmdAddPointer (&LoaderEntry->Command.AddPointer,
-                 Tracker);
-      break;
-
-    case QemuLoaderCmdAddChecksum:
-      Status = ProcessCmdAddChecksum (&LoaderEntry->Command.AddChecksum,
-                 Tracker);
-      break;
-
-    case QemuLoaderCmdWritePointer:
-        Status = ProcessCmdWritePointer (&LoaderEntry->Command.WritePointer,
-                   Tracker, S3Context);
-        if (!EFI_ERROR (Status)) {
-          WritePointerSubsetEnd = LoaderEntry + 1;
-        }
-        break;
-
-    default:
-      DEBUG ((DEBUG_VERBOSE, "%a: unknown loader command: 0x%x\n",
-        __FUNCTION__, LoaderEntry->Type));
-      break;
-    }
-
-    if (EFI_ERROR (Status)) {
-      goto RollbackWritePointersAndFreeTracker;
-    }
-  }
-
-  InstalledKey = AllocatePool (INSTALLED_TABLES_MAX * sizeof *InstalledKey);
-  if (InstalledKey == NULL) {
-    Status = EFI_OUT_OF_RESOURCES;
-    goto RollbackWritePointersAndFreeTracker;
-  }
-
-  SeenPointers = OrderedCollectionInit (PointerCompare, PointerCompare);
-  if (SeenPointers == NULL) {
-    Status = EFI_OUT_OF_RESOURCES;
-    goto FreeKeys;
-  }
-
-  //
-  // second pass: identify and install ACPI tables
-  //
-  Installed = 0;
-  for (LoaderEntry = LoaderStart; LoaderEntry < LoaderEnd; ++LoaderEntry) {
-    if (LoaderEntry->Type == QemuLoaderCmdAddPointer) {
-      Status = Process2ndPassCmdAddPointer (
-                 &LoaderEntry->Command.AddPointer,
-                 Tracker,
-                 AcpiProtocol,
-                 InstalledKey,
-                 &Installed,
-                 SeenPointers
-                 );
-      if (EFI_ERROR (Status)) {
-        goto UninstallAcpiTables;
-      }
-    }
-  }
-
-  //
-  // Translating the condensed QEMU_LOADER_WRITE_POINTER commands to ACPI S3
-  // Boot Script opcodes has to be the last operation in this function, because
-  // if it succeeds, it cannot be undone.
-  //
-  if (S3Context != NULL) {
-    Status = TransferS3ContextToBootScript (S3Context);
-    if (EFI_ERROR (Status)) {
-      goto UninstallAcpiTables;
-    }
-    //
-    // Ownership of S3Context has been transferred.
-    //
-    S3Context = NULL;
-  }
-
-UninstallAcpiTables:
-  if (EFI_ERROR (Status)) {
-    //
-    // roll back partial installation
-    //
-    while (Installed > 0) {
-      --Installed;
-      AcpiProtocol->UninstallAcpiTable (AcpiProtocol, InstalledKey[Installed]);
-    }
-  } else {
-    DEBUG ((DEBUG_INFO, "%a: installed %d tables\n", __FUNCTION__, Installed));
-  }
-
-  for (SeenPointerEntry = OrderedCollectionMin (SeenPointers);
-       SeenPointerEntry != NULL;
-       SeenPointerEntry = SeenPointerEntry2) {
-    SeenPointerEntry2 = OrderedCollectionNext (SeenPointerEntry);
-    OrderedCollectionDelete (SeenPointers, SeenPointerEntry, NULL);
-  }
-  OrderedCollectionUninit (SeenPointers);
-
-FreeKeys:
-  FreePool (InstalledKey);
-
-RollbackWritePointersAndFreeTracker:
-  //
-  // In case of failure, revoke any allocation addresses that were communicated
-  // to QEMU previously, before we release all the blobs.
-  //
-  if (EFI_ERROR (Status)) {
-    LoaderEntry = WritePointerSubsetEnd;
-    while (LoaderEntry > LoaderStart) {
-      --LoaderEntry;
-      if (LoaderEntry->Type == QemuLoaderCmdWritePointer) {
-        UndoCmdWritePointer (&LoaderEntry->Command.WritePointer);
-      }
-    }
-  }
-
-  //
-  // Tear down the tracker infrastructure. Each fw_cfg blob will be left in
-  // place only if we're exiting with success and the blob hosts data that is
-  // not directly part of some ACPI table.
-  //
-  for (TrackerEntry = OrderedCollectionMin (Tracker); TrackerEntry != NULL;
-       TrackerEntry = TrackerEntry2) {
-    VOID *UserStruct;
-    BLOB *Blob;
-
-    TrackerEntry2 = OrderedCollectionNext (TrackerEntry);
-    OrderedCollectionDelete (Tracker, TrackerEntry, &UserStruct);
-    Blob = UserStruct;
-
-    if (EFI_ERROR (Status) || Blob->HostsOnlyTableData) {
-      DEBUG ((DEBUG_VERBOSE, "%a: freeing \"%a\"\n", __FUNCTION__,
-        Blob->File));
-      gBS->FreePages ((UINTN)Blob->Base, EFI_SIZE_TO_PAGES (Blob->Size));
-    }
-    FreePool (Blob);
-  }
-  OrderedCollectionUninit (Tracker);
-
-FreeS3Context:
-  if (S3Context != NULL) {
-    ReleaseS3Context (S3Context);
-  }
-
-FreeAllocationsRestrictedTo32Bit:
-  ReleaseAllocationsRestrictedTo32Bit (AllocationsRestrictedTo32Bit);
-
-FreeLoader:
-  FreePool (LoaderStart);
-
-  return Status;
-}
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 14/43] OvmfPkg/XenAcpiPlatformDxe: remove QEMU fw_cfg dependency
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (12 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 13/43] OvmfPkg/XenAcpiPlatformDxe: remove the QEMU ACPI linker/loader client Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:39   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 15/43] OvmfPkg/XenAcpiPlatformDxe: remove the InstallAcpiTable() helper function Laszlo Ersek
                   ` (31 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Philippe Mathieu-Daudé

The QemuDetected() function wraps QemuFwCfgIsAvailable(); it always fails
on Xen. Because of that, we can eliminate the QemuDetected() call itself
from the Xen ACPI platform driver, and then the rest of "Qemu.c" becomes
useless -- the workhorse function of that source file is
QemuInstallAcpiTable(), which we no longer call.

Remove any dependencies that are no longer needed by the
XenAcpiPlatformDxe driver.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf |   9 -
 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h         |  14 -
 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c         |   9 +-
 OvmfPkg/XenAcpiPlatformDxe/Qemu.c                 | 511 --------------------
 4 files changed, 1 insertion(+), 542 deletions(-)

diff --git a/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf b/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
index 72132e397dc1..ca8e7e55f788 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
+++ b/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
@@ -22,29 +22,23 @@ [Defines]
 #
 
 [Sources]
   AcpiPlatform.c
   AcpiPlatform.h
   EntryPoint.c
-  Qemu.c
   Xen.c
 
 [Packages]
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
-  UefiCpuPkg/UefiCpuPkg.dec
 
 [LibraryClasses]
   BaseLib
-  BaseMemoryLib
   DebugLib
-  DxeServicesTableLib
-  MemoryAllocationLib
   PcdLib
-  QemuFwCfgLib
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   XenPlatformLib
 
 [Protocols]
   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
@@ -53,12 +47,9 @@ [Protocols]
 [Guids]
   gRootBridgesConnectedEventGroupGuid
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile
   gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
-  gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress
-  gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel
-  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress
 
 [Depex]
   gEfiAcpiTableProtocolGuid
diff --git a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
index d35143a00d01..2959ff0be6cf 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
@@ -18,26 +18,12 @@ InstallAcpiTable (
   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
   IN   VOID                          *AcpiTableBuffer,
   IN   UINTN                         AcpiTableBufferSize,
   OUT  UINTN                         *TableKey
   );
 
-BOOLEAN
-QemuDetected (
-  VOID
-  );
-
-EFI_STATUS
-EFIAPI
-QemuInstallAcpiTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  );
-
 EFI_STATUS
 EFIAPI
 InstallXenTables (
   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
   );
 
diff --git a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
index 9c8b1e0fcffa..66dcf885859e 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
@@ -152,24 +152,17 @@ InstallOvmfFvTables (
   INTN                                 Instance;
   EFI_ACPI_COMMON_HEADER               *CurrentTable;
   UINTN                                TableHandle;
   UINT32                               FvStatus;
   UINTN                                TableSize;
   UINTN                                Size;
-  EFI_ACPI_TABLE_INSTALL_ACPI_TABLE    TableInstallFunction;
 
   Instance     = 0;
   CurrentTable = NULL;
   TableHandle  = 0;
 
-  if (QemuDetected ()) {
-    TableInstallFunction = QemuInstallAcpiTable;
-  } else {
-    TableInstallFunction = InstallAcpiTable;
-  }
-
   //
   // set FwVol (and use an ASSERT() below) to suppress incorrect
   // compiler/analyzer warnings
   //
   FwVol = NULL;
   //
@@ -204,13 +197,13 @@ InstallOvmfFvTables (
       TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
       ASSERT (Size >= TableSize);
 
       //
       // Install ACPI table
       //
-      Status = TableInstallFunction (
+      Status = InstallAcpiTable (
                  AcpiTable,
                  CurrentTable,
                  TableSize,
                  &TableHandle
                  );
 
diff --git a/OvmfPkg/XenAcpiPlatformDxe/Qemu.c b/OvmfPkg/XenAcpiPlatformDxe/Qemu.c
deleted file mode 100644
index b4a407c41b71..000000000000
--- a/OvmfPkg/XenAcpiPlatformDxe/Qemu.c
+++ /dev/null
@@ -1,511 +0,0 @@
-/** @file
-  OVMF ACPI QEMU support
-
-  Copyright (C) 2012-2021, Red Hat, Inc.
-  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <IndustryStandard/Acpi.h>        // EFI_ACPI_1_0_IO_APIC_STRUCTURE
-#include <Library/BaseMemoryLib.h>        // CopyMem()
-#include <Library/DebugLib.h>             // DEBUG()
-#include <Library/DxeServicesTableLib.h>  // gDS
-#include <Library/MemoryAllocationLib.h>  // AllocatePool()
-#include <Library/PcdLib.h>               // PcdGet16()
-#include <Library/QemuFwCfgLib.h>         // QemuFwCfgIsAvailable()
-
-#include "AcpiPlatform.h"
-
-BOOLEAN
-QemuDetected (
-  VOID
-  )
-{
-  if (!QemuFwCfgIsAvailable ()) {
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-
-STATIC
-UINTN
-CountBits16 (
-  UINT16 Mask
-  )
-{
-  //
-  // For all N >= 1, N bits are enough to represent the number of bits set
-  // among N bits. It's true for N == 1. When adding a new bit (N := N+1),
-  // the maximum number of possibly set bits increases by one, while the
-  // representable maximum doubles.
-  //
-  Mask = ((Mask & 0xAAAA) >> 1) + (Mask & 0x5555);
-  Mask = ((Mask & 0xCCCC) >> 2) + (Mask & 0x3333);
-  Mask = ((Mask & 0xF0F0) >> 4) + (Mask & 0x0F0F);
-  Mask = ((Mask & 0xFF00) >> 8) + (Mask & 0x00FF);
-
-  return Mask;
-}
-
-
-STATIC
-EFI_STATUS
-EFIAPI
-QemuInstallAcpiMadtTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  )
-{
-  UINTN                                               CpuCount;
-  UINTN                                               PciLinkIsoCount;
-  UINTN                                               NewBufferSize;
-  EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *Madt;
-  EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE         *LocalApic;
-  EFI_ACPI_1_0_IO_APIC_STRUCTURE                      *IoApic;
-  EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE    *Iso;
-  EFI_ACPI_1_0_LOCAL_APIC_NMI_STRUCTURE               *LocalApicNmi;
-  VOID                                                *Ptr;
-  UINTN                                               Loop;
-  EFI_STATUS                                          Status;
-
-  ASSERT (AcpiTableBufferSize >= sizeof (EFI_ACPI_DESCRIPTION_HEADER));
-
-  QemuFwCfgSelectItem (QemuFwCfgItemSmpCpuCount);
-  CpuCount = QemuFwCfgRead16 ();
-  ASSERT (CpuCount >= 1);
-
-  //
-  // Set Level-tiggered, Active High for these identity mapped IRQs. The bitset
-  // corresponds to the union of all possible interrupt assignments for the LNKA,
-  // LNKB, LNKC, LNKD PCI interrupt lines. See the DSDT.
-  //
-  PciLinkIsoCount = CountBits16 (PcdGet16 (Pcd8259LegacyModeEdgeLevel));
-
-  NewBufferSize = 1                     * sizeof (*Madt) +
-                  CpuCount              * sizeof (*LocalApic) +
-                  1                     * sizeof (*IoApic) +
-                  (1 + PciLinkIsoCount) * sizeof (*Iso) +
-                  1                     * sizeof (*LocalApicNmi);
-
-  Madt = AllocatePool (NewBufferSize);
-  if (Madt == NULL) {
-    return EFI_OUT_OF_RESOURCES;
-  }
-
-  CopyMem (&(Madt->Header), AcpiTableBuffer, sizeof (EFI_ACPI_DESCRIPTION_HEADER));
-  Madt->Header.Length    = (UINT32) NewBufferSize;
-  Madt->LocalApicAddress = PcdGet32 (PcdCpuLocalApicBaseAddress);
-  Madt->Flags            = EFI_ACPI_1_0_PCAT_COMPAT;
-  Ptr = Madt + 1;
-
-  LocalApic = Ptr;
-  for (Loop = 0; Loop < CpuCount; ++Loop) {
-    LocalApic->Type            = EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC;
-    LocalApic->Length          = sizeof (*LocalApic);
-    LocalApic->AcpiProcessorId = (UINT8) Loop;
-    LocalApic->ApicId          = (UINT8) Loop;
-    LocalApic->Flags           = 1; // enabled
-    ++LocalApic;
-  }
-  Ptr = LocalApic;
-
-  IoApic = Ptr;
-  IoApic->Type             = EFI_ACPI_1_0_IO_APIC;
-  IoApic->Length           = sizeof (*IoApic);
-  IoApic->IoApicId         = (UINT8) CpuCount;
-  IoApic->Reserved         = EFI_ACPI_RESERVED_BYTE;
-  IoApic->IoApicAddress    = 0xFEC00000;
-  IoApic->SystemVectorBase = 0x00000000;
-  Ptr = IoApic + 1;
-
-  //
-  // IRQ0 (8254 Timer) => IRQ2 (PIC) Interrupt Source Override Structure
-  //
-  Iso = Ptr;
-  Iso->Type                        = EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE;
-  Iso->Length                      = sizeof (*Iso);
-  Iso->Bus                         = 0x00; // ISA
-  Iso->Source                      = 0x00; // IRQ0
-  Iso->GlobalSystemInterruptVector = 0x00000002;
-  Iso->Flags                       = 0x0000; // Conforms to specs of the bus
-  ++Iso;
-
-  //
-  // Set Level-triggered, Active High for all possible PCI link targets.
-  //
-  for (Loop = 0; Loop < 16; ++Loop) {
-    if ((PcdGet16 (Pcd8259LegacyModeEdgeLevel) & (1 << Loop)) == 0) {
-      continue;
-    }
-    Iso->Type                        = EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE;
-    Iso->Length                      = sizeof (*Iso);
-    Iso->Bus                         = 0x00; // ISA
-    Iso->Source                      = (UINT8) Loop;
-    Iso->GlobalSystemInterruptVector = (UINT32) Loop;
-    Iso->Flags                       = 0x000D; // Level-triggered, Active High
-    ++Iso;
-  }
-  ASSERT (
-    (UINTN) (Iso - (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE *)Ptr) ==
-      1 + PciLinkIsoCount
-    );
-  Ptr = Iso;
-
-  LocalApicNmi = Ptr;
-  LocalApicNmi->Type            = EFI_ACPI_1_0_LOCAL_APIC_NMI;
-  LocalApicNmi->Length          = sizeof (*LocalApicNmi);
-  LocalApicNmi->AcpiProcessorId = 0xFF; // applies to all processors
-  //
-  // polarity and trigger mode of the APIC I/O input signals conform to the
-  // specifications of the bus
-  //
-  LocalApicNmi->Flags           = 0x0000;
-  //
-  // Local APIC interrupt input LINTn to which NMI is connected.
-  //
-  LocalApicNmi->LocalApicInti   = 0x01;
-  Ptr = LocalApicNmi + 1;
-
-  ASSERT ((UINTN) ((UINT8 *)Ptr - (UINT8 *)Madt) == NewBufferSize);
-  Status = InstallAcpiTable (AcpiProtocol, Madt, NewBufferSize, TableKey);
-
-  FreePool (Madt);
-
-  return Status;
-}
-
-
-#pragma pack(1)
-
-typedef struct {
-  UINT64 Base;
-  UINT64 End;
-  UINT64 Length;
-} PCI_WINDOW;
-
-typedef struct {
-  PCI_WINDOW PciWindow32;
-  PCI_WINDOW PciWindow64;
-} FIRMWARE_DATA;
-
-typedef struct {
-  UINT8 BytePrefix;
-  UINT8 ByteValue;
-} AML_BYTE;
-
-typedef struct {
-  UINT8    NameOp;
-  UINT8    RootChar;
-  UINT8    NameChar[4];
-  UINT8    PackageOp;
-  UINT8    PkgLength;
-  UINT8    NumElements;
-  AML_BYTE Pm1aCntSlpTyp;
-  AML_BYTE Pm1bCntSlpTyp;
-  AML_BYTE Reserved[2];
-} SYSTEM_STATE_PACKAGE;
-
-#pragma pack()
-
-
-STATIC
-EFI_STATUS
-EFIAPI
-PopulateFwData(
-  OUT  FIRMWARE_DATA *FwData
-  )
-{
-  EFI_STATUS                      Status;
-  UINTN                           NumDesc;
-  EFI_GCD_MEMORY_SPACE_DESCRIPTOR *AllDesc;
-
-  Status = gDS->GetMemorySpaceMap (&NumDesc, &AllDesc);
-  if (Status == EFI_SUCCESS) {
-    UINT64 NonMmio32MaxExclTop;
-    UINT64 Mmio32MinBase;
-    UINT64 Mmio32MaxExclTop;
-    UINTN CurDesc;
-
-    Status = EFI_UNSUPPORTED;
-
-    NonMmio32MaxExclTop = 0;
-    Mmio32MinBase = BASE_4GB;
-    Mmio32MaxExclTop = 0;
-
-    for (CurDesc = 0; CurDesc < NumDesc; ++CurDesc) {
-      CONST EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Desc;
-      UINT64 ExclTop;
-
-      Desc = &AllDesc[CurDesc];
-      ExclTop = Desc->BaseAddress + Desc->Length;
-
-      if (ExclTop <= (UINT64) PcdGet32 (PcdOvmfFdBaseAddress)) {
-        switch (Desc->GcdMemoryType) {
-          case EfiGcdMemoryTypeNonExistent:
-            break;
-
-          case EfiGcdMemoryTypeReserved:
-          case EfiGcdMemoryTypeSystemMemory:
-            if (NonMmio32MaxExclTop < ExclTop) {
-              NonMmio32MaxExclTop = ExclTop;
-            }
-            break;
-
-          case EfiGcdMemoryTypeMemoryMappedIo:
-            if (Mmio32MinBase > Desc->BaseAddress) {
-              Mmio32MinBase = Desc->BaseAddress;
-            }
-            if (Mmio32MaxExclTop < ExclTop) {
-              Mmio32MaxExclTop = ExclTop;
-            }
-            break;
-
-          default:
-            ASSERT(0);
-        }
-      }
-    }
-
-    if (Mmio32MinBase < NonMmio32MaxExclTop) {
-      Mmio32MinBase = NonMmio32MaxExclTop;
-    }
-
-    if (Mmio32MinBase < Mmio32MaxExclTop) {
-      FwData->PciWindow32.Base   = Mmio32MinBase;
-      FwData->PciWindow32.End    = Mmio32MaxExclTop - 1;
-      FwData->PciWindow32.Length = Mmio32MaxExclTop - Mmio32MinBase;
-
-      FwData->PciWindow64.Base   = 0;
-      FwData->PciWindow64.End    = 0;
-      FwData->PciWindow64.Length = 0;
-
-      Status = EFI_SUCCESS;
-    }
-
-    FreePool (AllDesc);
-  }
-
-  DEBUG ((
-    DEBUG_INFO,
-    "ACPI PciWindow32: Base=0x%08lx End=0x%08lx Length=0x%08lx\n",
-    FwData->PciWindow32.Base,
-    FwData->PciWindow32.End,
-    FwData->PciWindow32.Length
-    ));
-  DEBUG ((
-    DEBUG_INFO,
-    "ACPI PciWindow64: Base=0x%08lx End=0x%08lx Length=0x%08lx\n",
-    FwData->PciWindow64.Base,
-    FwData->PciWindow64.End,
-    FwData->PciWindow64.Length
-    ));
-
-  return Status;
-}
-
-
-STATIC
-VOID
-EFIAPI
-GetSuspendStates (
-  UINTN                *SuspendToRamSize,
-  SYSTEM_STATE_PACKAGE *SuspendToRam,
-  UINTN                *SuspendToDiskSize,
-  SYSTEM_STATE_PACKAGE *SuspendToDisk
-  )
-{
-  STATIC CONST SYSTEM_STATE_PACKAGE Template = {
-    0x08,                   // NameOp
-    '\\',                   // RootChar
-    { '_', 'S', 'x', '_' }, // NameChar[4]
-    0x12,                   // PackageOp
-    0x0A,                   // PkgLength
-    0x04,                   // NumElements
-    { 0x0A, 0x00 },         // Pm1aCntSlpTyp
-    { 0x0A, 0x00 },         // Pm1bCntSlpTyp -- we don't support it
-    {                       // Reserved[2]
-      { 0x0A, 0x00 },
-      { 0x0A, 0x00 }
-    }
-  };
-  RETURN_STATUS                     Status;
-  FIRMWARE_CONFIG_ITEM              FwCfgItem;
-  UINTN                             FwCfgSize;
-  UINT8                             SystemStates[6];
-
-  //
-  // configure defaults
-  //
-  *SuspendToRamSize = sizeof Template;
-  CopyMem (SuspendToRam, &Template, sizeof Template);
-  SuspendToRam->NameChar[2]             = '3'; // S3
-  SuspendToRam->Pm1aCntSlpTyp.ByteValue = 1;   // PIIX4: STR
-
-  *SuspendToDiskSize = sizeof Template;
-  CopyMem (SuspendToDisk, &Template, sizeof Template);
-  SuspendToDisk->NameChar[2]             = '4'; // S4
-  SuspendToDisk->Pm1aCntSlpTyp.ByteValue = 2;   // PIIX4: POSCL
-
-  //
-  // check for overrides
-  //
-  Status = QemuFwCfgFindFile ("etc/system-states", &FwCfgItem, &FwCfgSize);
-  if (Status != RETURN_SUCCESS || FwCfgSize != sizeof SystemStates) {
-    DEBUG ((DEBUG_INFO, "ACPI using S3/S4 defaults\n"));
-    return;
-  }
-  QemuFwCfgSelectItem (FwCfgItem);
-  QemuFwCfgReadBytes (sizeof SystemStates, SystemStates);
-
-  //
-  // Each byte corresponds to a system state. In each byte, the MSB tells us
-  // whether the given state is enabled. If so, the three LSBs specify the
-  // value to be written to the PM control register's SUS_TYP bits.
-  //
-  if (SystemStates[3] & BIT7) {
-    SuspendToRam->Pm1aCntSlpTyp.ByteValue =
-        SystemStates[3] & (BIT2 | BIT1 | BIT0);
-    DEBUG ((DEBUG_INFO, "ACPI S3 value: %d\n",
-            SuspendToRam->Pm1aCntSlpTyp.ByteValue));
-  } else {
-    *SuspendToRamSize = 0;
-    DEBUG ((DEBUG_INFO, "ACPI S3 disabled\n"));
-  }
-
-  if (SystemStates[4] & BIT7) {
-    SuspendToDisk->Pm1aCntSlpTyp.ByteValue =
-        SystemStates[4] & (BIT2 | BIT1 | BIT0);
-    DEBUG ((DEBUG_INFO, "ACPI S4 value: %d\n",
-            SuspendToDisk->Pm1aCntSlpTyp.ByteValue));
-  } else {
-    *SuspendToDiskSize = 0;
-    DEBUG ((DEBUG_INFO, "ACPI S4 disabled\n"));
-  }
-}
-
-
-STATIC
-EFI_STATUS
-EFIAPI
-QemuInstallAcpiSsdtTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  )
-{
-  EFI_STATUS    Status;
-  FIRMWARE_DATA *FwData;
-
-  Status = EFI_OUT_OF_RESOURCES;
-
-  FwData = AllocateReservedPool (sizeof (*FwData));
-  if (FwData != NULL) {
-    UINTN                SuspendToRamSize;
-    SYSTEM_STATE_PACKAGE SuspendToRam;
-    UINTN                SuspendToDiskSize;
-    SYSTEM_STATE_PACKAGE SuspendToDisk;
-    UINTN                SsdtSize;
-    UINT8                *Ssdt;
-
-    GetSuspendStates (&SuspendToRamSize,  &SuspendToRam,
-                      &SuspendToDiskSize, &SuspendToDisk);
-    SsdtSize = AcpiTableBufferSize + 17 + SuspendToRamSize + SuspendToDiskSize;
-    Ssdt = AllocatePool (SsdtSize);
-
-    if (Ssdt != NULL) {
-      Status = PopulateFwData (FwData);
-
-      if (Status == EFI_SUCCESS) {
-        UINT8 *SsdtPtr;
-
-        SsdtPtr = Ssdt;
-
-        CopyMem (SsdtPtr, AcpiTableBuffer, AcpiTableBufferSize);
-        SsdtPtr += AcpiTableBufferSize;
-
-        //
-        // build "OperationRegion(FWDT, SystemMemory, 0x12345678, 0x87654321)"
-        //
-        *(SsdtPtr++) = 0x5B; // ExtOpPrefix
-        *(SsdtPtr++) = 0x80; // OpRegionOp
-        *(SsdtPtr++) = 'F';
-        *(SsdtPtr++) = 'W';
-        *(SsdtPtr++) = 'D';
-        *(SsdtPtr++) = 'T';
-        *(SsdtPtr++) = 0x00; // SystemMemory
-        *(SsdtPtr++) = 0x0C; // DWordPrefix
-
-        //
-        // no virtual addressing yet, take the four least significant bytes
-        //
-        CopyMem(SsdtPtr, &FwData, 4);
-        SsdtPtr += 4;
-
-        *(SsdtPtr++) = 0x0C; // DWordPrefix
-
-        *(UINT32*) SsdtPtr = sizeof (*FwData);
-        SsdtPtr += 4;
-
-        //
-        // add suspend system states
-        //
-        CopyMem (SsdtPtr, &SuspendToRam, SuspendToRamSize);
-        SsdtPtr += SuspendToRamSize;
-        CopyMem (SsdtPtr, &SuspendToDisk, SuspendToDiskSize);
-        SsdtPtr += SuspendToDiskSize;
-
-        ASSERT((UINTN) (SsdtPtr - Ssdt) == SsdtSize);
-        ((EFI_ACPI_DESCRIPTION_HEADER *) Ssdt)->Length = (UINT32) SsdtSize;
-        Status = InstallAcpiTable (AcpiProtocol, Ssdt, SsdtSize, TableKey);
-      }
-
-      FreePool(Ssdt);
-    }
-
-    if (Status != EFI_SUCCESS) {
-      FreePool(FwData);
-    }
-  }
-
-  return Status;
-}
-
-
-EFI_STATUS
-EFIAPI
-QemuInstallAcpiTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  )
-{
-  EFI_ACPI_DESCRIPTION_HEADER        *Hdr;
-  EFI_ACPI_TABLE_INSTALL_ACPI_TABLE  TableInstallFunction;
-
-  Hdr = (EFI_ACPI_DESCRIPTION_HEADER*) AcpiTableBuffer;
-  switch (Hdr->Signature) {
-  case EFI_ACPI_1_0_APIC_SIGNATURE:
-    TableInstallFunction = QemuInstallAcpiMadtTable;
-    break;
-  case EFI_ACPI_1_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE:
-    TableInstallFunction = QemuInstallAcpiSsdtTable;
-    break;
-  default:
-    TableInstallFunction = InstallAcpiTable;
-  }
-
-  return TableInstallFunction (
-           AcpiProtocol,
-           AcpiTableBuffer,
-           AcpiTableBufferSize,
-           TableKey
-           );
-}
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 15/43] OvmfPkg/XenAcpiPlatformDxe: remove the InstallAcpiTable() helper function
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (13 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 14/43] OvmfPkg/XenAcpiPlatformDxe: remove QEMU fw_cfg dependency Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  9:39   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 16/43] OvmfPkg/XenAcpiPlatformDxe: remove OVMF's built-in ACPI tables Laszlo Ersek
                   ` (30 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Philippe Mathieu-Daudé

The InstallAcpiTable() helper function buys us nothing. Reduce code
complexity by removing the function.

This patch is best viewed with "git show -b".

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h |  9 ---
 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c | 30 ++--------
 OvmfPkg/XenAcpiPlatformDxe/Xen.c          | 60 ++++++++++----------
 3 files changed, 36 insertions(+), 63 deletions(-)

diff --git a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
index 2959ff0be6cf..47d9769ed12b 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
@@ -9,21 +9,12 @@
 
 #ifndef ACPI_PLATFORM_H_
 #define ACPI_PLATFORM_H_
 
 #include <Protocol/AcpiTable.h> // EFI_ACPI_TABLE_PROTOCOL
 
-EFI_STATUS
-EFIAPI
-InstallAcpiTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  );
-
 EFI_STATUS
 EFIAPI
 InstallXenTables (
   IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
   );
 
diff --git a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
index 66dcf885859e..daf2bf3f458a 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
@@ -11,30 +11,12 @@
 #include <Library/UefiBootServicesTableLib.h> // gBS
 #include <Library/XenPlatformLib.h>           // XenDetected()
 #include <Protocol/FirmwareVolume2.h>         // gEfiFirmwareVolume2Protocol...
 
 #include "AcpiPlatform.h"
 
-EFI_STATUS
-EFIAPI
-InstallAcpiTable (
-  IN   EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol,
-  IN   VOID                          *AcpiTableBuffer,
-  IN   UINTN                         AcpiTableBufferSize,
-  OUT  UINTN                         *TableKey
-  )
-{
-  return AcpiProtocol->InstallAcpiTable (
-                         AcpiProtocol,
-                         AcpiTableBuffer,
-                         AcpiTableBufferSize,
-                         TableKey
-                         );
-}
-
-
 /**
   Locate the first instance of a protocol.  If the protocol requested is an
   FV protocol, then it will return the first FV that contains the ACPI table
   storage file.
 
   @param  Instance      Return pointer to the first instance of the protocol
@@ -197,18 +179,18 @@ InstallOvmfFvTables (
       TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
       ASSERT (Size >= TableSize);
 
       //
       // Install ACPI table
       //
-      Status = InstallAcpiTable (
-                 AcpiTable,
-                 CurrentTable,
-                 TableSize,
-                 &TableHandle
-                 );
+      Status = AcpiTable->InstallAcpiTable (
+                            AcpiTable,
+                            CurrentTable,
+                            TableSize,
+                            &TableHandle
+                            );
 
       //
       // Free memory allocated by ReadSection
       //
       gBS->FreePool (CurrentTable);
 
diff --git a/OvmfPkg/XenAcpiPlatformDxe/Xen.c b/OvmfPkg/XenAcpiPlatformDxe/Xen.c
index e8395db548d9..151376176f7d 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/Xen.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/Xen.c
@@ -182,18 +182,18 @@ InstallXenTables (
       CurrentTablePointer = (UINTN) *(UINT64 *)CurrentTableEntry;
       CurrentTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTablePointer;
 
       //
       // Install the XSDT tables
       //
-      Status = InstallAcpiTable (
-                 AcpiProtocol,
-                 CurrentTable,
-                 CurrentTable->Length,
-                 &TableHandle
-                 );
+      Status = AcpiProtocol->InstallAcpiTable (
+                               AcpiProtocol,
+                               CurrentTable,
+                               CurrentTable->Length,
+                               &TableHandle
+                               );
 
       if (EFI_ERROR (Status)) {
         return Status;
       }
 
       //
@@ -232,18 +232,18 @@ InstallXenTables (
       CurrentTablePointer = *(UINT32 *)CurrentTableEntry;
       CurrentTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTablePointer;
 
       //
       // Install the RSDT tables
       //
-      Status = InstallAcpiTable (
-                 AcpiProtocol,
-                 CurrentTable,
-                 CurrentTable->Length,
-                 &TableHandle
-                 );
+      Status = AcpiProtocol->InstallAcpiTable (
+                               AcpiProtocol,
+                               CurrentTable,
+                               CurrentTable->Length,
+                               &TableHandle
+                               );
 
       if (EFI_ERROR (Status)) {
         return Status;
       }
 
       //
@@ -263,32 +263,32 @@ InstallXenTables (
   // Install the FACS table.
   //
   if (Fadt2Table) {
     //
     // FACS 2.0
     //
-    Status = InstallAcpiTable (
-               AcpiProtocol,
-               Facs2Table,
-               Facs2Table->Length,
-               &TableHandle
-               );
+    Status = AcpiProtocol->InstallAcpiTable (
+                             AcpiProtocol,
+                             Facs2Table,
+                             Facs2Table->Length,
+                             &TableHandle
+                             );
     if (EFI_ERROR (Status)) {
       return Status;
     }
   }
   else if (Fadt1Table) {
     //
     // FACS 1.0
     //
-    Status = InstallAcpiTable (
-               AcpiProtocol,
-               Facs1Table,
-               Facs1Table->Length,
-               &TableHandle
-               );
+    Status = AcpiProtocol->InstallAcpiTable (
+                             AcpiProtocol,
+                             Facs1Table,
+                             Facs1Table->Length,
+                             &TableHandle
+                             );
     if (EFI_ERROR (Status)) {
       return Status;
     }
   }
 
   //
@@ -298,18 +298,18 @@ InstallXenTables (
   if (DsdtTable == NULL) {
     DEBUG ((DEBUG_ERROR, "%a: no DSDT found\n", __FUNCTION__));
     ASSERT (FALSE);
     CpuDeadLoop ();
   }
 
-  Status = InstallAcpiTable (
-             AcpiProtocol,
-             DsdtTable,
-             DsdtTable->Length,
-             &TableHandle
-             );
+  Status = AcpiProtocol->InstallAcpiTable (
+                           AcpiProtocol,
+                           DsdtTable,
+                           DsdtTable->Length,
+                           &TableHandle
+                           );
   if (EFI_ERROR (Status)) {
     return Status;
   }
 
   return EFI_SUCCESS;
 }
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 16/43] OvmfPkg/XenAcpiPlatformDxe: remove OVMF's built-in ACPI tables
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (14 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 15/43] OvmfPkg/XenAcpiPlatformDxe: remove the InstallAcpiTable() helper function Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:40   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 17/43] OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment Laszlo Ersek
                   ` (29 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Philippe Mathieu-Daudé

Xen is an advanced hypervisor; no Xen guest can function correctly without
the hypervisor's dynamically provided ACPI tables. Remove the built-in
(fallback) tables from XenAcpiPlatformDxe -- and the OvmfXen platform.

Remove any dependencies from XenAcpiPlatformDxe that are no longer needed.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/OvmfXen.dsc                               |   1 -
 OvmfPkg/OvmfXen.fdf                               |   7 -
 OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf |   2 -
 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c         | 202 --------------------
 4 files changed, 212 deletions(-)

diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 4d5171cd43c1..bcf64242d05c 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -650,13 +650,12 @@ [Components]
 
   #
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
   OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
-  OvmfPkg/AcpiTables/AcpiTables.inf
   MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
   MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
   MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
   #
   # Network Support
diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf
index 85306245b50f..8daa000de46a 100644
--- a/OvmfPkg/OvmfXen.fdf
+++ b/OvmfPkg/OvmfXen.fdf
@@ -350,13 +350,12 @@ [FV.DXEFV]
 
 INF  MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
 INF  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
 
 INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
 INF  OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
-INF  RuleOverride=ACPITABLE OvmfPkg/AcpiTables/AcpiTables.inf
 INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
 
 INF  FatPkg/EnhancedFatDxe/Fat.inf
 INF  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
@@ -521,18 +520,12 @@ [Rule.Common.UEFI_APPLICATION.BINARY]
   FILE APPLICATION = $(NAMED_GUID) {
     PE32      PE32                    |.efi
     UI        STRING="$(MODULE_NAME)" Optional
     VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
   }
 
-[Rule.Common.USER_DEFINED.ACPITABLE]
-  FILE FREEFORM = $(NAMED_GUID) {
-    RAW ACPI               |.acpi
-    RAW ASL                |.aml
-  }
-
 [Rule.Common.USER_DEFINED.CSM]
   FILE FREEFORM = $(NAMED_GUID) {
     RAW BIN                |.bin
   }
 
 [Rule.Common.SEC.RESET_VECTOR]
diff --git a/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf b/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
index ca8e7e55f788..db9b6e093de4 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
+++ b/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
@@ -39,17 +39,15 @@ [LibraryClasses]
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   XenPlatformLib
 
 [Protocols]
   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
-  gEfiFirmwareVolume2ProtocolGuid               # PROTOCOL SOMETIMES_CONSUMED
 
 [Guids]
   gRootBridgesConnectedEventGroupGuid
 
 [Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile
   gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
 
 [Depex]
   gEfiAcpiTableProtocolGuid
diff --git a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
index daf2bf3f458a..60576f3cc6d6 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
@@ -4,214 +4,16 @@
   Copyright (C) 2021, Red Hat, Inc.
   Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#include <Library/DebugLib.h>                 // ASSERT_EFI_ERROR()
-#include <Library/UefiBootServicesTableLib.h> // gBS
 #include <Library/XenPlatformLib.h>           // XenDetected()
-#include <Protocol/FirmwareVolume2.h>         // gEfiFirmwareVolume2Protocol...
 
 #include "AcpiPlatform.h"
 
-/**
-  Locate the first instance of a protocol.  If the protocol requested is an
-  FV protocol, then it will return the first FV that contains the ACPI table
-  storage file.
-
-  @param  Instance      Return pointer to the first instance of the protocol
-
-  @return EFI_SUCCESS           The function completed successfully.
-  @return EFI_NOT_FOUND         The protocol could not be located.
-  @return EFI_OUT_OF_RESOURCES  There are not enough resources to find the protocol.
-
-**/
-EFI_STATUS
-LocateFvInstanceWithTables (
-  OUT EFI_FIRMWARE_VOLUME2_PROTOCOL **Instance
-  )
-{
-  EFI_STATUS                    Status;
-  EFI_HANDLE                    *HandleBuffer;
-  UINTN                         NumberOfHandles;
-  EFI_FV_FILETYPE               FileType;
-  UINT32                        FvStatus;
-  EFI_FV_FILE_ATTRIBUTES        Attributes;
-  UINTN                         Size;
-  UINTN                         Index;
-  EFI_FIRMWARE_VOLUME2_PROTOCOL *FvInstance;
-
-  FvStatus = 0;
-
-  //
-  // Locate protocol.
-  //
-  Status = gBS->LocateHandleBuffer (
-                   ByProtocol,
-                   &gEfiFirmwareVolume2ProtocolGuid,
-                   NULL,
-                   &NumberOfHandles,
-                   &HandleBuffer
-                   );
-  if (EFI_ERROR (Status)) {
-    //
-    // Defined errors at this time are not found and out of resources.
-    //
-    return Status;
-  }
-
-  //
-  // Looking for FV with ACPI storage file
-  //
-  for (Index = 0; Index < NumberOfHandles; Index++) {
-    //
-    // Get the protocol on this handle
-    // This should not fail because of LocateHandleBuffer
-    //
-    Status = gBS->HandleProtocol (
-                     HandleBuffer[Index],
-                     &gEfiFirmwareVolume2ProtocolGuid,
-                     (VOID**) &FvInstance
-                     );
-    ASSERT_EFI_ERROR (Status);
-
-    //
-    // See if it has the ACPI storage file
-    //
-    Status = FvInstance->ReadFile (
-                           FvInstance,
-                           (EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
-                           NULL,
-                           &Size,
-                           &FileType,
-                           &Attributes,
-                           &FvStatus
-                           );
-
-    //
-    // If we found it, then we are done
-    //
-    if (Status == EFI_SUCCESS) {
-      *Instance = FvInstance;
-      break;
-    }
-  }
-
-  //
-  // Our exit status is determined by the success of the previous operations
-  // If the protocol was found, Instance already points to it.
-  //
-
-  //
-  // Free any allocated buffers
-  //
-  gBS->FreePool (HandleBuffer);
-
-  return Status;
-}
-
-
-/**
-  Find ACPI tables in an FV and install them.
-
-  This is now a fall-back path. Normally, we will search for tables provided
-  by the VMM first.
-
-  If that fails, we use this function to load the ACPI tables from an FV. The
-  sources for the FV based tables is located under OvmfPkg/AcpiTables.
-
-  @param  AcpiTable     Protocol instance pointer
-
-**/
-EFI_STATUS
-EFIAPI
-InstallOvmfFvTables (
-  IN  EFI_ACPI_TABLE_PROTOCOL     *AcpiTable
-  )
-{
-  EFI_STATUS                           Status;
-  EFI_FIRMWARE_VOLUME2_PROTOCOL        *FwVol;
-  INTN                                 Instance;
-  EFI_ACPI_COMMON_HEADER               *CurrentTable;
-  UINTN                                TableHandle;
-  UINT32                               FvStatus;
-  UINTN                                TableSize;
-  UINTN                                Size;
-
-  Instance     = 0;
-  CurrentTable = NULL;
-  TableHandle  = 0;
-
-  //
-  // set FwVol (and use an ASSERT() below) to suppress incorrect
-  // compiler/analyzer warnings
-  //
-  FwVol = NULL;
-  //
-  // Locate the firmware volume protocol
-  //
-  Status = LocateFvInstanceWithTables (&FwVol);
-  if (EFI_ERROR (Status)) {
-    return EFI_ABORTED;
-  }
-  ASSERT (FwVol != NULL);
-
-  //
-  // Read tables from the storage file.
-  //
-  while (Status == EFI_SUCCESS) {
-
-    Status = FwVol->ReadSection (
-                      FwVol,
-                      (EFI_GUID*)PcdGetPtr (PcdAcpiTableStorageFile),
-                      EFI_SECTION_RAW,
-                      Instance,
-                      (VOID**) &CurrentTable,
-                      &Size,
-                      &FvStatus
-                      );
-    if (!EFI_ERROR (Status)) {
-      //
-      // Add the table
-      //
-      TableHandle = 0;
-
-      TableSize = ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Length;
-      ASSERT (Size >= TableSize);
-
-      //
-      // Install ACPI table
-      //
-      Status = AcpiTable->InstallAcpiTable (
-                            AcpiTable,
-                            CurrentTable,
-                            TableSize,
-                            &TableHandle
-                            );
-
-      //
-      // Free memory allocated by ReadSection
-      //
-      gBS->FreePool (CurrentTable);
-
-      if (EFI_ERROR (Status)) {
-        return EFI_ABORTED;
-      }
-
-      //
-      // Increment the instance
-      //
-      Instance++;
-      CurrentTable = NULL;
-    }
-  }
-
-  return EFI_SUCCESS;
-}
-
 /**
   Effective entrypoint of Acpi Platform driver.
 
   @param  ImageHandle
   @param  SystemTable
 
@@ -231,13 +33,9 @@ InstallAcpiTables (
   if (XenDetected ()) {
     Status = InstallXenTables (AcpiTable);
   } else {
     Status = EFI_UNSUPPORTED;
   }
 
-  if (EFI_ERROR (Status)) {
-    Status = InstallOvmfFvTables (AcpiTable);
-  }
-
   return Status;
 }
 
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 17/43] OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (15 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 16/43] OvmfPkg/XenAcpiPlatformDxe: remove OVMF's built-in ACPI tables Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-26 20:40   ` Rebecca Cran
  2021-05-27  8:40   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 18/43] OvmfPkg/AcpiTables: remove unused module Laszlo Ersek
                   ` (28 subsequent siblings)
  45 siblings, 2 replies; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Jordan Justen, Peter Grehan,
	Philippe Mathieu-Daudé, Rebecca Cran

The built-in ACPI tables for Bhyve are located in the
"OvmfPkg/Bhyve/AcpiTables" module, not in the "OvmfPkg/AcpiTables" module.
Correct the typo in a code comment.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
index d5c78c61d5ad..9ccdb4d91cd1 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
@@ -129,13 +129,13 @@ LocateFvInstanceWithTables (
   Find ACPI tables in an FV and install them.
 
   This is now a fall-back path. Normally, we will search for tables provided
   by the VMM first.
 
   If that fails, we use this function to load the ACPI tables from an FV. The
-  sources for the FV based tables is located under OvmfPkg/AcpiTables.
+  sources for the FV based tables is located under OvmfPkg/Bhyve/AcpiTables.
 
   @param  AcpiTable     Protocol instance pointer
 
 **/
 EFI_STATUS
 EFIAPI
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 18/43] OvmfPkg/AcpiTables: remove unused module
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (16 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 17/43] OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:27   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 19/43] OvmfPkg/OvmfXen: make "PcdPciDisableBusEnumeration" Fixed-at-Build Laszlo Ersek
                   ` (27 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

The "OvmfPkg/AcpiTables/AcpiTables.inf" module is no longer used by any
module in edk2; remove it.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/AcpiTables/AcpiTables.inf |  38 --
 OvmfPkg/AcpiTables/Platform.h     |  68 --
 OvmfPkg/AcpiTables/Dsdt.asl       | 692 --------------------
 OvmfPkg/AcpiTables/Facp.aslc      |  89 ---
 OvmfPkg/AcpiTables/Facs.aslc      |  78 ---
 OvmfPkg/AcpiTables/Madt.aslc      | 153 -----
 OvmfPkg/AcpiTables/Ssdt.asl       |  13 -
 7 files changed, 1131 deletions(-)

diff --git a/OvmfPkg/AcpiTables/AcpiTables.inf b/OvmfPkg/AcpiTables/AcpiTables.inf
deleted file mode 100644
index b7d8d774281b..000000000000
--- a/OvmfPkg/AcpiTables/AcpiTables.inf
+++ /dev/null
@@ -1,38 +0,0 @@
-## @file
-#  Component description file for PlatformAcpiTables module.
-#
-#  ACPI table data and ASL sources required to boot the platform.
-#
-#  Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
-#  SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
-  INF_VERSION                    = 0x00010005
-  BASE_NAME                      = PlatformAcpiTables
-  FILE_GUID                      = 7E374E25-8E01-4FEE-87F2-390C23C606CD
-  MODULE_TYPE                    = USER_DEFINED
-  VERSION_STRING                 = 1.0
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-#  VALID_ARCHITECTURES           = IA32 X64 EBC
-#
-
-[Sources]
-  Platform.h
-  Madt.aslc
-  Facp.aslc
-  Facs.aslc
-  Dsdt.asl
-  Ssdt.asl
-
-[Packages]
-  MdePkg/MdePkg.dec
-  OvmfPkg/OvmfPkg.dec
-
-[Pcd]
-  gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort
-
diff --git a/OvmfPkg/AcpiTables/Platform.h b/OvmfPkg/AcpiTables/Platform.h
deleted file mode 100644
index e4ee848961c6..000000000000
--- a/OvmfPkg/AcpiTables/Platform.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/** @file
-  Platform specific defines for constructing ACPI tables
-
-  Copyright (c) 2012, 2013, Red Hat, Inc.
-  Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _Platform_h_INCLUDED_
-#define _Platform_h_INCLUDED_
-
-#include <PiDxe.h>
-#include <IndustryStandard/Acpi.h>
-
-//
-// ACPI table information used to initialize tables.
-//
-#define EFI_ACPI_OEM_ID           'O','V','M','F',' ',' '   // OEMID 6 bytes long
-#define EFI_ACPI_OEM_TABLE_ID     SIGNATURE_64('O','V','M','F','E','D','K','2') // OEM table id 8 bytes long
-#define EFI_ACPI_OEM_REVISION     0x20130221
-#define EFI_ACPI_CREATOR_ID       SIGNATURE_32('O','V','M','F')
-#define EFI_ACPI_CREATOR_REVISION 0x00000099
-
-#define SCI_INT_VECTOR  0x0009
-#define SMI_CMD_IO_PORT 0xB2
-#define ACPI_ENABLE     0xF1
-#define ACPI_DISABLE    0xF0
-#define S4BIOS_REQ      0x00
-#define PM1a_EVT_BLK    0x0000b000
-#define PM1a_CNT_BLK    0x0000b004
-#define PM_TMR_BLK      0x0000b008
-#define GPE0_BLK        0x0000afe0
-#define PM1_EVT_LEN     0x04
-#define PM1_CNT_LEN     0x02
-#define PM_TM_LEN       0x04
-#define GPE0_BLK_LEN    0x04
-#define RESERVED        0x00
-#define P_LVL2_LAT      0x0065
-#define P_LVL3_LAT      0x03E9
-#define FLUSH_SIZE      0x0000
-#define FLUSH_STRIDE    0x0000
-#define DUTY_OFFSET     0x00
-#define DUTY_WIDTH      0x00
-#define DAY_ALRM        0x00
-#define MON_ALRM        0x00
-#define CENTURY         0x00
-#define FLAG            (EFI_ACPI_2_0_WBINVD | \
-                         EFI_ACPI_2_0_PROC_C1 | \
-                         EFI_ACPI_2_0_SLP_BUTTON | \
-                         EFI_ACPI_2_0_RTC_S4 | \
-                         EFI_ACPI_2_0_RESET_REG_SUP)
-#define RESET_REG       0xCF9
-#define RESET_VALUE     (BIT2 | BIT1) // PIIX3 Reset CPU + System Reset
-
-//
-// Byte-aligned IO port register block initializer for
-// EFI_ACPI_2_0_GENERIC_ADDRESS_STRUCTURE
-//
-#define GAS2_IO(Base, Size) {                             \
-          EFI_ACPI_2_0_SYSTEM_IO, /* AddressSpaceId    */ \
-          (Size) * 8,             /* RegisterBitWidth  */ \
-          0,                      /* RegisterBitOffset */ \
-          0,                      /* Reserved          */ \
-          (Base)                  /* Address           */ \
-          }
-
-#endif
diff --git a/OvmfPkg/AcpiTables/Dsdt.asl b/OvmfPkg/AcpiTables/Dsdt.asl
deleted file mode 100644
index 7550fb46b628..000000000000
--- a/OvmfPkg/AcpiTables/Dsdt.asl
+++ /dev/null
@@ -1,692 +0,0 @@
-/** @file
-  Contains root level name space objects for the platform
-
-  Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-DefinitionBlock ("Dsdt.aml", "DSDT", 1, "INTEL ", "OVMF    ", 4) {
-  //
-  // System Sleep States
-  //
-  // We build S3 and S4 with GetSuspendStates() in
-  // "OvmfPkg/AcpiPlatformDxe/Qemu.c".
-  //
-  Name (\_S0, Package () {5, 0, 0, 0}) // Working
-  Name (\_S5, Package () {0, 0, 0, 0}) // Soft Off
-
-  //
-  //  System Bus
-  //
-  Scope (\_SB) {
-    //
-    // PCI Root Bridge
-    //
-    Device (PCI0) {
-      Name (_HID, EISAID ("PNP0A03"))
-      Name (_ADR, 0x00000000)
-      Name (_BBN, 0x00)
-      Name (_UID, 0x00)
-
-      //
-      // BUS, I/O, and MMIO resources
-      //
-      Name (CRES, ResourceTemplate () {
-        WORDBusNumber (          // Bus number resource (0); the bridge produces bus numbers for its subsequent buses
-          ResourceProducer,      // bit 0 of general flags is 1
-          MinFixed,              // Range is fixed
-          MaxFixed,              // Range is fixed
-          PosDecode,             // PosDecode
-          0x0000,                // Granularity
-          0x0000,                // Min
-          0x00FF,                // Max
-          0x0000,                // Translation
-          0x0100                 // Range Length = Max-Min+1
-          )
-
-        IO (Decode16, 0xCF8, 0xCF8, 0x01, 0x08)       //Consumed resource (0xCF8-0xCFF)
-
-        WORDIO (                 // Consumed-and-produced resource (all I/O below CF8)
-          ResourceProducer,      // bit 0 of general flags is 0
-          MinFixed,              // Range is fixed
-          MaxFixed,              // Range is fixed
-          PosDecode,
-          EntireRange,
-          0x0000,                // Granularity
-          0x0000,                // Min
-          0x0CF7,                // Max
-          0x0000,                // Translation
-          0x0CF8                 // Range Length
-          )
-
-        WORDIO (                 // Consumed-and-produced resource (all I/O above CFF)
-          ResourceProducer,      // bit 0 of general flags is 0
-          MinFixed,              // Range is fixed
-          MaxFixed,              // Range is fixed
-          PosDecode,
-          EntireRange,
-          0x0000,                // Granularity
-          0x0D00,                // Min
-          0xFFFF,                // Max
-          0x0000,                // Translation
-          0xF300                 // Range Length
-          )
-
-        DWORDMEMORY (            // Descriptor for legacy VGA video RAM
-          ResourceProducer,      // bit 0 of general flags is 0
-          PosDecode,
-          MinFixed,              // Range is fixed
-          MaxFixed,              // Range is Fixed
-          Cacheable,
-          ReadWrite,
-          0x00000000,            // Granularity
-          0x000A0000,            // Min
-          0x000BFFFF,            // Max
-          0x00000000,            // Translation
-          0x00020000             // Range Length
-          )
-
-        DWORDMEMORY (            // Descriptor for 32-bit MMIO
-          ResourceProducer,      // bit 0 of general flags is 0
-          PosDecode,
-          MinFixed,              // Range is fixed
-          MaxFixed,              // Range is Fixed
-          NonCacheable,
-          ReadWrite,
-          0x00000000,            // Granularity
-          0xF8000000,            // Min
-          0xFFFBFFFF,            // Max
-          0x00000000,            // Translation
-          0x07FC0000,            // Range Length
-          ,                      // ResourceSourceIndex
-          ,                      // ResourceSource
-          PW32                   // DescriptorName
-          )
-      })
-
-      Name (CR64, ResourceTemplate () {
-        QWordMemory (            // Descriptor for 64-bit MMIO
-            ResourceProducer,    // bit 0 of general flags is 0
-            PosDecode,
-            MinFixed,            // Range is fixed
-            MaxFixed,            // Range is Fixed
-            Cacheable,
-            ReadWrite,
-            0x00000000,          // Granularity
-            0x8000000000,        // Min
-            0xFFFFFFFFFF,        // Max
-            0x00000000,          // Translation
-            0x8000000000,        // Range Length
-            ,                    // ResourceSourceIndex
-            ,                    // ResourceSource
-            PW64                 // DescriptorName
-            )
-      })
-
-      Method (_CRS, 0, Serialized) {
-        //
-        // see the FIRMWARE_DATA structure in "OvmfPkg/AcpiPlatformDxe/Qemu.c"
-        //
-        External (FWDT, OpRegionObj)
-        Field(FWDT, QWordAcc, NoLock, Preserve) {
-          P0S, 64,               // PciWindow32.Base
-          P0E, 64,               // PciWindow32.End
-          P0L, 64,               // PciWindow32.Length
-          P1S, 64,               // PciWindow64.Base
-          P1E, 64,               // PciWindow64.End
-          P1L, 64                // PciWindow64.Length
-        }
-        Field(FWDT, DWordAcc, NoLock, Preserve) {
-          P0SL, 32,              // PciWindow32.Base,   low  32 bits
-          P0SH, 32,              // PciWindow32.Base,   high 32 bits
-          P0EL, 32,              // PciWindow32.End,    low  32 bits
-          P0EH, 32,              // PciWindow32.End,    high 32 bits
-          P0LL, 32,              // PciWindow32.Length, low  32 bits
-          P0LH, 32,              // PciWindow32.Length, high 32 bits
-          P1SL, 32,              // PciWindow64.Base,   low  32 bits
-          P1SH, 32,              // PciWindow64.Base,   high 32 bits
-          P1EL, 32,              // PciWindow64.End,    low  32 bits
-          P1EH, 32,              // PciWindow64.End,    high 32 bits
-          P1LL, 32,              // PciWindow64.Length, low  32 bits
-          P1LH, 32               // PciWindow64.Length, high 32 bits
-        }
-
-        //
-        // fixup 32-bit PCI IO window
-        //
-        CreateDWordField (CRES, \_SB.PCI0.PW32._MIN, PS32)
-        CreateDWordField (CRES, \_SB.PCI0.PW32._MAX, PE32)
-        CreateDWordField (CRES, \_SB.PCI0.PW32._LEN, PL32)
-        Store (P0SL, PS32)
-        Store (P0EL, PE32)
-        Store (P0LL, PL32)
-
-        If (LAnd (LEqual (P1SL, 0x00), LEqual (P1SH, 0x00))) {
-          Return (CRES)
-        } Else {
-          //
-          // fixup 64-bit PCI IO window
-          //
-          CreateQWordField (CR64, \_SB.PCI0.PW64._MIN, PS64)
-          CreateQWordField (CR64, \_SB.PCI0.PW64._MAX, PE64)
-          CreateQWordField (CR64, \_SB.PCI0.PW64._LEN, PL64)
-          Store (P1S, PS64)
-          Store (P1E, PE64)
-          Store (P1L, PL64)
-
-          //
-          // add window and return result
-          //
-          ConcatenateResTemplate (CRES, CR64, Local0)
-          Return (Local0)
-        }
-      }
-
-      //
-      // PCI Interrupt Routing Table - PIC Mode Only
-      //
-      Method (_PRT, 0, NotSerialized) {
-        Return (
-          Package () {
-            //
-            // Bus 0; Devices 0 to 15
-            //
-            Package () {0x0000FFFF, 0x00, \_SB.PCI0.LPC.LNKD, 0x00},
-            Package () {0x0000FFFF, 0x01, \_SB.PCI0.LPC.LNKA, 0x00},
-            Package () {0x0000FFFF, 0x02, \_SB.PCI0.LPC.LNKB, 0x00},
-            Package () {0x0000FFFF, 0x03, \_SB.PCI0.LPC.LNKC, 0x00},
-
-            //
-            // Bus 0, Device 1, Pin 0 (INTA) is special; it corresponds to the
-            // internally generated SCI (System Control Interrupt), which is
-            // always routed to GSI 9. By setting the third (= Source) field to
-            // zero, we could use the fourth (= Source Index) field to hardwire
-            // the pin to GSI 9 directly.
-            //
-            // That way however, in accordance with the ACPI spec's description
-            // of SCI, the interrupt would be treated as "active low,
-            // shareable, level", and that doesn't match qemu.
-            //
-            // In QemuInstallAcpiMadtTable() [OvmfPkg/AcpiPlatformDxe/Qemu.c]
-            // we install an Interrupt Override Structure for the identity
-            // mapped IRQ#9 / GSI 9 (the corresponding bit being set in
-            // Pcd8259LegacyModeEdgeLevel), which describes the correct
-            // polarity (active high). As a consequence, some OS'en (eg. Linux)
-            // override the default (active low) polarity originating from the
-            // _PRT; others (eg. FreeBSD) don't. Therefore we need a separate
-            // link device just to specify a polarity that matches the MADT.
-            //
-            Package () {0x0001FFFF, 0x00, \_SB.PCI0.LPC.LNKS, 0x00},
-
-            Package () {0x0001FFFF, 0x01, \_SB.PCI0.LPC.LNKB, 0x00},
-            Package () {0x0001FFFF, 0x02, \_SB.PCI0.LPC.LNKC, 0x00},
-            Package () {0x0001FFFF, 0x03, \_SB.PCI0.LPC.LNKD, 0x00},
-
-            Package () {0x0002FFFF, 0x00, \_SB.PCI0.LPC.LNKB, 0x00},
-            Package () {0x0002FFFF, 0x01, \_SB.PCI0.LPC.LNKC, 0x00},
-            Package () {0x0002FFFF, 0x02, \_SB.PCI0.LPC.LNKD, 0x00},
-            Package () {0x0002FFFF, 0x03, \_SB.PCI0.LPC.LNKA, 0x00},
-
-            Package () {0x0003FFFF, 0x00, \_SB.PCI0.LPC.LNKC, 0x00},
-            Package () {0x0003FFFF, 0x01, \_SB.PCI0.LPC.LNKD, 0x00},
-            Package () {0x0003FFFF, 0x02, \_SB.PCI0.LPC.LNKA, 0x00},
-            Package () {0x0003FFFF, 0x03, \_SB.PCI0.LPC.LNKB, 0x00},
-
-            Package () {0x0004FFFF, 0x00, \_SB.PCI0.LPC.LNKD, 0x00},
-            Package () {0x0004FFFF, 0x01, \_SB.PCI0.LPC.LNKA, 0x00},
-            Package () {0x0004FFFF, 0x02, \_SB.PCI0.LPC.LNKB, 0x00},
-            Package () {0x0004FFFF, 0x03, \_SB.PCI0.LPC.LNKC, 0x00},
-
-            Package () {0x0005FFFF, 0x00, \_SB.PCI0.LPC.LNKA, 0x00},
-            Package () {0x0005FFFF, 0x01, \_SB.PCI0.LPC.LNKB, 0x00},
-            Package () {0x0005FFFF, 0x02, \_SB.PCI0.LPC.LNKC, 0x00},
-            Package () {0x0005FFFF, 0x03, \_SB.PCI0.LPC.LNKD, 0x00},
-
-            Package () {0x0006FFFF, 0x00, \_SB.PCI0.LPC.LNKB, 0x00},
-            Package () {0x0006FFFF, 0x01, \_SB.PCI0.LPC.LNKC, 0x00},
-            Package () {0x0006FFFF, 0x02, \_SB.PCI0.LPC.LNKD, 0x00},
-            Package () {0x0006FFFF, 0x03, \_SB.PCI0.LPC.LNKA, 0x00},
-
-            Package () {0x0007FFFF, 0x00, \_SB.PCI0.LPC.LNKC, 0x00},
-            Package () {0x0007FFFF, 0x01, \_SB.PCI0.LPC.LNKD, 0x00},
-            Package () {0x0007FFFF, 0x02, \_SB.PCI0.LPC.LNKA, 0x00},
-            Package () {0x0007FFFF, 0x03, \_SB.PCI0.LPC.LNKB, 0x00},
-
-            Package () {0x0008FFFF, 0x00, \_SB.PCI0.LPC.LNKD, 0x00},
-            Package () {0x0008FFFF, 0x01, \_SB.PCI0.LPC.LNKA, 0x00},
-            Package () {0x0008FFFF, 0x02, \_SB.PCI0.LPC.LNKB, 0x00},
-            Package () {0x0008FFFF, 0x03, \_SB.PCI0.LPC.LNKC, 0x00},
-
-            Package () {0x0009FFFF, 0x00, \_SB.PCI0.LPC.LNKA, 0x00},
-            Package () {0x0009FFFF, 0x01, \_SB.PCI0.LPC.LNKB, 0x00},
-            Package () {0x0009FFFF, 0x02, \_SB.PCI0.LPC.LNKC, 0x00},
-            Package () {0x0009FFFF, 0x03, \_SB.PCI0.LPC.LNKD, 0x00},
-
-            Package () {0x000AFFFF, 0x00, \_SB.PCI0.LPC.LNKB, 0x00},
-            Package () {0x000AFFFF, 0x01, \_SB.PCI0.LPC.LNKC, 0x00},
-            Package () {0x000AFFFF, 0x02, \_SB.PCI0.LPC.LNKD, 0x00},
-            Package () {0x000AFFFF, 0x03, \_SB.PCI0.LPC.LNKA, 0x00},
-
-            Package () {0x000BFFFF, 0x00, \_SB.PCI0.LPC.LNKC, 0x00},
-            Package () {0x000BFFFF, 0x01, \_SB.PCI0.LPC.LNKD, 0x00},
-            Package () {0x000BFFFF, 0x02, \_SB.PCI0.LPC.LNKA, 0x00},
-            Package () {0x000BFFFF, 0x03, \_SB.PCI0.LPC.LNKB, 0x00},
-
-            Package () {0x000CFFFF, 0x00, \_SB.PCI0.LPC.LNKD, 0x00},
-            Package () {0x000CFFFF, 0x01, \_SB.PCI0.LPC.LNKA, 0x00},
-            Package () {0x000CFFFF, 0x02, \_SB.PCI0.LPC.LNKB, 0x00},
-            Package () {0x000CFFFF, 0x03, \_SB.PCI0.LPC.LNKC, 0x00},
-
-            Package () {0x000DFFFF, 0x00, \_SB.PCI0.LPC.LNKA, 0x00},
-            Package () {0x000DFFFF, 0x01, \_SB.PCI0.LPC.LNKB, 0x00},
-            Package () {0x000DFFFF, 0x02, \_SB.PCI0.LPC.LNKC, 0x00},
-            Package () {0x000DFFFF, 0x03, \_SB.PCI0.LPC.LNKD, 0x00},
-
-            Package () {0x000EFFFF, 0x00, \_SB.PCI0.LPC.LNKB, 0x00},
-            Package () {0x000EFFFF, 0x01, \_SB.PCI0.LPC.LNKC, 0x00},
-            Package () {0x000EFFFF, 0x02, \_SB.PCI0.LPC.LNKD, 0x00},
-            Package () {0x000EFFFF, 0x03, \_SB.PCI0.LPC.LNKA, 0x00},
-
-            Package () {0x000FFFFF, 0x00, \_SB.PCI0.LPC.LNKC, 0x00},
-            Package () {0x000FFFFF, 0x01, \_SB.PCI0.LPC.LNKD, 0x00},
-            Package () {0x000FFFFF, 0x02, \_SB.PCI0.LPC.LNKA, 0x00},
-            Package () {0x000FFFFF, 0x03, \_SB.PCI0.LPC.LNKB, 0x00}
-          }
-        )
-      }
-
-      //
-      // PCI to ISA Bridge (Bus 0, Device 1, Function 0)
-      // "Low Pin Count"
-      //
-      Device (LPC) {
-        Name (_ADR, 0x00010000)
-
-        //
-        // The SCI cannot be rerouted or disabled with PIRQRC[A:D]; we only
-        // need this link device in order to specify the polarity.
-        //
-        Device (LNKS) {
-          Name (_HID, EISAID("PNP0C0F"))
-          Name (_UID, 0)
-
-          Name (_STA, 0xB) // 0x1: device present
-                           // 0x2: enabled and decoding resources
-                           // 0x8: functioning properly
-
-          Method (_SRS, 1, NotSerialized) { /* no-op */ }
-          Method (_DIS, 0, NotSerialized) { /* no-op */ }
-
-          Name (_PRS, ResourceTemplate () {
-            Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) { 9 }
-            //
-            // list of IRQs occupied thus far: 9
-            //
-          })
-          Method (_CRS, 0, NotSerialized) { Return (_PRS) }
-        }
-
-        //
-        // PCI Interrupt Routing Configuration Registers, PIRQRC[A:D]
-        //
-        OperationRegion (PRR0, PCI_Config, 0x60, 0x04)
-        Field (PRR0, ANYACC, NOLOCK, PRESERVE) {
-          PIRA, 8,
-          PIRB, 8,
-          PIRC, 8,
-          PIRD, 8
-        }
-
-        //
-        // _STA method for LNKA, LNKB, LNKC, LNKD
-        // Arg0[in]: value of PIRA / PIRB / PIRC / PIRD
-        //
-        Method (PSTA, 1, NotSerialized) {
-          If (And (Arg0, 0x80)) { // disable-bit set?
-            Return (0x9)          // "device present" | "functioning properly"
-          } Else {
-            Return (0xB)          // same | "enabled and decoding resources"
-          }
-        }
-
-        //
-        // _CRS method for LNKA, LNKB, LNKC, LNKD
-        // Arg0[in]: value of PIRA / PIRB / PIRC / PIRD
-        //
-        Method (PCRS, 1, Serialized) {
-          //
-          // create temporary buffer with an Extended Interrupt Descriptor
-          // whose single vector defaults to zero
-          //
-          Name (BUF0, ResourceTemplate () {
-              Interrupt (ResourceConsumer, Level, ActiveHigh, Shared){0}
-            }
-          )
-
-          //
-          // define reference to first interrupt vector in buffer
-          //
-          CreateDWordField (BUF0, 0x05, IRQW)
-
-          //
-          // If the disable-bit is clear, overwrite the default zero vector
-          // with the value in Arg0 (ie. PIRQRC[A:D]). Reserved bits are read
-          // as 0.
-          //
-          If (LNot (And (Arg0, 0x80))) {
-            Store (Arg0, IRQW)
-          }
-          Return (BUF0)
-        }
-
-        //
-        // _PRS resource for LNKA, LNKB, LNKC, LNKD
-        //
-        Name (PPRS, ResourceTemplate () {
-          Interrupt (ResourceConsumer, Level, ActiveHigh, Shared) {5, 10, 11}
-          //
-          // list of IRQs occupied thus far: 9, 5, 10, 11
-          //
-        })
-
-        //
-        // PCI IRQ Link A
-        //
-        Device (LNKA) {
-          Name (_HID, EISAID("PNP0C0F"))
-          Name (_UID, 1)
-
-          Method (_STA, 0, NotSerialized) { Return (PSTA (PIRA)) }
-          Method (_DIS, 0, NotSerialized) {
-            Or (PIRA, 0x80, PIRA) // set disable-bit
-          }
-          Method (_CRS, 0, NotSerialized) { Return (PCRS (PIRA)) }
-          Method (_PRS, 0, NotSerialized) { Return (PPRS) }
-          Method (_SRS, 1, NotSerialized) {
-            CreateDWordField (Arg0, 0x05, IRQW)
-            Store (IRQW, PIRA)
-          }
-        }
-
-        //
-        // PCI IRQ Link B
-        //
-        Device (LNKB) {
-          Name (_HID, EISAID("PNP0C0F"))
-          Name (_UID, 2)
-
-          Method (_STA, 0, NotSerialized) { Return (PSTA (PIRB)) }
-          Method (_DIS, 0, NotSerialized) {
-            Or (PIRB, 0x80, PIRB) // set disable-bit
-          }
-          Method (_CRS, 0, NotSerialized) { Return (PCRS (PIRB)) }
-          Method (_PRS, 0, NotSerialized) { Return (PPRS) }
-          Method (_SRS, 1, NotSerialized) {
-            CreateDWordField (Arg0, 0x05, IRQW)
-            Store (IRQW, PIRB)
-          }
-        }
-
-        //
-        // PCI IRQ Link C
-        //
-        Device (LNKC) {
-          Name (_HID, EISAID("PNP0C0F"))
-          Name (_UID, 3)
-
-          Method (_STA, 0, NotSerialized) { Return (PSTA (PIRC)) }
-          Method (_DIS, 0, NotSerialized) {
-            Or (PIRC, 0x80, PIRC) // set disable-bit
-          }
-          Method (_CRS, 0, NotSerialized) { Return (PCRS (PIRC)) }
-          Method (_PRS, 0, NotSerialized) { Return (PPRS) }
-          Method (_SRS, 1, NotSerialized) {
-            CreateDWordField (Arg0, 0x05, IRQW)
-            Store (IRQW, PIRC)
-          }
-        }
-
-        //
-        // PCI IRQ Link D
-        //
-        Device (LNKD) {
-          Name (_HID, EISAID("PNP0C0F"))
-          Name (_UID, 4)
-
-          Method (_STA, 0, NotSerialized) { Return (PSTA (PIRD)) }
-          Method (_DIS, 0, NotSerialized) {
-            Or (PIRD, 0x80, PIRD) // set disable-bit
-          }
-          Method (_CRS, 0, NotSerialized) { Return (PCRS (PIRD)) }
-          Method (_PRS, 0, NotSerialized) { Return (PPRS) }
-          Method (_SRS, 1, NotSerialized) {
-            CreateDWordField (Arg0, 0x05, IRQW)
-            Store (IRQW, PIRD)
-          }
-        }
-
-        //
-        // Programmable Interrupt Controller (PIC)
-        //
-        Device(PIC) {
-          Name (_HID, EISAID ("PNP0000"))
-          Name (_CRS, ResourceTemplate () {
-            IO (Decode16, 0x020, 0x020, 0x00, 0x02)
-            IO (Decode16, 0x0A0, 0x0A0, 0x00, 0x02)
-            IO (Decode16, 0x4D0, 0x4D0, 0x00, 0x02)
-            IRQNoFlags () {2}
-            //
-            // list of IRQs occupied thus far: 9, 5, 10, 11, 2
-            //
-          })
-        }
-
-        //
-        // ISA DMA
-        //
-        Device (DMAC) {
-          Name (_HID, EISAID ("PNP0200"))
-          Name (_CRS, ResourceTemplate () {
-            IO (Decode16, 0x00, 0x00, 0, 0x10)
-            IO (Decode16, 0x81, 0x81, 0, 0x03)
-            IO (Decode16, 0x87, 0x87, 0, 0x01)
-            IO (Decode16, 0x89, 0x89, 0, 0x03)
-            IO (Decode16, 0x8f, 0x8f, 0, 0x01)
-            IO (Decode16, 0xc0, 0xc0, 0, 0x20)
-            DMA (Compatibility, NotBusMaster, Transfer8) {4}
-          })
-        }
-
-        //
-        // 8254 Timer
-        //
-        Device(TMR) {
-          Name(_HID,EISAID("PNP0100"))
-          Name(_CRS, ResourceTemplate () {
-            IO (Decode16, 0x40, 0x40, 0x00, 0x04)
-            IRQNoFlags () {0}
-            //
-            // list of IRQs occupied thus far: 9, 5, 10, 11, 2, 0
-            //
-          })
-        }
-
-        //
-        // Real Time Clock
-        //
-        Device (RTC) {
-          Name (_HID, EISAID ("PNP0B00"))
-          Name (_CRS, ResourceTemplate () {
-            IO (Decode16, 0x70, 0x70, 0x00, 0x02)
-            IRQNoFlags () {8}
-            //
-            // list of IRQs occupied thus far: 9, 5, 10, 11, 2, 0, 8
-            //
-          })
-        }
-
-        //
-        // PCAT Speaker
-        //
-        Device(SPKR) {
-          Name (_HID, EISAID("PNP0800"))
-          Name (_CRS, ResourceTemplate () {
-            IO (Decode16, 0x61, 0x61, 0x01, 0x01)
-          })
-        }
-
-        //
-        // Floating Point Coprocessor
-        //
-        Device(FPU) {
-          Name (_HID, EISAID("PNP0C04"))
-          Name (_CRS, ResourceTemplate () {
-            IO (Decode16, 0xF0, 0xF0, 0x00, 0x10)
-            IRQNoFlags () {13}
-            //
-            // list of IRQs occupied thus far: 9, 5, 10, 11, 2, 0, 8, 13
-            //
-          })
-        }
-
-        //
-        // Generic motherboard devices and pieces that don't fit anywhere else
-        //
-        Device(XTRA) {
-          Name (_HID, EISAID ("PNP0C02"))
-          Name (_UID, 0x01)
-          Name (_CRS, ResourceTemplate () {
-            IO (Decode16, 0x010, 0x010, 0x00, 0x10)
-            IO (Decode16, 0x022, 0x022, 0x00, 0x1E)
-            IO (Decode16, 0x044, 0x044, 0x00, 0x1C)
-            IO (Decode16, 0x062, 0x062, 0x00, 0x02)
-            IO (Decode16, 0x065, 0x065, 0x00, 0x0B)
-            IO (Decode16, 0x072, 0x072, 0x00, 0x0E)
-            IO (Decode16, 0x080, 0x080, 0x00, 0x01)
-            IO (Decode16, 0x084, 0x084, 0x00, 0x03)
-            IO (Decode16, 0x088, 0x088, 0x00, 0x01)
-            IO (Decode16, 0x08c, 0x08c, 0x00, 0x03)
-            IO (Decode16, 0x090, 0x090, 0x00, 0x10)
-            IO (Decode16, 0x0A2, 0x0A2, 0x00, 0x1E)
-            IO (Decode16, 0x0E0, 0x0E0, 0x00, 0x10)
-            IO (Decode16, 0x1E0, 0x1E0, 0x00, 0x10)
-            IO (Decode16, 0x160, 0x160, 0x00, 0x10)
-            IO (Decode16, 0x278, 0x278, 0x00, 0x08)
-            IO (Decode16, 0x370, 0x370, 0x00, 0x02)
-            IO (Decode16, 0x378, 0x378, 0x00, 0x08)
-            IO (Decode16, FixedPcdGet16 (PcdDebugIoPort), FixedPcdGet16 (PcdDebugIoPort), 0x00, 0x01)
-            IO (Decode16, 0x440, 0x440, 0x00, 0x10)
-            IO (Decode16, 0x678, 0x678, 0x00, 0x08)
-            IO (Decode16, 0x778, 0x778, 0x00, 0x08)
-            IO (Decode16, 0xafe0, 0xafe0, 0x00, 0x04)      // QEMU GPE0 BLK
-            IO (Decode16, 0xb000, 0xb000, 0x00, 0x40)      // PMBLK1
-            Memory32Fixed (ReadOnly, 0xFEC00000, 0x1000)   // IO APIC
-            Memory32Fixed (ReadOnly, 0xFEE00000, 0x100000) // LAPIC
-          })
-        }
-
-        //
-        // PS/2 Keyboard and PC/AT Enhanced Keyboard 101/102
-        //
-        Device (PS2K) {
-          Name (_HID, EISAID ("PNP0303"))
-          Name (_CID, EISAID ("PNP030B"))
-          Name(_CRS,ResourceTemplate() {
-            IO (Decode16, 0x60, 0x60, 0x00, 0x01)
-            IO (Decode16, 0x64, 0x64, 0x00, 0x01)
-            IRQNoFlags () {1}
-            //
-            // list of IRQs occupied thus far: 9, 5, 10, 11, 2, 0, 8, 13, 1
-            //
-          })
-        }
-
-        //
-        // PS/2 Mouse and Microsoft Mouse
-        //
-        Device (PS2M) {  // PS/2 stype mouse port
-          Name (_HID, EISAID ("PNP0F03"))
-          Name (_CID, EISAID ("PNP0F13"))
-          Name (_CRS, ResourceTemplate() {
-            IRQNoFlags () {12}
-            //
-            // list of IRQs occupied thus far:
-            // 9, 5, 10, 11, 2, 0, 8, 13, 1, 12
-            //
-          })
-        }
-
-        //
-        // UART Serial Port - COM1
-        //
-        Device (UAR1) {
-          Name (_HID, EISAID ("PNP0501"))
-          Name (_DDN, "COM1")
-          Name (_UID, 0x01)
-          Name(_CRS,ResourceTemplate() {
-            IO (Decode16, 0x3F8, 0x3F8, 0x01, 0x08)
-            IRQ (Edge, ActiveHigh, Exclusive, ) {4}
-            //
-            // list of IRQs occupied thus far:
-            // 9, 5, 10, 11, 2, 0, 8, 13, 1, 12, 4
-            //
-          })
-        }
-
-        //
-        // UART Serial Port - COM2
-        //
-        Device (UAR2) {
-          Name (_HID, EISAID ("PNP0501"))
-          Name (_DDN, "COM2")
-          Name (_UID, 0x02)
-          Name(_CRS,ResourceTemplate() {
-            IO (Decode16, 0x2F8, 0x2F8, 0x01, 0x08)
-            IRQ (Edge, ActiveHigh, Exclusive, ) {3}
-            //
-            // list of IRQs occupied thus far:
-            // 9, 5, 10, 11, 2, 0, 8, 13, 1, 12, 4, 3
-            //
-          })
-        }
-
-        //
-        // Floppy Disk Controller
-        //
-        Device (FDC) {
-          Name (_HID, EISAID ("PNP0700"))
-          Name (_CRS,ResourceTemplate() {
-            IO (Decode16, 0x3F0, 0x3F0, 0x01, 0x06)
-            IO (Decode16, 0x3F7, 0x3F7, 0x01, 0x01)
-            IRQNoFlags () {6}
-            //
-            // list of IRQs occupied thus far:
-            // 9, 5, 10, 11, 2, 0, 8, 13, 1, 12, 4, 3, 6
-            //
-            DMA (Compatibility, NotBusMaster, Transfer8) {2}
-          })
-        }
-
-        //
-        // parallel port -- no DMA for now
-        //
-        Device (PAR1) {
-          Name (_HID, EISAID ("PNP0400"))
-          Name (_DDN, "LPT1")
-          Name (_UID, 0x01)
-          Name(_CRS, ResourceTemplate() {
-            IO (Decode16, 0x0378, 0x0378, 0x00, 0x08)
-            IRQNoFlags () {7}
-            //
-            // list of IRQs occupied thus far:
-            // 9, 5, 10, 11, 2, 0, 8, 13, 1, 12, 4, 3, 6, 7
-            // in order:
-            // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
-            //
-          })
-        }
-      }
-    }
-  }
-}
diff --git a/OvmfPkg/AcpiTables/Facp.aslc b/OvmfPkg/AcpiTables/Facp.aslc
deleted file mode 100644
index 657a8c645821..000000000000
--- a/OvmfPkg/AcpiTables/Facp.aslc
+++ /dev/null
@@ -1,89 +0,0 @@
-/** @file
-  FACP Table
-
-  Copyright (c) 2013, Red Hat, Inc.
-  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include "Platform.h"
-
-EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE FACP = {
-  {
-    EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
-    sizeof (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE),
-    EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
-    0,                          // to make sum of entire table == 0
-    {EFI_ACPI_OEM_ID},          // OEMID is a 6 bytes long field
-    EFI_ACPI_OEM_TABLE_ID,      // OEM table identification(8 bytes long)
-    EFI_ACPI_OEM_REVISION,      // OEM revision number
-    EFI_ACPI_CREATOR_ID,        // ASL compiler vendor ID
-    EFI_ACPI_CREATOR_REVISION   // ASL compiler revision number
-  },
-  0,                // Physical address of FACS
-  0,                // Physical address of DSDT
-  RESERVED,         // System Interrupt Model in ACPI 1.0, eliminated in 2.0
-  EFI_ACPI_2_0_PM_PROFILE_UNSPECIFIED, // Preferred PM profile
-  SCI_INT_VECTOR,   // System vector of SCI interrupt
-  SMI_CMD_IO_PORT,  // Port address of SMI command port
-  ACPI_ENABLE,      // value to write to port smi_cmd to enable ACPI
-  ACPI_DISABLE,     // value to write to port smi_cmd to disable ACPI
-  S4BIOS_REQ,       // Value to write to SMI CMD port to enter the S4BIOS state
-  0,                // PState control
-  PM1a_EVT_BLK,     // Port address of Power Mgt 1a Event Reg Blk
-  0,                // Power Mgt 1b Event Reg Blk unsupported
-  PM1a_CNT_BLK,     // Port address of Power Mgt 1a Ctrl Reg Blk
-  0,                // Power Mgt 1b Ctrl Reg Blk unsupported
-  0,                // Power Mgt 2  Ctrl Reg Blk unsupported
-  PM_TMR_BLK,       // Port address of Power Mgt Timer Ctrl Reg Blk
-  GPE0_BLK,         // Port addr of General Purpose Event 0 Reg Blk
-  0,                // General Purpose Event 1 Reg Blk unsupported
-  PM1_EVT_LEN,      // Byte Length of ports at pm1X_evt_blk
-  PM1_CNT_LEN,      // Byte Length of ports at pm1X_cnt_blk
-  0,                // Power Mgt 2 Ctrl Reg Blk unsupported
-  PM_TM_LEN,        // Byte Length of ports at pm_tm_blk
-  GPE0_BLK_LEN,     // Byte Length of ports at gpe0_blk
-  0,                // General Purpose Event 1 Reg Blk unsupported
-  0,                // General Purpose Event 1 Reg Blk unsupported
-  0,                // _CST support
-  P_LVL2_LAT,       // worst case HW latency to enter/exit C2 state
-  P_LVL3_LAT,       // worst case HW latency to enter/exit C3 state
-  FLUSH_SIZE,       // Size of area read to flush caches
-  FLUSH_STRIDE,     // Stride used in flushing caches
-  DUTY_OFFSET,      // bit location of duty cycle field in p_cnt reg
-  DUTY_WIDTH,       // bit width of duty cycle field in p_cnt reg
-  DAY_ALRM,         // index to day-of-month alarm in RTC CMOS RAM
-  MON_ALRM,         // index to month-of-year alarm in RTC CMOS RAM
-  CENTURY,          // index to century in RTC CMOS RAM
-  0x0000,           // Boot architecture flag (16-bit)
-  RESERVED,         // reserved
-  FLAG,             // Fixed feature flags
-  GAS2_IO(RESET_REG, 1), // Extended address of the Reset Register
-  RESET_VALUE,           // Value for the Reset Register to reset the system
-  { RESERVED },     // reserved[3]
-  0,                // 64-bit physical address of FACS, set at installation
-  0,                // 64-bit physical address of DSDT, set at installation
-
-  GAS2_IO(PM1a_EVT_BLK, PM1_EVT_LEN), // Ext. addr. of PM 1a Event Reg Blk
-  { 0 },                              // PM 1b Event Reg Blk unsupported
-  GAS2_IO(PM1a_CNT_BLK, PM1_CNT_LEN), // Ext. addr. of PM 1a Ctrl Reg Blk
-  { 0 },                              // PM 1b Ctrl Reg Blk unsupported
-  { 0 },                              // PM 2  Ctrl Reg Blk unsupported
-  GAS2_IO(PM_TMR_BLK, PM_TM_LEN),     // Ext. addr. of PM Timer Ctrl Reg Blk
-  GAS2_IO(GPE0_BLK, GPE0_BLK_LEN),    // Ext. addr. of GPE 0 Reg Blk
-  { 0 }                               // GPE 1 Reg Blk unsupported
-};
-
-
-VOID*
-ReferenceAcpiTable (
-  VOID
-  )
-{
-  //
-  // Reference the table being generated to prevent the optimizer from removing the
-  // data structure from the executable
-  //
-  return (VOID*)&FACP;
-}
diff --git a/OvmfPkg/AcpiTables/Facs.aslc b/OvmfPkg/AcpiTables/Facs.aslc
deleted file mode 100644
index d4e6ac4b6bad..000000000000
--- a/OvmfPkg/AcpiTables/Facs.aslc
+++ /dev/null
@@ -1,78 +0,0 @@
-/** @file
-  FACS Table
-
-  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <IndustryStandard/Acpi.h>
-
-EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE FACS = {
-  EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE,
-  sizeof (EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE),
-
-  //
-  // Hardware Signature will be updated at runtime
-  //
-  0x00000000,
-  0x00,
-  0x00,
-  0x00,
-  {
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE,
-    EFI_ACPI_RESERVED_BYTE
-  }
-};
-
-
-VOID*
-ReferenceAcpiTable (
-  VOID
-  )
-{
-  //
-  // Reference the table being generated to prevent the optimizer from removing the
-  // data structure from the executable
-  //
-  return (VOID*)&FACS;
-}
-
diff --git a/OvmfPkg/AcpiTables/Madt.aslc b/OvmfPkg/AcpiTables/Madt.aslc
deleted file mode 100644
index 02fc3649a0d0..000000000000
--- a/OvmfPkg/AcpiTables/Madt.aslc
+++ /dev/null
@@ -1,153 +0,0 @@
-/** @file
-  MADT Table
-
-  This file contains a structure definition for the ACPI 1.0 Multiple APIC
-  Description Table (MADT).
-
-  Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <IndustryStandard/Acpi.h>
-#include <Platform.h>
-
-//
-// Local APIC address
-//
-#define EFI_ACPI_LOCAL_APIC_ADDRESS 0xFEE00000 // TBD
-
-//
-// Multiple APIC Flags are defined in AcpiX.0.h
-//
-#define EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS (EFI_ACPI_1_0_PCAT_COMPAT)
-
-//
-// Define the number of each table type.
-// This is where the table layout is modified.
-//
-#define EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT           1
-#define EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT      2
-#define EFI_ACPI_IO_APIC_COUNT                        1
-
-//
-// Ensure proper structure formats
-//
-#pragma pack (1)
-
-//
-// ACPI 1.0 MADT structure
-//
-typedef struct {
-  EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER   Header;
-
-#if EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT > 0
-  EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE           LocalApic[EFI_ACPI_PROCESSOR_LOCAL_APIC_COUNT];
-#endif
-
-#if EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT > 0
-  EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE      Iso[EFI_ACPI_INTERRUPT_SOURCE_OVERRIDE_COUNT];
-#endif
-
-#if EFI_ACPI_IO_APIC_COUNT > 0
-  EFI_ACPI_1_0_IO_APIC_STRUCTURE                        IoApic[EFI_ACPI_IO_APIC_COUNT];
-#endif
-
-} EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE;
-
-#pragma pack ()
-
-//
-// Multiple APIC Description Table
-//
-EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
-  {
-    {
-      EFI_ACPI_1_0_APIC_SIGNATURE,
-      sizeof (EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE),
-      EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
-      0x00,                                                     // Checksum will be updated at runtime
-      {EFI_ACPI_OEM_ID},
-      EFI_ACPI_OEM_TABLE_ID,
-      EFI_ACPI_OEM_REVISION,
-      EFI_ACPI_CREATOR_ID,
-      EFI_ACPI_CREATOR_REVISION
-    },
-
-    //
-    // MADT specific fields
-    //
-    EFI_ACPI_LOCAL_APIC_ADDRESS,
-    EFI_ACPI_1_0_MULTIPLE_APIC_FLAGS,
-  },
-
-  //
-  // Processor Local APIC Structure
-  //
-  {
-    {
-      EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC,                        // Type
-      sizeof (EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE),     // Length
-      0x00,                                                     // Processor ID
-      0x00,                                                     // Local APIC ID
-      0x00000001                                                // Flags - Enabled by default
-    }
-  },
-
-  //
-  // Interrupt Source Override Structure
-  //
-
-  {
-    {
-      //
-      // IRQ0=>IRQ2 Interrupt Source Override Structure
-      //
-      EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE,                   // Type
-      sizeof (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length
-      0x00,                                                     // Bus - ISA
-      0x00,                                                     // Source - IRQ0
-      0x00000002,                                               // Global System Interrupt - IRQ2
-      0x0000                                                    // Flags - Conforms to specifications of the bus
-    },
-
-    {
-      //
-      // ISO (SCI Active High) Interrupt Source Override Structure
-      //
-      EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE,                   // Type
-      sizeof (EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE),// Length
-      0x00,                                                     // Bus - ISA
-      0x09,                                                     // Source - IRQ0
-      0x00000009,                                               // Global System Interrupt - IRQ2
-      0x000D                                                    // Flags - Level-tiggered, Active High
-    }
-  },
-
-  //
-  // IO APIC Structure
-  //
-  {
-    {
-      EFI_ACPI_1_0_IO_APIC,                                     // Type
-      sizeof (EFI_ACPI_1_0_IO_APIC_STRUCTURE),                  // Length
-      0x02,                                                     // IO APIC ID
-      EFI_ACPI_RESERVED_BYTE,                                   // Reserved
-      0xFEC00000,                                               // IO APIC Address (physical)
-      0x00000000                                                // Global System Interrupt Base
-    }
-  },
-};
-
-
-VOID*
-ReferenceAcpiTable (
-  VOID
-  )
-{
-  //
-  // Reference the table being generated to prevent the optimizer from removing the
-  // data structure from the executable
-  //
-  return (VOID*)&Madt;
-}
diff --git a/OvmfPkg/AcpiTables/Ssdt.asl b/OvmfPkg/AcpiTables/Ssdt.asl
deleted file mode 100644
index 6926e56dafc1..000000000000
--- a/OvmfPkg/AcpiTables/Ssdt.asl
+++ /dev/null
@@ -1,13 +0,0 @@
-/** @file
-  Placeholder for runtime-generated objects.
-
-  This empty table provides only a header for dynamic copying and extension,
-  and a trigger for QemuInstallAcpiSsdtTable().
-
-  Copyright (C) 2012 Red Hat, Inc.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-DefinitionBlock ("Ssdt.aml", "SSDT", 1, "REDHAT", "OVMF    ", 1) {
-}
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 19/43] OvmfPkg/OvmfXen: make "PcdPciDisableBusEnumeration" Fixed-at-Build
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (17 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 18/43] OvmfPkg/AcpiTables: remove unused module Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:42   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 20/43] OvmfPkg/XenAcpiPlatformDxe: remove delayed ACPI table installation Laszlo Ersek
                   ` (26 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Philippe Mathieu-Daudé

The OvmfXen platform specifies the dynamic access method for
"PcdPciDisableBusEnumeration" needlessly.

After the DSC file sets the PCD to TRUE by default, the InitializeXen()
function in XenPlatformPei superfluously sets the PCD to TRUE again. There
are no other writes to the PCD in the platform.

Make the PCD Fixed-At-Build, and remove the access (in fact, the whole
InitializeXen() function) from XenPlatformPei.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/OvmfXen.dsc                       |  2 +-
 OvmfPkg/XenPlatformPei/XenPlatformPei.inf |  1 -
 OvmfPkg/XenPlatformPei/Platform.h         |  5 -----
 OvmfPkg/XenPlatformPei/Platform.c         |  1 -
 OvmfPkg/XenPlatformPei/Xen.c              | 20 --------------------
 5 files changed, 1 insertion(+), 28 deletions(-)

diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index bcf64242d05c..779bcc3f8b9a 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -357,12 +357,13 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
 !ifdef $(CSM_ENABLE)
   gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE
 !endif
 
 [PcdsFixedAtBuild]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
   gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
   gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
   gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|0
 !if ($(FD_SIZE_IN_KB) == 1024) || ($(FD_SIZE_IN_KB) == 2048)
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
@@ -458,13 +459,12 @@ [PcdsFixedAtBuild]
 
 [PcdsDynamicDefault]
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0
diff --git a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
index 87dd4b24679a..597cb6fcd7ff 100644
--- a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
+++ b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
@@ -78,13 +78,12 @@ [Pcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size
   gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
   gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
   gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask
   gEfiMdePkgTokenSpaceGuid.PcdFSBClock
   gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy
   gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress
diff --git a/OvmfPkg/XenPlatformPei/Platform.h b/OvmfPkg/XenPlatformPei/Platform.h
index 77d88fc159d7..67887c9c4cd9 100644
--- a/OvmfPkg/XenPlatformPei/Platform.h
+++ b/OvmfPkg/XenPlatformPei/Platform.h
@@ -88,17 +88,12 @@ InstallClearCacheCallback (
 
 EFI_STATUS
 XenConnect (
   VOID
   );
 
-EFI_STATUS
-InitializeXen (
-  VOID
-  );
-
 BOOLEAN
 XenDetect (
   VOID
   );
 
 BOOLEAN
diff --git a/OvmfPkg/XenPlatformPei/Platform.c b/OvmfPkg/XenPlatformPei/Platform.c
index e9511eb40c62..a811e72ee301 100644
--- a/OvmfPkg/XenPlatformPei/Platform.c
+++ b/OvmfPkg/XenPlatformPei/Platform.c
@@ -444,13 +444,12 @@ InitializeXenPlatform (
   mHostBridgeDevId = PciRead16 (OVMF_HOSTBRIDGE_DID);
 
   PublishPeiMemory ();
 
   InitializeRamRegions ();
 
-  InitializeXen ();
   CalibrateLapicTimer ();
 
   if (mBootMode != BOOT_ON_S3_RESUME) {
     ReserveEmuVariableNvStore ();
     PeiFvInitialization ();
     MemMapInitialization ();
diff --git a/OvmfPkg/XenPlatformPei/Xen.c b/OvmfPkg/XenPlatformPei/Xen.c
index cf14ee8eb3a0..a4e82b356936 100644
--- a/OvmfPkg/XenPlatformPei/Xen.c
+++ b/OvmfPkg/XenPlatformPei/Xen.c
@@ -369,32 +369,12 @@ XenPublishRamRegions (
       break;
     }
   }
 }
 
 
-/**
-  Perform Xen PEI initialization.
-
-  @return EFI_SUCCESS     Xen initialized successfully
-  @return EFI_NOT_FOUND   Not running under Xen
-
-**/
-EFI_STATUS
-InitializeXen (
-  VOID
-  )
-{
-  RETURN_STATUS PcdStatus;
-
-  PcdStatus = PcdSetBoolS (PcdPciDisableBusEnumeration, TRUE);
-  ASSERT_RETURN_ERROR (PcdStatus);
-
-  return EFI_SUCCESS;
-}
-
 EFI_STATUS
 PhysicalAddressIdentityMapping (
   IN EFI_PHYSICAL_ADDRESS   AddressToMap
   )
 {
   INTN                            Index;
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 20/43] OvmfPkg/XenAcpiPlatformDxe: remove delayed ACPI table installation
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (18 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 19/43] OvmfPkg/OvmfXen: make "PcdPciDisableBusEnumeration" Fixed-at-Build Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:28   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 21/43] OvmfPkg/PlatformPei: remove Xen support Laszlo Ersek
                   ` (25 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Philippe Mathieu-Daudé

Because "PcdPciDisableBusEnumeration" is always TRUE in the OvmfXen
platform, we can remove the delayed ACPI table installation from
XenAcpiPlatformDxe. A number of dependencies become useless this way;
remove them too.

(Note that, conversely, in the QemuFwCfgAcpiPlatformDxe driver, we
*cannot* assume that "PcdPciDisableBusEnumeration" is always FALSE,
regardless of Xen: in the ArmVirtQemu platform, the PCD may carry either
FALSE or TRUE, dependent on whether or not the QEMU "virt" machine
configuration includes a PCIe host controller, respectively.)

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf |  8 ---
 OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c           | 56 +-------------------
 2 files changed, 2 insertions(+), 62 deletions(-)

diff --git a/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf b/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
index db9b6e093de4..d3a6353a50a6 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
+++ b/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
@@ -25,29 +25,21 @@ [Sources]
   AcpiPlatform.c
   AcpiPlatform.h
   EntryPoint.c
   Xen.c
 
 [Packages]
-  MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
   BaseLib
   DebugLib
-  PcdLib
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   XenPlatformLib
 
 [Protocols]
   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
 
-[Guids]
-  gRootBridgesConnectedEventGroupGuid
-
-[Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
-
 [Depex]
   gEfiAcpiTableProtocolGuid
diff --git a/OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c b/OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
index b6d0835fe3d4..1a23790a3b2c 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
@@ -4,15 +4,13 @@
   Copyright (C) 2015-2021, Red Hat, Inc.
   Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
-#include <Guid/RootBridgesConnectedEventGroup.h> // gRootBridgesConnectedEve...
-#include <Library/DebugLib.h>                    // DEBUG()
-#include <Library/PcdLib.h>                      // PcdGetBool()
+#include <Library/DebugLib.h>                    // ASSERT_EFI_ERROR()
 #include <Library/UefiBootServicesTableLib.h>    // gBS
 #include <Protocol/AcpiTable.h>                  // EFI_ACPI_TABLE_PROTOCOL
 
 #include "AcpiPlatform.h"
 
 STATIC
@@ -31,65 +29,15 @@ FindAcpiTableProtocol (
                   );
   ASSERT_EFI_ERROR (Status);
   return AcpiTable;
 }
 
 
-STATIC
-VOID
-EFIAPI
-OnRootBridgesConnected (
-  IN EFI_EVENT Event,
-  IN VOID      *Context
-  )
-{
-  EFI_STATUS Status;
-
-  DEBUG ((DEBUG_INFO,
-    "%a: root bridges have been connected, installing ACPI tables\n",
-    __FUNCTION__));
-  Status = InstallAcpiTables (FindAcpiTableProtocol ());
-  if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status));
-  }
-  gBS->CloseEvent (Event);
-}
-
-
 EFI_STATUS
 EFIAPI
 AcpiPlatformEntryPoint (
   IN EFI_HANDLE         ImageHandle,
   IN EFI_SYSTEM_TABLE   *SystemTable
   )
 {
-  EFI_STATUS Status;
-  EFI_EVENT  RootBridgesConnected;
-
-  //
-  // If the platform doesn't support PCI, or PCI enumeration has been disabled,
-  // install the tables at once, and let the entry point's return code reflect
-  // the full functionality.
-  //
-  if (PcdGetBool (PcdPciDisableBusEnumeration)) {
-    DEBUG ((DEBUG_INFO, "%a: PCI or its enumeration disabled, installing "
-      "ACPI tables\n", __FUNCTION__));
-    return InstallAcpiTables (FindAcpiTableProtocol ());
-  }
-
-  //
-  // Otherwise, delay installing the ACPI tables until root bridges are
-  // connected. The entry point's return status will only reflect the callback
-  // setup. (Note that we're a DXE_DRIVER; our entry point function is invoked
-  // strictly before BDS is entered and can connect the root bridges.)
-  //
-  Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK,
-                  OnRootBridgesConnected, NULL /* Context */,
-                  &gRootBridgesConnectedEventGroupGuid, &RootBridgesConnected);
-  if (!EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_INFO,
-      "%a: waiting for root bridges to be connected, registered callback\n",
-      __FUNCTION__));
-  }
-
-  return Status;
+  return InstallAcpiTables (FindAcpiTableProtocol ());
 }
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 21/43] OvmfPkg/PlatformPei: remove Xen support
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (19 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 20/43] OvmfPkg/XenAcpiPlatformDxe: remove delayed ACPI table installation Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27 10:20   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 22/43] OvmfPkg: drop PcdPciDisableBusEnumeration from the IA32, IA32X64, X64 DSCs Laszlo Ersek
                   ` (24 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Andrew Fish, Ard Biesheuvel, Jordan Justen, Leif Lindholm,
	Michael D Kinney, Philippe Mathieu-Daudé

The "OvmfPkg/PlatformPei/PlatformPei.inf" module is used by the following
platform DSCs:

  OvmfPkg/AmdSev/AmdSevX64.dsc
  OvmfPkg/OvmfPkgIa32.dsc
  OvmfPkg/OvmfPkgIa32X64.dsc
  OvmfPkg/OvmfPkgX64.dsc

Remove Xen support from "OvmfPkg/PlatformPei", including any dependencies
that now become unused. The basic idea is to substitute FALSE for "mXen".

Remove "OvmfPkg/PlatformPei" from the "OvmfPkg: Xen-related modules"
section of "Maintainers.txt".

This patch is best reviewed with "git show -b -W".

Cc: Andrew Fish <afish@apple.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/PlatformPei/PlatformPei.inf |   4 -
 Maintainers.txt                     |   3 -
 OvmfPkg/PlatformPei/Platform.h      |  17 --
 OvmfPkg/PlatformPei/Xen.h           |  39 ----
 OvmfPkg/PlatformPei/MemDetect.c     |  10 +-
 OvmfPkg/PlatformPei/Platform.c      | 162 +++++++-------
 OvmfPkg/PlatformPei/Xen.c           | 222 --------------------
 7 files changed, 77 insertions(+), 380 deletions(-)

diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf
index 6ef77ba7bb21..89d1f7636870 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -30,26 +30,23 @@ [Sources]
   FeatureControl.c
   Fv.c
   MemDetect.c
   MemTypeInfo.c
   Platform.c
   Platform.h
-  Xen.c
-  Xen.h
 
 [Packages]
   EmbeddedPkg/EmbeddedPkg.dec
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
   SecurityPkg/SecurityPkg.dec
   UefiCpuPkg/UefiCpuPkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [Guids]
   gEfiMemoryTypeInformationGuid
-  gEfiXenInfoGuid
 
 [LibraryClasses]
   BaseLib
   CacheMaintenanceLib
   DebugLib
   HobLib
@@ -93,13 +90,12 @@ [Pcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes
   gUefiOvmfPkgTokenSpaceGuid.PcdQ35SmramAtDefaultSmbase
   gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
   gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable
   gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask
   gEfiMdeModulePkgTokenSpaceGuid.PcdGhcbBase
diff --git a/Maintainers.txt b/Maintainers.txt
index 82008a0046c6..be40a1d6f2b6 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -498,15 +498,12 @@ F: OvmfPkg/Library/XenConsoleSerialPortLib/
 F: OvmfPkg/Library/XenHypercallLib/
 F: OvmfPkg/Library/XenIoMmioLib/
 F: OvmfPkg/Library/XenPlatformLib/
 F: OvmfPkg/Library/XenRealTimeClockLib/
 F: OvmfPkg/OvmfXen.*
 F: OvmfPkg/OvmfXenElfHeaderGenerator.c
-F: OvmfPkg/PlatformPei/MemDetect.c
-F: OvmfPkg/PlatformPei/Platform.*
-F: OvmfPkg/PlatformPei/Xen.*
 F: OvmfPkg/SmbiosPlatformDxe/*Xen.c
 F: OvmfPkg/XenAcpiPlatformDxe/
 F: OvmfPkg/XenBusDxe/
 F: OvmfPkg/XenIoPciDxe/
 F: OvmfPkg/XenIoPvhDxe/
 F: OvmfPkg/XenPlatformPei/
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index 0484ec9e6b4c..8b1d270c2b0b 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -94,34 +94,17 @@ InstallFeatureControlCallback (
 
 VOID
 InstallClearCacheCallback (
   VOID
   );
 
-EFI_STATUS
-InitializeXen (
-  VOID
-  );
-
-BOOLEAN
-XenDetect (
-  VOID
-  );
-
 VOID
 AmdSevInitialize (
   VOID
   );
 
-extern BOOLEAN mXen;
-
-VOID
-XenPublishRamRegions (
-  VOID
-  );
-
 extern EFI_BOOT_MODE mBootMode;
 
 extern BOOLEAN mS3Supported;
 
 extern UINT8 mPhysMemAddressWidth;
 
diff --git a/OvmfPkg/PlatformPei/Xen.h b/OvmfPkg/PlatformPei/Xen.h
deleted file mode 100644
index 2605481280c0..000000000000
--- a/OvmfPkg/PlatformPei/Xen.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @file
-  Ovmf info structure passed by Xen
-
-Copyright (c) 2013, Citrix Systems UK Ltd.<BR>
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __XEN_H__
-#define __XEN_H__
-
-#include <PiPei.h>
-
-// Physical address of OVMF info
-#define OVMF_INFO_PHYSICAL_ADDRESS 0x00001000
-
-// This structure must match the definition on Xen side
-#pragma pack(1)
-typedef struct {
-  CHAR8 Signature[14]; // XenHVMOVMF\0
-  UINT8 Length;        // Length of this structure
-  UINT8 Checksum;      // Set such that the sum over bytes 0..length == 0
-  //
-  // Physical address of an array of TablesCount elements.
-  //
-  // Each element contains the physical address of a BIOS table.
-  //
-  EFI_PHYSICAL_ADDRESS Tables;
-  UINT32 TablesCount;
-  //
-  // Physical address of the E820 table, contains E820EntriesCount entries.
-  //
-  EFI_PHYSICAL_ADDRESS E820;
-  UINT32 E820EntriesCount;
-} EFI_XEN_OVMF_INFO;
-#pragma pack()
-
-#endif /* __XEN_H__ */
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
index c08aa2e45a53..2deec128f464 100644
--- a/OvmfPkg/PlatformPei/MemDetect.c
+++ b/OvmfPkg/PlatformPei/MemDetect.c
@@ -132,16 +132,12 @@ QemuUc32BaseInitialization (
   VOID
   )
 {
   UINT32 LowerMemorySize;
   UINT32 Uc32Size;
 
-  if (mXen) {
-    return;
-  }
-
   if (mHostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) {
     //
     // On q35, the 32-bit area that we'll mark as UC, through variable MTRRs,
     // starts at PcdPciExpressBaseAddress. The platform DSC is responsible for
     // setting PcdPciExpressBaseAddress such that describing the
     // [PcdPciExpressBaseAddress, 4GB) range require a very small number of
@@ -816,17 +812,13 @@ QemuInitializeRam (
 **/
 VOID
 InitializeRamRegions (
   VOID
   )
 {
-  if (!mXen) {
-    QemuInitializeRam ();
-  } else {
-    XenPublishRamRegions ();
-  }
+  QemuInitializeRam ();
 
   if (mS3Supported && mBootMode != BOOT_ON_S3_RESUME) {
     //
     // This is the memory range that will be used for PEI on S3 resume
     //
     BuildMemoryAllocationHob (
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 96468701e3b8..d3a20122a2ea 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -143,103 +143,100 @@ MemMapInitialization (
   VOID
   )
 {
   UINT64        PciIoBase;
   UINT64        PciIoSize;
   RETURN_STATUS PcdStatus;
+  UINT32        TopOfLowRam;
+  UINT64        PciExBarBase;
+  UINT32        PciBase;
+  UINT32        PciSize;
 
   PciIoBase = 0xC000;
   PciIoSize = 0x4000;
 
   //
   // Video memory + Legacy BIOS region
   //
   AddIoMemoryRangeHob (0x0A0000, BASE_1MB);
 
-  if (!mXen) {
-    UINT32  TopOfLowRam;
-    UINT64  PciExBarBase;
-    UINT32  PciBase;
-    UINT32  PciSize;
-
-    TopOfLowRam = GetSystemMemorySizeBelow4gb ();
-    PciExBarBase = 0;
-    if (mHostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) {
-      //
-      // The MMCONFIG area is expected to fall between the top of low RAM and
-      // the base of the 32-bit PCI host aperture.
-      //
-      PciExBarBase = FixedPcdGet64 (PcdPciExpressBaseAddress);
-      ASSERT (TopOfLowRam <= PciExBarBase);
-      ASSERT (PciExBarBase <= MAX_UINT32 - SIZE_256MB);
-      PciBase = (UINT32)(PciExBarBase + SIZE_256MB);
-    } else {
-      ASSERT (TopOfLowRam <= mQemuUc32Base);
-      PciBase = mQemuUc32Base;
-    }
-
+  TopOfLowRam = GetSystemMemorySizeBelow4gb ();
+  PciExBarBase = 0;
+  if (mHostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) {
     //
-    // address       purpose   size
-    // ------------  --------  -------------------------
-    // max(top, 2g)  PCI MMIO  0xFC000000 - max(top, 2g)
-    // 0xFC000000    gap                           44 MB
-    // 0xFEC00000    IO-APIC                        4 KB
-    // 0xFEC01000    gap                         1020 KB
-    // 0xFED00000    HPET                           1 KB
-    // 0xFED00400    gap                          111 KB
-    // 0xFED1C000    gap (PIIX4) / RCRB (ICH9)     16 KB
-    // 0xFED20000    gap                          896 KB
-    // 0xFEE00000    LAPIC                          1 MB
+    // The MMCONFIG area is expected to fall between the top of low RAM and
+    // the base of the 32-bit PCI host aperture.
     //
-    PciSize = 0xFC000000 - PciBase;
-    AddIoMemoryBaseSizeHob (PciBase, PciSize);
-    PcdStatus = PcdSet64S (PcdPciMmio32Base, PciBase);
-    ASSERT_RETURN_ERROR (PcdStatus);
-    PcdStatus = PcdSet64S (PcdPciMmio32Size, PciSize);
-    ASSERT_RETURN_ERROR (PcdStatus);
+    PciExBarBase = FixedPcdGet64 (PcdPciExpressBaseAddress);
+    ASSERT (TopOfLowRam <= PciExBarBase);
+    ASSERT (PciExBarBase <= MAX_UINT32 - SIZE_256MB);
+    PciBase = (UINT32)(PciExBarBase + SIZE_256MB);
+  } else {
+    ASSERT (TopOfLowRam <= mQemuUc32Base);
+    PciBase = mQemuUc32Base;
+  }
 
-    AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB);
-    AddIoMemoryBaseSizeHob (0xFED00000, SIZE_1KB);
-    if (mHostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) {
-      AddIoMemoryBaseSizeHob (ICH9_ROOT_COMPLEX_BASE, SIZE_16KB);
-      //
-      // Note: there should be an
-      //
-      //   AddIoMemoryBaseSizeHob (PciExBarBase, SIZE_256MB);
-      //
-      // call below, just like the one above for RCBA. However, Linux insists
-      // that the MMCONFIG area be marked in the E820 or UEFI memory map as
-      // "reserved memory" -- Linux does not content itself with a simple gap
-      // in the memory map wherever the MCFG ACPI table points to.
-      //
-      // This appears to be a safety measure. The PCI Firmware Specification
-      // (rev 3.1) says in 4.1.2. "MCFG Table Description": "The resources can
-      // *optionally* be returned in [...] EFIGetMemoryMap as reserved memory
-      // [...]". (Emphasis added here.)
-      //
-      // Normally we add memory resource descriptor HOBs in
-      // QemuInitializeRam(), and pre-allocate from those with memory
-      // allocation HOBs in InitializeRamRegions(). However, the MMCONFIG area
-      // is most definitely not RAM; so, as an exception, cover it with
-      // uncacheable reserved memory right here.
-      //
-      AddReservedMemoryBaseSizeHob (PciExBarBase, SIZE_256MB, FALSE);
-      BuildMemoryAllocationHob (PciExBarBase, SIZE_256MB,
-        EfiReservedMemoryType);
-    }
-    AddIoMemoryBaseSizeHob (PcdGet32(PcdCpuLocalApicBaseAddress), SIZE_1MB);
+  //
+  // address       purpose   size
+  // ------------  --------  -------------------------
+  // max(top, 2g)  PCI MMIO  0xFC000000 - max(top, 2g)
+  // 0xFC000000    gap                           44 MB
+  // 0xFEC00000    IO-APIC                        4 KB
+  // 0xFEC01000    gap                         1020 KB
+  // 0xFED00000    HPET                           1 KB
+  // 0xFED00400    gap                          111 KB
+  // 0xFED1C000    gap (PIIX4) / RCRB (ICH9)     16 KB
+  // 0xFED20000    gap                          896 KB
+  // 0xFEE00000    LAPIC                          1 MB
+  //
+  PciSize = 0xFC000000 - PciBase;
+  AddIoMemoryBaseSizeHob (PciBase, PciSize);
+  PcdStatus = PcdSet64S (PcdPciMmio32Base, PciBase);
+  ASSERT_RETURN_ERROR (PcdStatus);
+  PcdStatus = PcdSet64S (PcdPciMmio32Size, PciSize);
+  ASSERT_RETURN_ERROR (PcdStatus);
 
+  AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB);
+  AddIoMemoryBaseSizeHob (0xFED00000, SIZE_1KB);
+  if (mHostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) {
+    AddIoMemoryBaseSizeHob (ICH9_ROOT_COMPLEX_BASE, SIZE_16KB);
+    //
+    // Note: there should be an
+    //
+    //   AddIoMemoryBaseSizeHob (PciExBarBase, SIZE_256MB);
     //
-    // On Q35, the IO Port space is available for PCI resource allocations from
-    // 0x6000 up.
+    // call below, just like the one above for RCBA. However, Linux insists
+    // that the MMCONFIG area be marked in the E820 or UEFI memory map as
+    // "reserved memory" -- Linux does not content itself with a simple gap
+    // in the memory map wherever the MCFG ACPI table points to.
     //
-    if (mHostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) {
-      PciIoBase = 0x6000;
-      PciIoSize = 0xA000;
-      ASSERT ((ICH9_PMBASE_VALUE & 0xF000) < PciIoBase);
-    }
+    // This appears to be a safety measure. The PCI Firmware Specification
+    // (rev 3.1) says in 4.1.2. "MCFG Table Description": "The resources can
+    // *optionally* be returned in [...] EFIGetMemoryMap as reserved memory
+    // [...]". (Emphasis added here.)
+    //
+    // Normally we add memory resource descriptor HOBs in
+    // QemuInitializeRam(), and pre-allocate from those with memory
+    // allocation HOBs in InitializeRamRegions(). However, the MMCONFIG area
+    // is most definitely not RAM; so, as an exception, cover it with
+    // uncacheable reserved memory right here.
+    //
+    AddReservedMemoryBaseSizeHob (PciExBarBase, SIZE_256MB, FALSE);
+    BuildMemoryAllocationHob (PciExBarBase, SIZE_256MB,
+      EfiReservedMemoryType);
+  }
+  AddIoMemoryBaseSizeHob (PcdGet32(PcdCpuLocalApicBaseAddress), SIZE_1MB);
+
+  //
+  // On Q35, the IO Port space is available for PCI resource allocations from
+  // 0x6000 up.
+  //
+  if (mHostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) {
+    PciIoBase = 0x6000;
+    PciIoSize = 0xA000;
+    ASSERT ((ICH9_PMBASE_VALUE & 0xF000) < PciIoBase);
   }
 
   //
   // Add PCI IO Port space available for PCI resource allocations.
   //
   BuildResourceDescriptorHob (
@@ -368,15 +365,15 @@ MiscInitialization (
       return;
   }
   PcdStatus = PcdSet16S (PcdOvmfHostBridgePciDevId, mHostBridgeDevId);
   ASSERT_RETURN_ERROR (PcdStatus);
 
   //
-  // If the appropriate IOspace enable bit is set, assume the ACPI PMBA
-  // has been configured (e.g., by Xen) and skip the setup here.
-  // This matches the logic in AcpiTimerLibConstructor ().
+  // If the appropriate IOspace enable bit is set, assume the ACPI PMBA has
+  // been configured and skip the setup here. This matches the logic in
+  // AcpiTimerLibConstructor ().
   //
   if ((PciRead8 (AcpiCtlReg) & AcpiEnBit) == 0) {
     //
     // The PEI phase should be exited with fully accessibe ACPI PM IO space:
     // 1. set PMBA
     //
@@ -700,14 +697,12 @@ InitializePlatform (
   EFI_STATUS    Status;
 
   DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n"));
 
   DebugDumpCmos ();
 
-  XenDetect ();
-
   if (QemuFwCfgS3Enabled ()) {
     DEBUG ((DEBUG_INFO, "S3 support was detected on QEMU\n"));
     mS3Supported = TRUE;
     Status = PcdSetBoolS (PcdAcpiS3Enable, TRUE);
     ASSERT_EFI_ERROR (Status);
   }
@@ -732,17 +727,12 @@ InitializePlatform (
   PublishPeiMemory ();
 
   QemuUc32BaseInitialization ();
 
   InitializeRamRegions ();
 
-  if (mXen) {
-    DEBUG ((DEBUG_INFO, "Xen was detected\n"));
-    InitializeXen ();
-  }
-
   if (mBootMode != BOOT_ON_S3_RESUME) {
     if (!FeaturePcdGet (PcdSmmSmramRequire)) {
       ReserveEmuVariableNvStore ();
     }
     PeiFvInitialization ();
     MemTypeInfoInitialization ();
diff --git a/OvmfPkg/PlatformPei/Xen.c b/OvmfPkg/PlatformPei/Xen.c
deleted file mode 100644
index 104922c67e7e..000000000000
--- a/OvmfPkg/PlatformPei/Xen.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/**@file
-  Xen Platform PEI support
-
-  Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
-  Copyright (c) 2011, Andrei Warkentin <andreiw@motorola.com>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-//
-// The package level header files this module uses
-//
-#include <PiPei.h>
-
-//
-// The Library classes this module consumes
-//
-#include <Library/DebugLib.h>
-#include <Library/HobLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
-#include <Guid/XenInfo.h>
-#include <IndustryStandard/E820.h>
-#include <Library/ResourcePublicationLib.h>
-#include <Library/MtrrLib.h>
-
-#include "Platform.h"
-#include "Xen.h"
-
-BOOLEAN mXen = FALSE;
-
-STATIC UINT32 mXenLeaf = 0;
-
-EFI_XEN_INFO mXenInfo;
-
-/**
-  Returns E820 map provided by Xen
-
-  @param Entries      Pointer to E820 map
-  @param Count        Number of entries
-
-  @return EFI_STATUS
-**/
-EFI_STATUS
-XenGetE820Map (
-  EFI_E820_ENTRY64 **Entries,
-  UINT32 *Count
-  )
-{
-  EFI_XEN_OVMF_INFO *Info =
-    (EFI_XEN_OVMF_INFO *)(UINTN) OVMF_INFO_PHYSICAL_ADDRESS;
-
-  if (AsciiStrCmp ((CHAR8 *) Info->Signature, "XenHVMOVMF")) {
-    return EFI_NOT_FOUND;
-  }
-
-  ASSERT (Info->E820 < MAX_ADDRESS);
-  *Entries = (EFI_E820_ENTRY64 *)(UINTN) Info->E820;
-  *Count = Info->E820EntriesCount;
-
-  return EFI_SUCCESS;
-}
-
-/**
-  Connects to the Hypervisor.
-
-  @param  XenLeaf     CPUID index used to connect.
-
-  @return EFI_STATUS
-
-**/
-EFI_STATUS
-XenConnect (
-  UINT32 XenLeaf
-  )
-{
-  UINT32 Index;
-  UINT32 TransferReg;
-  UINT32 TransferPages;
-  UINT32 XenVersion;
-
-  AsmCpuid (XenLeaf + 2, &TransferPages, &TransferReg, NULL, NULL);
-  mXenInfo.HyperPages = AllocatePages (TransferPages);
-  if (!mXenInfo.HyperPages) {
-    return EFI_OUT_OF_RESOURCES;
-  }
-
-  for (Index = 0; Index < TransferPages; Index++) {
-    AsmWriteMsr64 (TransferReg,
-                   (UINTN) mXenInfo.HyperPages +
-                   (Index << EFI_PAGE_SHIFT) + Index);
-  }
-
-  AsmCpuid (XenLeaf + 1, &XenVersion, NULL, NULL, NULL);
-  DEBUG ((DEBUG_ERROR, "Detected Xen version %d.%d\n",
-          XenVersion >> 16, XenVersion & 0xFFFF));
-  mXenInfo.VersionMajor = (UINT16)(XenVersion >> 16);
-  mXenInfo.VersionMinor = (UINT16)(XenVersion & 0xFFFF);
-
-  BuildGuidDataHob (
-    &gEfiXenInfoGuid,
-    &mXenInfo,
-    sizeof(mXenInfo)
-    );
-
-  return EFI_SUCCESS;
-}
-
-/**
-  Figures out if we are running inside Xen HVM.
-
-  @retval TRUE   Xen was detected
-  @retval FALSE  Xen was not detected
-
-**/
-BOOLEAN
-XenDetect (
-  VOID
-  )
-{
-  UINT8 Signature[13];
-
-  if (mXenLeaf != 0) {
-    return TRUE;
-  }
-
-  Signature[12] = '\0';
-  for (mXenLeaf = 0x40000000; mXenLeaf < 0x40010000; mXenLeaf += 0x100) {
-    AsmCpuid (mXenLeaf,
-              NULL,
-              (UINT32 *) &Signature[0],
-              (UINT32 *) &Signature[4],
-              (UINT32 *) &Signature[8]);
-
-    if (!AsciiStrCmp ((CHAR8 *) Signature, "XenVMMXenVMM")) {
-      mXen = TRUE;
-      return TRUE;
-    }
-  }
-
-  mXenLeaf = 0;
-  return FALSE;
-}
-
-
-VOID
-XenPublishRamRegions (
-  VOID
-  )
-{
-  EFI_E820_ENTRY64  *E820Map;
-  UINT32            E820EntriesCount;
-  EFI_STATUS        Status;
-
-  if (!mXen) {
-    return;
-  }
-
-  DEBUG ((DEBUG_INFO, "Using memory map provided by Xen\n"));
-
-  //
-  // Parse RAM in E820 map
-  //
-  E820EntriesCount = 0;
-  Status = XenGetE820Map (&E820Map, &E820EntriesCount);
-
-  ASSERT_EFI_ERROR (Status);
-
-  if (E820EntriesCount > 0) {
-    EFI_E820_ENTRY64 *Entry;
-    UINT32 Loop;
-
-    for (Loop = 0; Loop < E820EntriesCount; Loop++) {
-      Entry = E820Map + Loop;
-
-      //
-      // Only care about RAM
-      //
-      if (Entry->Type != EfiAcpiAddressRangeMemory) {
-        continue;
-      }
-
-      AddMemoryBaseSizeHob (Entry->BaseAddr, Entry->Length);
-
-      MtrrSetMemoryAttribute (Entry->BaseAddr, Entry->Length, CacheWriteBack);
-    }
-  }
-}
-
-
-/**
-  Perform Xen PEI initialization.
-
-  @return EFI_SUCCESS     Xen initialized successfully
-  @return EFI_NOT_FOUND   Not running under Xen
-
-**/
-EFI_STATUS
-InitializeXen (
-  VOID
-  )
-{
-  RETURN_STATUS PcdStatus;
-
-  if (mXenLeaf == 0) {
-    return EFI_NOT_FOUND;
-  }
-
-  XenConnect (mXenLeaf);
-
-  //
-  // Reserve away HVMLOADER reserved memory [0xFC000000,0xFD000000).
-  // This needs to match HVMLOADER RESERVED_MEMBASE/RESERVED_MEMSIZE.
-  //
-  AddReservedMemoryBaseSizeHob (0xFC000000, 0x1000000, FALSE);
-
-  PcdStatus = PcdSetBoolS (PcdPciDisableBusEnumeration, TRUE);
-  ASSERT_RETURN_ERROR (PcdStatus);
-
-  return EFI_SUCCESS;
-}
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 22/43] OvmfPkg: drop PcdPciDisableBusEnumeration from the IA32, IA32X64, X64 DSCs
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (20 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 21/43] OvmfPkg/PlatformPei: remove Xen support Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:29   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 23/43] OvmfPkg: drop PcdPciDisableBusEnumeration from the AmdSev platform Laszlo Ersek
                   ` (23 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

With the Xen-dependent PcdSetBoolS() call removed from
OvmfPkg/PlatformPei, the "OvmfPkgIa32.dsc", "OvmfPkgIa32X64.dsc",
"OvmfPkgX64.dsc" platforms never write "PcdPciDisableBusEnumeration". This
means we don't need a dynamic default for the PCD in the DSC files; it
could be declared Fixed-at-Build.

However, because the PCD's default value in "MdeModulePkg.dec" is FALSE,
remove the (same-value) platform defaults altogether.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/OvmfPkgIa32.dsc    | 1 -
 OvmfPkg/OvmfPkgIa32X64.dsc | 1 -
 OvmfPkg/OvmfPkgX64.dsc     | 1 -
 3 files changed, 3 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 4b7e1c731ef5..7a37efd35664 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -595,13 +595,12 @@ [PcdsDynamicDefault]
 
 !if $(SMM_REQUIRE) == FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
 !endif
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 1d1dea4b19cd..d6cc58a261d9 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -601,13 +601,12 @@ [PcdsDynamicDefault]
 
 !if $(SMM_REQUIRE) == FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
 !endif
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index d71edd6b2272..ab60c36eca27 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -601,13 +601,12 @@ [PcdsDynamicDefault]
 
 !if $(SMM_REQUIRE) == FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
 !endif
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 23/43] OvmfPkg: drop PcdPciDisableBusEnumeration from the AmdSev platform
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (21 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 22/43] OvmfPkg: drop PcdPciDisableBusEnumeration from the IA32, IA32X64, X64 DSCs Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27 10:21   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 24/43] OvmfPkg/Bhyve: make "PcdPciDisableBusEnumeration" Fixed-at-Build Laszlo Ersek
                   ` (22 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Brijesh Singh, Erdem Aktas, James Bottomley,
	Jiewen Yao, Jordan Justen, Min Xu, Philippe Mathieu-Daudé,
	Tom Lendacky

With the Xen-dependent PcdSetBoolS() call removed from
OvmfPkg/PlatformPei, the "AmdSevX64.dsc" platform never writes
"PcdPciDisableBusEnumeration". This means we don't need a dynamic default
for the PCD in the DSC file; it could be declared Fixed-at-Build.

However, because the PCD's default value in "MdeModulePkg.dec" is FALSE,
remove the (same-value) platform default altogether.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/AmdSev/AmdSevX64.dsc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 9e7c459e9a8b..1d487befae08 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -532,13 +532,12 @@ [PcdsFixedAtBuild]
 [PcdsDynamicDefault]
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
 
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 24/43] OvmfPkg/Bhyve: make "PcdPciDisableBusEnumeration" Fixed-at-Build
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (22 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 23/43] OvmfPkg: drop PcdPciDisableBusEnumeration from the AmdSev platform Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-26 20:41   ` Rebecca Cran
  2021-05-27  8:43   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 25/43] OvmfPkg/OvmfXen: remove IncompatiblePciDeviceSupport DXE driver Laszlo Ersek
                   ` (21 subsequent siblings)
  45 siblings, 2 replies; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Jordan Justen, Peter Grehan,
	Philippe Mathieu-Daudé, Rebecca Cran

The Bhyve platform specifies the dynamic access method for
"PcdPciDisableBusEnumeration" needlessly.

After the DSC file sets the PCD to TRUE by default, the PCD is never
written again. In particular, the
"OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf" file references the PCD
superfluously.

Make the PCD Fixed-At-Build, and remove the PCD reference from the INF
file.

(Note that further simplifications are possible in
"OvmfPkg/Bhyve/AcpiPlatformDxe", but those are out of scope for this patch
series.)

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Bhyve/BhyveX64.dsc                | 2 +-
 OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 7d9e88040000..896b62881bdb 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -428,12 +428,13 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
 
 [PcdsFixedAtBuild]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
   gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
   gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
   gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|0
@@ -526,13 +527,12 @@ [PcdsDynamicDefault]
   #   ($(SMM_REQUIRE) == FALSE)
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
 
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800
   gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0
diff --git a/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf b/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf
index 12203e9f804d..739d63098b1e 100644
--- a/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf
@@ -83,13 +83,12 @@ [Pcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDecompressionScratchEnd
   gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes
   gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
   gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable
   gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask
   gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 25/43] OvmfPkg/OvmfXen: remove IncompatiblePciDeviceSupport DXE driver
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (23 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 24/43] OvmfPkg/Bhyve: make "PcdPciDisableBusEnumeration" Fixed-at-Build Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:29   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 26/43] OvmfPkg/Bhyve: " Laszlo Ersek
                   ` (20 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Philippe Mathieu-Daudé

The entry point function of "OvmfPkg/IncompatiblePciDeviceSupportDxe",
namely DriverInitialize()
[OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c],
bails out immediately if "PcdPciDisableBusEnumeration" is TRUE.

The OvmfXen platform statically assigns this PCD TRUE. Thus, remove the
driver from the OvmfXen platform.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/OvmfXen.dsc | 1 -
 OvmfPkg/OvmfXen.fdf | 1 -
 2 files changed, 2 deletions(-)

diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 779bcc3f8b9a..2d32c5734fa7 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -551,13 +551,12 @@ [Components]
   MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 
   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
   OvmfPkg/XenTimerDxe/XenTimerDxe.inf
   UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
   UefiCpuPkg/CpuDxe/CpuDxe.inf
-  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
   OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
     <LibraryClasses>
       PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
       PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
       NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf
diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf
index 8daa000de46a..9acc7c93b98b 100644
--- a/OvmfPkg/OvmfXen.fdf
+++ b/OvmfPkg/OvmfXen.fdf
@@ -298,13 +298,12 @@ [FV.DXEFV]
 INF  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
 INF  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 INF  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
 INF  OvmfPkg/XenTimerDxe/XenTimerDxe.inf
 INF  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
 INF  UefiCpuPkg/CpuDxe/CpuDxe.inf
-INF  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
 INF  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
 INF  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
 INF  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
 INF  MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
 INF  MdeModulePkg/Universal/Metronome/Metronome.inf
 INF  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 26/43] OvmfPkg/Bhyve: remove IncompatiblePciDeviceSupport DXE driver
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (24 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 25/43] OvmfPkg/OvmfXen: remove IncompatiblePciDeviceSupport DXE driver Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27 10:23   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 27/43] OvmfPkg/IncompatiblePciDeviceSupportDxe: remove PcdPciDisableBusEnumeration Laszlo Ersek
                   ` (19 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Jordan Justen, Peter Grehan,
	Philippe Mathieu-Daudé, Rebecca Cran

The entry point function of "OvmfPkg/IncompatiblePciDeviceSupportDxe",
namely DriverInitialize()
[OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c],
bails out immediately if "PcdPciDisableBusEnumeration" is TRUE.

The Bhyve platform statically assigns this PCD TRUE. Thus, remove the
driver from the Bhyve platform.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Bhyve/BhyveX64.dsc | 1 -
 OvmfPkg/Bhyve/BhyveX64.fdf | 1 -
 2 files changed, 2 deletions(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 896b62881bdb..30a99e2a3425 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -660,13 +660,12 @@ [Components]
   }
 
   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
   UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
   UefiCpuPkg/CpuDxe/CpuDxe.inf
   PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
-  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
   OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
     <LibraryClasses>
       PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
       PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
       NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf
diff --git a/OvmfPkg/Bhyve/BhyveX64.fdf b/OvmfPkg/Bhyve/BhyveX64.fdf
index f4050c4934b7..3eff36dac18f 100644
--- a/OvmfPkg/Bhyve/BhyveX64.fdf
+++ b/OvmfPkg/Bhyve/BhyveX64.fdf
@@ -207,13 +207,12 @@ [FV.DXEFV]
 INF  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
 INF  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 INF  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
 INF  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
 INF  UefiCpuPkg/CpuDxe/CpuDxe.inf
 INF  PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
-INF  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
 INF  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
 INF  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
 INF  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
 INF  MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
 INF  MdeModulePkg/Universal/Metronome/Metronome.inf
 INF  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 27/43] OvmfPkg/IncompatiblePciDeviceSupportDxe: remove PcdPciDisableBusEnumeration
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (25 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 26/43] OvmfPkg/Bhyve: " Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:30   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 28/43] OvmfPkg/PciHostBridgeLib: consolidate #includes and INF file sections Laszlo Ersek
                   ` (18 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

At this point, the IncompatiblePciDeviceSupportDxe driver is included in
the following platforms in edk2:

  OvmfPkg/AmdSev/AmdSevX64.dsc
  OvmfPkg/OvmfPkgIa32.dsc
  OvmfPkg/OvmfPkgIa32X64.dsc
  OvmfPkg/OvmfPkgX64.dsc

All those platforms inherit FALSE for "PcdPciDisableBusEnumeration" from
"MdeModulePkg.dec".

This makes the PcdGetBool() call in the entry point of the driver
superfluous; remove it. Clean up now unused dependencies in the INF file
as well.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf |  2 --
 OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c   | 10 +++-------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf b/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
index f08b6f4bd4b4..c3e6bb944791 100644
--- a/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
+++ b/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
@@ -17,13 +17,12 @@ [Defines]
   ENTRY_POINT                    = DriverInitialize
 
 [Sources]
   IncompatiblePciDeviceSupport.c
 
 [Packages]
-  MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
   DebugLib
   MemoryAllocationLib
@@ -33,11 +32,10 @@ [LibraryClasses]
 
 [Protocols]
   gEfiIncompatiblePciDeviceSupportProtocolGuid ## SOMETIMES_PRODUCES
   gEfiLegacyBiosProtocolGuid                   ## NOTIFY
 
 [Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration ## CONSUMES
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size                ## CONSUMES
 
 [Depex]
   TRUE
diff --git a/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c b/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
index 53c768167de9..db1532f10934 100644
--- a/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
+++ b/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
@@ -263,20 +263,16 @@ DriverInitialize (
 {
   EFI_STATUS Status;
   EFI_EVENT  Event;
   VOID       *Registration;
 
   //
-  // If the PCI Bus driver is not supposed to allocate resources, then it makes
-  // no sense to install a protocol that influences the resource allocation.
+  // If there is no 64-bit PCI MMIO aperture, then 64-bit MMIO BARs have to be
+  // allocated under 4 GB unconditionally.
   //
-  // Similarly, if there is no 64-bit PCI MMIO aperture, then 64-bit MMIO BARs
-  // have to be allocated under 4 GB unconditionally.
-  //
-  if (PcdGetBool (PcdPciDisableBusEnumeration) ||
-      PcdGet64 (PcdPciMmio64Size) == 0) {
+  if (PcdGet64 (PcdPciMmio64Size) == 0) {
     return EFI_UNSUPPORTED;
   }
 
   //
   // Otherwise, create a protocol notify to see if a CSM is present. (With the
   // CSM absent, the PCI Bus driver won't have to worry about allocating 64-bit
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 28/43] OvmfPkg/PciHostBridgeLib: consolidate #includes and INF file sections
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (26 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 27/43] OvmfPkg/IncompatiblePciDeviceSupportDxe: remove PcdPciDisableBusEnumeration Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:31   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 29/43] OvmfPkg/PciHostBridgeLibScan: create from PciHostBridgeLib Laszlo Ersek
                   ` (17 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Philippe Mathieu-Daudé

- In every C file, list every necessary public #include individually, with
  an example identifier that's actually consumed.

- Place all public #includes first, all module-private #includes second.
  Separate them with a single empty line. Keep each section sorted in
  itself.

- Sort all sections in the INF file, except [Defines].

- Add unlisted lib classes.

- Remove unnecessary #include directives, add unlisted #include
  directives.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf |  7 +++---
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   | 22 +++++++-----------
 OvmfPkg/Library/PciHostBridgeLib/XenSupport.c         | 24 +++++++++-----------
 3 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
index 4610a0c1490b..622780888472 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
@@ -22,32 +22,33 @@ [Defines]
 # tools.
 #
 #  VALID_ARCHITECTURES           = IA32 X64 EBC
 #
 
 [Sources]
+  PciHostBridge.h
   PciHostBridgeLib.c
   XenSupport.c
-  PciHostBridge.h
 
 [Packages]
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
+  BaseLib
   BaseMemoryLib
   DebugLib
   MemoryAllocationLib
   PcdLib
   PciHostBridgeUtilityLib
   PciLib
 
 [Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
+  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size
-  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
index 7d9fb0fb293a..6db91fb7e20c 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -4,29 +4,23 @@
   Copyright (C) 2016, Red Hat, Inc.
   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
-#include <PiDxe.h>
+#include <IndustryStandard/Pci.h>                     // PCI_MAX_BUS
+#include <IndustryStandard/Q35MchIch9.h>              // INTEL_Q35_MCH_DEVIC...
+#include <Library/BaseMemoryLib.h>                    // ZeroMem()
+#include <Library/PcdLib.h>                           // PcdGet64()
+#include <Library/PciHostBridgeLib.h>                 // PCI_ROOT_BRIDGE_APE...
+#include <Library/PciHostBridgeUtilityLib.h>          // PciHostBridgeUtilit...
+#include <Protocol/PciHostBridgeResourceAllocation.h> // EFI_PCI_HOST_BRIDGE...
+#include <Protocol/PciRootBridgeIo.h>                 // EFI_PCI_ATTRIBUTE_I...
 
-#include <IndustryStandard/Pci.h>
-#include <IndustryStandard/Q35MchIch9.h>
-
-#include <Protocol/PciHostBridgeResourceAllocation.h>
-#include <Protocol/PciRootBridgeIo.h>
-
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
-#include <Library/PciHostBridgeLib.h>
-#include <Library/PciHostBridgeUtilityLib.h>
 #include "PciHostBridge.h"
 
-
 STATIC PCI_ROOT_BRIDGE_APERTURE mNonExistAperture = { MAX_UINT64, 0 };
 
 
 /**
   Return all the root bridge instances in an array.
 
diff --git a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
index 9ef39f01821b..07c498dd0ea2 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
+++ b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
@@ -3,27 +3,25 @@
 
   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
-#include <PiDxe.h>
 
-#include <IndustryStandard/Pci.h>
-#include <IndustryStandard/Q35MchIch9.h>
+#include <IndustryStandard/Pci.h>            // EFI_PCI_COMMAND_IO_SPACE
+#include <IndustryStandard/Q35MchIch9.h>     // INTEL_Q35_MCH_DEVICE_ID
+#include <Library/BaseLib.h>                 // DisableInterrupts()
+#include <Library/BaseMemoryLib.h>           // ZeroMem()
+#include <Library/DebugLib.h>                // ASSERT()
+#include <Library/MemoryAllocationLib.h>     // ReallocatePool()
+#include <Library/PcdLib.h>                  // PcdGet16()
+#include <Library/PciHostBridgeLib.h>        // PCI_ROOT_BRIDGE_APERTURE
+#include <Library/PciHostBridgeUtilityLib.h> // PciHostBridgeUtilityInitRoot...
+#include <Library/PciLib.h>                  // PciRead32()
+#include <Protocol/PciRootBridgeIo.h>        // EFI_PCI_ATTRIBUTE_ISA_IO
 
-#include <Protocol/PciHostBridgeResourceAllocation.h>
-#include <Protocol/PciRootBridgeIo.h>
-
-#include <Library/BaseMemoryLib.h>
-#include <Library/DebugLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
-#include <Library/PciHostBridgeLib.h>
-#include <Library/PciHostBridgeUtilityLib.h>
-#include <Library/PciLib.h>
 #include "PciHostBridge.h"
 
 STATIC
 VOID
 PcatPciRootBridgeBarExisted (
   IN  UINTN                          Address,
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 29/43] OvmfPkg/PciHostBridgeLibScan: create from PciHostBridgeLib
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (27 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 28/43] OvmfPkg/PciHostBridgeLib: consolidate #includes and INF file sections Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-31 14:52   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 30/43] OvmfPkg/Bhyve: consume PciHostBridgeLibScan Laszlo Ersek
                   ` (16 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Peter Grehan, Philippe Mathieu-Daudé, Rebecca Cran

Create an almost verbatim copy of the
"OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf" library instance.

The new PciHostBridgeLibScan instance will ultimately duplicate a
negligible amount of code from the original, and will be used by the Bhyve
and OvmfXen platforms.

List the new driver in "Maintainers.txt", in the "OvmfPkg: bhyve-related
modules" and "OvmfPkg: Xen-related modules" sections.

This patch should be reviewed with "git show --find-copies-harder".

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.inf => PciHostBridgeLibScan/PciHostBridgeLibScan.inf} | 6 +++---
 Maintainers.txt                                                                                          | 2 ++
 OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridge.h                               | 1 +
 OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridgeLib.c                            | 2 +-
 OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/XenSupport.c                                  | 1 +
 5 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
similarity index 84%
copy from OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
copy to OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
index 622780888472..46859388870f 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+++ b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
@@ -1,21 +1,21 @@
 ## @file
 #  OVMF's instance of the PCI Host Bridge Library.
 #
-#  Copyright (C) 2016, Red Hat, Inc.
+#  Copyright (C) 2016-2021, Red Hat, Inc.
 #  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 #
 ##
 
 [Defines]
   INF_VERSION                    = 0x00010005
-  BASE_NAME                      = PciHostBridgeLib
-  FILE_GUID                      = 9F2BC05E-51EA-4AED-9A3E-7699641734E8
+  BASE_NAME                      = PciHostBridgeLibScan
+  FILE_GUID                      = c93f2411-9bf5-4894-b552-67fae0c3d291
   MODULE_TYPE                    = DXE_DRIVER
   VERSION_STRING                 = 1.0
   LIBRARY_CLASS                  = PciHostBridgeLib
 
 #
 # The following information is for reference only and not required by the build
diff --git a/Maintainers.txt b/Maintainers.txt
index be40a1d6f2b6..a273409a923f 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -432,12 +432,13 @@ OvmfPkg: bhyve-related modules
 F: OvmfPkg/Bhyve/
 F: OvmfPkg/Include/IndustryStandard/Bhyve.h
 F: OvmfPkg/Include/Library/BhyveFwCtlLib.h
 F: OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.c
 F: OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLibBhyve.inf
 F: OvmfPkg/Library/BhyveFwCtlLib/
+F: OvmfPkg/Library/PciHostBridgeLibScan/
 F: OvmfPkg/Library/PlatformBootManagerLibBhyve/
 F: OvmfPkg/Library/ResetSystemLib/BaseResetShutdownBhyve.c
 F: OvmfPkg/Library/ResetSystemLib/BaseResetSystemLibBhyve.inf
 R: Rebecca Cran <rebecca@bsdio.com>
 R: Peter Grehan <grehan@freebsd.org>
 
@@ -490,12 +491,13 @@ F: OvmfPkg/Include/IndustryStandard/Xen/
 F: OvmfPkg/Include/Library/XenHypercallLib.h
 F: OvmfPkg/Include/Library/XenIoMmioLib.h
 F: OvmfPkg/Include/Library/XenPlatformLib.h
 F: OvmfPkg/Include/Protocol/XenBus.h
 F: OvmfPkg/Include/Protocol/XenIo.h
 F: OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
+F: OvmfPkg/Library/PciHostBridgeLibScan/
 F: OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
 F: OvmfPkg/Library/XenConsoleSerialPortLib/
 F: OvmfPkg/Library/XenHypercallLib/
 F: OvmfPkg/Library/XenIoMmioLib/
 F: OvmfPkg/Library/XenPlatformLib/
 F: OvmfPkg/Library/XenRealTimeClockLib/
diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridge.h
similarity index 83%
copy from OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h
copy to OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridge.h
index a2e4d8696281..582b7929aff2 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h
+++ b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridge.h
@@ -1,9 +1,10 @@
 /** @file
   Header file of OVMF instance of PciHostBridgeLib.
 
+  Copyright (C) 2021, Red Hat, Inc.
   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
similarity index 95%
copy from OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
copy to OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
index 6db91fb7e20c..6c2acc9f99bc 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
@@ -1,10 +1,10 @@
 /** @file
   OVMF's instance of the PCI Host Bridge Library.
 
-  Copyright (C) 2016, Red Hat, Inc.
+  Copyright (C) 2016-2021, Red Hat, Inc.
   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 #include <IndustryStandard/Pci.h>                     // PCI_MAX_BUS
diff --git a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c b/OvmfPkg/Library/PciHostBridgeLibScan/XenSupport.c
similarity index 96%
copy from OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
copy to OvmfPkg/Library/PciHostBridgeLibScan/XenSupport.c
index 07c498dd0ea2..a4a61e5836e0 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
+++ b/OvmfPkg/Library/PciHostBridgeLibScan/XenSupport.c
@@ -1,9 +1,10 @@
 /** @file
   Scan the entire PCI bus for root bridges to support OVMF above Xen.
 
+  Copyright (C) 2021, Red Hat, Inc.
   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 30/43] OvmfPkg/Bhyve: consume PciHostBridgeLibScan
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (28 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 29/43] OvmfPkg/PciHostBridgeLibScan: create from PciHostBridgeLib Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-26 22:46   ` Rebecca Cran
  2021-05-27  8:31   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 31/43] OvmfPkg/OvmfXen: " Laszlo Ersek
                   ` (15 subsequent siblings)
  45 siblings, 2 replies; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Ard Biesheuvel, Jordan Justen, Peter Grehan,
	Philippe Mathieu-Daudé, Rebecca Cran

Switch the Bhyve platform from the "OvmfPkg/PciHostBridgeLib" instance to
the "OvmfPkg/PciHostBridgeLibScan" instance. Currently this is a no-op
functionally; we'll customize the "PciHostBridgeLibScan" instance later.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Bhyve/BhyveX64.dsc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 30a99e2a3425..d8792812ab21 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -663,13 +663,13 @@ [Components]
   UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
   UefiCpuPkg/CpuDxe/CpuDxe.inf
   PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
   OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
     <LibraryClasses>
-      PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+      PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
       PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
       NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf
   }
   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
     <LibraryClasses>
       PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 31/43] OvmfPkg/OvmfXen: consume PciHostBridgeLibScan
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (29 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 30/43] OvmfPkg/Bhyve: consume PciHostBridgeLibScan Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:31   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 32/43] OvmfPkg/PciHostBridgeLib: remove Bhyve and Xen support Laszlo Ersek
                   ` (14 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Philippe Mathieu-Daudé

Switch the OvmfXen platform from the "OvmfPkg/PciHostBridgeLib" instance
to the "OvmfPkg/PciHostBridgeLibScan" instance. Currently this is a no-op
functionally; we'll customize the "PciHostBridgeLibScan" instance later.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/OvmfXen.dsc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 2d32c5734fa7..0986d9f5c356 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -554,13 +554,13 @@ [Components]
   OvmfPkg/XenTimerDxe/XenTimerDxe.inf
   UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
   UefiCpuPkg/CpuDxe/CpuDxe.inf
   OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
     <LibraryClasses>
-      PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+      PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
       PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
       NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf
   }
   MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
     <LibraryClasses>
       PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 32/43] OvmfPkg/PciHostBridgeLib: remove Bhyve and Xen support
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (30 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 31/43] OvmfPkg/OvmfXen: " Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:32   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 33/43] OvmfPkg/PciHostBridgeLibScan: remove QEMU (fw_cfg) support Laszlo Ersek
                   ` (13 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Andrew Fish, Ard Biesheuvel, Jordan Justen, Leif Lindholm,
	Michael D Kinney, Philippe Mathieu-Daudé

The "OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf" instance is
used by the following platforms in edk2:

  OvmfPkg/AmdSev/AmdSevX64.dsc
  OvmfPkg/OvmfPkgIa32.dsc
  OvmfPkg/OvmfPkgIa32X64.dsc
  OvmfPkg/OvmfPkgX64.dsc

All these platforms statically inherit PcdPciDisableBusEnumeration=FALSE
from "MdeModulePkg.dec". Remove the the PCD and everything that depends on
it from the PciHostBridgeLib instance. Namely, remove the logic that
determines the root bridge apertures by (a) scanning the entire bus,
device and function number space, and (b) parsing the BAR values that were
pre-set by the Bhyve or Xen machinery.

"XenSupport.c" used to be listed explicitly in "Maintainers.txt", remove
it from that spot too.

Cc: Andrew Fish <afish@apple.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf |   7 -
 Maintainers.txt                                       |   1 -
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h      |  13 -
 OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   |   6 -
 OvmfPkg/Library/PciHostBridgeLib/XenSupport.c         | 471 --------------------
 5 files changed, 498 deletions(-)

diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
index 622780888472..f9f182557453 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
@@ -22,32 +22,25 @@ [Defines]
 # tools.
 #
 #  VALID_ARCHITECTURES           = IA32 X64 EBC
 #
 
 [Sources]
-  PciHostBridge.h
   PciHostBridgeLib.c
-  XenSupport.c
 
 [Packages]
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
-  BaseLib
   BaseMemoryLib
-  DebugLib
-  MemoryAllocationLib
   PcdLib
   PciHostBridgeUtilityLib
-  PciLib
 
 [Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase
   gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base
diff --git a/Maintainers.txt b/Maintainers.txt
index a273409a923f..e5f419e67f0c 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -490,13 +490,12 @@ F: OvmfPkg/Include/Guid/XenInfo.h
 F: OvmfPkg/Include/IndustryStandard/Xen/
 F: OvmfPkg/Include/Library/XenHypercallLib.h
 F: OvmfPkg/Include/Library/XenIoMmioLib.h
 F: OvmfPkg/Include/Library/XenPlatformLib.h
 F: OvmfPkg/Include/Protocol/XenBus.h
 F: OvmfPkg/Include/Protocol/XenIo.h
-F: OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
 F: OvmfPkg/Library/PciHostBridgeLibScan/
 F: OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
 F: OvmfPkg/Library/XenConsoleSerialPortLib/
 F: OvmfPkg/Library/XenHypercallLib/
 F: OvmfPkg/Library/XenIoMmioLib/
 F: OvmfPkg/Library/XenPlatformLib/
diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h
deleted file mode 100644
index a2e4d8696281..000000000000
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/** @file
-  Header file of OVMF instance of PciHostBridgeLib.
-
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-PCI_ROOT_BRIDGE *
-ScanForRootBridges (
-  UINTN      *NumberOfRootBridges
-);
diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
index 6db91fb7e20c..835efffccaf5 100644
--- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
+++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
@@ -13,14 +13,12 @@
 #include <Library/PcdLib.h>                           // PcdGet64()
 #include <Library/PciHostBridgeLib.h>                 // PCI_ROOT_BRIDGE_APE...
 #include <Library/PciHostBridgeUtilityLib.h>          // PciHostBridgeUtilit...
 #include <Protocol/PciHostBridgeResourceAllocation.h> // EFI_PCI_HOST_BRIDGE...
 #include <Protocol/PciRootBridgeIo.h>                 // EFI_PCI_ATTRIBUTE_I...
 
-#include "PciHostBridge.h"
-
 STATIC PCI_ROOT_BRIDGE_APERTURE mNonExistAperture = { MAX_UINT64, 0 };
 
 
 /**
   Return all the root bridge instances in an array.
 
@@ -39,16 +37,12 @@ PciHostBridgeGetRootBridges (
   UINT64               Attributes;
   UINT64               AllocationAttributes;
   PCI_ROOT_BRIDGE_APERTURE Io;
   PCI_ROOT_BRIDGE_APERTURE Mem;
   PCI_ROOT_BRIDGE_APERTURE MemAbove4G;
 
-  if (PcdGetBool (PcdPciDisableBusEnumeration)) {
-    return ScanForRootBridges (Count);
-  }
-
   ZeroMem (&Io, sizeof (Io));
   ZeroMem (&Mem, sizeof (Mem));
   ZeroMem (&MemAbove4G, sizeof (MemAbove4G));
 
   Attributes = EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO |
     EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO |
diff --git a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
deleted file mode 100644
index 07c498dd0ea2..000000000000
--- a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
+++ /dev/null
@@ -1,471 +0,0 @@
-/** @file
-  Scan the entire PCI bus for root bridges to support OVMF above Xen.
-
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include <IndustryStandard/Pci.h>            // EFI_PCI_COMMAND_IO_SPACE
-#include <IndustryStandard/Q35MchIch9.h>     // INTEL_Q35_MCH_DEVICE_ID
-#include <Library/BaseLib.h>                 // DisableInterrupts()
-#include <Library/BaseMemoryLib.h>           // ZeroMem()
-#include <Library/DebugLib.h>                // ASSERT()
-#include <Library/MemoryAllocationLib.h>     // ReallocatePool()
-#include <Library/PcdLib.h>                  // PcdGet16()
-#include <Library/PciHostBridgeLib.h>        // PCI_ROOT_BRIDGE_APERTURE
-#include <Library/PciHostBridgeUtilityLib.h> // PciHostBridgeUtilityInitRoot...
-#include <Library/PciLib.h>                  // PciRead32()
-#include <Protocol/PciRootBridgeIo.h>        // EFI_PCI_ATTRIBUTE_ISA_IO
-
-#include "PciHostBridge.h"
-
-STATIC
-VOID
-PcatPciRootBridgeBarExisted (
-  IN  UINTN                          Address,
-  OUT UINT32                         *OriginalValue,
-  OUT UINT32                         *Value
-  )
-{
-  //
-  // Preserve the original value
-  //
-  *OriginalValue = PciRead32 (Address);
-
-  //
-  // Disable timer interrupt while the BAR is probed
-  //
-  DisableInterrupts ();
-
-  PciWrite32 (Address, 0xFFFFFFFF);
-  *Value = PciRead32 (Address);
-  PciWrite32 (Address, *OriginalValue);
-
-  //
-  // Enable interrupt
-  //
-  EnableInterrupts ();
-}
-
-#define PCI_COMMAND_DECODE ((UINT16)(EFI_PCI_COMMAND_IO_SPACE | \
-                                     EFI_PCI_COMMAND_MEMORY_SPACE))
-STATIC
-VOID
-PcatPciRootBridgeDecodingDisable (
-  IN  UINTN                          Address
-  )
-{
-  UINT16                             Value;
-
-  Value = PciRead16 (Address);
-  if (Value & PCI_COMMAND_DECODE) {
-    PciWrite16 (Address, Value & ~(UINT32)PCI_COMMAND_DECODE);
-  }
-}
-
-STATIC
-VOID
-PcatPciRootBridgeParseBars (
-  IN UINT16                         Command,
-  IN UINTN                          Bus,
-  IN UINTN                          Device,
-  IN UINTN                          Function,
-  IN UINTN                          BarOffsetBase,
-  IN UINTN                          BarOffsetEnd,
-  IN PCI_ROOT_BRIDGE_APERTURE       *Io,
-  IN PCI_ROOT_BRIDGE_APERTURE       *Mem,
-  IN PCI_ROOT_BRIDGE_APERTURE       *MemAbove4G
-
-)
-{
-  UINT32                            OriginalValue;
-  UINT32                            Value;
-  UINT32                            OriginalUpperValue;
-  UINT32                            UpperValue;
-  UINT64                            Mask;
-  UINTN                             Offset;
-  UINT64                            Base;
-  UINT64                            Length;
-  UINT64                            Limit;
-  PCI_ROOT_BRIDGE_APERTURE          *MemAperture;
-
-  // Disable address decoding for every device before OVMF starts sizing it
-  PcatPciRootBridgeDecodingDisable (
-    PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET)
-  );
-
-  for (Offset = BarOffsetBase; Offset < BarOffsetEnd; Offset += sizeof (UINT32)) {
-    PcatPciRootBridgeBarExisted (
-      PCI_LIB_ADDRESS (Bus, Device, Function, Offset),
-      &OriginalValue, &Value
-    );
-    if (Value == 0) {
-      continue;
-    }
-    if ((Value & BIT0) == BIT0) {
-      //
-      // IO Bar
-      //
-      if (Command & EFI_PCI_COMMAND_IO_SPACE) {
-        Mask = 0xfffffffc;
-        Base = OriginalValue & Mask;
-        Length = ((~(Value & Mask)) & Mask) + 0x04;
-        if (!(Value & 0xFFFF0000)) {
-          Length &= 0x0000FFFF;
-        }
-        Limit = Base + Length - 1;
-
-        if (Base < Limit) {
-          if (Io->Base > Base) {
-            Io->Base = Base;
-          }
-          if (Io->Limit < Limit) {
-            Io->Limit = Limit;
-          }
-        }
-      }
-    } else {
-      //
-      // Mem Bar
-      //
-      if (Command & EFI_PCI_COMMAND_MEMORY_SPACE) {
-
-        Mask = 0xfffffff0;
-        Base = OriginalValue & Mask;
-        Length = Value & Mask;
-
-        if ((Value & (BIT1 | BIT2)) == 0) {
-          //
-          // 32bit
-          //
-          Length = ((~Length) + 1) & 0xffffffff;
-
-          MemAperture = Mem;
-        } else {
-          //
-          // 64bit
-          //
-          Offset += 4;
-          PcatPciRootBridgeBarExisted (
-            PCI_LIB_ADDRESS (Bus, Device, Function, Offset),
-            &OriginalUpperValue,
-            &UpperValue
-          );
-
-          Base = Base | LShiftU64 ((UINT64) OriginalUpperValue, 32);
-          Length = Length | LShiftU64 ((UINT64) UpperValue, 32);
-          Length = (~Length) + 1;
-
-          if (Base < BASE_4GB) {
-            MemAperture = Mem;
-          } else {
-            MemAperture = MemAbove4G;
-          }
-        }
-
-        Limit = Base + Length - 1;
-        if (Base < Limit) {
-          if (MemAperture->Base > Base) {
-            MemAperture->Base = Base;
-          }
-          if (MemAperture->Limit < Limit) {
-            MemAperture->Limit = Limit;
-          }
-        }
-      }
-    }
-  }
-}
-
-STATIC PCI_ROOT_BRIDGE_APERTURE mNonExistAperture = { MAX_UINT64, 0 };
-
-PCI_ROOT_BRIDGE *
-ScanForRootBridges (
-  UINTN      *NumberOfRootBridges
-  )
-{
-  UINTN      PrimaryBus;
-  UINTN      SubBus;
-  UINT8      Device;
-  UINT8      Function;
-  UINTN      NumberOfDevices;
-  UINTN      Address;
-  PCI_TYPE01 Pci;
-  UINT64     Attributes;
-  UINT64     Base;
-  UINT64     Limit;
-  UINT64     Value;
-  PCI_ROOT_BRIDGE_APERTURE Io, Mem, MemAbove4G, *MemAperture;
-  PCI_ROOT_BRIDGE *RootBridges;
-  UINTN      BarOffsetEnd;
-
-
-  *NumberOfRootBridges = 0;
-  RootBridges = NULL;
-
-  //
-  // After scanning all the PCI devices on the PCI root bridge's primary bus,
-  // update the Primary Bus Number for the next PCI root bridge to be this PCI
-  // root bridge's subordinate bus number + 1.
-  //
-  for (PrimaryBus = 0; PrimaryBus <= PCI_MAX_BUS; PrimaryBus = SubBus + 1) {
-    SubBus = PrimaryBus;
-    Attributes = 0;
-
-    ZeroMem (&Io, sizeof (Io));
-    ZeroMem (&Mem, sizeof (Mem));
-    ZeroMem (&MemAbove4G, sizeof (MemAbove4G));
-    Io.Base = Mem.Base = MemAbove4G.Base = MAX_UINT64;
-    //
-    // Scan all the PCI devices on the primary bus of the PCI root bridge
-    //
-    for (Device = 0, NumberOfDevices = 0; Device <= PCI_MAX_DEVICE; Device++) {
-
-      for (Function = 0; Function <= PCI_MAX_FUNC; Function++) {
-
-        //
-        // Compute the PCI configuration address of the PCI device to probe
-        //
-        Address = PCI_LIB_ADDRESS (PrimaryBus, Device, Function, 0);
-
-        //
-        // Read the Vendor ID from the PCI Configuration Header
-        //
-        if (PciRead16 (Address) == MAX_UINT16) {
-          if (Function == 0) {
-            //
-            // If the PCI Configuration Read fails, or a PCI device does not
-            // exist, then skip this entire PCI device
-            //
-            break;
-          } else {
-            //
-            // If PCI function != 0, VendorId == 0xFFFF, we continue to search
-            // PCI function.
-            //
-            continue;
-          }
-        }
-
-        //
-        // Read the entire PCI Configuration Header
-        //
-        PciReadBuffer (Address, sizeof (Pci), &Pci);
-
-        //
-        // Increment the number of PCI device found on the primary bus of the
-        // PCI root bridge
-        //
-        NumberOfDevices++;
-
-        //
-        // Look for devices with the VGA Palette Snoop enabled in the COMMAND
-        // register of the PCI Config Header
-        //
-        if ((Pci.Hdr.Command & EFI_PCI_COMMAND_VGA_PALETTE_SNOOP) != 0) {
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO;
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;
-        }
-
-        BarOffsetEnd = 0;
-
-        //
-        // PCI-PCI Bridge
-        //
-        if (IS_PCI_BRIDGE (&Pci)) {
-          //
-          // Get the Bus range that the PPB is decoding
-          //
-          if (Pci.Bridge.SubordinateBus > SubBus) {
-            //
-            // If the subordinate bus number of the PCI-PCI bridge is greater
-            // than the PCI root bridge's current subordinate bus number,
-            // then update the PCI root bridge's subordinate bus number
-            //
-            SubBus = Pci.Bridge.SubordinateBus;
-          }
-
-          //
-          // Get the I/O range that the PPB is decoding
-          //
-          Value = Pci.Bridge.IoBase & 0x0f;
-          Base = ((UINT32) Pci.Bridge.IoBase & 0xf0) << 8;
-          Limit = (((UINT32) Pci.Bridge.IoLimit & 0xf0) << 8) | 0x0fff;
-          if (Value == BIT0) {
-            Base |= ((UINT32) Pci.Bridge.IoBaseUpper16 << 16);
-            Limit |= ((UINT32) Pci.Bridge.IoLimitUpper16 << 16);
-          }
-          if (Base < Limit) {
-            if (Io.Base > Base) {
-              Io.Base = Base;
-            }
-            if (Io.Limit < Limit) {
-              Io.Limit = Limit;
-            }
-          }
-
-          //
-          // Get the Memory range that the PPB is decoding
-          //
-          Base = ((UINT32) Pci.Bridge.MemoryBase & 0xfff0) << 16;
-          Limit = (((UINT32) Pci.Bridge.MemoryLimit & 0xfff0) << 16) | 0xfffff;
-          if (Base < Limit) {
-            if (Mem.Base > Base) {
-              Mem.Base = Base;
-            }
-            if (Mem.Limit < Limit) {
-              Mem.Limit = Limit;
-            }
-          }
-
-          //
-          // Get the Prefetchable Memory range that the PPB is decoding
-          // and merge it into Memory range
-          //
-          Value = Pci.Bridge.PrefetchableMemoryBase & 0x0f;
-          Base = ((UINT32) Pci.Bridge.PrefetchableMemoryBase & 0xfff0) << 16;
-          Limit = (((UINT32) Pci.Bridge.PrefetchableMemoryLimit & 0xfff0)
-                   << 16) | 0xfffff;
-          MemAperture = &Mem;
-          if (Value == BIT0) {
-            Base |= LShiftU64 (Pci.Bridge.PrefetchableBaseUpper32, 32);
-            Limit |= LShiftU64 (Pci.Bridge.PrefetchableLimitUpper32, 32);
-            MemAperture = &MemAbove4G;
-          }
-          if (Base < Limit) {
-            if (MemAperture->Base > Base) {
-              MemAperture->Base = Base;
-            }
-            if (MemAperture->Limit < Limit) {
-              MemAperture->Limit = Limit;
-            }
-          }
-
-          //
-          // Look at the PPB Configuration for legacy decoding attributes
-          //
-          if ((Pci.Bridge.BridgeControl & EFI_PCI_BRIDGE_CONTROL_ISA)
-              == EFI_PCI_BRIDGE_CONTROL_ISA) {
-            Attributes |= EFI_PCI_ATTRIBUTE_ISA_IO;
-            Attributes |= EFI_PCI_ATTRIBUTE_ISA_IO_16;
-            Attributes |= EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO;
-          }
-          if ((Pci.Bridge.BridgeControl & EFI_PCI_BRIDGE_CONTROL_VGA)
-              == EFI_PCI_BRIDGE_CONTROL_VGA) {
-            Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO;
-            Attributes |= EFI_PCI_ATTRIBUTE_VGA_MEMORY;
-            Attributes |= EFI_PCI_ATTRIBUTE_VGA_IO;
-            if ((Pci.Bridge.BridgeControl & EFI_PCI_BRIDGE_CONTROL_VGA_16)
-                != 0) {
-              Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;
-              Attributes |= EFI_PCI_ATTRIBUTE_VGA_IO_16;
-            }
-          }
-
-          BarOffsetEnd = OFFSET_OF (PCI_TYPE01, Bridge.Bar[2]);
-        } else {
-          //
-          // Parse the BARs of the PCI device to get what I/O Ranges, Memory
-          // Ranges, and Prefetchable Memory Ranges the device is decoding
-          //
-          if ((Pci.Hdr.HeaderType & HEADER_LAYOUT_CODE) == HEADER_TYPE_DEVICE) {
-            BarOffsetEnd = OFFSET_OF (PCI_TYPE00, Device.Bar[6]);
-          }
-        }
-
-        PcatPciRootBridgeParseBars (
-          Pci.Hdr.Command,
-          PrimaryBus,
-          Device,
-          Function,
-          OFFSET_OF (PCI_TYPE00, Device.Bar),
-          BarOffsetEnd,
-          &Io,
-          &Mem, &MemAbove4G
-        );
-
-        //
-        // See if the PCI device is an IDE controller
-        //
-        if (IS_CLASS2 (&Pci, PCI_CLASS_MASS_STORAGE,
-                       PCI_CLASS_MASS_STORAGE_IDE)) {
-          if (Pci.Hdr.ClassCode[0] & 0x80) {
-            Attributes |= EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO;
-            Attributes |= EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO;
-          }
-          if (Pci.Hdr.ClassCode[0] & 0x01) {
-            Attributes |= EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO;
-          }
-          if (Pci.Hdr.ClassCode[0] & 0x04) {
-            Attributes |= EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO;
-          }
-        }
-
-        //
-        // See if the PCI device is a legacy VGA controller or
-        // a standard VGA controller
-        //
-        if (IS_CLASS2 (&Pci, PCI_CLASS_OLD, PCI_CLASS_OLD_VGA) ||
-            IS_CLASS2 (&Pci, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_VGA)
-            ) {
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO;
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_MEMORY;
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_IO;
-          Attributes |= EFI_PCI_ATTRIBUTE_VGA_IO_16;
-        }
-
-        //
-        // See if the PCI Device is a PCI - ISA or PCI - EISA
-        // or ISA_POSITIVE_DECODE Bridge device
-        //
-        if (Pci.Hdr.ClassCode[2] == PCI_CLASS_BRIDGE) {
-          if (Pci.Hdr.ClassCode[1] == PCI_CLASS_BRIDGE_ISA ||
-              Pci.Hdr.ClassCode[1] == PCI_CLASS_BRIDGE_EISA ||
-              Pci.Hdr.ClassCode[1] == PCI_CLASS_BRIDGE_ISA_PDECODE) {
-            Attributes |= EFI_PCI_ATTRIBUTE_ISA_IO;
-            Attributes |= EFI_PCI_ATTRIBUTE_ISA_IO_16;
-            Attributes |= EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO;
-          }
-        }
-
-        //
-        // If this device is not a multi function device, then skip the rest
-        // of this PCI device
-        //
-        if (Function == 0 && !IS_PCI_MULTI_FUNC (&Pci)) {
-          break;
-        }
-      }
-    }
-
-    //
-    // If at least one PCI device was found on the primary bus of this PCI
-    // root bridge, then the PCI root bridge exists.
-    //
-    if (NumberOfDevices > 0) {
-      RootBridges = ReallocatePool (
-        (*NumberOfRootBridges) * sizeof (PCI_ROOT_BRIDGE),
-        (*NumberOfRootBridges + 1) * sizeof (PCI_ROOT_BRIDGE),
-        RootBridges
-      );
-      ASSERT (RootBridges != NULL);
-      PciHostBridgeUtilityInitRootBridge (
-        Attributes, Attributes, 0,
-        FALSE, PcdGet16 (PcdOvmfHostBridgePciDevId) != INTEL_Q35_MCH_DEVICE_ID,
-        (UINT8) PrimaryBus, (UINT8) SubBus,
-        &Io, &Mem, &MemAbove4G, &mNonExistAperture, &mNonExistAperture,
-        &RootBridges[*NumberOfRootBridges]
-      );
-      RootBridges[*NumberOfRootBridges].ResourceAssigned = TRUE;
-      //
-      // Increment the index for the next PCI Root Bridge
-      //
-      (*NumberOfRootBridges)++;
-    }
-  }
-
-  return RootBridges;
-}
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 33/43] OvmfPkg/PciHostBridgeLibScan: remove QEMU (fw_cfg) support
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (31 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 32/43] OvmfPkg/PciHostBridgeLib: remove Bhyve and Xen support Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27 10:25   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 34/43] OvmfPkg/PciHostBridgeLibScan: remove PcdOvmfHostBridgePciDevId Laszlo Ersek
                   ` (12 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Peter Grehan, Philippe Mathieu-Daudé, Rebecca Cran

The "OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf"
instance is used in the following platforms in edk2:

  OvmfPkg/Bhyve/BhyveX64.dsc
  OvmfPkg/OvmfXen.dsc

Both platforms define "PcdPciDisableBusEnumeration" with Fixed-at-Build
access method, and TRUE value. Remove the PCD from the
PciHostBridgeLibScan instance, and everything else that is useful only
when the PCD is FALSE.

In practice, this removes the PciHostBridgeUtilityGetRootBridges()
function call, which is based on fw-cfg; see
"OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c".

(Note that the dependency on PciHostBridgeUtilityLib remains in place,
given that the PciHostBridgeLibScan instance continues using lower-level
functions from the library that do not depend on fw-cfg.)

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf |  7 ---
 OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c       | 63 +-------------------
 2 files changed, 2 insertions(+), 68 deletions(-)

diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
index 46859388870f..1ba880be6782 100644
--- a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
+++ b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
@@ -41,14 +41,7 @@ [LibraryClasses]
   MemoryAllocationLib
   PcdLib
   PciHostBridgeUtilityLib
   PciLib
 
 [Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
-  gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase
-  gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize
-  gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base
-  gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size
-  gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base
-  gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size
diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
index 6c2acc9f99bc..f0166e0f7279 100644
--- a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
+++ b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
@@ -4,26 +4,17 @@
   Copyright (C) 2016-2021, Red Hat, Inc.
   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
-#include <IndustryStandard/Pci.h>                     // PCI_MAX_BUS
-#include <IndustryStandard/Q35MchIch9.h>              // INTEL_Q35_MCH_DEVIC...
-#include <Library/BaseMemoryLib.h>                    // ZeroMem()
-#include <Library/PcdLib.h>                           // PcdGet64()
-#include <Library/PciHostBridgeLib.h>                 // PCI_ROOT_BRIDGE_APE...
+#include <Library/PciHostBridgeLib.h>                 // PCI_ROOT_BRIDGE
 #include <Library/PciHostBridgeUtilityLib.h>          // PciHostBridgeUtilit...
-#include <Protocol/PciHostBridgeResourceAllocation.h> // EFI_PCI_HOST_BRIDGE...
-#include <Protocol/PciRootBridgeIo.h>                 // EFI_PCI_ATTRIBUTE_I...
 
 #include "PciHostBridge.h"
 
-STATIC PCI_ROOT_BRIDGE_APERTURE mNonExistAperture = { MAX_UINT64, 0 };
-
-
 /**
   Return all the root bridge instances in an array.
 
   @param Count  Return the count of root bridge instances.
 
   @return All the root bridge instances in an array.
@@ -33,63 +24,13 @@ STATIC PCI_ROOT_BRIDGE_APERTURE mNonExistAperture = { MAX_UINT64, 0 };
 PCI_ROOT_BRIDGE *
 EFIAPI
 PciHostBridgeGetRootBridges (
   UINTN *Count
   )
 {
-  UINT64               Attributes;
-  UINT64               AllocationAttributes;
-  PCI_ROOT_BRIDGE_APERTURE Io;
-  PCI_ROOT_BRIDGE_APERTURE Mem;
-  PCI_ROOT_BRIDGE_APERTURE MemAbove4G;
-
-  if (PcdGetBool (PcdPciDisableBusEnumeration)) {
-    return ScanForRootBridges (Count);
-  }
-
-  ZeroMem (&Io, sizeof (Io));
-  ZeroMem (&Mem, sizeof (Mem));
-  ZeroMem (&MemAbove4G, sizeof (MemAbove4G));
-
-  Attributes = EFI_PCI_ATTRIBUTE_IDE_PRIMARY_IO |
-    EFI_PCI_ATTRIBUTE_IDE_SECONDARY_IO |
-    EFI_PCI_ATTRIBUTE_ISA_IO_16 |
-    EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO |
-    EFI_PCI_ATTRIBUTE_VGA_MEMORY |
-    EFI_PCI_ATTRIBUTE_VGA_IO_16 |
-    EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;
-
-  AllocationAttributes = EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM;
-  if (PcdGet64 (PcdPciMmio64Size) > 0) {
-    AllocationAttributes |= EFI_PCI_HOST_BRIDGE_MEM64_DECODE;
-    MemAbove4G.Base = PcdGet64 (PcdPciMmio64Base);
-    MemAbove4G.Limit = PcdGet64 (PcdPciMmio64Base) +
-                       PcdGet64 (PcdPciMmio64Size) - 1;
-  } else {
-    CopyMem (&MemAbove4G, &mNonExistAperture, sizeof (mNonExistAperture));
-  }
-
-  Io.Base = PcdGet64 (PcdPciIoBase);
-  Io.Limit = PcdGet64 (PcdPciIoBase) + (PcdGet64 (PcdPciIoSize) - 1);
-  Mem.Base = PcdGet64 (PcdPciMmio32Base);
-  Mem.Limit = PcdGet64 (PcdPciMmio32Base) + (PcdGet64 (PcdPciMmio32Size) - 1);
-
-  return PciHostBridgeUtilityGetRootBridges (
-    Count,
-    Attributes,
-    AllocationAttributes,
-    FALSE,
-    PcdGet16 (PcdOvmfHostBridgePciDevId) != INTEL_Q35_MCH_DEVICE_ID,
-    0,
-    PCI_MAX_BUS,
-    &Io,
-    &Mem,
-    &MemAbove4G,
-    &mNonExistAperture,
-    &mNonExistAperture
-    );
+  return ScanForRootBridges (Count);
 }
 
 
 /**
   Free the root bridge instances array returned from
   PciHostBridgeGetRootBridges().
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 34/43] OvmfPkg/PciHostBridgeLibScan: remove PcdOvmfHostBridgePciDevId
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (32 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 33/43] OvmfPkg/PciHostBridgeLibScan: remove QEMU (fw_cfg) support Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:33   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 35/43] OvmfPkg/PciHostBridgeLibScan: clean up file names and file-top comments Laszlo Ersek
                   ` (11 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Peter Grehan, Philippe Mathieu-Daudé, Rebecca Cran

The "OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf"
instance is used in the following platforms in edk2:

  OvmfPkg/Bhyve/BhyveX64.dsc
  OvmfPkg/OvmfXen.dsc

Neither Bhyve nor Xen provide a Q35 board, therefore the expression

  PcdGet16 (PcdOvmfHostBridgePciDevId) != INTEL_Q35_MCH_DEVICE_ID

always evaluates to TRUE, in the PciHostBridgeLibScan instance.

Replace the expression with constant TRUE, eliminating the PCD dependency.

(In effect, this reports that the root bridge being registered does not
support extended PCI config space.)

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf | 4 ----
 OvmfPkg/Library/PciHostBridgeLibScan/XenSupport.c             | 4 +---
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
index 1ba880be6782..199db4cbbd19 100644
--- a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
+++ b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
@@ -36,12 +36,8 @@ [Packages]
 
 [LibraryClasses]
   BaseLib
   BaseMemoryLib
   DebugLib
   MemoryAllocationLib
-  PcdLib
   PciHostBridgeUtilityLib
   PciLib
-
-[Pcd]
-  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/XenSupport.c b/OvmfPkg/Library/PciHostBridgeLibScan/XenSupport.c
index a4a61e5836e0..edf993e82dcc 100644
--- a/OvmfPkg/Library/PciHostBridgeLibScan/XenSupport.c
+++ b/OvmfPkg/Library/PciHostBridgeLibScan/XenSupport.c
@@ -6,18 +6,16 @@
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #include <IndustryStandard/Pci.h>            // EFI_PCI_COMMAND_IO_SPACE
-#include <IndustryStandard/Q35MchIch9.h>     // INTEL_Q35_MCH_DEVICE_ID
 #include <Library/BaseLib.h>                 // DisableInterrupts()
 #include <Library/BaseMemoryLib.h>           // ZeroMem()
 #include <Library/DebugLib.h>                // ASSERT()
 #include <Library/MemoryAllocationLib.h>     // ReallocatePool()
-#include <Library/PcdLib.h>                  // PcdGet16()
 #include <Library/PciHostBridgeLib.h>        // PCI_ROOT_BRIDGE_APERTURE
 #include <Library/PciHostBridgeUtilityLib.h> // PciHostBridgeUtilityInitRoot...
 #include <Library/PciLib.h>                  // PciRead32()
 #include <Protocol/PciRootBridgeIo.h>        // EFI_PCI_ATTRIBUTE_ISA_IO
 
 #include "PciHostBridge.h"
@@ -452,13 +450,13 @@ ScanForRootBridges (
         (*NumberOfRootBridges + 1) * sizeof (PCI_ROOT_BRIDGE),
         RootBridges
       );
       ASSERT (RootBridges != NULL);
       PciHostBridgeUtilityInitRootBridge (
         Attributes, Attributes, 0,
-        FALSE, PcdGet16 (PcdOvmfHostBridgePciDevId) != INTEL_Q35_MCH_DEVICE_ID,
+        FALSE, TRUE /* NoExtendedConfigSpace */,
         (UINT8) PrimaryBus, (UINT8) SubBus,
         &Io, &Mem, &MemAbove4G, &mNonExistAperture, &mNonExistAperture,
         &RootBridges[*NumberOfRootBridges]
       );
       RootBridges[*NumberOfRootBridges].ResourceAssigned = TRUE;
       //
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 35/43] OvmfPkg/PciHostBridgeLibScan: clean up file names and file-top comments
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (33 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 34/43] OvmfPkg/PciHostBridgeLibScan: remove PcdOvmfHostBridgePciDevId Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:34   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 36/43] OvmfPkg/SmbiosPlatformDxe: clean up #includes and INF Laszlo Ersek
                   ` (10 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Peter Grehan, Philippe Mathieu-Daudé, Rebecca Cran

Rename "XenSupport.c" to "ScanForRootBridges.c", after the main function
in it.

Update the file-top comments; refer to both Bhyve and Xen.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf               | 4 ++--
 OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridge.h                        | 3 ++-
 OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c                     | 2 +-
 OvmfPkg/Library/PciHostBridgeLibScan/{XenSupport.c => ScanForRootBridges.c} | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
index 199db4cbbd19..a2ac5f93d193 100644
--- a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
+++ b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
@@ -1,8 +1,8 @@
 ## @file
-#  OVMF's instance of the PCI Host Bridge Library.
+#  OVMF's instance of the PCI Host Bridge Library, for Bhyve and Xen guests.
 #
 #  Copyright (C) 2016-2021, Red Hat, Inc.
 #  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -24,13 +24,13 @@ [Defines]
 #  VALID_ARCHITECTURES           = IA32 X64 EBC
 #
 
 [Sources]
   PciHostBridge.h
   PciHostBridgeLib.c
-  XenSupport.c
+  ScanForRootBridges.c
 
 [Packages]
   MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
 
diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridge.h b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridge.h
index 582b7929aff2..cb05220161d7 100644
--- a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridge.h
+++ b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridge.h
@@ -1,8 +1,9 @@
 /** @file
-  Header file of OVMF instance of PciHostBridgeLib.
+  OVMF's instance of the PCI Host Bridge Library, for Bhyve and Xen guests;
+  internal declarations.
 
   Copyright (C) 2021, Red Hat, Inc.
   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
index f0166e0f7279..ac8d1033df24 100644
--- a/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
+++ b/OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
@@ -1,8 +1,8 @@
 /** @file
-  OVMF's instance of the PCI Host Bridge Library.
+  OVMF's instance of the PCI Host Bridge Library, for Bhyve and Xen guests.
 
   Copyright (C) 2016-2021, Red Hat, Inc.
   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
diff --git a/OvmfPkg/Library/PciHostBridgeLibScan/XenSupport.c b/OvmfPkg/Library/PciHostBridgeLibScan/ScanForRootBridges.c
similarity index 96%
rename from OvmfPkg/Library/PciHostBridgeLibScan/XenSupport.c
rename to OvmfPkg/Library/PciHostBridgeLibScan/ScanForRootBridges.c
index edf993e82dcc..a6126a1aea52 100644
--- a/OvmfPkg/Library/PciHostBridgeLibScan/XenSupport.c
+++ b/OvmfPkg/Library/PciHostBridgeLibScan/ScanForRootBridges.c
@@ -1,8 +1,8 @@
 /** @file
-  Scan the entire PCI bus for root bridges to support OVMF above Xen.
+  Scan the entire PCI bus for root bridges to support OVMF on Bhyve and Xen.
 
   Copyright (C) 2021, Red Hat, Inc.
   Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 36/43] OvmfPkg/SmbiosPlatformDxe: clean up #includes and INF
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (34 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 35/43] OvmfPkg/PciHostBridgeLibScan: clean up file names and file-top comments Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:34   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 37/43] OvmfPkg/SmbiosPlatformDxe: return EFI_NOT_FOUND if there is no SMBIOS data Laszlo Ersek
                   ` (9 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Philippe Mathieu-Daudé

- Sort all sections in the INF file.

- Remove unused packages (MdeModulePkg) and lib classes (BaseMemoryLib)
  from the INF file.

- Restrict some lib classes (BaseLib, HobLib) and GUIDs (gEfiXenInfoGuid)
  to IA32 and X64, in the INF file; only the IA32/X64 Xen implementation
  requires these.

- Don't make "SmbiosPlatformDxe.h" #include everything just as a
  convenience. Spell out directly needed #includes in every file (annotate
  each with an example identifier consumed), drop unused #includes.

- Keep #includes sorted.

- Remove the leading underscore from the #include guard macro name in
  "SmbiosPlatformDxe.h".

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 20 ++++++++++----------
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h   | 15 +++------------
 OvmfPkg/SmbiosPlatformDxe/Qemu.c                |  8 +++++---
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c   |  6 ++++++
 OvmfPkg/SmbiosPlatformDxe/X86Xen.c              |  6 ++++--
 5 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index 8b56d90cf805..6063c0c9f609 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -21,44 +21,44 @@ [Defines]
 # The following information is for reference only and not required by the build tools.
 #
 #  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64
 #
 
 [Sources]
-  SmbiosPlatformDxe.h
-  SmbiosPlatformDxe.c
   Qemu.c
+  SmbiosPlatformDxe.c
+  SmbiosPlatformDxe.h
 
 [Sources.IA32, Sources.X64]
   X86Xen.c
 
 [Sources.ARM, Sources.AARCH64]
   ArmXen.c
 
 [Packages]
   MdePkg/MdePkg.dec
-  MdeModulePkg/MdeModulePkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
-  UefiBootServicesTableLib
-  BaseMemoryLib
-  BaseLib
-  UefiDriverEntryPoint
   DebugLib
-  HobLib
-  QemuFwCfgLib
   MemoryAllocationLib
   PcdLib
+  QemuFwCfgLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+
+[LibraryClasses.IA32, LibraryClasses.X64]
+  BaseLib
+  HobLib
 
 [Pcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated
 
 [Protocols]
   gEfiSmbiosProtocolGuid                      # PROTOCOL ALWAYS_CONSUMED
 
-[Guids]
+[Guids.IA32, Guids.X64]
   gEfiXenInfoGuid
 
 [Depex]
   gEfiSmbiosProtocolGuid
 
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index 21aa916d7784..ad42a326418c 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -5,25 +5,16 @@
   Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
-#ifndef _SMBIOS_PLATFORM_DXE_H_
-#define _SMBIOS_PLATFORM_DXE_H_
-
-#include <PiDxe.h>
-
-#include <Protocol/Smbios.h>
-#include <IndustryStandard/SmBios.h>
-#include <Library/DebugLib.h>
-#include <Library/BaseLib.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
+#ifndef SMBIOS_PLATFORM_DXE_H_
+#define SMBIOS_PLATFORM_DXE_H_
 
+#include <IndustryStandard/SmBios.h> // SMBIOS_TABLE_ENTRY_POINT
 
 /**
   Locates the Xen SMBIOS data if it exists
 
   @return SMBIOS_TABLE_ENTRY_POINT   Address of Xen SMBIOS data
 
diff --git a/OvmfPkg/SmbiosPlatformDxe/Qemu.c b/OvmfPkg/SmbiosPlatformDxe/Qemu.c
index e34658238123..fcfc3e33c28c 100644
--- a/OvmfPkg/SmbiosPlatformDxe/Qemu.c
+++ b/OvmfPkg/SmbiosPlatformDxe/Qemu.c
@@ -3,16 +3,18 @@
 
   Copyright (C) 2014, Gabriel L. Somlo <somlo@cmu.edu>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
+#include <Library/DebugLib.h>            // ASSERT_EFI_ERROR()
+#include <Library/MemoryAllocationLib.h> // AllocatePool()
+#include <Library/PcdLib.h>              // PcdGetBool()
+#include <Library/QemuFwCfgLib.h>        // QemuFwCfgFindFile()
+
 #include "SmbiosPlatformDxe.h"
-#include <Library/QemuFwCfgLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/PcdLib.h>
 
 /**
   Locates and extracts the QEMU SMBIOS data if present in fw_cfg
 
   @return                 Address of extracted QEMU SMBIOS data
 
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index 7991a19dc9c6..9bfc9f14f1a5 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -5,12 +5,18 @@
   Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
+#include <IndustryStandard/SmBios.h>          // SMBIOS_TABLE_TYPE0
+#include <Library/DebugLib.h>                 // ASSERT_EFI_ERROR()
+#include <Library/MemoryAllocationLib.h>      // FreePool()
+#include <Library/UefiBootServicesTableLib.h> // gBS
+#include <Protocol/Smbios.h>                  // EFI_SMBIOS_PROTOCOL
+
 #include "SmbiosPlatformDxe.h"
 
 #define TYPE0_STRINGS \
   "EFI Development Kit II / OVMF\0"     /* Vendor */ \
   "0.0.0\0"                             /* BiosVersion */ \
   "02/06/2015\0"                        /* BiosReleaseDate */
diff --git a/OvmfPkg/SmbiosPlatformDxe/X86Xen.c b/OvmfPkg/SmbiosPlatformDxe/X86Xen.c
index bead810efddb..e0b1b29f80db 100644
--- a/OvmfPkg/SmbiosPlatformDxe/X86Xen.c
+++ b/OvmfPkg/SmbiosPlatformDxe/X86Xen.c
@@ -5,15 +5,17 @@
   Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
+#include <Library/BaseLib.h> // AsciiStrnCmp()
+#include <Library/HobLib.h>  // GetFirstGuidHob()
+#include <Pi/PiHob.h>        // EFI_HOB_GUID_TYPE
+
 #include "SmbiosPlatformDxe.h"
-#include <Library/HobLib.h>
-#include <Guid/XenInfo.h>
 
 #define XEN_SMBIOS_PHYSICAL_ADDRESS       0x000EB000
 #define XEN_SMBIOS_PHYSICAL_END           0x000F0000
 
 /**
   Validates the SMBIOS entry point structure
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 37/43] OvmfPkg/SmbiosPlatformDxe: return EFI_NOT_FOUND if there is no SMBIOS data
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (35 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 36/43] OvmfPkg/SmbiosPlatformDxe: clean up #includes and INF Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:45   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 38/43] OvmfPkg/SmbiosPlatformDxe: locate SMBIOS protocol in InstallAllStructures() Laszlo Ersek
                   ` (8 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

According to the function-top comment, SmbiosTablePublishEntry() is
supposed to return an error code if no SMBIOS data is found, from either
GetXenSmbiosTables() or GetQemuSmbiosTables(). Currently the function
returns EFI_SUCCESS in this case however (propagated from
gBS->LocateProtocol()). Make the return code match the documentation.

(This issue is not too important, but it gets in the way of splitting the
entry point function next.)

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index 9bfc9f14f1a5..6d73173aa512 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -189,12 +189,13 @@ SmbiosTablePublishEntry (
                   (VOID**)&Smbios
                   );
   if (EFI_ERROR (Status)) {
     return Status;
   }
 
+  Status = EFI_NOT_FOUND;
   //
   // Add Xen or QEMU SMBIOS data if found
   //
   EntryPointStructure = GetXenSmbiosTables ();
   if (EntryPointStructure != NULL) {
     SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 38/43] OvmfPkg/SmbiosPlatformDxe: locate SMBIOS protocol in InstallAllStructures()
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (36 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 37/43] OvmfPkg/SmbiosPlatformDxe: return EFI_NOT_FOUND if there is no SMBIOS data Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-27  8:35   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 39/43] OvmfPkg/SmbiosPlatformDxe: split GetXenSmbiosTables() decl. to new header Laszlo Ersek
                   ` (7 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

Locate the SMBIOS protocol internally to the InstallAllStructures()
function. This has no performance impact (InstallAllStructures() is only
called once), but moving the code from the entry point function makes the
latter smaller. And that will be useful when we split the entry point
function to two versions.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 30 +++++++++-----------
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index 6d73173aa512..757bec879e4a 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -92,27 +92,38 @@ SmbiosTableLength (
 }
 
 
 /**
   Install all structures from the given SMBIOS structures block
 
-  @param  Smbios               SMBIOS protocol
   @param  TableAddress         SMBIOS tables starting address
 
 **/
 EFI_STATUS
 InstallAllStructures (
-  IN EFI_SMBIOS_PROTOCOL       *Smbios,
   IN UINT8                     *TableAddress
   )
 {
+  EFI_SMBIOS_PROTOCOL       *Smbios;
   EFI_STATUS                Status;
   SMBIOS_STRUCTURE_POINTER  SmbiosTable;
   EFI_SMBIOS_HANDLE         SmbiosHandle;
   BOOLEAN                   NeedSmbiosType0;
 
+  //
+  // Find the SMBIOS protocol
+  //
+  Status = gBS->LocateProtocol (
+                  &gEfiSmbiosProtocolGuid,
+                  NULL,
+                  (VOID**)&Smbios
+                  );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
   SmbiosTable.Raw = TableAddress;
   if (SmbiosTable.Raw == NULL) {
     return EFI_INVALID_PARAMETER;
   }
 
   NeedSmbiosType0 = TRUE;
@@ -173,41 +184,28 @@ EFIAPI
 SmbiosTablePublishEntry (
   IN EFI_HANDLE           ImageHandle,
   IN EFI_SYSTEM_TABLE     *SystemTable
   )
 {
   EFI_STATUS                Status;
-  EFI_SMBIOS_PROTOCOL       *Smbios;
   SMBIOS_TABLE_ENTRY_POINT  *EntryPointStructure;
   UINT8                     *SmbiosTables;
 
-  //
-  // Find the SMBIOS protocol
-  //
-  Status = gBS->LocateProtocol (
-                  &gEfiSmbiosProtocolGuid,
-                  NULL,
-                  (VOID**)&Smbios
-                  );
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
   Status = EFI_NOT_FOUND;
   //
   // Add Xen or QEMU SMBIOS data if found
   //
   EntryPointStructure = GetXenSmbiosTables ();
   if (EntryPointStructure != NULL) {
     SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
   } else {
     SmbiosTables = GetQemuSmbiosTables ();
   }
 
   if (SmbiosTables != NULL) {
-    Status = InstallAllStructures (Smbios, SmbiosTables);
+    Status = InstallAllStructures (SmbiosTables);
 
     //
     // Free SmbiosTables if allocated by Qemu (i.e., NOT by Xen):
     //
     if (EntryPointStructure == NULL) {
       FreePool (SmbiosTables);
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 39/43] OvmfPkg/SmbiosPlatformDxe: split GetXenSmbiosTables() decl. to new header
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (37 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 38/43] OvmfPkg/SmbiosPlatformDxe: locate SMBIOS protocol in InstallAllStructures() Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-31 14:54   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 40/43] OvmfPkg/SmbiosPlatformDxe: declare InstallAllStructures() in header file Laszlo Ersek
                   ` (6 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Andrew Fish, Anthony Perard, Ard Biesheuvel, Jordan Justen,
	Julien Grall, Leif Lindholm, Michael D Kinney,
	Philippe Mathieu-Daudé

Move the declaration of the GetXenSmbiosTables() function to a new header
file called "XenSmbiosPlatformDxe.h". (The only declaration that remains
in "SmbiosPlatformDxe.h" for now is that of GetQemuSmbiosTables().)

Modify the pattern in "Maintainers.txt" so that the new file be covered in
the "OvmfPkg: Xen-related modules" section.

This patch is best viewed with "git show --no-renames".

Cc: Andrew Fish <afish@apple.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf                |  1 +
 Maintainers.txt                                                |  2 +-
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h                  | 14 --------------
 OvmfPkg/SmbiosPlatformDxe/{ArmXen.c => XenSmbiosPlatformDxe.h} | 20 ++++++++++----------
 OvmfPkg/SmbiosPlatformDxe/ArmXen.c                             |  2 +-
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c                  |  1 +
 OvmfPkg/SmbiosPlatformDxe/X86Xen.c                             |  2 +-
 7 files changed, 15 insertions(+), 27 deletions(-)

diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index 6063c0c9f609..140fa16ac135 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -24,12 +24,13 @@ [Defines]
 #
 
 [Sources]
   Qemu.c
   SmbiosPlatformDxe.c
   SmbiosPlatformDxe.h
+  XenSmbiosPlatformDxe.h
 
 [Sources.IA32, Sources.X64]
   X86Xen.c
 
 [Sources.ARM, Sources.AARCH64]
   ArmXen.c
diff --git a/Maintainers.txt b/Maintainers.txt
index e5f419e67f0c..751477e8e62a 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -499,13 +499,13 @@ F: OvmfPkg/Library/XenConsoleSerialPortLib/
 F: OvmfPkg/Library/XenHypercallLib/
 F: OvmfPkg/Library/XenIoMmioLib/
 F: OvmfPkg/Library/XenPlatformLib/
 F: OvmfPkg/Library/XenRealTimeClockLib/
 F: OvmfPkg/OvmfXen.*
 F: OvmfPkg/OvmfXenElfHeaderGenerator.c
-F: OvmfPkg/SmbiosPlatformDxe/*Xen.c
+F: OvmfPkg/SmbiosPlatformDxe/*Xen*
 F: OvmfPkg/XenAcpiPlatformDxe/
 F: OvmfPkg/XenBusDxe/
 F: OvmfPkg/XenIoPciDxe/
 F: OvmfPkg/XenIoPvhDxe/
 F: OvmfPkg/XenPlatformPei/
 F: OvmfPkg/XenPvBlkDxe/
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index ad42a326418c..7a0bdbb2911f 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -8,26 +8,12 @@
 
 **/
 
 #ifndef SMBIOS_PLATFORM_DXE_H_
 #define SMBIOS_PLATFORM_DXE_H_
 
-#include <IndustryStandard/SmBios.h> // SMBIOS_TABLE_ENTRY_POINT
-
-/**
-  Locates the Xen SMBIOS data if it exists
-
-  @return SMBIOS_TABLE_ENTRY_POINT   Address of Xen SMBIOS data
-
-**/
-SMBIOS_TABLE_ENTRY_POINT *
-GetXenSmbiosTables (
-  VOID
-  );
-
-
 /**
   Locates and extracts the QEMU SMBIOS table data if present in fw_cfg
 
   @return             Address of extracted QEMU SMBIOS data
 
 **/
diff --git a/OvmfPkg/SmbiosPlatformDxe/ArmXen.c b/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.h
similarity index 56%
copy from OvmfPkg/SmbiosPlatformDxe/ArmXen.c
copy to OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.h
index c2847f905303..850a8b662cd5 100644
--- a/OvmfPkg/SmbiosPlatformDxe/ArmXen.c
+++ b/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.h
@@ -1,28 +1,28 @@
 /** @file
-  Detect Xen SMBIOS data on ARM / AARCH64.
+  This driver installs SMBIOS information for OVMF on Xen
 
-  Copyright (C) 2015, Red Hat, Inc.
+  Copyright (C) 2021, Red Hat, Inc.
   Copyright (c) 2011, Bei Guan <gbtju85@gmail.com>
   Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
+
 **/
 
-#include "SmbiosPlatformDxe.h"
+#ifndef XEN_SMBIOS_PLATFORM_DXE_H_
+#define XEN_SMBIOS_PLATFORM_DXE_H_
+
+#include <IndustryStandard/SmBios.h> // SMBIOS_TABLE_ENTRY_POINT
 
 /**
   Locates the Xen SMBIOS data if it exists
 
   @return SMBIOS_TABLE_ENTRY_POINT   Address of Xen SMBIOS data
 
 **/
 SMBIOS_TABLE_ENTRY_POINT *
 GetXenSmbiosTables (
   VOID
-  )
-{
-  //
-  // Not implemented yet.
-  //
-  return NULL;
-}
+  );
+
+#endif
diff --git a/OvmfPkg/SmbiosPlatformDxe/ArmXen.c b/OvmfPkg/SmbiosPlatformDxe/ArmXen.c
index c2847f905303..3dd849bbc0b4 100644
--- a/OvmfPkg/SmbiosPlatformDxe/ArmXen.c
+++ b/OvmfPkg/SmbiosPlatformDxe/ArmXen.c
@@ -5,13 +5,13 @@
   Copyright (c) 2011, Bei Guan <gbtju85@gmail.com>
   Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
-#include "SmbiosPlatformDxe.h"
+#include "XenSmbiosPlatformDxe.h"
 
 /**
   Locates the Xen SMBIOS data if it exists
 
   @return SMBIOS_TABLE_ENTRY_POINT   Address of Xen SMBIOS data
 
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index 757bec879e4a..f280a1852ddd 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -12,12 +12,13 @@
 #include <Library/DebugLib.h>                 // ASSERT_EFI_ERROR()
 #include <Library/MemoryAllocationLib.h>      // FreePool()
 #include <Library/UefiBootServicesTableLib.h> // gBS
 #include <Protocol/Smbios.h>                  // EFI_SMBIOS_PROTOCOL
 
 #include "SmbiosPlatformDxe.h"
+#include "XenSmbiosPlatformDxe.h"
 
 #define TYPE0_STRINGS \
   "EFI Development Kit II / OVMF\0"     /* Vendor */ \
   "0.0.0\0"                             /* BiosVersion */ \
   "02/06/2015\0"                        /* BiosReleaseDate */
 //
diff --git a/OvmfPkg/SmbiosPlatformDxe/X86Xen.c b/OvmfPkg/SmbiosPlatformDxe/X86Xen.c
index e0b1b29f80db..0acedf8995da 100644
--- a/OvmfPkg/SmbiosPlatformDxe/X86Xen.c
+++ b/OvmfPkg/SmbiosPlatformDxe/X86Xen.c
@@ -9,13 +9,13 @@
 **/
 
 #include <Library/BaseLib.h> // AsciiStrnCmp()
 #include <Library/HobLib.h>  // GetFirstGuidHob()
 #include <Pi/PiHob.h>        // EFI_HOB_GUID_TYPE
 
-#include "SmbiosPlatformDxe.h"
+#include "XenSmbiosPlatformDxe.h"
 
 #define XEN_SMBIOS_PHYSICAL_ADDRESS       0x000EB000
 #define XEN_SMBIOS_PHYSICAL_END           0x000F0000
 
 /**
   Validates the SMBIOS entry point structure
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 40/43] OvmfPkg/SmbiosPlatformDxe: declare InstallAllStructures() in header file
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (38 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 39/43] OvmfPkg/SmbiosPlatformDxe: split GetXenSmbiosTables() decl. to new header Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-31 15:00   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 41/43] OvmfPkg/SmbiosPlatformDxe: create Xen-specific module INF file Laszlo Ersek
                   ` (5 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

Add an extern declaration for the InstallAllStructures() function to the
"SmbiosPlatformDxe.h" header file. (The leading comment block and the
prototype are simply copied from "SmbiosPlatformDxe.c".)

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index 7a0bdbb2911f..0ae2556fe800 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -8,12 +8,23 @@
 
 **/
 
 #ifndef SMBIOS_PLATFORM_DXE_H_
 #define SMBIOS_PLATFORM_DXE_H_
 
+/**
+  Install all structures from the given SMBIOS structures block
+
+  @param  TableAddress         SMBIOS tables starting address
+
+**/
+EFI_STATUS
+InstallAllStructures (
+  IN UINT8                     *TableAddress
+  );
+
 /**
   Locates and extracts the QEMU SMBIOS table data if present in fw_cfg
 
   @return             Address of extracted QEMU SMBIOS data
 
 **/
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 41/43] OvmfPkg/SmbiosPlatformDxe: create Xen-specific module INF file
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (39 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 40/43] OvmfPkg/SmbiosPlatformDxe: declare InstallAllStructures() in header file Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-31 14:56   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 42/43] OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point Laszlo Ersek
                   ` (4 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Philippe Mathieu-Daudé

"OvmfPkg/SmbiosPlatformDxe" is structured somewhat differently from the
drivers duplicated and trimmed thus far in this series. The final QEMU and
Xen versions will share a relatively significant amount of code, therefore
duplicating the whole driver is less useful, even temporarily. Instead,
duplicate the INF file, in preparation for customizing the entry point
function.

Because ArmVirtXen doesn't actually include OvmfPkg/SmbiosPlatformDxe [*],
there is only one platform that's supposed to consume the new driver:
OvmfXen. Switch OvmfXen to the new driver at once.

[*] See commit 164cf4038357 ("OvmfPkg: SmbiosPlatformDxe: restrict current
    Xen code to IA32/X64", 2015-07-26).

This patch is best viewed with "git show --find-copies-harder".

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/OvmfXen.dsc                                                           | 2 +-
 OvmfPkg/OvmfXen.fdf                                                           | 2 +-
 OvmfPkg/SmbiosPlatformDxe/{SmbiosPlatformDxe.inf => XenSmbiosPlatformDxe.inf} | 7 ++++---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 0986d9f5c356..3c1ca6bfd493 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -642,13 +642,13 @@ [Components]
   # SMBIOS Support
   #
   MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf {
     <LibraryClasses>
       NULL|OvmfPkg/Library/SmbiosVersionLib/DetectSmbiosVersionLib.inf
   }
-  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+  OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf
 
   #
   # ACPI Support
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
   OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf
index 9acc7c93b98b..aeb9336fd5b7 100644
--- a/OvmfPkg/OvmfXen.fdf
+++ b/OvmfPkg/OvmfXen.fdf
@@ -345,13 +345,13 @@ [FV.DXEFV]
 !if $(SOURCE_DEBUG_ENABLE) == FALSE
 INF  MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf
 !endif
 INF  MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KeyboardDxe.inf
 
 INF  MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
-INF  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+INF  OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf
 
 INF  MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
 INF  OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
 INF  MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.inf
 INF  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf
similarity index 80%
copy from OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
copy to OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf
index 140fa16ac135..5a093c69afd9 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf
@@ -1,20 +1,21 @@
 ## @file
-#  This driver installs SMBIOS information for OVMF
+#  This driver installs SMBIOS information for OVMF on Xen
 #
+#  Copyright (C) 2021, Red Hat, Inc.
 #  Copyright (c) 2011, Bei Guan <gbtju85@gmail.com>
 #  Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
 [Defines]
   INF_VERSION                    = 0x00010005
-  BASE_NAME                      = SmbiosPlatformDxe
-  FILE_GUID                      = 4110465d-5ff3-4f4b-b580-24ed0d06747a
+  BASE_NAME                      = XenSmbiosPlatformDxe
+  FILE_GUID                      = c41f0579-5598-40f1-95db-3983c8ebbe2a
   MODULE_TYPE                    = DXE_DRIVER
   VERSION_STRING                 = 1.0
 
   ENTRY_POINT                    = SmbiosTablePublishEntry
 
 #
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 42/43] OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (40 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 41/43] OvmfPkg/SmbiosPlatformDxe: create Xen-specific module INF file Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-31 15:03   ` Philippe Mathieu-Daudé
  2021-05-26 20:14 ` [PATCH 43/43] OvmfPkg: restrict XenPlatformLib to BdsDxe in the IA32, IA32X64, X64 DSCs Laszlo Ersek
                   ` (3 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Philippe Mathieu-Daudé

Remove the SmbiosTablePublishEntry() function from "SmbiosPlatformDxe.c".
"SmbiosPlatformDxe.c" becomes hypervisor-agnostic.

Add SmbiosTablePublishEntry() back, simplified for QEMU, to the existent
file "Qemu.c". The GetQemuSmbiosTables() function no longer needs to be
declared in "SmbiosPlatformDxe.h"; "SmbiosPlatformDxe.h" becomes
hypervisor-agnostic.

Add SmbiosTablePublishEntry() back, renamed and simplified for Xen, to the
new, arch-independent file "Xen.c". (The existent Xen-specific C files are
arch-dependent.)

Update both INF files; remove the dependencies that are now superfluous in
each.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien@xen.org>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf    | 14 ------
 OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf | 12 ++---
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h      | 11 -----
 OvmfPkg/SmbiosPlatformDxe/Qemu.c                   | 33 +++++++++++++
 OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c      | 49 --------------------
 OvmfPkg/SmbiosPlatformDxe/Xen.c                    | 49 ++++++++++++++++++++
 6 files changed, 86 insertions(+), 82 deletions(-)

diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
index 140fa16ac135..eaee73110d27 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
@@ -24,19 +24,12 @@ [Defines]
 #
 
 [Sources]
   Qemu.c
   SmbiosPlatformDxe.c
   SmbiosPlatformDxe.h
-  XenSmbiosPlatformDxe.h
-
-[Sources.IA32, Sources.X64]
-  X86Xen.c
-
-[Sources.ARM, Sources.AARCH64]
-  ArmXen.c
 
 [Packages]
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
@@ -44,22 +37,15 @@ [LibraryClasses]
   MemoryAllocationLib
   PcdLib
   QemuFwCfgLib
   UefiBootServicesTableLib
   UefiDriverEntryPoint
 
-[LibraryClasses.IA32, LibraryClasses.X64]
-  BaseLib
-  HobLib
-
 [Pcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated
 
 [Protocols]
   gEfiSmbiosProtocolGuid                      # PROTOCOL ALWAYS_CONSUMED
 
-[Guids.IA32, Guids.X64]
-  gEfiXenInfoGuid
-
 [Depex]
   gEfiSmbiosProtocolGuid
 
diff --git a/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf b/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf
index 5a093c69afd9..7f4588e33d1e 100644
--- a/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf
+++ b/OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf
@@ -13,51 +13,47 @@ [Defines]
   INF_VERSION                    = 0x00010005
   BASE_NAME                      = XenSmbiosPlatformDxe
   FILE_GUID                      = c41f0579-5598-40f1-95db-3983c8ebbe2a
   MODULE_TYPE                    = DXE_DRIVER
   VERSION_STRING                 = 1.0
 
-  ENTRY_POINT                    = SmbiosTablePublishEntry
+  ENTRY_POINT                    = XenSmbiosTablePublishEntry
 
 #
 # The following information is for reference only and not required by the build tools.
 #
 #  VALID_ARCHITECTURES           = IA32 X64 EBC ARM AARCH64
 #
 
 [Sources]
-  Qemu.c
   SmbiosPlatformDxe.c
   SmbiosPlatformDxe.h
+  Xen.c
   XenSmbiosPlatformDxe.h
 
 [Sources.IA32, Sources.X64]
   X86Xen.c
 
 [Sources.ARM, Sources.AARCH64]
   ArmXen.c
 
 [Packages]
   MdePkg/MdePkg.dec
+
+[Packages.IA32, Packages.X64]
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
   DebugLib
-  MemoryAllocationLib
-  PcdLib
-  QemuFwCfgLib
   UefiBootServicesTableLib
   UefiDriverEntryPoint
 
 [LibraryClasses.IA32, LibraryClasses.X64]
   BaseLib
   HobLib
 
-[Pcd]
-  gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated
-
 [Protocols]
   gEfiSmbiosProtocolGuid                      # PROTOCOL ALWAYS_CONSUMED
 
 [Guids.IA32, Guids.X64]
   gEfiXenInfoGuid
 
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
index 0ae2556fe800..213a7f39e91d 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h
@@ -19,18 +19,7 @@
 **/
 EFI_STATUS
 InstallAllStructures (
   IN UINT8                     *TableAddress
   );
 
-/**
-  Locates and extracts the QEMU SMBIOS table data if present in fw_cfg
-
-  @return             Address of extracted QEMU SMBIOS data
-
-**/
-UINT8 *
-GetQemuSmbiosTables (
-  VOID
-  );
-
 #endif
diff --git a/OvmfPkg/SmbiosPlatformDxe/Qemu.c b/OvmfPkg/SmbiosPlatformDxe/Qemu.c
index fcfc3e33c28c..a668c6ac2123 100644
--- a/OvmfPkg/SmbiosPlatformDxe/Qemu.c
+++ b/OvmfPkg/SmbiosPlatformDxe/Qemu.c
@@ -45,6 +45,39 @@ GetQemuSmbiosTables (
 
   QemuFwCfgSelectItem (Tables);
   QemuFwCfgReadBytes (TablesSize, QemuTables);
 
   return QemuTables;
 }
+
+/**
+  Installs SMBIOS information for OVMF
+
+  @param ImageHandle     Module's image handle
+  @param SystemTable     Pointer of EFI_SYSTEM_TABLE
+
+  @retval EFI_SUCCESS    Smbios data successfully installed
+  @retval Other          Smbios data was not installed
+
+**/
+EFI_STATUS
+EFIAPI
+SmbiosTablePublishEntry (
+  IN EFI_HANDLE           ImageHandle,
+  IN EFI_SYSTEM_TABLE     *SystemTable
+  )
+{
+  EFI_STATUS                Status;
+  UINT8                     *SmbiosTables;
+
+  Status = EFI_NOT_FOUND;
+  //
+  // Add QEMU SMBIOS data if found
+  //
+  SmbiosTables = GetQemuSmbiosTables ();
+  if (SmbiosTables != NULL) {
+    Status = InstallAllStructures (SmbiosTables);
+    FreePool (SmbiosTables);
+  }
+
+  return Status;
+}
diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
index f280a1852ddd..7bcf83762e9b 100644
--- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
+++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c
@@ -7,18 +7,16 @@
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #include <IndustryStandard/SmBios.h>          // SMBIOS_TABLE_TYPE0
 #include <Library/DebugLib.h>                 // ASSERT_EFI_ERROR()
-#include <Library/MemoryAllocationLib.h>      // FreePool()
 #include <Library/UefiBootServicesTableLib.h> // gBS
 #include <Protocol/Smbios.h>                  // EFI_SMBIOS_PROTOCOL
 
 #include "SmbiosPlatformDxe.h"
-#include "XenSmbiosPlatformDxe.h"
 
 #define TYPE0_STRINGS \
   "EFI Development Kit II / OVMF\0"     /* Vendor */ \
   "0.0.0\0"                             /* BiosVersion */ \
   "02/06/2015\0"                        /* BiosReleaseDate */
 //
@@ -165,53 +163,6 @@ InstallAllStructures (
                        );
     ASSERT_EFI_ERROR (Status);
   }
 
   return EFI_SUCCESS;
 }
-
-
-/**
-  Installs SMBIOS information for OVMF
-
-  @param ImageHandle     Module's image handle
-  @param SystemTable     Pointer of EFI_SYSTEM_TABLE
-
-  @retval EFI_SUCCESS    Smbios data successfully installed
-  @retval Other          Smbios data was not installed
-
-**/
-EFI_STATUS
-EFIAPI
-SmbiosTablePublishEntry (
-  IN EFI_HANDLE           ImageHandle,
-  IN EFI_SYSTEM_TABLE     *SystemTable
-  )
-{
-  EFI_STATUS                Status;
-  SMBIOS_TABLE_ENTRY_POINT  *EntryPointStructure;
-  UINT8                     *SmbiosTables;
-
-  Status = EFI_NOT_FOUND;
-  //
-  // Add Xen or QEMU SMBIOS data if found
-  //
-  EntryPointStructure = GetXenSmbiosTables ();
-  if (EntryPointStructure != NULL) {
-    SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
-  } else {
-    SmbiosTables = GetQemuSmbiosTables ();
-  }
-
-  if (SmbiosTables != NULL) {
-    Status = InstallAllStructures (SmbiosTables);
-
-    //
-    // Free SmbiosTables if allocated by Qemu (i.e., NOT by Xen):
-    //
-    if (EntryPointStructure == NULL) {
-      FreePool (SmbiosTables);
-    }
-  }
-
-  return Status;
-}
diff --git a/OvmfPkg/SmbiosPlatformDxe/Xen.c b/OvmfPkg/SmbiosPlatformDxe/Xen.c
new file mode 100644
index 000000000000..75d9550913d1
--- /dev/null
+++ b/OvmfPkg/SmbiosPlatformDxe/Xen.c
@@ -0,0 +1,49 @@
+/** @file
+  This driver installs SMBIOS information for OVMF on Xen
+
+  Copyright (C) 2021, Red Hat, Inc.
+  Copyright (c) 2011, Bei Guan <gbtju85@gmail.com>
+  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "SmbiosPlatformDxe.h"
+#include "XenSmbiosPlatformDxe.h"
+
+/**
+  Installs SMBIOS information for OVMF on Xen
+
+  @param ImageHandle     Module's image handle
+  @param SystemTable     Pointer of EFI_SYSTEM_TABLE
+
+  @retval EFI_SUCCESS    Smbios data successfully installed
+  @retval Other          Smbios data was not installed
+
+**/
+EFI_STATUS
+EFIAPI
+XenSmbiosTablePublishEntry (
+  IN EFI_HANDLE           ImageHandle,
+  IN EFI_SYSTEM_TABLE     *SystemTable
+  )
+{
+  EFI_STATUS                Status;
+  SMBIOS_TABLE_ENTRY_POINT  *EntryPointStructure;
+  UINT8                     *SmbiosTables;
+
+  Status = EFI_NOT_FOUND;
+  //
+  // Add Xen SMBIOS data if found
+  //
+  EntryPointStructure = GetXenSmbiosTables ();
+  if (EntryPointStructure != NULL) {
+    SmbiosTables = (UINT8*)(UINTN)EntryPointStructure->TableAddress;
+    if (SmbiosTables != NULL) {
+      Status = InstallAllStructures (SmbiosTables);
+    }
+  }
+
+  return Status;
+}
-- 
2.19.1.3.g30247aa5d201



^ permalink raw reply related	[flat|nested] 102+ messages in thread

* [PATCH 43/43] OvmfPkg: restrict XenPlatformLib to BdsDxe in the IA32, IA32X64, X64 DSCs
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (41 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 42/43] OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point Laszlo Ersek
@ 2021-05-26 20:14 ` Laszlo Ersek
  2021-05-31 14:58   ` Philippe Mathieu-Daudé
  2021-05-27  7:34 ` [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Ard Biesheuvel
                   ` (2 subsequent siblings)
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-26 20:14 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Philippe Mathieu-Daudé

The "OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf"
library instance is used in the following platform DSC files in edk2:

  OvmfPkg/OvmfPkgIa32.dsc
  OvmfPkg/OvmfPkgIa32X64.dsc
  OvmfPkg/OvmfPkgX64.dsc
  OvmfPkg/OvmfXen.dsc

The Xen customizations are very light-weight in this
PlatformBootManagerLib instance. Isolating them statically, for the sake
of the first three DSC files, would save negligible binary code size, and
would likely worsen code complexity (by way of introducing new internal
interfaces) or blow up source code size (by duplicating almost the entire
lib instance source code). So for now, keep this one bit of Xen dynamism
even on QEMU.

However, because it's only PlatformBootManagerLib now that uses
XenPlatformLib (for the above-stated enlightenment), restrict the
XenPlatformLib class resolution in the first three DSC files to the only
DXE driver that consumes PlatformBootManagerLib (and therefore
XenPlatformLib): BdsDxe. This will cause a build failure later if someone
attempts to call a XenPlatformLib API (that is, tries to re-introduce Xen
enlightenment) in a different module in these non-Xen DSC files.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/OvmfPkgIa32.dsc    | 2 +-
 OvmfPkg/OvmfPkgIa32X64.dsc | 2 +-
 OvmfPkg/OvmfPkgX64.dsc     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 7a37efd35664..f53efeae7986 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -223,13 +223,12 @@ [LibraryClasses]
 
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
   S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
-  XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 
 !if $(TPM_ENABLE) == TRUE
   Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
   Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
   Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
   Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
@@ -767,12 +766,13 @@ [Components]
   MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
   MdeModulePkg/Universal/Metronome/Metronome.inf
   PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
   MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
     <LibraryClasses>
+      XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 !ifdef $(CSM_ENABLE)
       NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
       NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
 !endif
   }
   MdeModulePkg/Logo/LogoDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index d6cc58a261d9..b3662e17f256 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -227,13 +227,12 @@ [LibraryClasses]
 
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
   S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
-  XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 
 !if $(TPM_ENABLE) == TRUE
   Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
   Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
   Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
   Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
@@ -781,12 +780,13 @@ [Components.X64]
   MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
   MdeModulePkg/Universal/Metronome/Metronome.inf
   PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
   MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
     <LibraryClasses>
+      XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 !ifdef $(CSM_ENABLE)
       NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
       NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
 !endif
   }
   MdeModulePkg/Logo/LogoDxe.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index ab60c36eca27..0a237a905866 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -227,13 +227,12 @@ [LibraryClasses]
 
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
   S3BootScriptLib|MdeModulePkg/Library/PiDxeS3BootScriptLib/DxeS3BootScriptLib.inf
   SmbusLib|MdePkg/Library/BaseSmbusLibNull/BaseSmbusLibNull.inf
   OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
-  XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 
 !if $(TPM_ENABLE) == TRUE
   Tpm12CommandLib|SecurityPkg/Library/Tpm12CommandLib/Tpm12CommandLib.inf
   Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
   Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
   Tcg2PpVendorLib|SecurityPkg/Library/Tcg2PpVendorLibNull/Tcg2PpVendorLibNull.inf
@@ -779,12 +778,13 @@ [Components]
   MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
   MdeModulePkg/Universal/Metronome/Metronome.inf
   PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
   MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
     <LibraryClasses>
+      XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 !ifdef $(CSM_ENABLE)
       NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
       NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
 !endif
   }
   MdeModulePkg/Logo/LogoDxe.inf
-- 
2.19.1.3.g30247aa5d201


^ permalink raw reply related	[flat|nested] 102+ messages in thread

* Re: [PATCH 17/43] OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment
  2021-05-26 20:14 ` [PATCH 17/43] OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment Laszlo Ersek
@ 2021-05-26 20:40   ` Rebecca Cran
  2021-05-27  8:40   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 102+ messages in thread
From: Rebecca Cran @ 2021-05-26 20:40 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Ard Biesheuvel, Jordan Justen, Peter Grehan,
	Philippe Mathieu-Daudé

On 5/26/21 2:14 PM, Laszlo Ersek wrote:

> The built-in ACPI tables for Bhyve are located in the
> "OvmfPkg/Bhyve/AcpiTables" module, not in the "OvmfPkg/AcpiTables" module.
> Correct the typo in a code comment.
>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>   OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
> index d5c78c61d5ad..9ccdb4d91cd1 100644
> --- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
> +++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
> @@ -129,13 +129,13 @@ LocateFvInstanceWithTables (
>     Find ACPI tables in an FV and install them.
>   
>     This is now a fall-back path. Normally, we will search for tables provided
>     by the VMM first.
>   
>     If that fails, we use this function to load the ACPI tables from an FV. The
> -  sources for the FV based tables is located under OvmfPkg/AcpiTables.
> +  sources for the FV based tables is located under OvmfPkg/Bhyve/AcpiTables.
>   
>     @param  AcpiTable     Protocol instance pointer
>   
>   **/
>   EFI_STATUS
>   EFIAPI
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 24/43] OvmfPkg/Bhyve: make "PcdPciDisableBusEnumeration" Fixed-at-Build
  2021-05-26 20:14 ` [PATCH 24/43] OvmfPkg/Bhyve: make "PcdPciDisableBusEnumeration" Fixed-at-Build Laszlo Ersek
@ 2021-05-26 20:41   ` Rebecca Cran
  2021-05-27  8:43   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 102+ messages in thread
From: Rebecca Cran @ 2021-05-26 20:41 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Ard Biesheuvel, Jordan Justen, Peter Grehan,
	Philippe Mathieu-Daudé

On 5/26/21 2:14 PM, Laszlo Ersek wrote:
> The Bhyve platform specifies the dynamic access method for
> "PcdPciDisableBusEnumeration" needlessly.
>
> After the DSC file sets the PCD to TRUE by default, the PCD is never
> written again. In particular, the
> "OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf" file references the PCD
> superfluously.
>
> Make the PCD Fixed-At-Build, and remove the PCD reference from the INF
> file.
>
> (Note that further simplifications are possible in
> "OvmfPkg/Bhyve/AcpiPlatformDxe", but those are out of scope for this patch
> series.)
>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>   OvmfPkg/Bhyve/BhyveX64.dsc                | 2 +-
>   OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf | 1 -
>   2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
> index 7d9e88040000..896b62881bdb 100644
> --- a/OvmfPkg/Bhyve/BhyveX64.dsc
> +++ b/OvmfPkg/Bhyve/BhyveX64.dsc
> @@ -428,12 +428,13 @@ [PcdsFeatureFlag]
>     gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
>     gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
>     gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
>     gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
>   
>   [PcdsFixedAtBuild]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
>     gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|FALSE
>     gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|TRUE
>     gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1
>     gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
>     gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x10
>     gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|0
> @@ -526,13 +527,12 @@ [PcdsDynamicDefault]
>     #   ($(SMM_REQUIRE) == FALSE)
>     gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
>   
>     gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
>     gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0
>     gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
>     gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800
>     gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600
>     gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable|FALSE
>     gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId|0
>     gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase|0x0
>     gUefiOvmfPkgTokenSpaceGuid.PcdPciIoSize|0x0
> diff --git a/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf b/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf
> index 12203e9f804d..739d63098b1e 100644
> --- a/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf
> +++ b/OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf
> @@ -83,13 +83,12 @@ [Pcd]
>     gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDecompressionScratchEnd
>     gUefiOvmfPkgTokenSpaceGuid.PcdQ35TsegMbytes
>     gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress
>     gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
>     gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
>     gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
>     gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
>     gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable
>     gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack
>     gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiS3Enable
>     gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrMask
>     gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy


Reviewed-by: Rebecca Cran <rebecca@bsdio.com>



^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 30/43] OvmfPkg/Bhyve: consume PciHostBridgeLibScan
  2021-05-26 20:14 ` [PATCH 30/43] OvmfPkg/Bhyve: consume PciHostBridgeLibScan Laszlo Ersek
@ 2021-05-26 22:46   ` Rebecca Cran
  2021-05-27  8:31   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 102+ messages in thread
From: Rebecca Cran @ 2021-05-26 22:46 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Ard Biesheuvel, Jordan Justen, Peter Grehan,
	Philippe Mathieu-Daudé

On 5/26/21 2:14 PM, Laszlo Ersek wrote:
> Switch the Bhyve platform from the "OvmfPkg/PciHostBridgeLib" instance to
> the "OvmfPkg/PciHostBridgeLibScan" instance. Currently this is a no-op
> functionally; we'll customize the "PciHostBridgeLibScan" instance later.
>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>   OvmfPkg/Bhyve/BhyveX64.dsc | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
> index 30a99e2a3425..d8792812ab21 100644
> --- a/OvmfPkg/Bhyve/BhyveX64.dsc
> +++ b/OvmfPkg/Bhyve/BhyveX64.dsc
> @@ -663,13 +663,13 @@ [Components]
>     UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
>     UefiCpuPkg/CpuDxe/CpuDxe.inf
>     PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
>     OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
>     MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
>       <LibraryClasses>
> -      PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> +      PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf
>         PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
>         NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf
>     }
>     MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
>       <LibraryClasses>
>         PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (42 preceding siblings ...)
  2021-05-26 20:14 ` [PATCH 43/43] OvmfPkg: restrict XenPlatformLib to BdsDxe in the IA32, IA32X64, X64 DSCs Laszlo Ersek
@ 2021-05-27  7:34 ` Ard Biesheuvel
  2021-05-27  8:55   ` Laszlo Ersek
  2021-05-27 13:07 ` Leif Lindholm
  2021-06-02  8:36 ` [edk2-devel] " Laszlo Ersek
  45 siblings, 1 reply; 102+ messages in thread
From: Ard Biesheuvel @ 2021-05-27  7:34 UTC (permalink / raw)
  To: Laszlo Ersek
  Cc: devel, Andrew Fish, Anthony Perard, Ard Biesheuvel, Brijesh Singh,
	Erdem Aktas, James Bottomley, Jiewen Yao, Jordan Justen,
	Julien Grall, Leif Lindholm, Michael D Kinney, Min Xu,
	Peter Grehan, Philippe Mathieu-Daudé, Rebecca Cran,
	Tom Lendacky

On Wed, 26 May 2021 at 22:15, Laszlo Ersek <lersek@redhat.com> wrote:
>
> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Repo:     https://pagure.io/lersek/edk2.git
> Branch:   xen_split_bz_2122
>
> This patch set removes dynamic Xen enlightenment from the following
> platforms:
>
>   OvmfPkg/OvmfPkgIa32.dsc
>   OvmfPkg/OvmfPkgIa32X64.dsc
>   OvmfPkg/OvmfPkgX64.dsc
>
> In Xen guests, the following platform should be used:
>
>   OvmfPkg/OvmfXen.dsc
>
> Please see more details / references in the bugzilla ticket.
>
> NOOPT build savings:
>
> - Ia32:    PEIFV 1536 bytes, DXEFV 130288 bytes
> - Ia32X64: PEIFV 1536 bytes, DXEFV 140912 bytes
> - X64:     PEIFV 1664 bytes, DXEFV 140912 bytes
> - Xen:     PEIFV  256 bytes, DXEFV  69504 bytes
>
> Functional testing:
>
> - Booted a Fedora guest on OvmfPkgIa32X64 on QEMU/KVM, compared verbose
>   logs before-after. Memory allocations were satisfied at different
>   addresses, as expected, plus the Xen drivers were absent. No
>   differences otherwise.
>
> - Booted a RHEL guest on ArmVirtQemu on AARCH64. Memory allocations were
>   satisfied at different addresses, as expected.
>
> - Xen regression-testing was not done; I'm requesting feedback.
>
> Build testing / bisectability: at every stage, the series builds with
> the following script:
>
> > #!/bin/bash
> > set -e -u -C
> >
> > build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc            -a AARCH64
> > build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc    -a ARM
> > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc               -a AARCH64
> > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc       -a ARM
> > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc         -a AARCH64
> > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc -a ARM
> > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc                -a AARCH64
> > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc        -a ARM
> > build -b NOOPT -t GCC5 -p OvmfPkg/AmdSev/AmdSevX64.dsc             -a X64
> > build -b NOOPT -t GCC5 -p OvmfPkg/Bhyve/BhyveX64.dsc               -a X64
> > build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32.dsc          -a IA32
> > build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32X64.dsc       -a IA32 -a X64
> > build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc                   -a X64
> > build -b NOOPT -t GCC5 -p OvmfPkg/OvmfXen.dsc                      -a X64
>
> The patches in the series were formatted with the following options, for
> posting:
>
>   --stat=1000 --stat-graph-width=20 --find-copies-harder -U6
>
> (The option "--find-copies-harder" is not the best for presenting every
> single patch in the series, in isolation, but taken globally for the
> entire series, it is the most helpful option.)
>
> Some patches advance with really small steps, in order to cut down on a
> subsequent "meaty" patch. Personally I don't like reviewing code
> movement patches, so I did my best to (a) keep that to a minimum, and
> (b) present it as unintrusively as possible.
>
> The CC list is a bit long; the reason is that I kept touching up
> "Maintainers.txt", and the "OvmfPkg/Bhyve" and "OvmfPkg/AmdSev"
> platforms as well (whenever it made sense).
>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Min Xu <min.m.xu@intel.com>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
>
> Thanks,
> Laszlo
>
> Laszlo Ersek (43):
>   OvmfPkg: remove the Xen drivers from the IA32, IA32X64, and X64
>     platforms
>   OvmfPkg: remove the Xen drivers from the AmdSev platform
>   OvmfPkg: switch IA32, IA32X64, X64 to the fw_cfg-only ACPI platform
>     driver
>   OvmfPkg: switch the AmdSev platform to the fw_cfg-only ACPI platform
>     driver
>   OvmfPkg/README: bump minimum QEMU version to 1.7.1, machine types to
>     1.7
>   OvmfPkg/AcpiPlatformDxe: fix header file warts
>   OvmfPkg/AcpiPlatformDxe: sort #includes and [LibraryClasses]
>   OvmfPkg/AcpiPlatformDxe/QemuLoader.h: remove QemuFwCfgLib class
>     dependency
>   OvmfPkg/AcpiPlatformDxe: move "QemuLoader.h" to IndustryStandard
>   OvmfPkg/AcpiPlatformDxe: consolidate #includes and [LibraryClasses]
>   OvmfPkg/XenAcpiPlatformDxe: create from AcpiPlatformDxe
>   OvmfPkg/AcpiPlatformDxe: remove the "AcpiPlatformDxe.inf" driver
>   OvmfPkg/XenAcpiPlatformDxe: remove the QEMU ACPI linker/loader client
>   OvmfPkg/XenAcpiPlatformDxe: remove QEMU fw_cfg dependency
>   OvmfPkg/XenAcpiPlatformDxe: remove the InstallAcpiTable() helper
>     function
>   OvmfPkg/XenAcpiPlatformDxe: remove OVMF's built-in ACPI tables
>   OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment
>   OvmfPkg/AcpiTables: remove unused module
>   OvmfPkg/OvmfXen: make "PcdPciDisableBusEnumeration" Fixed-at-Build
>   OvmfPkg/XenAcpiPlatformDxe: remove delayed ACPI table installation
>   OvmfPkg/PlatformPei: remove Xen support
>   OvmfPkg: drop PcdPciDisableBusEnumeration from the IA32, IA32X64, X64
>     DSCs
>   OvmfPkg: drop PcdPciDisableBusEnumeration from the AmdSev platform
>   OvmfPkg/Bhyve: make "PcdPciDisableBusEnumeration" Fixed-at-Build
>   OvmfPkg/OvmfXen: remove IncompatiblePciDeviceSupport DXE driver
>   OvmfPkg/Bhyve: remove IncompatiblePciDeviceSupport DXE driver
>   OvmfPkg/IncompatiblePciDeviceSupportDxe: remove
>     PcdPciDisableBusEnumeration
>   OvmfPkg/PciHostBridgeLib: consolidate #includes and INF file sections
>   OvmfPkg/PciHostBridgeLibScan: create from PciHostBridgeLib
>   OvmfPkg/Bhyve: consume PciHostBridgeLibScan
>   OvmfPkg/OvmfXen: consume PciHostBridgeLibScan
>   OvmfPkg/PciHostBridgeLib: remove Bhyve and Xen support
>   OvmfPkg/PciHostBridgeLibScan: remove QEMU (fw_cfg) support
>   OvmfPkg/PciHostBridgeLibScan: remove PcdOvmfHostBridgePciDevId
>   OvmfPkg/PciHostBridgeLibScan: clean up file names and file-top
>     comments
>   OvmfPkg/SmbiosPlatformDxe: clean up #includes and INF
>   OvmfPkg/SmbiosPlatformDxe: return EFI_NOT_FOUND if there is no SMBIOS
>     data
>   OvmfPkg/SmbiosPlatformDxe: locate SMBIOS protocol in
>     InstallAllStructures()
>   OvmfPkg/SmbiosPlatformDxe: split GetXenSmbiosTables() decl. to new
>     header
>   OvmfPkg/SmbiosPlatformDxe: declare InstallAllStructures() in header
>     file
>   OvmfPkg/SmbiosPlatformDxe: create Xen-specific module INF file
>   OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point
>   OvmfPkg: restrict XenPlatformLib to BdsDxe in the IA32, IA32X64, X64
>     DSCs
>

Thanks for taking this on.

For the series,

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>


>  Maintainers.txt                                                                                          |  10 +-
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c                                                                   | 262 --------
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h                                                                   |  50 +-
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf                                                              |  71 --
>  OvmfPkg/AcpiPlatformDxe/BootScript.c                                                                     |   7 +-
>  OvmfPkg/AcpiPlatformDxe/EntryPoint.c                                                                     |   7 +-
>  OvmfPkg/AcpiPlatformDxe/PciDecoding.c                                                                    |   4 +-
>  OvmfPkg/AcpiPlatformDxe/Qemu.c                                                                           | 511 ---------------
>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c                                                                  |  21 +-
>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf                                                     |   5 +-
>  OvmfPkg/AcpiTables/AcpiTables.inf                                                                        |  38 --
>  OvmfPkg/AcpiTables/Dsdt.asl                                                                              | 692 --------------------
>  OvmfPkg/AcpiTables/Facp.aslc                                                                             |  89 ---
>  OvmfPkg/AcpiTables/Facs.aslc                                                                             |  78 ---
>  OvmfPkg/AcpiTables/Madt.aslc                                                                             | 153 -----
>  OvmfPkg/AcpiTables/Platform.h                                                                            |  68 --
>  OvmfPkg/AcpiTables/Ssdt.asl                                                                              |  13 -
>  OvmfPkg/AmdSev/AmdSevX64.dsc                                                                             |   9 +-
>  OvmfPkg/AmdSev/AmdSevX64.fdf                                                                             |  12 +-
>  OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c                                                             |   2 +-
>  OvmfPkg/Bhyve/BhyveX64.dsc                                                                               |   5 +-
>  OvmfPkg/Bhyve/BhyveX64.fdf                                                                               |   1 -
>  OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf                                                                |   1 -
>  OvmfPkg/{AcpiPlatformDxe => Include/IndustryStandard}/QemuLoader.h                                       |   8 +-
>  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c                                   |  10 +-
>  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf                                 |   2 -
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c                                                      |  28 +-
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf                                                    |   8 +-
>  OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridge.h                               |   4 +-
>  OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c                                                  |  74 +++
>  OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.inf => PciHostBridgeLibScan/PciHostBridgeLibScan.inf} |  24 +-
>  OvmfPkg/Library/{PciHostBridgeLib/XenSupport.c => PciHostBridgeLibScan/ScanForRootBridges.c}             |  27 +-
>  OvmfPkg/OvmfPkgIa32.dsc                                                                                  |  10 +-
>  OvmfPkg/OvmfPkgIa32.fdf                                                                                  |  12 +-
>  OvmfPkg/OvmfPkgIa32X64.dsc                                                                               |  10 +-
>  OvmfPkg/OvmfPkgIa32X64.fdf                                                                               |  12 +-
>  OvmfPkg/OvmfPkgX64.dsc                                                                                   |  10 +-
>  OvmfPkg/OvmfPkgX64.fdf                                                                                   |  12 +-
>  OvmfPkg/OvmfXen.dsc                                                                                      |  10 +-
>  OvmfPkg/OvmfXen.fdf                                                                                      |  12 +-
>  OvmfPkg/PlatformPei/MemDetect.c                                                                          |  10 +-
>  OvmfPkg/PlatformPei/Platform.c                                                                           | 162 +++--
>  OvmfPkg/PlatformPei/Platform.h                                                                           |  17 -
>  OvmfPkg/PlatformPei/PlatformPei.inf                                                                      |   4 -
>  OvmfPkg/PlatformPei/Xen.c                                                                                | 222 -------
>  OvmfPkg/PlatformPei/Xen.h                                                                                |  39 --
>  OvmfPkg/README                                                                                           |  43 +-
>  OvmfPkg/SmbiosPlatformDxe/ArmXen.c                                                                       |   2 +-
>  OvmfPkg/SmbiosPlatformDxe/Qemu.c                                                                         |  41 +-
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c                                                            |  79 +--
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h                                                            |  37 +-
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf                                                          |  23 +-
>  OvmfPkg/SmbiosPlatformDxe/X86Xen.c                                                                       |   8 +-
>  OvmfPkg/SmbiosPlatformDxe/Xen.c                                                                          |  49 ++
>  OvmfPkg/SmbiosPlatformDxe/{ArmXen.c => XenSmbiosPlatformDxe.h}                                           |  20 +-
>  OvmfPkg/SmbiosPlatformDxe/{SmbiosPlatformDxe.inf => XenSmbiosPlatformDxe.inf}                            |  32 +-
>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c                                                                |  41 ++
>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h                                                                |  28 +
>  OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c                                                                  |  43 ++
>  OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Xen.c                                                    |  66 +-
>  OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf                                                        |  45 ++
>  OvmfPkg/XenPlatformPei/Platform.c                                                                        |   1 -
>  OvmfPkg/XenPlatformPei/Platform.h                                                                        |   5 -
>  OvmfPkg/XenPlatformPei/Xen.c                                                                             |  20 -
>  OvmfPkg/XenPlatformPei/XenPlatformPei.inf                                                                |   1 -
>  65 files changed, 593 insertions(+), 2827 deletions(-)
>  delete mode 100644 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
>  delete mode 100644 OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
>  delete mode 100644 OvmfPkg/AcpiPlatformDxe/Qemu.c
>  delete mode 100644 OvmfPkg/AcpiTables/AcpiTables.inf
>  delete mode 100644 OvmfPkg/AcpiTables/Dsdt.asl
>  delete mode 100644 OvmfPkg/AcpiTables/Facp.aslc
>  delete mode 100644 OvmfPkg/AcpiTables/Facs.aslc
>  delete mode 100644 OvmfPkg/AcpiTables/Madt.aslc
>  delete mode 100644 OvmfPkg/AcpiTables/Platform.h
>  delete mode 100644 OvmfPkg/AcpiTables/Ssdt.asl
>  rename OvmfPkg/{AcpiPlatformDxe => Include/IndustryStandard}/QemuLoader.h (94%)
>  rename OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridge.h (57%)
>  create mode 100644 OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
>  copy OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.inf => PciHostBridgeLibScan/PciHostBridgeLibScan.inf} (51%)
>  rename OvmfPkg/Library/{PciHostBridgeLib/XenSupport.c => PciHostBridgeLibScan/ScanForRootBridges.c} (91%)
>  delete mode 100644 OvmfPkg/PlatformPei/Xen.c
>  delete mode 100644 OvmfPkg/PlatformPei/Xen.h
>  create mode 100644 OvmfPkg/SmbiosPlatformDxe/Xen.c
>  copy OvmfPkg/SmbiosPlatformDxe/{ArmXen.c => XenSmbiosPlatformDxe.h} (56%)
>  copy OvmfPkg/SmbiosPlatformDxe/{SmbiosPlatformDxe.inf => XenSmbiosPlatformDxe.inf} (65%)
>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
>  rename OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Xen.c (82%)
>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
>
>
> base-commit: cfa6ffb113f2c0d922034cc77c0d6c52eea05497
> --
> 2.19.1.3.g30247aa5d201
>

^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 01/43] OvmfPkg: remove the Xen drivers from the IA32, IA32X64, and X64 platforms
  2021-05-26 20:14 ` [PATCH 01/43] OvmfPkg: remove the Xen drivers from the IA32, IA32X64, and X64 platforms Laszlo Ersek
@ 2021-05-27  8:22   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:22 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Remove the three Xen drivers as the first step for removing Xen support
> from the historical OvmfPkg* platforms. Xen (HVM and PVH) guests are
> supported by the dedicated OvmfXen platform.
> 
> No module remains dependent on XenHypercallLib, so remove the
> XenHypercallLib class resolutions too, from the DSC files.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/OvmfPkgIa32.dsc    | 4 ----
>  OvmfPkg/OvmfPkgIa32X64.dsc | 4 ----
>  OvmfPkg/OvmfPkgX64.dsc     | 4 ----
>  OvmfPkg/OvmfPkgIa32.fdf    | 3 ---
>  OvmfPkg/OvmfPkgIa32X64.fdf | 3 ---
>  OvmfPkg/OvmfPkgX64.fdf     | 3 ---
>  6 files changed, 21 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 02/43] OvmfPkg: remove the Xen drivers from the AmdSev platform
  2021-05-26 20:14 ` [PATCH 02/43] OvmfPkg: remove the Xen drivers from the AmdSev platform Laszlo Ersek
@ 2021-05-27  8:22   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:22 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Ard Biesheuvel, Brijesh Singh, Erdem Aktas, James Bottomley,
	Jiewen Yao, Jordan Justen, Min Xu, Tom Lendacky

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> For symmetry with the historical OvmfPkg* platforms, remove the three Xen
> drivers from the remotely attested, QEMU/KVM-only, AmdSev platform. Xen
> (HVM and PVH) guests are supported by the dedicated OvmfXen platform.
> 
> No module remains dependent on XenHypercallLib, so remove the
> XenHypercallLib class resolution too, from the DSC file.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Min Xu <min.m.xu@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/AmdSev/AmdSevX64.dsc | 4 ----
>  OvmfPkg/AmdSev/AmdSevX64.fdf | 3 ---
>  2 files changed, 7 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 05/43] OvmfPkg/README: bump minimum QEMU version to 1.7.1, machine types to 1.7
  2021-05-26 20:14 ` [PATCH 05/43] OvmfPkg/README: bump minimum QEMU version to 1.7.1, machine types to 1.7 Laszlo Ersek
@ 2021-05-27  8:24   ` Philippe Mathieu-Daudé
  2021-05-27  8:56     ` Laszlo Ersek
  0 siblings, 1 reply; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:24 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Due to switching to the QemuFwCfgAcpiPlatformDxe driver earlier in this
> series, require QEMU version 1.7.1 in the "OvmfPkg/README" file, and
> require 1.7 or later machine types too.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/README | 43 ++++----------------
>  1 file changed, 8 insertions(+), 35 deletions(-)

:))

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 06/43] OvmfPkg/AcpiPlatformDxe: fix header file warts
  2021-05-26 20:14 ` [PATCH 06/43] OvmfPkg/AcpiPlatformDxe: fix header file warts Laszlo Ersek
@ 2021-05-27  8:24   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:24 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> - Remove the leading underscores from the #include guard macro names;
>   clean up the names in general.
> 
> - Remove the useless "Include/" directory prefix from the public header
>   pathnames.
> 
> - Fix incorrect file-top comment.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h | 6 +++---
>  OvmfPkg/AcpiPlatformDxe/QemuLoader.h   | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 07/43] OvmfPkg/AcpiPlatformDxe: sort #includes and [LibraryClasses]
  2021-05-26 20:14 ` [PATCH 07/43] OvmfPkg/AcpiPlatformDxe: sort #includes and [LibraryClasses] Laszlo Ersek
@ 2021-05-27  8:25   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:25 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Place all public #includes first, all module-private #includes second.
> Separate them with a single empty line. Keep each section sorted in
> itself.
> 
> Sort all sections in both INF files.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf          | 18 +++++++++---------
>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf |  2 +-
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h               | 15 ++++++---------
>  OvmfPkg/AcpiPlatformDxe/EntryPoint.c                 |  1 +
>  OvmfPkg/AcpiPlatformDxe/Qemu.c                       | 11 ++++++-----
>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c              | 12 ++++++------
>  OvmfPkg/AcpiPlatformDxe/Xen.c                        |  3 ++-
>  7 files changed, 31 insertions(+), 31 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 08/43] OvmfPkg/AcpiPlatformDxe/QemuLoader.h: remove QemuFwCfgLib class dependency
  2021-05-26 20:14 ` [PATCH 08/43] OvmfPkg/AcpiPlatformDxe/QemuLoader.h: remove QemuFwCfgLib class dependency Laszlo Ersek
@ 2021-05-27  8:26   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:26 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> "QemuLoader.h" needs the QEMU_FW_CFG_FNAME_SIZE macro. This macro used to
> live in the QemuFwCfgLib class header, but we moved it to the more
> foundational IndustryStandard include file called "QemuFwCfg.h" in commit
> 5583a8a4ffd0 ("OvmfPkg/QemuFwCfgLib: move types/macros from lib class to
> IndustryStandard", 2017-02-22).
> 
> Replace the lib class dependency with the more basic IndustryStandard
> dependency in "QemuLoader.h".
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/AcpiPlatformDxe/QemuLoader.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 09/43] OvmfPkg/AcpiPlatformDxe: move "QemuLoader.h" to IndustryStandard
  2021-05-26 20:14 ` [PATCH 09/43] OvmfPkg/AcpiPlatformDxe: move "QemuLoader.h" to IndustryStandard Laszlo Ersek
@ 2021-05-27  8:26   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:26 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Turn the "QemuLoader.h" header into a public (IndustryStandard) one. The
> QEMU ACPI linker-loader interface is stable between QEMU and multiple
> guest firmwares.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/{AcpiPlatformDxe => Include/IndustryStandard}/QemuLoader.h | 0
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf                        | 1 -
>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf               | 1 -
>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c                            | 2 +-
>  4 files changed, 1 insertion(+), 3 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 18/43] OvmfPkg/AcpiTables: remove unused module
  2021-05-26 20:14 ` [PATCH 18/43] OvmfPkg/AcpiTables: remove unused module Laszlo Ersek
@ 2021-05-27  8:27   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:27 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The "OvmfPkg/AcpiTables/AcpiTables.inf" module is no longer used by any
> module in edk2; remove it.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/AcpiTables/AcpiTables.inf |  38 --
>  OvmfPkg/AcpiTables/Platform.h     |  68 --
>  OvmfPkg/AcpiTables/Dsdt.asl       | 692 --------------------
>  OvmfPkg/AcpiTables/Facp.aslc      |  89 ---
>  OvmfPkg/AcpiTables/Facs.aslc      |  78 ---
>  OvmfPkg/AcpiTables/Madt.aslc      | 153 -----
>  OvmfPkg/AcpiTables/Ssdt.asl       |  13 -
>  7 files changed, 1131 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 20/43] OvmfPkg/XenAcpiPlatformDxe: remove delayed ACPI table installation
  2021-05-26 20:14 ` [PATCH 20/43] OvmfPkg/XenAcpiPlatformDxe: remove delayed ACPI table installation Laszlo Ersek
@ 2021-05-27  8:28   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:28 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Because "PcdPciDisableBusEnumeration" is always TRUE in the OvmfXen
> platform, we can remove the delayed ACPI table installation from
> XenAcpiPlatformDxe. A number of dependencies become useless this way;
> remove them too.
> 
> (Note that, conversely, in the QemuFwCfgAcpiPlatformDxe driver, we
> *cannot* assume that "PcdPciDisableBusEnumeration" is always FALSE,
> regardless of Xen: in the ArmVirtQemu platform, the PCD may carry either
> FALSE or TRUE, dependent on whether or not the QEMU "virt" machine
> configuration includes a PCIe host controller, respectively.)
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf |  8 ---
>  OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c           | 56 +-------------------
>  2 files changed, 2 insertions(+), 62 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 22/43] OvmfPkg: drop PcdPciDisableBusEnumeration from the IA32, IA32X64, X64 DSCs
  2021-05-26 20:14 ` [PATCH 22/43] OvmfPkg: drop PcdPciDisableBusEnumeration from the IA32, IA32X64, X64 DSCs Laszlo Ersek
@ 2021-05-27  8:29   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:29 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> With the Xen-dependent PcdSetBoolS() call removed from
> OvmfPkg/PlatformPei, the "OvmfPkgIa32.dsc", "OvmfPkgIa32X64.dsc",
> "OvmfPkgX64.dsc" platforms never write "PcdPciDisableBusEnumeration". This
> means we don't need a dynamic default for the PCD in the DSC files; it
> could be declared Fixed-at-Build.
> 
> However, because the PCD's default value in "MdeModulePkg.dec" is FALSE,
> remove the (same-value) platform defaults altogether.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/OvmfPkgIa32.dsc    | 1 -
>  OvmfPkg/OvmfPkgIa32X64.dsc | 1 -
>  OvmfPkg/OvmfPkgX64.dsc     | 1 -
>  3 files changed, 3 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 25/43] OvmfPkg/OvmfXen: remove IncompatiblePciDeviceSupport DXE driver
  2021-05-26 20:14 ` [PATCH 25/43] OvmfPkg/OvmfXen: remove IncompatiblePciDeviceSupport DXE driver Laszlo Ersek
@ 2021-05-27  8:29   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:29 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The entry point function of "OvmfPkg/IncompatiblePciDeviceSupportDxe",
> namely DriverInitialize()
> [OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c],
> bails out immediately if "PcdPciDisableBusEnumeration" is TRUE.
> 
> The OvmfXen platform statically assigns this PCD TRUE. Thus, remove the
> driver from the OvmfXen platform.
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/OvmfXen.dsc | 1 -
>  OvmfPkg/OvmfXen.fdf | 1 -
>  2 files changed, 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 27/43] OvmfPkg/IncompatiblePciDeviceSupportDxe: remove PcdPciDisableBusEnumeration
  2021-05-26 20:14 ` [PATCH 27/43] OvmfPkg/IncompatiblePciDeviceSupportDxe: remove PcdPciDisableBusEnumeration Laszlo Ersek
@ 2021-05-27  8:30   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:30 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> At this point, the IncompatiblePciDeviceSupportDxe driver is included in
> the following platforms in edk2:
> 
>   OvmfPkg/AmdSev/AmdSevX64.dsc
>   OvmfPkg/OvmfPkgIa32.dsc
>   OvmfPkg/OvmfPkgIa32X64.dsc
>   OvmfPkg/OvmfPkgX64.dsc
> 
> All those platforms inherit FALSE for "PcdPciDisableBusEnumeration" from
> "MdeModulePkg.dec".
> 
> This makes the PcdGetBool() call in the entry point of the driver
> superfluous; remove it. Clean up now unused dependencies in the INF file
> as well.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf |  2 --
>  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c   | 10 +++-------
>  2 files changed, 3 insertions(+), 9 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 28/43] OvmfPkg/PciHostBridgeLib: consolidate #includes and INF file sections
  2021-05-26 20:14 ` [PATCH 28/43] OvmfPkg/PciHostBridgeLib: consolidate #includes and INF file sections Laszlo Ersek
@ 2021-05-27  8:31   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:31 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> - In every C file, list every necessary public #include individually, with
>   an example identifier that's actually consumed.
> 
> - Place all public #includes first, all module-private #includes second.
>   Separate them with a single empty line. Keep each section sorted in
>   itself.
> 
> - Sort all sections in the INF file, except [Defines].
> 
> - Add unlisted lib classes.
> 
> - Remove unnecessary #include directives, add unlisted #include
>   directives.
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf |  7 +++---
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   | 22 +++++++-----------
>  OvmfPkg/Library/PciHostBridgeLib/XenSupport.c         | 24 +++++++++-----------
>  3 files changed, 23 insertions(+), 30 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 30/43] OvmfPkg/Bhyve: consume PciHostBridgeLibScan
  2021-05-26 20:14 ` [PATCH 30/43] OvmfPkg/Bhyve: consume PciHostBridgeLibScan Laszlo Ersek
  2021-05-26 22:46   ` Rebecca Cran
@ 2021-05-27  8:31   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:31 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Ard Biesheuvel, Jordan Justen, Peter Grehan, Rebecca Cran

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Switch the Bhyve platform from the "OvmfPkg/PciHostBridgeLib" instance to
> the "OvmfPkg/PciHostBridgeLibScan" instance. Currently this is a no-op
> functionally; we'll customize the "PciHostBridgeLibScan" instance later.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/Bhyve/BhyveX64.dsc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 31/43] OvmfPkg/OvmfXen: consume PciHostBridgeLibScan
  2021-05-26 20:14 ` [PATCH 31/43] OvmfPkg/OvmfXen: " Laszlo Ersek
@ 2021-05-27  8:31   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:31 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Switch the OvmfXen platform from the "OvmfPkg/PciHostBridgeLib" instance
> to the "OvmfPkg/PciHostBridgeLibScan" instance. Currently this is a no-op
> functionally; we'll customize the "PciHostBridgeLibScan" instance later.
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/OvmfXen.dsc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 32/43] OvmfPkg/PciHostBridgeLib: remove Bhyve and Xen support
  2021-05-26 20:14 ` [PATCH 32/43] OvmfPkg/PciHostBridgeLib: remove Bhyve and Xen support Laszlo Ersek
@ 2021-05-27  8:32   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:32 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Andrew Fish, Ard Biesheuvel, Jordan Justen, Leif Lindholm,
	Michael D Kinney

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The "OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf" instance is
> used by the following platforms in edk2:
> 
>   OvmfPkg/AmdSev/AmdSevX64.dsc
>   OvmfPkg/OvmfPkgIa32.dsc
>   OvmfPkg/OvmfPkgIa32X64.dsc
>   OvmfPkg/OvmfPkgX64.dsc
> 
> All these platforms statically inherit PcdPciDisableBusEnumeration=FALSE
> from "MdeModulePkg.dec". Remove the the PCD and everything that depends on
> it from the PciHostBridgeLib instance. Namely, remove the logic that
> determines the root bridge apertures by (a) scanning the entire bus,
> device and function number space, and (b) parsing the BAR values that were
> pre-set by the Bhyve or Xen machinery.
> 
> "XenSupport.c" used to be listed explicitly in "Maintainers.txt", remove
> it from that spot too.
> 
> Cc: Andrew Fish <afish@apple.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf |   7 -
>  Maintainers.txt                                       |   1 -
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h      |  13 -
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   |   6 -
>  OvmfPkg/Library/PciHostBridgeLib/XenSupport.c         | 471 --------------------
>  5 files changed, 498 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 34/43] OvmfPkg/PciHostBridgeLibScan: remove PcdOvmfHostBridgePciDevId
  2021-05-26 20:14 ` [PATCH 34/43] OvmfPkg/PciHostBridgeLibScan: remove PcdOvmfHostBridgePciDevId Laszlo Ersek
@ 2021-05-27  8:33   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:33 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Peter Grehan, Rebecca Cran

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The "OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf"
> instance is used in the following platforms in edk2:
> 
>   OvmfPkg/Bhyve/BhyveX64.dsc
>   OvmfPkg/OvmfXen.dsc
> 
> Neither Bhyve nor Xen provide a Q35 board, therefore the expression
> 
>   PcdGet16 (PcdOvmfHostBridgePciDevId) != INTEL_Q35_MCH_DEVICE_ID
> 
> always evaluates to TRUE, in the PciHostBridgeLibScan instance.
> 
> Replace the expression with constant TRUE, eliminating the PCD dependency.
> 
> (In effect, this reports that the root bridge being registered does not
> support extended PCI config space.)
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf | 4 ----
>  OvmfPkg/Library/PciHostBridgeLibScan/XenSupport.c             | 4 +---
>  2 files changed, 1 insertion(+), 7 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 35/43] OvmfPkg/PciHostBridgeLibScan: clean up file names and file-top comments
  2021-05-26 20:14 ` [PATCH 35/43] OvmfPkg/PciHostBridgeLibScan: clean up file names and file-top comments Laszlo Ersek
@ 2021-05-27  8:34   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:34 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Peter Grehan, Rebecca Cran

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Rename "XenSupport.c" to "ScanForRootBridges.c", after the main function
> in it.
> 
> Update the file-top comments; refer to both Bhyve and Xen.
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf               | 4 ++--
>  OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridge.h                        | 3 ++-
>  OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c                     | 2 +-
>  OvmfPkg/Library/PciHostBridgeLibScan/{XenSupport.c => ScanForRootBridges.c} | 2 +-
>  4 files changed, 6 insertions(+), 5 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 36/43] OvmfPkg/SmbiosPlatformDxe: clean up #includes and INF
  2021-05-26 20:14 ` [PATCH 36/43] OvmfPkg/SmbiosPlatformDxe: clean up #includes and INF Laszlo Ersek
@ 2021-05-27  8:34   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:34 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> - Sort all sections in the INF file.
> 
> - Remove unused packages (MdeModulePkg) and lib classes (BaseMemoryLib)
>   from the INF file.
> 
> - Restrict some lib classes (BaseLib, HobLib) and GUIDs (gEfiXenInfoGuid)
>   to IA32 and X64, in the INF file; only the IA32/X64 Xen implementation
>   requires these.
> 
> - Don't make "SmbiosPlatformDxe.h" #include everything just as a
>   convenience. Spell out directly needed #includes in every file (annotate
>   each with an example identifier consumed), drop unused #includes.
> 
> - Keep #includes sorted.
> 
> - Remove the leading underscore from the #include guard macro name in
>   "SmbiosPlatformDxe.h".
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 20 ++++++++++----------
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h   | 15 +++------------
>  OvmfPkg/SmbiosPlatformDxe/Qemu.c                |  8 +++++---
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c   |  6 ++++++
>  OvmfPkg/SmbiosPlatformDxe/X86Xen.c              |  6 ++++--
>  5 files changed, 28 insertions(+), 27 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 38/43] OvmfPkg/SmbiosPlatformDxe: locate SMBIOS protocol in InstallAllStructures()
  2021-05-26 20:14 ` [PATCH 38/43] OvmfPkg/SmbiosPlatformDxe: locate SMBIOS protocol in InstallAllStructures() Laszlo Ersek
@ 2021-05-27  8:35   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:35 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Locate the SMBIOS protocol internally to the InstallAllStructures()
> function. This has no performance impact (InstallAllStructures() is only
> called once), but moving the code from the entry point function makes the
> latter smaller. And that will be useful when we split the entry point
> function to two versions.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 30 +++++++++-----------
>  1 file changed, 14 insertions(+), 16 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 13/43] OvmfPkg/XenAcpiPlatformDxe: remove the QEMU ACPI linker/loader client
  2021-05-26 20:14 ` [PATCH 13/43] OvmfPkg/XenAcpiPlatformDxe: remove the QEMU ACPI linker/loader client Laszlo Ersek
@ 2021-05-27  8:38   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:38 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The root of the QEMU ACPI linker/loader client in XenAcpiPlatformDxe is
> the InstallQemuFwCfgTables() function. This function always fails on Xen,
> due to its top-most QemuFwCfgFindFile() call.
> 
> Remove the InstallQemuFwCfgTables() function call from XenAcpiPlatformDxe,
> along with all dependencies that now become unused.
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf |    6 -
>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h         |   51 -
>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c         |    2 +-
>  OvmfPkg/XenAcpiPlatformDxe/BootScript.c           |  269 -----
>  OvmfPkg/XenAcpiPlatformDxe/PciDecoding.c          |  194 ----
>  OvmfPkg/XenAcpiPlatformDxe/QemuFwCfgAcpi.c        | 1196 --------------------
>  6 files changed, 1 insertion(+), 1717 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 14/43] OvmfPkg/XenAcpiPlatformDxe: remove QEMU fw_cfg dependency
  2021-05-26 20:14 ` [PATCH 14/43] OvmfPkg/XenAcpiPlatformDxe: remove QEMU fw_cfg dependency Laszlo Ersek
@ 2021-05-27  8:39   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:39 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The QemuDetected() function wraps QemuFwCfgIsAvailable(); it always fails
> on Xen. Because of that, we can eliminate the QemuDetected() call itself
> from the Xen ACPI platform driver, and then the rest of "Qemu.c" becomes
> useless -- the workhorse function of that source file is
> QemuInstallAcpiTable(), which we no longer call.
> 
> Remove any dependencies that are no longer needed by the
> XenAcpiPlatformDxe driver.
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf |   9 -
>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h         |  14 -
>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c         |   9 +-
>  OvmfPkg/XenAcpiPlatformDxe/Qemu.c                 | 511 --------------------
>  4 files changed, 1 insertion(+), 542 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 16/43] OvmfPkg/XenAcpiPlatformDxe: remove OVMF's built-in ACPI tables
  2021-05-26 20:14 ` [PATCH 16/43] OvmfPkg/XenAcpiPlatformDxe: remove OVMF's built-in ACPI tables Laszlo Ersek
@ 2021-05-27  8:40   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:40 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Xen is an advanced hypervisor; no Xen guest can function correctly without
> the hypervisor's dynamically provided ACPI tables. Remove the built-in
> (fallback) tables from XenAcpiPlatformDxe -- and the OvmfXen platform.
> 
> Remove any dependencies from XenAcpiPlatformDxe that are no longer needed.
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/OvmfXen.dsc                               |   1 -
>  OvmfPkg/OvmfXen.fdf                               |   7 -
>  OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf |   2 -
>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c         | 202 --------------------
>  4 files changed, 212 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 17/43] OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment
  2021-05-26 20:14 ` [PATCH 17/43] OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment Laszlo Ersek
  2021-05-26 20:40   ` Rebecca Cran
@ 2021-05-27  8:40   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:40 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Ard Biesheuvel, Jordan Justen, Peter Grehan, Rebecca Cran

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The built-in ACPI tables for Bhyve are located in the
> "OvmfPkg/Bhyve/AcpiTables" module, not in the "OvmfPkg/AcpiTables" module.
> Correct the typo in a code comment.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 10/43] OvmfPkg/AcpiPlatformDxe: consolidate #includes and [LibraryClasses]
  2021-05-26 20:14 ` [PATCH 10/43] OvmfPkg/AcpiPlatformDxe: consolidate #includes and [LibraryClasses] Laszlo Ersek
@ 2021-05-27  8:41   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:41 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> - #include only such public headers in "AcpiPlatform.h" that are required
>   by the function declarations and type definitions introduced in
>   "AcpiPlatform.h". Don't use "AcpiPlatform.h" as a convenience #include
>   file.
> 
> - In every file, list every necessary public #include individually, with
>   an example identifier that's actually consumed.
> 
> - Remove unnecessary lib classes, add unlisted lib classes.
> 
> - Remove unnecessary #include directives, add unlisted #include
>   directives.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf          |  1 -
>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf |  2 ++
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h               | 12 ++----------
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c               |  5 +++++
>  OvmfPkg/AcpiPlatformDxe/BootScript.c                 |  7 ++++---
>  OvmfPkg/AcpiPlatformDxe/EntryPoint.c                 |  6 +++++-
>  OvmfPkg/AcpiPlatformDxe/PciDecoding.c                |  4 +++-
>  OvmfPkg/AcpiPlatformDxe/Qemu.c                       | 14 +++++++-------
>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c              | 19 ++++++++++---------
>  OvmfPkg/AcpiPlatformDxe/Xen.c                        |  4 +++-
>  10 files changed, 41 insertions(+), 33 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 19/43] OvmfPkg/OvmfXen: make "PcdPciDisableBusEnumeration" Fixed-at-Build
  2021-05-26 20:14 ` [PATCH 19/43] OvmfPkg/OvmfXen: make "PcdPciDisableBusEnumeration" Fixed-at-Build Laszlo Ersek
@ 2021-05-27  8:42   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:42 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The OvmfXen platform specifies the dynamic access method for
> "PcdPciDisableBusEnumeration" needlessly.
> 
> After the DSC file sets the PCD to TRUE by default, the InitializeXen()
> function in XenPlatformPei superfluously sets the PCD to TRUE again. There
> are no other writes to the PCD in the platform.
> 
> Make the PCD Fixed-At-Build, and remove the access (in fact, the whole
> InitializeXen() function) from XenPlatformPei.
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/OvmfXen.dsc                       |  2 +-
>  OvmfPkg/XenPlatformPei/XenPlatformPei.inf |  1 -
>  OvmfPkg/XenPlatformPei/Platform.h         |  5 -----
>  OvmfPkg/XenPlatformPei/Platform.c         |  1 -
>  OvmfPkg/XenPlatformPei/Xen.c              | 20 --------------------
>  5 files changed, 1 insertion(+), 28 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 24/43] OvmfPkg/Bhyve: make "PcdPciDisableBusEnumeration" Fixed-at-Build
  2021-05-26 20:14 ` [PATCH 24/43] OvmfPkg/Bhyve: make "PcdPciDisableBusEnumeration" Fixed-at-Build Laszlo Ersek
  2021-05-26 20:41   ` Rebecca Cran
@ 2021-05-27  8:43   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:43 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Ard Biesheuvel, Jordan Justen, Peter Grehan, Rebecca Cran

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The Bhyve platform specifies the dynamic access method for
> "PcdPciDisableBusEnumeration" needlessly.
> 
> After the DSC file sets the PCD to TRUE by default, the PCD is never
> written again. In particular, the
> "OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf" file references the PCD
> superfluously.
> 
> Make the PCD Fixed-At-Build, and remove the PCD reference from the INF
> file.
> 
> (Note that further simplifications are possible in
> "OvmfPkg/Bhyve/AcpiPlatformDxe", but those are out of scope for this patch
> series.)
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/Bhyve/BhyveX64.dsc                | 2 +-
>  OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf | 1 -
>  2 files changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 37/43] OvmfPkg/SmbiosPlatformDxe: return EFI_NOT_FOUND if there is no SMBIOS data
  2021-05-26 20:14 ` [PATCH 37/43] OvmfPkg/SmbiosPlatformDxe: return EFI_NOT_FOUND if there is no SMBIOS data Laszlo Ersek
@ 2021-05-27  8:45   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  8:45 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> According to the function-top comment, SmbiosTablePublishEntry() is
> supposed to return an error code if no SMBIOS data is found, from either
> GetXenSmbiosTables() or GetQemuSmbiosTables(). Currently the function
> returns EFI_SUCCESS in this case however (propagated from
> gBS->LocateProtocol()). Make the return code match the documentation.
> 
> (This issue is not too important, but it gets in the way of splitting the
> entry point function next.)
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc
  2021-05-27  7:34 ` [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Ard Biesheuvel
@ 2021-05-27  8:55   ` Laszlo Ersek
  2021-05-31 15:06     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-27  8:55 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: devel, Andrew Fish, Anthony Perard, Ard Biesheuvel, Brijesh Singh,
	Erdem Aktas, James Bottomley, Jiewen Yao, Jordan Justen,
	Julien Grall, Leif Lindholm, Michael D Kinney, Min Xu,
	Peter Grehan, Philippe Mathieu-Daudé, Rebecca Cran,
	Tom Lendacky

On 05/27/21 09:34, Ard Biesheuvel wrote:
> On Wed, 26 May 2021 at 22:15, Laszlo Ersek <lersek@redhat.com> wrote:
>>
>> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
>> Repo:     https://pagure.io/lersek/edk2.git
>> Branch:   xen_split_bz_2122
>>
>> This patch set removes dynamic Xen enlightenment from the following
>> platforms:
>>
>>   OvmfPkg/OvmfPkgIa32.dsc
>>   OvmfPkg/OvmfPkgIa32X64.dsc
>>   OvmfPkg/OvmfPkgX64.dsc
>>
>> In Xen guests, the following platform should be used:
>>
>>   OvmfPkg/OvmfXen.dsc
>>
>> Please see more details / references in the bugzilla ticket.
>>
>> NOOPT build savings:
>>
>> - Ia32:    PEIFV 1536 bytes, DXEFV 130288 bytes
>> - Ia32X64: PEIFV 1536 bytes, DXEFV 140912 bytes
>> - X64:     PEIFV 1664 bytes, DXEFV 140912 bytes
>> - Xen:     PEIFV  256 bytes, DXEFV  69504 bytes
>>
>> Functional testing:
>>
>> - Booted a Fedora guest on OvmfPkgIa32X64 on QEMU/KVM, compared verbose
>>   logs before-after. Memory allocations were satisfied at different
>>   addresses, as expected, plus the Xen drivers were absent. No
>>   differences otherwise.
>>
>> - Booted a RHEL guest on ArmVirtQemu on AARCH64. Memory allocations were
>>   satisfied at different addresses, as expected.
>>
>> - Xen regression-testing was not done; I'm requesting feedback.
>>
>> Build testing / bisectability: at every stage, the series builds with
>> the following script:
>>
>>> #!/bin/bash
>>> set -e -u -C
>>>
>>> build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc            -a AARCH64
>>> build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc    -a ARM
>>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc               -a AARCH64
>>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc       -a ARM
>>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc         -a AARCH64
>>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc -a ARM
>>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc                -a AARCH64
>>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc        -a ARM
>>> build -b NOOPT -t GCC5 -p OvmfPkg/AmdSev/AmdSevX64.dsc             -a X64
>>> build -b NOOPT -t GCC5 -p OvmfPkg/Bhyve/BhyveX64.dsc               -a X64
>>> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32.dsc          -a IA32
>>> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32X64.dsc       -a IA32 -a X64
>>> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc                   -a X64
>>> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfXen.dsc                      -a X64
>>
>> The patches in the series were formatted with the following options, for
>> posting:
>>
>>   --stat=1000 --stat-graph-width=20 --find-copies-harder -U6
>>
>> (The option "--find-copies-harder" is not the best for presenting every
>> single patch in the series, in isolation, but taken globally for the
>> entire series, it is the most helpful option.)
>>
>> Some patches advance with really small steps, in order to cut down on a
>> subsequent "meaty" patch. Personally I don't like reviewing code
>> movement patches, so I did my best to (a) keep that to a minimum, and
>> (b) present it as unintrusively as possible.
>>
>> The CC list is a bit long; the reason is that I kept touching up
>> "Maintainers.txt", and the "OvmfPkg/Bhyve" and "OvmfPkg/AmdSev"
>> platforms as well (whenever it made sense).

> Thanks for taking this on.
> 
> For the series,
> 
> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>

Thank you, Ard!

I hope the large patch count (with the small patch bodies and the
not-so-short commit messages) didn't get on your nerves! I really did
make an effort to find a good balance. E.g. in the "clean up and sort
#includes & INF files" patches.

Thank you again!
Laszlo


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 05/43] OvmfPkg/README: bump minimum QEMU version to 1.7.1, machine types to 1.7
  2021-05-27  8:24   ` Philippe Mathieu-Daudé
@ 2021-05-27  8:56     ` Laszlo Ersek
  0 siblings, 0 replies; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-27  8:56 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 05/27/21 10:24, Philippe Mathieu-Daudé wrote:
> On 5/26/21 10:14 PM, Laszlo Ersek wrote:
>> Due to switching to the QemuFwCfgAcpiPlatformDxe driver earlier in this
>> series, require QEMU version 1.7.1 in the "OvmfPkg/README" file, and
>> require 1.7 or later machine types too.
>>
>> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
>> ---
>>  OvmfPkg/README | 43 ++++----------------
>>  1 file changed, 8 insertions(+), 35 deletions(-)
> 
> :))
> 
> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
> 

Time flies, doesn't it :)

Thank you!
Laszlo


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 15/43] OvmfPkg/XenAcpiPlatformDxe: remove the InstallAcpiTable() helper function
  2021-05-26 20:14 ` [PATCH 15/43] OvmfPkg/XenAcpiPlatformDxe: remove the InstallAcpiTable() helper function Laszlo Ersek
@ 2021-05-27  9:39   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27  9:39 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The InstallAcpiTable() helper function buys us nothing. Reduce code
> complexity by removing the function.
> 
> This patch is best viewed with "git show -b".
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h |  9 ---
>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c | 30 ++--------
>  OvmfPkg/XenAcpiPlatformDxe/Xen.c          | 60 ++++++++++----------
>  3 files changed, 36 insertions(+), 63 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 03/43] OvmfPkg: switch IA32, IA32X64, X64 to the fw_cfg-only ACPI platform driver
  2021-05-26 20:14 ` [PATCH 03/43] OvmfPkg: switch IA32, IA32X64, X64 to the fw_cfg-only ACPI platform driver Laszlo Ersek
@ 2021-05-27 10:15   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27 10:15 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Switch the historical OvmfPkg* platforms from the AcpiPlatformDxe driver
> to the QemuFwCfgAcpiPlatformDxe driver. (The latter is used by the
> ArmVirtQemu* platforms as well.)
> 
> The change effectively replaces the following call tree:
> 
>   InstallAcpiTables                [AcpiPlatform.c]
> 
>     XenDetected                    [XenPlatformLib] *
>     InstallXenTables               [Xen.c]          *
>       GetXenAcpiRsdp               [Xen.c]          *
> 
>     InstallQemuFwCfgTables         [QemuFwCfgAcpi.c]
>       ...
> 
>     InstallOvmfFvTables            [AcpiPlatform.c] *
>       QemuDetected                 [Qemu.c]         *
>       LocateFvInstanceWithTables   [AcpiPlatform.c] *
>         QemuInstallAcpiTable       [Qemu.c]         *
>           QemuInstallAcpiMadtTable [Qemu.c]         *
>             CountBits16            [Qemu.c]         *
>           QemuInstallAcpiSsdtTable [Qemu.c]         *
>             GetSuspendStates       [Qemu.c]         *
>             PopulateFwData         [Qemu.c]         *
> 
> with the one below:
> 
>   InstallAcpiTables        [QemuFwCfgAcpiPlatform.c]
>     InstallQemuFwCfgTables [QemuFwCfgAcpi.c]
>       ...
> 
> eliminating the sub-trees highlighted with "*".
> 
> There are two consequences:
> 
> (1) Xen compatibility is removed from the ACPI platform driver of the
>    historical OvmfPkg* platforms.
> 
> (2) The ACPI tables that are statically built into OVMF (via
>     "OvmfPkg/AcpiTables/AcpiTables.inf") are never installed. In
>     particular, OVMF's own runtime preparation of the MADT and SSDT is
>     eliminated.
> 
> Because of (2), remove the "OvmfPkg/AcpiTables/AcpiTables.inf" module as
> well -- and then the ACPITABLE build rule too.
> 
> Note that (2) only removes effectively dead code; the QEMU ACPI
> linker-loader has taken priority since QEMU 1.7.1 (2014). References:
> 
> - https://wiki.qemu.org/Planning/1.7
> - https://wiki.qemu.org/Features/ACPITableGeneration
> - edk2 commit 96bbdbc85693 ("OvmfPkg: AcpiPlatformDxe: download ACPI
>                             tables from QEMU", 2014-03-31)
> - edk2 commit 387536e472aa ("OvmfPkg: AcpiPlatformDxe: implement QEMU's
>                             full ACPI table loader interface", 2014-09-22)
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/OvmfPkgIa32.dsc    | 3 +--
>  OvmfPkg/OvmfPkgIa32X64.dsc | 3 +--
>  OvmfPkg/OvmfPkgX64.dsc     | 3 +--
>  OvmfPkg/OvmfPkgIa32.fdf    | 9 +--------
>  OvmfPkg/OvmfPkgIa32X64.fdf | 9 +--------
>  OvmfPkg/OvmfPkgX64.fdf     | 9 +--------
>  6 files changed, 6 insertions(+), 30 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 04/43] OvmfPkg: switch the AmdSev platform to the fw_cfg-only ACPI platform driver
  2021-05-26 20:14 ` [PATCH 04/43] OvmfPkg: switch the AmdSev platform " Laszlo Ersek
@ 2021-05-27 10:15   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27 10:15 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Ard Biesheuvel, Brijesh Singh, Erdem Aktas, James Bottomley,
	Jiewen Yao, Jordan Justen, Min Xu, Tom Lendacky

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> For consistency with the historical OvmfPkg* platforms, switch the
> remotely attested, QEMU/KVM-only, AmdSev platform from the AcpiPlatformDxe
> driver to the QemuFwCfgAcpiPlatformDxe driver.
> 
> No module remains dependent on XenPlatformLib, so remove the
> XenPlatformLib class resolution too, from the DSC file.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Min Xu <min.m.xu@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/AmdSev/AmdSevX64.dsc | 4 +---
>  OvmfPkg/AmdSev/AmdSevX64.fdf | 9 +--------
>  2 files changed, 2 insertions(+), 11 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 11/43] OvmfPkg/XenAcpiPlatformDxe: create from AcpiPlatformDxe
  2021-05-26 20:14 ` [PATCH 11/43] OvmfPkg/XenAcpiPlatformDxe: create from AcpiPlatformDxe Laszlo Ersek
@ 2021-05-27 10:16   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27 10:16 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Andrew Fish, Anthony Perard, Ard Biesheuvel, Jordan Justen,
	Julien Grall, Leif Lindholm, Michael D Kinney

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Create an almost verbatim copy of the
> "OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf" driver for the OvmfXen
> platform. We're going to trim the driver in subsequent patches.
> Ultimately, the XenAcpiPlatformDxe driver will duplicate a negligible
> amount of code that is currently present in the QemuFwCfgAcpiPlatformDxe
> driver.
> 
> List the new driver in "Maintainers.txt", in the "OvmfPkg: Xen-related
> modules" section.
> 
> Switch the OvmfXen platform to the new driver at once.
> 
> This patch should be reviewed with "git show --find-copies-harder".
> 
> Cc: Andrew Fish <afish@apple.com>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/OvmfXen.dsc                                                                        | 2 +-
>  OvmfPkg/OvmfXen.fdf                                                                        | 2 +-
>  OvmfPkg/{AcpiPlatformDxe/AcpiPlatformDxe.inf => XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf} | 7 ++++---
>  Maintainers.txt                                                                            | 1 +
>  OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/AcpiPlatform.h                             | 3 ++-
>  OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/AcpiPlatform.c                             | 3 ++-
>  OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/BootScript.c                               | 2 +-
>  OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/EntryPoint.c                               | 4 ++--
>  OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/PciDecoding.c                              | 2 +-
>  OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Qemu.c                                     | 3 +--
>  OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/QemuFwCfgAcpi.c                            | 2 +-
>  OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Xen.c                                      | 1 +
>  12 files changed, 18 insertions(+), 14 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 12/43] OvmfPkg/AcpiPlatformDxe: remove the "AcpiPlatformDxe.inf" driver
  2021-05-26 20:14 ` [PATCH 12/43] OvmfPkg/AcpiPlatformDxe: remove the "AcpiPlatformDxe.inf" driver Laszlo Ersek
@ 2021-05-27 10:17   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27 10:17 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Andrew Fish, Ard Biesheuvel, Jordan Justen, Leif Lindholm,
	Michael D Kinney

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The "OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf" module is no longer
> referenced in any platform DSC file; remove it.
> 
> That orphans the "AcpiPlatform.c", "Qemu.c" and "Xen.c" files in the
> "OvmfPkg/AcpiPlatformDxe/" directory; remove them.
> 
> That in turn removes the only definitions of the InstallAcpiTable(),
> QemuDetected(), QemuInstallAcpiTable(), InstallXenTables() functions in
> the "OvmfPkg/AcpiPlatformDxe/" directory, so remove their declarations
> from "AcpiPlatform.h".
> 
> Remove "OvmfPkg/AcpiPlatformDxe/Xen.c" from the "OvmfPkg: Xen-related
> modules" section of "Maintainers.txt", as well.
> 
> Cc: Andrew Fish <afish@apple.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf |  69 ---
>  Maintainers.txt                             |   1 -
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h      |  29 --
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c      | 267 ----------
>  OvmfPkg/AcpiPlatformDxe/Qemu.c              | 512 --------------------
>  OvmfPkg/AcpiPlatformDxe/Xen.c               | 315 ------------
>  6 files changed, 1193 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 21/43] OvmfPkg/PlatformPei: remove Xen support
  2021-05-26 20:14 ` [PATCH 21/43] OvmfPkg/PlatformPei: remove Xen support Laszlo Ersek
@ 2021-05-27 10:20   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27 10:20 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Andrew Fish, Ard Biesheuvel, Jordan Justen, Leif Lindholm,
	Michael D Kinney

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The "OvmfPkg/PlatformPei/PlatformPei.inf" module is used by the following
> platform DSCs:
> 
>   OvmfPkg/AmdSev/AmdSevX64.dsc
>   OvmfPkg/OvmfPkgIa32.dsc
>   OvmfPkg/OvmfPkgIa32X64.dsc
>   OvmfPkg/OvmfPkgX64.dsc
> 
> Remove Xen support from "OvmfPkg/PlatformPei", including any dependencies
> that now become unused. The basic idea is to substitute FALSE for "mXen".
> 
> Remove "OvmfPkg/PlatformPei" from the "OvmfPkg: Xen-related modules"
> section of "Maintainers.txt".
> 
> This patch is best reviewed with "git show -b -W".
Thanks for the tip ;)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

> Cc: Andrew Fish <afish@apple.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/PlatformPei/PlatformPei.inf |   4 -
>  Maintainers.txt                     |   3 -
>  OvmfPkg/PlatformPei/Platform.h      |  17 --
>  OvmfPkg/PlatformPei/Xen.h           |  39 ----
>  OvmfPkg/PlatformPei/MemDetect.c     |  10 +-
>  OvmfPkg/PlatformPei/Platform.c      | 162 +++++++-------
>  OvmfPkg/PlatformPei/Xen.c           | 222 --------------------
>  7 files changed, 77 insertions(+), 380 deletions(-)


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 23/43] OvmfPkg: drop PcdPciDisableBusEnumeration from the AmdSev platform
  2021-05-26 20:14 ` [PATCH 23/43] OvmfPkg: drop PcdPciDisableBusEnumeration from the AmdSev platform Laszlo Ersek
@ 2021-05-27 10:21   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27 10:21 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Ard Biesheuvel, Brijesh Singh, Erdem Aktas, James Bottomley,
	Jiewen Yao, Jordan Justen, Min Xu, Tom Lendacky

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> With the Xen-dependent PcdSetBoolS() call removed from
> OvmfPkg/PlatformPei, the "AmdSevX64.dsc" platform never writes
> "PcdPciDisableBusEnumeration". This means we don't need a dynamic default
> for the PCD in the DSC file; it could be declared Fixed-at-Build.
> 
> However, because the PCD's default value in "MdeModulePkg.dec" is FALSE,
> remove the (same-value) platform default altogether.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Min Xu <min.m.xu@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/AmdSev/AmdSevX64.dsc | 1 -
>  1 file changed, 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 26/43] OvmfPkg/Bhyve: remove IncompatiblePciDeviceSupport DXE driver
  2021-05-26 20:14 ` [PATCH 26/43] OvmfPkg/Bhyve: " Laszlo Ersek
@ 2021-05-27 10:23   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27 10:23 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Ard Biesheuvel, Jordan Justen, Peter Grehan, Rebecca Cran

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The entry point function of "OvmfPkg/IncompatiblePciDeviceSupportDxe",
> namely DriverInitialize()
> [OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c],
> bails out immediately if "PcdPciDisableBusEnumeration" is TRUE.
> 
> The Bhyve platform statically assigns this PCD TRUE. Thus, remove the
> driver from the Bhyve platform.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/Bhyve/BhyveX64.dsc | 1 -
>  OvmfPkg/Bhyve/BhyveX64.fdf | 1 -
>  2 files changed, 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 33/43] OvmfPkg/PciHostBridgeLibScan: remove QEMU (fw_cfg) support
  2021-05-26 20:14 ` [PATCH 33/43] OvmfPkg/PciHostBridgeLibScan: remove QEMU (fw_cfg) support Laszlo Ersek
@ 2021-05-27 10:25   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-27 10:25 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Peter Grehan, Rebecca Cran

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The "OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf"
> instance is used in the following platforms in edk2:
> 
>   OvmfPkg/Bhyve/BhyveX64.dsc
>   OvmfPkg/OvmfXen.dsc
> 
> Both platforms define "PcdPciDisableBusEnumeration" with Fixed-at-Build
> access method, and TRUE value. Remove the PCD from the
> PciHostBridgeLibScan instance, and everything else that is useful only
> when the PCD is FALSE.
> 
> In practice, this removes the PciHostBridgeUtilityGetRootBridges()
> function call, which is based on fw-cfg; see
> "OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c".
> 
> (Note that the dependency on PciHostBridgeUtilityLib remains in place,
> given that the PciHostBridgeLibScan instance continues using lower-level
> functions from the library that do not depend on fw-cfg.)
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLibScan.inf |  7 ---
>  OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c       | 63 +-------------------
>  2 files changed, 2 insertions(+), 68 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (43 preceding siblings ...)
  2021-05-27  7:34 ` [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Ard Biesheuvel
@ 2021-05-27 13:07 ` Leif Lindholm
  2021-05-27 13:09   ` Leif Lindholm
  2021-05-27 16:30   ` Laszlo Ersek
  2021-06-02  8:36 ` [edk2-devel] " Laszlo Ersek
  45 siblings, 2 replies; 102+ messages in thread
From: Leif Lindholm @ 2021-05-27 13:07 UTC (permalink / raw)
  To: Laszlo Ersek
  Cc: devel, Andrew Fish, Anthony Perard, Ard Biesheuvel, Brijesh Singh,
	Erdem Aktas, James Bottomley, Jiewen Yao, Jordan Justen,
	Julien Grall, Michael D Kinney, Min Xu, Peter Grehan,
	Philippe Mathieu-Daudé, Rebecca Cran, Tom Lendacky

On Wed, May 26, 2021 at 22:14:03 +0200, Laszlo Ersek wrote:
> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Repo:     https://pagure.io/lersek/edk2.git
> Branch:   xen_split_bz_2122
> 
> This patch set removes dynamic Xen enlightenment from the following
> platforms:
> 
>   OvmfPkg/OvmfPkgIa32.dsc
>   OvmfPkg/OvmfPkgIa32X64.dsc
>   OvmfPkg/OvmfPkgX64.dsc
> 
> In Xen guests, the following platform should be used:
> 
>   OvmfPkg/OvmfXen.dsc
> 
> Please see more details / references in the bugzilla ticket.
> 
> NOOPT build savings:
> 
> - Ia32:    PEIFV 1536 bytes, DXEFV 130288 bytes
> - Ia32X64: PEIFV 1536 bytes, DXEFV 140912 bytes
> - X64:     PEIFV 1664 bytes, DXEFV 140912 bytes
> - Xen:     PEIFV  256 bytes, DXEFV  69504 bytes
> 
> Functional testing:
> 
> - Booted a Fedora guest on OvmfPkgIa32X64 on QEMU/KVM, compared verbose
>   logs before-after. Memory allocations were satisfied at different
>   addresses, as expected, plus the Xen drivers were absent. No
>   differences otherwise.
> 
> - Booted a RHEL guest on ArmVirtQemu on AARCH64. Memory allocations were
>   satisfied at different addresses, as expected.
> 
> - Xen regression-testing was not done; I'm requesting feedback.
> 
> Build testing / bisectability: at every stage, the series builds with
> the following script:
> 
> > #!/bin/bash
> > set -e -u -C
> >
> > build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc            -a AARCH64
> > build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc    -a ARM
> > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc               -a AARCH64
> > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc       -a ARM
> > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc         -a AARCH64
> > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc -a ARM
> > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc                -a AARCH64
> > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc        -a ARM
> > build -b NOOPT -t GCC5 -p OvmfPkg/AmdSev/AmdSevX64.dsc             -a X64
> > build -b NOOPT -t GCC5 -p OvmfPkg/Bhyve/BhyveX64.dsc               -a X64
> > build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32.dsc          -a IA32
> > build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32X64.dsc       -a IA32 -a X64
> > build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc                   -a X64
> > build -b NOOPT -t GCC5 -p OvmfPkg/OvmfXen.dsc                      -a X64
> 
> The patches in the series were formatted with the following options, for
> posting:
> 
>   --stat=1000 --stat-graph-width=20 --find-copies-harder -U6
> 
> (The option "--find-copies-harder" is not the best for presenting every
> single patch in the series, in isolation, but taken globally for the
> entire series, it is the most helpful option.)
> 
> Some patches advance with really small steps, in order to cut down on a
> subsequent "meaty" patch. Personally I don't like reviewing code
> movement patches, so I did my best to (a) keep that to a minimum, and
> (b) present it as unintrusively as possible.
> 
> The CC list is a bit long; the reason is that I kept touching up
> "Maintainers.txt", and the "OvmfPkg/Bhyve" and "OvmfPkg/AmdSev"
> platforms as well (whenever it made sense).

I presume I was primarily cc:d for the Maintainers.txt bit?
For that (patches 11, 12, 21):
Reviewed-by: Leif Lindholm <leif@nuviainc.com>

> Cc: Andrew Fish <afish@apple.com>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Min Xu <min.m.xu@intel.com>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> 
> Thanks,
> Laszlo
> 
> Laszlo Ersek (43):
>   OvmfPkg: remove the Xen drivers from the IA32, IA32X64, and X64
>     platforms
>   OvmfPkg: remove the Xen drivers from the AmdSev platform
>   OvmfPkg: switch IA32, IA32X64, X64 to the fw_cfg-only ACPI platform
>     driver
>   OvmfPkg: switch the AmdSev platform to the fw_cfg-only ACPI platform
>     driver
>   OvmfPkg/README: bump minimum QEMU version to 1.7.1, machine types to
>     1.7
>   OvmfPkg/AcpiPlatformDxe: fix header file warts
>   OvmfPkg/AcpiPlatformDxe: sort #includes and [LibraryClasses]
>   OvmfPkg/AcpiPlatformDxe/QemuLoader.h: remove QemuFwCfgLib class
>     dependency
>   OvmfPkg/AcpiPlatformDxe: move "QemuLoader.h" to IndustryStandard
>   OvmfPkg/AcpiPlatformDxe: consolidate #includes and [LibraryClasses]
>   OvmfPkg/XenAcpiPlatformDxe: create from AcpiPlatformDxe
>   OvmfPkg/AcpiPlatformDxe: remove the "AcpiPlatformDxe.inf" driver
>   OvmfPkg/XenAcpiPlatformDxe: remove the QEMU ACPI linker/loader client
>   OvmfPkg/XenAcpiPlatformDxe: remove QEMU fw_cfg dependency
>   OvmfPkg/XenAcpiPlatformDxe: remove the InstallAcpiTable() helper
>     function
>   OvmfPkg/XenAcpiPlatformDxe: remove OVMF's built-in ACPI tables
>   OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment
>   OvmfPkg/AcpiTables: remove unused module
>   OvmfPkg/OvmfXen: make "PcdPciDisableBusEnumeration" Fixed-at-Build
>   OvmfPkg/XenAcpiPlatformDxe: remove delayed ACPI table installation
>   OvmfPkg/PlatformPei: remove Xen support
>   OvmfPkg: drop PcdPciDisableBusEnumeration from the IA32, IA32X64, X64
>     DSCs
>   OvmfPkg: drop PcdPciDisableBusEnumeration from the AmdSev platform
>   OvmfPkg/Bhyve: make "PcdPciDisableBusEnumeration" Fixed-at-Build
>   OvmfPkg/OvmfXen: remove IncompatiblePciDeviceSupport DXE driver
>   OvmfPkg/Bhyve: remove IncompatiblePciDeviceSupport DXE driver
>   OvmfPkg/IncompatiblePciDeviceSupportDxe: remove
>     PcdPciDisableBusEnumeration
>   OvmfPkg/PciHostBridgeLib: consolidate #includes and INF file sections
>   OvmfPkg/PciHostBridgeLibScan: create from PciHostBridgeLib
>   OvmfPkg/Bhyve: consume PciHostBridgeLibScan
>   OvmfPkg/OvmfXen: consume PciHostBridgeLibScan
>   OvmfPkg/PciHostBridgeLib: remove Bhyve and Xen support
>   OvmfPkg/PciHostBridgeLibScan: remove QEMU (fw_cfg) support
>   OvmfPkg/PciHostBridgeLibScan: remove PcdOvmfHostBridgePciDevId
>   OvmfPkg/PciHostBridgeLibScan: clean up file names and file-top
>     comments
>   OvmfPkg/SmbiosPlatformDxe: clean up #includes and INF
>   OvmfPkg/SmbiosPlatformDxe: return EFI_NOT_FOUND if there is no SMBIOS
>     data
>   OvmfPkg/SmbiosPlatformDxe: locate SMBIOS protocol in
>     InstallAllStructures()
>   OvmfPkg/SmbiosPlatformDxe: split GetXenSmbiosTables() decl. to new
>     header
>   OvmfPkg/SmbiosPlatformDxe: declare InstallAllStructures() in header
>     file
>   OvmfPkg/SmbiosPlatformDxe: create Xen-specific module INF file
>   OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point
>   OvmfPkg: restrict XenPlatformLib to BdsDxe in the IA32, IA32X64, X64
>     DSCs
> 
>  Maintainers.txt                                                                                          |  10 +-
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c                                                                   | 262 --------
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h                                                                   |  50 +-
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf                                                              |  71 --
>  OvmfPkg/AcpiPlatformDxe/BootScript.c                                                                     |   7 +-
>  OvmfPkg/AcpiPlatformDxe/EntryPoint.c                                                                     |   7 +-
>  OvmfPkg/AcpiPlatformDxe/PciDecoding.c                                                                    |   4 +-
>  OvmfPkg/AcpiPlatformDxe/Qemu.c                                                                           | 511 ---------------
>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c                                                                  |  21 +-
>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf                                                     |   5 +-
>  OvmfPkg/AcpiTables/AcpiTables.inf                                                                        |  38 --
>  OvmfPkg/AcpiTables/Dsdt.asl                                                                              | 692 --------------------
>  OvmfPkg/AcpiTables/Facp.aslc                                                                             |  89 ---
>  OvmfPkg/AcpiTables/Facs.aslc                                                                             |  78 ---
>  OvmfPkg/AcpiTables/Madt.aslc                                                                             | 153 -----
>  OvmfPkg/AcpiTables/Platform.h                                                                            |  68 --
>  OvmfPkg/AcpiTables/Ssdt.asl                                                                              |  13 -
>  OvmfPkg/AmdSev/AmdSevX64.dsc                                                                             |   9 +-
>  OvmfPkg/AmdSev/AmdSevX64.fdf                                                                             |  12 +-
>  OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c                                                             |   2 +-
>  OvmfPkg/Bhyve/BhyveX64.dsc                                                                               |   5 +-
>  OvmfPkg/Bhyve/BhyveX64.fdf                                                                               |   1 -
>  OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf                                                                |   1 -
>  OvmfPkg/{AcpiPlatformDxe => Include/IndustryStandard}/QemuLoader.h                                       |   8 +-
>  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c                                   |  10 +-
>  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf                                 |   2 -
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c                                                      |  28 +-
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf                                                    |   8 +-
>  OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridge.h                               |   4 +-
>  OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c                                                  |  74 +++
>  OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.inf => PciHostBridgeLibScan/PciHostBridgeLibScan.inf} |  24 +-
>  OvmfPkg/Library/{PciHostBridgeLib/XenSupport.c => PciHostBridgeLibScan/ScanForRootBridges.c}             |  27 +-
>  OvmfPkg/OvmfPkgIa32.dsc                                                                                  |  10 +-
>  OvmfPkg/OvmfPkgIa32.fdf                                                                                  |  12 +-
>  OvmfPkg/OvmfPkgIa32X64.dsc                                                                               |  10 +-
>  OvmfPkg/OvmfPkgIa32X64.fdf                                                                               |  12 +-
>  OvmfPkg/OvmfPkgX64.dsc                                                                                   |  10 +-
>  OvmfPkg/OvmfPkgX64.fdf                                                                                   |  12 +-
>  OvmfPkg/OvmfXen.dsc                                                                                      |  10 +-
>  OvmfPkg/OvmfXen.fdf                                                                                      |  12 +-
>  OvmfPkg/PlatformPei/MemDetect.c                                                                          |  10 +-
>  OvmfPkg/PlatformPei/Platform.c                                                                           | 162 +++--
>  OvmfPkg/PlatformPei/Platform.h                                                                           |  17 -
>  OvmfPkg/PlatformPei/PlatformPei.inf                                                                      |   4 -
>  OvmfPkg/PlatformPei/Xen.c                                                                                | 222 -------
>  OvmfPkg/PlatformPei/Xen.h                                                                                |  39 --
>  OvmfPkg/README                                                                                           |  43 +-
>  OvmfPkg/SmbiosPlatformDxe/ArmXen.c                                                                       |   2 +-
>  OvmfPkg/SmbiosPlatformDxe/Qemu.c                                                                         |  41 +-
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c                                                            |  79 +--
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h                                                            |  37 +-
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf                                                          |  23 +-
>  OvmfPkg/SmbiosPlatformDxe/X86Xen.c                                                                       |   8 +-
>  OvmfPkg/SmbiosPlatformDxe/Xen.c                                                                          |  49 ++
>  OvmfPkg/SmbiosPlatformDxe/{ArmXen.c => XenSmbiosPlatformDxe.h}                                           |  20 +-
>  OvmfPkg/SmbiosPlatformDxe/{SmbiosPlatformDxe.inf => XenSmbiosPlatformDxe.inf}                            |  32 +-
>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c                                                                |  41 ++
>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h                                                                |  28 +
>  OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c                                                                  |  43 ++
>  OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Xen.c                                                    |  66 +-
>  OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf                                                        |  45 ++
>  OvmfPkg/XenPlatformPei/Platform.c                                                                        |   1 -
>  OvmfPkg/XenPlatformPei/Platform.h                                                                        |   5 -
>  OvmfPkg/XenPlatformPei/Xen.c                                                                             |  20 -
>  OvmfPkg/XenPlatformPei/XenPlatformPei.inf                                                                |   1 -
>  65 files changed, 593 insertions(+), 2827 deletions(-)
>  delete mode 100644 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
>  delete mode 100644 OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
>  delete mode 100644 OvmfPkg/AcpiPlatformDxe/Qemu.c
>  delete mode 100644 OvmfPkg/AcpiTables/AcpiTables.inf
>  delete mode 100644 OvmfPkg/AcpiTables/Dsdt.asl
>  delete mode 100644 OvmfPkg/AcpiTables/Facp.aslc
>  delete mode 100644 OvmfPkg/AcpiTables/Facs.aslc
>  delete mode 100644 OvmfPkg/AcpiTables/Madt.aslc
>  delete mode 100644 OvmfPkg/AcpiTables/Platform.h
>  delete mode 100644 OvmfPkg/AcpiTables/Ssdt.asl
>  rename OvmfPkg/{AcpiPlatformDxe => Include/IndustryStandard}/QemuLoader.h (94%)
>  rename OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridge.h (57%)
>  create mode 100644 OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
>  copy OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.inf => PciHostBridgeLibScan/PciHostBridgeLibScan.inf} (51%)
>  rename OvmfPkg/Library/{PciHostBridgeLib/XenSupport.c => PciHostBridgeLibScan/ScanForRootBridges.c} (91%)
>  delete mode 100644 OvmfPkg/PlatformPei/Xen.c
>  delete mode 100644 OvmfPkg/PlatformPei/Xen.h
>  create mode 100644 OvmfPkg/SmbiosPlatformDxe/Xen.c
>  copy OvmfPkg/SmbiosPlatformDxe/{ArmXen.c => XenSmbiosPlatformDxe.h} (56%)
>  copy OvmfPkg/SmbiosPlatformDxe/{SmbiosPlatformDxe.inf => XenSmbiosPlatformDxe.inf} (65%)
>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
>  rename OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Xen.c (82%)
>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
> 
> 
> base-commit: cfa6ffb113f2c0d922034cc77c0d6c52eea05497
> -- 
> 2.19.1.3.g30247aa5d201
> 

^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc
  2021-05-27 13:07 ` Leif Lindholm
@ 2021-05-27 13:09   ` Leif Lindholm
  2021-05-27 16:30   ` Laszlo Ersek
  1 sibling, 0 replies; 102+ messages in thread
From: Leif Lindholm @ 2021-05-27 13:09 UTC (permalink / raw)
  To: Laszlo Ersek
  Cc: edk2-devel-groups-io, Andrew Fish, Anthony Perard, Ard Biesheuvel,
	Brijesh Singh, Erdem Aktas, James Bottomley, Jiewen Yao,
	Jordan Justen, Julien Grall, Michael D Kinney, Min Xu,
	Peter Grehan, Philippe Mathieu-Daudé, Rebecca Cran,
	Tom Lendacky

[-- Attachment #1: Type: text/plain, Size: 3696 bytes --]

On Thu, May 27, 2021 at 2:07 PM Leif Lindholm <leif@nuviainc.com> wrote:
>
> On Wed, May 26, 2021 at 22:14:03 +0200, Laszlo Ersek wrote:
> > Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> > Repo:     https://pagure.io/lersek/edk2.git
> > Branch:   xen_split_bz_2122
> >
> > This patch set removes dynamic Xen enlightenment from the following
> > platforms:
> >
> >   OvmfPkg/OvmfPkgIa32.dsc
> >   OvmfPkg/OvmfPkgIa32X64.dsc
> >   OvmfPkg/OvmfPkgX64.dsc
> >
> > In Xen guests, the following platform should be used:
> >
> >   OvmfPkg/OvmfXen.dsc
> >
> > Please see more details / references in the bugzilla ticket.
> >
> > NOOPT build savings:
> >
> > - Ia32:    PEIFV 1536 bytes, DXEFV 130288 bytes
> > - Ia32X64: PEIFV 1536 bytes, DXEFV 140912 bytes
> > - X64:     PEIFV 1664 bytes, DXEFV 140912 bytes
> > - Xen:     PEIFV  256 bytes, DXEFV  69504 bytes
> >
> > Functional testing:
> >
> > - Booted a Fedora guest on OvmfPkgIa32X64 on QEMU/KVM, compared verbose
> >   logs before-after. Memory allocations were satisfied at different
> >   addresses, as expected, plus the Xen drivers were absent. No
> >   differences otherwise.
> >
> > - Booted a RHEL guest on ArmVirtQemu on AARCH64. Memory allocations were
> >   satisfied at different addresses, as expected.
> >
> > - Xen regression-testing was not done; I'm requesting feedback.
> >
> > Build testing / bisectability: at every stage, the series builds with
> > the following script:
> >
> > > #!/bin/bash
> > > set -e -u -C
> > >
> > > build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc            -a
AARCH64
> > > build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc    -a ARM
> > > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc               -a
AARCH64
> > > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc       -a ARM
> > > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc         -a
AARCH64
> > > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc -a ARM
> > > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc                -a
AARCH64
> > > build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc        -a ARM
> > > build -b NOOPT -t GCC5 -p OvmfPkg/AmdSev/AmdSevX64.dsc             -a
X64
> > > build -b NOOPT -t GCC5 -p OvmfPkg/Bhyve/BhyveX64.dsc               -a
X64
> > > build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32.dsc          -a IA32
> > > build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32X64.dsc       -a IA32 -a
X64
> > > build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc                   -a
X64
> > > build -b NOOPT -t GCC5 -p OvmfPkg/OvmfXen.dsc                      -a
X64
> >
> > The patches in the series were formatted with the following options, for
> > posting:
> >
> >   --stat=1000 --stat-graph-width=20 --find-copies-harder -U6
> >
> > (The option "--find-copies-harder" is not the best for presenting every
> > single patch in the series, in isolation, but taken globally for the
> > entire series, it is the most helpful option.)
> >
> > Some patches advance with really small steps, in order to cut down on a
> > subsequent "meaty" patch. Personally I don't like reviewing code
> > movement patches, so I did my best to (a) keep that to a minimum, and
> > (b) present it as unintrusively as possible.
> >
> > The CC list is a bit long; the reason is that I kept touching up
> > "Maintainers.txt", and the "OvmfPkg/Bhyve" and "OvmfPkg/AmdSev"
> > platforms as well (whenever it made sense).
>
> I presume I was primarily cc:d for the Maintainers.txt bit?
> For that (patches 11, 12, 21):
> Reviewed-by: Leif Lindholm <leif@nuviainc.com>

Gah. Also for 32,39/43:
Reviewed-by: Leif Lindholm <leif@nuviainc.com>

Sorry, I think that's all of them.

/
    Leif

[-- Attachment #2: Type: text/html, Size: 5014 bytes --]

^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc
  2021-05-27 13:07 ` Leif Lindholm
  2021-05-27 13:09   ` Leif Lindholm
@ 2021-05-27 16:30   ` Laszlo Ersek
  1 sibling, 0 replies; 102+ messages in thread
From: Laszlo Ersek @ 2021-05-27 16:30 UTC (permalink / raw)
  To: Leif Lindholm
  Cc: devel, Andrew Fish, Anthony Perard, Ard Biesheuvel, Brijesh Singh,
	Erdem Aktas, James Bottomley, Jiewen Yao, Jordan Justen,
	Julien Grall, Michael D Kinney, Min Xu, Peter Grehan,
	Philippe Mathieu-Daudé, Rebecca Cran, Tom Lendacky

On 05/27/21 15:07, Leif Lindholm wrote:
> On Wed, May 26, 2021 at 22:14:03 +0200, Laszlo Ersek wrote:
>> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
>> Repo:     https://pagure.io/lersek/edk2.git
>> Branch:   xen_split_bz_2122
>>
>> This patch set removes dynamic Xen enlightenment from the following
>> platforms:
>>
>>   OvmfPkg/OvmfPkgIa32.dsc
>>   OvmfPkg/OvmfPkgIa32X64.dsc
>>   OvmfPkg/OvmfPkgX64.dsc
>>
>> In Xen guests, the following platform should be used:
>>
>>   OvmfPkg/OvmfXen.dsc
>>
>> Please see more details / references in the bugzilla ticket.
>>
>> NOOPT build savings:
>>
>> - Ia32:    PEIFV 1536 bytes, DXEFV 130288 bytes
>> - Ia32X64: PEIFV 1536 bytes, DXEFV 140912 bytes
>> - X64:     PEIFV 1664 bytes, DXEFV 140912 bytes
>> - Xen:     PEIFV  256 bytes, DXEFV  69504 bytes
>>
>> Functional testing:
>>
>> - Booted a Fedora guest on OvmfPkgIa32X64 on QEMU/KVM, compared verbose
>>   logs before-after. Memory allocations were satisfied at different
>>   addresses, as expected, plus the Xen drivers were absent. No
>>   differences otherwise.
>>
>> - Booted a RHEL guest on ArmVirtQemu on AARCH64. Memory allocations were
>>   satisfied at different addresses, as expected.
>>
>> - Xen regression-testing was not done; I'm requesting feedback.
>>
>> Build testing / bisectability: at every stage, the series builds with
>> the following script:
>>
>>> #!/bin/bash
>>> set -e -u -C
>>>
>>> build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc            -a AARCH64
>>> build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc    -a ARM
>>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc               -a AARCH64
>>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc       -a ARM
>>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc         -a AARCH64
>>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc -a ARM
>>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc                -a AARCH64
>>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc        -a ARM
>>> build -b NOOPT -t GCC5 -p OvmfPkg/AmdSev/AmdSevX64.dsc             -a X64
>>> build -b NOOPT -t GCC5 -p OvmfPkg/Bhyve/BhyveX64.dsc               -a X64
>>> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32.dsc          -a IA32
>>> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32X64.dsc       -a IA32 -a X64
>>> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc                   -a X64
>>> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfXen.dsc                      -a X64
>>
>> The patches in the series were formatted with the following options, for
>> posting:
>>
>>   --stat=1000 --stat-graph-width=20 --find-copies-harder -U6
>>
>> (The option "--find-copies-harder" is not the best for presenting every
>> single patch in the series, in isolation, but taken globally for the
>> entire series, it is the most helpful option.)
>>
>> Some patches advance with really small steps, in order to cut down on a
>> subsequent "meaty" patch. Personally I don't like reviewing code
>> movement patches, so I did my best to (a) keep that to a minimum, and
>> (b) present it as unintrusively as possible.
>>
>> The CC list is a bit long; the reason is that I kept touching up
>> "Maintainers.txt", and the "OvmfPkg/Bhyve" and "OvmfPkg/AmdSev"
>> platforms as well (whenever it made sense).
> 
> I presume I was primarily cc:d for the Maintainers.txt bit?

Correct!

> For that (patches 11, 12, 21):
> Reviewed-by: Leif Lindholm <leif@nuviainc.com>

Thanks!
Laszlo

> 
>> Cc: Andrew Fish <afish@apple.com>
>> Cc: Anthony Perard <anthony.perard@citrix.com>
>> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
>> Cc: Brijesh Singh <brijesh.singh@amd.com>
>> Cc: Erdem Aktas <erdemaktas@google.com>
>> Cc: James Bottomley <jejb@linux.ibm.com>
>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Julien Grall <julien@xen.org>
>> Cc: Leif Lindholm <leif@nuviainc.com>
>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>> Cc: Min Xu <min.m.xu@intel.com>
>> Cc: Peter Grehan <grehan@freebsd.org>
>> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Cc: Rebecca Cran <rebecca@bsdio.com>
>> Cc: Tom Lendacky <thomas.lendacky@amd.com>
>>
>> Thanks,
>> Laszlo
>>
>> Laszlo Ersek (43):
>>   OvmfPkg: remove the Xen drivers from the IA32, IA32X64, and X64
>>     platforms
>>   OvmfPkg: remove the Xen drivers from the AmdSev platform
>>   OvmfPkg: switch IA32, IA32X64, X64 to the fw_cfg-only ACPI platform
>>     driver
>>   OvmfPkg: switch the AmdSev platform to the fw_cfg-only ACPI platform
>>     driver
>>   OvmfPkg/README: bump minimum QEMU version to 1.7.1, machine types to
>>     1.7
>>   OvmfPkg/AcpiPlatformDxe: fix header file warts
>>   OvmfPkg/AcpiPlatformDxe: sort #includes and [LibraryClasses]
>>   OvmfPkg/AcpiPlatformDxe/QemuLoader.h: remove QemuFwCfgLib class
>>     dependency
>>   OvmfPkg/AcpiPlatformDxe: move "QemuLoader.h" to IndustryStandard
>>   OvmfPkg/AcpiPlatformDxe: consolidate #includes and [LibraryClasses]
>>   OvmfPkg/XenAcpiPlatformDxe: create from AcpiPlatformDxe
>>   OvmfPkg/AcpiPlatformDxe: remove the "AcpiPlatformDxe.inf" driver
>>   OvmfPkg/XenAcpiPlatformDxe: remove the QEMU ACPI linker/loader client
>>   OvmfPkg/XenAcpiPlatformDxe: remove QEMU fw_cfg dependency
>>   OvmfPkg/XenAcpiPlatformDxe: remove the InstallAcpiTable() helper
>>     function
>>   OvmfPkg/XenAcpiPlatformDxe: remove OVMF's built-in ACPI tables
>>   OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment
>>   OvmfPkg/AcpiTables: remove unused module
>>   OvmfPkg/OvmfXen: make "PcdPciDisableBusEnumeration" Fixed-at-Build
>>   OvmfPkg/XenAcpiPlatformDxe: remove delayed ACPI table installation
>>   OvmfPkg/PlatformPei: remove Xen support
>>   OvmfPkg: drop PcdPciDisableBusEnumeration from the IA32, IA32X64, X64
>>     DSCs
>>   OvmfPkg: drop PcdPciDisableBusEnumeration from the AmdSev platform
>>   OvmfPkg/Bhyve: make "PcdPciDisableBusEnumeration" Fixed-at-Build
>>   OvmfPkg/OvmfXen: remove IncompatiblePciDeviceSupport DXE driver
>>   OvmfPkg/Bhyve: remove IncompatiblePciDeviceSupport DXE driver
>>   OvmfPkg/IncompatiblePciDeviceSupportDxe: remove
>>     PcdPciDisableBusEnumeration
>>   OvmfPkg/PciHostBridgeLib: consolidate #includes and INF file sections
>>   OvmfPkg/PciHostBridgeLibScan: create from PciHostBridgeLib
>>   OvmfPkg/Bhyve: consume PciHostBridgeLibScan
>>   OvmfPkg/OvmfXen: consume PciHostBridgeLibScan
>>   OvmfPkg/PciHostBridgeLib: remove Bhyve and Xen support
>>   OvmfPkg/PciHostBridgeLibScan: remove QEMU (fw_cfg) support
>>   OvmfPkg/PciHostBridgeLibScan: remove PcdOvmfHostBridgePciDevId
>>   OvmfPkg/PciHostBridgeLibScan: clean up file names and file-top
>>     comments
>>   OvmfPkg/SmbiosPlatformDxe: clean up #includes and INF
>>   OvmfPkg/SmbiosPlatformDxe: return EFI_NOT_FOUND if there is no SMBIOS
>>     data
>>   OvmfPkg/SmbiosPlatformDxe: locate SMBIOS protocol in
>>     InstallAllStructures()
>>   OvmfPkg/SmbiosPlatformDxe: split GetXenSmbiosTables() decl. to new
>>     header
>>   OvmfPkg/SmbiosPlatformDxe: declare InstallAllStructures() in header
>>     file
>>   OvmfPkg/SmbiosPlatformDxe: create Xen-specific module INF file
>>   OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point
>>   OvmfPkg: restrict XenPlatformLib to BdsDxe in the IA32, IA32X64, X64
>>     DSCs
>>
>>  Maintainers.txt                                                                                          |  10 +-
>>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c                                                                   | 262 --------
>>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h                                                                   |  50 +-
>>  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf                                                              |  71 --
>>  OvmfPkg/AcpiPlatformDxe/BootScript.c                                                                     |   7 +-
>>  OvmfPkg/AcpiPlatformDxe/EntryPoint.c                                                                     |   7 +-
>>  OvmfPkg/AcpiPlatformDxe/PciDecoding.c                                                                    |   4 +-
>>  OvmfPkg/AcpiPlatformDxe/Qemu.c                                                                           | 511 ---------------
>>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c                                                                  |  21 +-
>>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf                                                     |   5 +-
>>  OvmfPkg/AcpiTables/AcpiTables.inf                                                                        |  38 --
>>  OvmfPkg/AcpiTables/Dsdt.asl                                                                              | 692 --------------------
>>  OvmfPkg/AcpiTables/Facp.aslc                                                                             |  89 ---
>>  OvmfPkg/AcpiTables/Facs.aslc                                                                             |  78 ---
>>  OvmfPkg/AcpiTables/Madt.aslc                                                                             | 153 -----
>>  OvmfPkg/AcpiTables/Platform.h                                                                            |  68 --
>>  OvmfPkg/AcpiTables/Ssdt.asl                                                                              |  13 -
>>  OvmfPkg/AmdSev/AmdSevX64.dsc                                                                             |   9 +-
>>  OvmfPkg/AmdSev/AmdSevX64.fdf                                                                             |  12 +-
>>  OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c                                                             |   2 +-
>>  OvmfPkg/Bhyve/BhyveX64.dsc                                                                               |   5 +-
>>  OvmfPkg/Bhyve/BhyveX64.fdf                                                                               |   1 -
>>  OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf                                                                |   1 -
>>  OvmfPkg/{AcpiPlatformDxe => Include/IndustryStandard}/QemuLoader.h                                       |   8 +-
>>  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c                                   |  10 +-
>>  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf                                 |   2 -
>>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c                                                      |  28 +-
>>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf                                                    |   8 +-
>>  OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridge.h                               |   4 +-
>>  OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c                                                  |  74 +++
>>  OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.inf => PciHostBridgeLibScan/PciHostBridgeLibScan.inf} |  24 +-
>>  OvmfPkg/Library/{PciHostBridgeLib/XenSupport.c => PciHostBridgeLibScan/ScanForRootBridges.c}             |  27 +-
>>  OvmfPkg/OvmfPkgIa32.dsc                                                                                  |  10 +-
>>  OvmfPkg/OvmfPkgIa32.fdf                                                                                  |  12 +-
>>  OvmfPkg/OvmfPkgIa32X64.dsc                                                                               |  10 +-
>>  OvmfPkg/OvmfPkgIa32X64.fdf                                                                               |  12 +-
>>  OvmfPkg/OvmfPkgX64.dsc                                                                                   |  10 +-
>>  OvmfPkg/OvmfPkgX64.fdf                                                                                   |  12 +-
>>  OvmfPkg/OvmfXen.dsc                                                                                      |  10 +-
>>  OvmfPkg/OvmfXen.fdf                                                                                      |  12 +-
>>  OvmfPkg/PlatformPei/MemDetect.c                                                                          |  10 +-
>>  OvmfPkg/PlatformPei/Platform.c                                                                           | 162 +++--
>>  OvmfPkg/PlatformPei/Platform.h                                                                           |  17 -
>>  OvmfPkg/PlatformPei/PlatformPei.inf                                                                      |   4 -
>>  OvmfPkg/PlatformPei/Xen.c                                                                                | 222 -------
>>  OvmfPkg/PlatformPei/Xen.h                                                                                |  39 --
>>  OvmfPkg/README                                                                                           |  43 +-
>>  OvmfPkg/SmbiosPlatformDxe/ArmXen.c                                                                       |   2 +-
>>  OvmfPkg/SmbiosPlatformDxe/Qemu.c                                                                         |  41 +-
>>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c                                                            |  79 +--
>>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h                                                            |  37 +-
>>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf                                                          |  23 +-
>>  OvmfPkg/SmbiosPlatformDxe/X86Xen.c                                                                       |   8 +-
>>  OvmfPkg/SmbiosPlatformDxe/Xen.c                                                                          |  49 ++
>>  OvmfPkg/SmbiosPlatformDxe/{ArmXen.c => XenSmbiosPlatformDxe.h}                                           |  20 +-
>>  OvmfPkg/SmbiosPlatformDxe/{SmbiosPlatformDxe.inf => XenSmbiosPlatformDxe.inf}                            |  32 +-
>>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c                                                                |  41 ++
>>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h                                                                |  28 +
>>  OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c                                                                  |  43 ++
>>  OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Xen.c                                                    |  66 +-
>>  OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf                                                        |  45 ++
>>  OvmfPkg/XenPlatformPei/Platform.c                                                                        |   1 -
>>  OvmfPkg/XenPlatformPei/Platform.h                                                                        |   5 -
>>  OvmfPkg/XenPlatformPei/Xen.c                                                                             |  20 -
>>  OvmfPkg/XenPlatformPei/XenPlatformPei.inf                                                                |   1 -
>>  65 files changed, 593 insertions(+), 2827 deletions(-)
>>  delete mode 100644 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
>>  delete mode 100644 OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
>>  delete mode 100644 OvmfPkg/AcpiPlatformDxe/Qemu.c
>>  delete mode 100644 OvmfPkg/AcpiTables/AcpiTables.inf
>>  delete mode 100644 OvmfPkg/AcpiTables/Dsdt.asl
>>  delete mode 100644 OvmfPkg/AcpiTables/Facp.aslc
>>  delete mode 100644 OvmfPkg/AcpiTables/Facs.aslc
>>  delete mode 100644 OvmfPkg/AcpiTables/Madt.aslc
>>  delete mode 100644 OvmfPkg/AcpiTables/Platform.h
>>  delete mode 100644 OvmfPkg/AcpiTables/Ssdt.asl
>>  rename OvmfPkg/{AcpiPlatformDxe => Include/IndustryStandard}/QemuLoader.h (94%)
>>  rename OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridge.h (57%)
>>  create mode 100644 OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
>>  copy OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.inf => PciHostBridgeLibScan/PciHostBridgeLibScan.inf} (51%)
>>  rename OvmfPkg/Library/{PciHostBridgeLib/XenSupport.c => PciHostBridgeLibScan/ScanForRootBridges.c} (91%)
>>  delete mode 100644 OvmfPkg/PlatformPei/Xen.c
>>  delete mode 100644 OvmfPkg/PlatformPei/Xen.h
>>  create mode 100644 OvmfPkg/SmbiosPlatformDxe/Xen.c
>>  copy OvmfPkg/SmbiosPlatformDxe/{ArmXen.c => XenSmbiosPlatformDxe.h} (56%)
>>  copy OvmfPkg/SmbiosPlatformDxe/{SmbiosPlatformDxe.inf => XenSmbiosPlatformDxe.inf} (65%)
>>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
>>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
>>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
>>  rename OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Xen.c (82%)
>>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
>>
>>
>> base-commit: cfa6ffb113f2c0d922034cc77c0d6c52eea05497
>> -- 
>> 2.19.1.3.g30247aa5d201
>>
> 


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 29/43] OvmfPkg/PciHostBridgeLibScan: create from PciHostBridgeLib
  2021-05-26 20:14 ` [PATCH 29/43] OvmfPkg/PciHostBridgeLibScan: create from PciHostBridgeLib Laszlo Ersek
@ 2021-05-31 14:52   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-31 14:52 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall,
	Peter Grehan, Rebecca Cran

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Create an almost verbatim copy of the
> "OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf" library instance.
> 
> The new PciHostBridgeLibScan instance will ultimately duplicate a
> negligible amount of code from the original, and will be used by the Bhyve
> and OvmfXen platforms.
> 
> List the new driver in "Maintainers.txt", in the "OvmfPkg: bhyve-related
> modules" and "OvmfPkg: Xen-related modules" sections.
> 
> This patch should be reviewed with "git show --find-copies-harder".

Thanks for the tip :)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.inf => PciHostBridgeLibScan/PciHostBridgeLibScan.inf} | 6 +++---
>  Maintainers.txt                                                                                          | 2 ++
>  OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridge.h                               | 1 +
>  OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridgeLib.c                            | 2 +-
>  OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/XenSupport.c                                  | 1 +
>  5 files changed, 8 insertions(+), 4 deletions(-)


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 39/43] OvmfPkg/SmbiosPlatformDxe: split GetXenSmbiosTables() decl. to new header
  2021-05-26 20:14 ` [PATCH 39/43] OvmfPkg/SmbiosPlatformDxe: split GetXenSmbiosTables() decl. to new header Laszlo Ersek
@ 2021-05-31 14:54   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-31 14:54 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Andrew Fish, Anthony Perard, Ard Biesheuvel, Jordan Justen,
	Julien Grall, Leif Lindholm, Michael D Kinney

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Move the declaration of the GetXenSmbiosTables() function to a new header
> file called "XenSmbiosPlatformDxe.h". (The only declaration that remains
> in "SmbiosPlatformDxe.h" for now is that of GetQemuSmbiosTables().)
> 
> Modify the pattern in "Maintainers.txt" so that the new file be covered in
> the "OvmfPkg: Xen-related modules" section.
> 
> This patch is best viewed with "git show --no-renames".

Thanks again!

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

> Cc: Andrew Fish <afish@apple.com>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf                |  1 +
>  Maintainers.txt                                                |  2 +-
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h                  | 14 --------------
>  OvmfPkg/SmbiosPlatformDxe/{ArmXen.c => XenSmbiosPlatformDxe.h} | 20 ++++++++++----------
>  OvmfPkg/SmbiosPlatformDxe/ArmXen.c                             |  2 +-
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c                  |  1 +
>  OvmfPkg/SmbiosPlatformDxe/X86Xen.c                             |  2 +-
>  7 files changed, 15 insertions(+), 27 deletions(-)


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 41/43] OvmfPkg/SmbiosPlatformDxe: create Xen-specific module INF file
  2021-05-26 20:14 ` [PATCH 41/43] OvmfPkg/SmbiosPlatformDxe: create Xen-specific module INF file Laszlo Ersek
@ 2021-05-31 14:56   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-31 14:56 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> "OvmfPkg/SmbiosPlatformDxe" is structured somewhat differently from the
> drivers duplicated and trimmed thus far in this series. The final QEMU and
> Xen versions will share a relatively significant amount of code, therefore
> duplicating the whole driver is less useful, even temporarily. Instead,
> duplicate the INF file, in preparation for customizing the entry point
> function.
> 
> Because ArmVirtXen doesn't actually include OvmfPkg/SmbiosPlatformDxe [*],
> there is only one platform that's supposed to consume the new driver:
> OvmfXen. Switch OvmfXen to the new driver at once.
> 
> [*] See commit 164cf4038357 ("OvmfPkg: SmbiosPlatformDxe: restrict current
>     Xen code to IA32/X64", 2015-07-26).
> 
> This patch is best viewed with "git show --find-copies-harder".
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/OvmfXen.dsc                                                           | 2 +-
>  OvmfPkg/OvmfXen.fdf                                                           | 2 +-
>  OvmfPkg/SmbiosPlatformDxe/{SmbiosPlatformDxe.inf => XenSmbiosPlatformDxe.inf} | 7 ++++---
>  3 files changed, 6 insertions(+), 5 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 43/43] OvmfPkg: restrict XenPlatformLib to BdsDxe in the IA32, IA32X64, X64 DSCs
  2021-05-26 20:14 ` [PATCH 43/43] OvmfPkg: restrict XenPlatformLib to BdsDxe in the IA32, IA32X64, X64 DSCs Laszlo Ersek
@ 2021-05-31 14:58   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-31 14:58 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> The "OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf"
> library instance is used in the following platform DSC files in edk2:
> 
>   OvmfPkg/OvmfPkgIa32.dsc
>   OvmfPkg/OvmfPkgIa32X64.dsc
>   OvmfPkg/OvmfPkgX64.dsc
>   OvmfPkg/OvmfXen.dsc
> 
> The Xen customizations are very light-weight in this
> PlatformBootManagerLib instance. Isolating them statically, for the sake
> of the first three DSC files, would save negligible binary code size, and
> would likely worsen code complexity (by way of introducing new internal
> interfaces) or blow up source code size (by duplicating almost the entire
> lib instance source code). So for now, keep this one bit of Xen dynamism
> even on QEMU.
> 
> However, because it's only PlatformBootManagerLib now that uses
> XenPlatformLib (for the above-stated enlightenment), restrict the
> XenPlatformLib class resolution in the first three DSC files to the only
> DXE driver that consumes PlatformBootManagerLib (and therefore
> XenPlatformLib): BdsDxe. This will cause a build failure later if someone
> attempts to call a XenPlatformLib API (that is, tries to re-introduce Xen
> enlightenment) in a different module in these non-Xen DSC files.
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/OvmfPkgIa32.dsc    | 2 +-
>  OvmfPkg/OvmfPkgIa32X64.dsc | 2 +-
>  OvmfPkg/OvmfPkgX64.dsc     | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 40/43] OvmfPkg/SmbiosPlatformDxe: declare InstallAllStructures() in header file
  2021-05-26 20:14 ` [PATCH 40/43] OvmfPkg/SmbiosPlatformDxe: declare InstallAllStructures() in header file Laszlo Ersek
@ 2021-05-31 15:00   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-31 15:00 UTC (permalink / raw)
  To: Laszlo Ersek, devel; +Cc: Ard Biesheuvel, Jordan Justen

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Add an extern declaration for the InstallAllStructures() function to the
> "SmbiosPlatformDxe.h" header file. (The leading comment block and the
> prototype are simply copied from "SmbiosPlatformDxe.c".)
> 
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 42/43] OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point
  2021-05-26 20:14 ` [PATCH 42/43] OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point Laszlo Ersek
@ 2021-05-31 15:03   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-31 15:03 UTC (permalink / raw)
  To: Laszlo Ersek, devel
  Cc: Anthony Perard, Ard Biesheuvel, Jordan Justen, Julien Grall

On 5/26/21 10:14 PM, Laszlo Ersek wrote:
> Remove the SmbiosTablePublishEntry() function from "SmbiosPlatformDxe.c".
> "SmbiosPlatformDxe.c" becomes hypervisor-agnostic.
> 
> Add SmbiosTablePublishEntry() back, simplified for QEMU, to the existent
> file "Qemu.c". The GetQemuSmbiosTables() function no longer needs to be
> declared in "SmbiosPlatformDxe.h"; "SmbiosPlatformDxe.h" becomes
> hypervisor-agnostic.
> 
> Add SmbiosTablePublishEntry() back, renamed and simplified for Xen, to the
> new, arch-independent file "Xen.c". (The existent Xen-specific C files are
> arch-dependent.)

:)

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

> Update both INF files; remove the dependencies that are now superfluous in
> each.
> 
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf    | 14 ------
>  OvmfPkg/SmbiosPlatformDxe/XenSmbiosPlatformDxe.inf | 12 ++---
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h      | 11 -----
>  OvmfPkg/SmbiosPlatformDxe/Qemu.c                   | 33 +++++++++++++
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c      | 49 --------------------
>  OvmfPkg/SmbiosPlatformDxe/Xen.c                    | 49 ++++++++++++++++++++
>  6 files changed, 86 insertions(+), 82 deletions(-)


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc
  2021-05-27  8:55   ` Laszlo Ersek
@ 2021-05-31 15:06     ` Philippe Mathieu-Daudé
  2021-06-01  7:41       ` Laszlo Ersek
  0 siblings, 1 reply; 102+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-31 15:06 UTC (permalink / raw)
  To: Laszlo Ersek, Ard Biesheuvel
  Cc: devel, Andrew Fish, Anthony Perard, Ard Biesheuvel, Brijesh Singh,
	Erdem Aktas, James Bottomley, Jiewen Yao, Jordan Justen,
	Julien Grall, Leif Lindholm, Michael D Kinney, Min Xu,
	Peter Grehan, Rebecca Cran, Tom Lendacky

On 5/27/21 10:55 AM, Laszlo Ersek wrote:
> On 05/27/21 09:34, Ard Biesheuvel wrote:
>> On Wed, 26 May 2021 at 22:15, Laszlo Ersek <lersek@redhat.com> wrote:
>>>
>>> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
>>> Repo:     https://pagure.io/lersek/edk2.git
>>> Branch:   xen_split_bz_2122
>>>
>>> This patch set removes dynamic Xen enlightenment from the following
>>> platforms:
>>>
>>>   OvmfPkg/OvmfPkgIa32.dsc
>>>   OvmfPkg/OvmfPkgIa32X64.dsc
>>>   OvmfPkg/OvmfPkgX64.dsc
>>>
>>> In Xen guests, the following platform should be used:
>>>
>>>   OvmfPkg/OvmfXen.dsc
>>>

>> For the series,
>>
>> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
> 
> Thank you, Ard!
> 
> I hope the large patch count (with the small patch bodies and the
> not-so-short commit messages) didn't get on your nerves! I really did
> make an effort to find a good balance. E.g. in the "clean up and sort
> #includes & INF files" patches.

I certainly prefer a long series of little patches (so I can stop /
resume the review) rather than a short one of big patches which
burn my review cycle quicker.

This one in particular made a complex refactor easy to review,
thanks!

Phil.


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc
  2021-05-31 15:06     ` Philippe Mathieu-Daudé
@ 2021-06-01  7:41       ` Laszlo Ersek
  0 siblings, 0 replies; 102+ messages in thread
From: Laszlo Ersek @ 2021-06-01  7:41 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Ard Biesheuvel
  Cc: devel, Andrew Fish, Anthony Perard, Ard Biesheuvel, Brijesh Singh,
	Erdem Aktas, James Bottomley, Jiewen Yao, Jordan Justen,
	Julien Grall, Leif Lindholm, Michael D Kinney, Min Xu,
	Peter Grehan, Rebecca Cran, Tom Lendacky

On 05/31/21 17:06, Philippe Mathieu-Daudé wrote:
> On 5/27/21 10:55 AM, Laszlo Ersek wrote:
>> On 05/27/21 09:34, Ard Biesheuvel wrote:
>>> On Wed, 26 May 2021 at 22:15, Laszlo Ersek <lersek@redhat.com> wrote:
>>>>
>>>> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
>>>> Repo:     https://pagure.io/lersek/edk2.git
>>>> Branch:   xen_split_bz_2122
>>>>
>>>> This patch set removes dynamic Xen enlightenment from the following
>>>> platforms:
>>>>
>>>>   OvmfPkg/OvmfPkgIa32.dsc
>>>>   OvmfPkg/OvmfPkgIa32X64.dsc
>>>>   OvmfPkg/OvmfPkgX64.dsc
>>>>
>>>> In Xen guests, the following platform should be used:
>>>>
>>>>   OvmfPkg/OvmfXen.dsc
>>>>
> 
>>> For the series,
>>>
>>> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
>>
>> Thank you, Ard!
>>
>> I hope the large patch count (with the small patch bodies and the
>> not-so-short commit messages) didn't get on your nerves! I really did
>> make an effort to find a good balance. E.g. in the "clean up and sort
>> #includes & INF files" patches.
> 
> I certainly prefer a long series of little patches (so I can stop /
> resume the review) rather than a short one of big patches which
> burn my review cycle quicker.
> 
> This one in particular made a complex refactor easy to review,
> thanks!

Thank you, Phil!
Laszlo

> 
> Phil.
> 


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [edk2-devel] [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc
  2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
                   ` (44 preceding siblings ...)
  2021-05-27 13:07 ` Leif Lindholm
@ 2021-06-02  8:36 ` Laszlo Ersek
  2021-06-04 14:02   ` Anthony PERARD
  45 siblings, 1 reply; 102+ messages in thread
From: Laszlo Ersek @ 2021-06-02  8:36 UTC (permalink / raw)
  To: Anthony Perard, Julien Grall
  Cc: devel, Ard Biesheuvel, Philippe Mathieu-Daudé, xen-devel

Anthony, Julien,

(or anyone else subscribed to xen-devel -- CC'd now),

On 05/26/21 22:14, Laszlo Ersek wrote:
> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> Repo:     https://pagure.io/lersek/edk2.git
> Branch:   xen_split_bz_2122

can you please build the OvmfXen platform on this branch, and check if
there are any regressions?

Thanks,
Laszlo

> 
> This patch set removes dynamic Xen enlightenment from the following
> platforms:
> 
>   OvmfPkg/OvmfPkgIa32.dsc
>   OvmfPkg/OvmfPkgIa32X64.dsc
>   OvmfPkg/OvmfPkgX64.dsc
> 
> In Xen guests, the following platform should be used:
> 
>   OvmfPkg/OvmfXen.dsc
> 
> Please see more details / references in the bugzilla ticket.
> 
> NOOPT build savings:
> 
> - Ia32:    PEIFV 1536 bytes, DXEFV 130288 bytes
> - Ia32X64: PEIFV 1536 bytes, DXEFV 140912 bytes
> - X64:     PEIFV 1664 bytes, DXEFV 140912 bytes
> - Xen:     PEIFV  256 bytes, DXEFV  69504 bytes
> 
> Functional testing:
> 
> - Booted a Fedora guest on OvmfPkgIa32X64 on QEMU/KVM, compared verbose
>   logs before-after. Memory allocations were satisfied at different
>   addresses, as expected, plus the Xen drivers were absent. No
>   differences otherwise.
> 
> - Booted a RHEL guest on ArmVirtQemu on AARCH64. Memory allocations were
>   satisfied at different addresses, as expected.
> 
> - Xen regression-testing was not done; I'm requesting feedback.
> 
> Build testing / bisectability: at every stage, the series builds with
> the following script:
> 
>> #!/bin/bash
>> set -e -u -C
>>
>> build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc            -a AARCH64
>> build -b DEBUG -t GCC5 -p ArmVirtPkg/ArmVirtKvmTool.dsc    -a ARM
>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc               -a AARCH64
>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemu.dsc       -a ARM
>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc         -a AARCH64
>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtQemuKernel.dsc -a ARM
>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc                -a AARCH64
>> build -b NOOPT -t GCC5 -p ArmVirtPkg/ArmVirtXen.dsc        -a ARM
>> build -b NOOPT -t GCC5 -p OvmfPkg/AmdSev/AmdSevX64.dsc             -a X64
>> build -b NOOPT -t GCC5 -p OvmfPkg/Bhyve/BhyveX64.dsc               -a X64
>> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32.dsc          -a IA32
>> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgIa32X64.dsc       -a IA32 -a X64
>> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfPkgX64.dsc                   -a X64
>> build -b NOOPT -t GCC5 -p OvmfPkg/OvmfXen.dsc                      -a X64
> 
> The patches in the series were formatted with the following options, for
> posting:
> 
>   --stat=1000 --stat-graph-width=20 --find-copies-harder -U6
> 
> (The option "--find-copies-harder" is not the best for presenting every
> single patch in the series, in isolation, but taken globally for the
> entire series, it is the most helpful option.)
> 
> Some patches advance with really small steps, in order to cut down on a
> subsequent "meaty" patch. Personally I don't like reviewing code
> movement patches, so I did my best to (a) keep that to a minimum, and
> (b) present it as unintrusively as possible.
> 
> The CC list is a bit long; the reason is that I kept touching up
> "Maintainers.txt", and the "OvmfPkg/Bhyve" and "OvmfPkg/AmdSev"
> platforms as well (whenever it made sense).
> 
> Cc: Andrew Fish <afish@apple.com>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien@xen.org>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Min Xu <min.m.xu@intel.com>
> Cc: Peter Grehan <grehan@freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> 
> Thanks,
> Laszlo
> 
> Laszlo Ersek (43):
>   OvmfPkg: remove the Xen drivers from the IA32, IA32X64, and X64
>     platforms
>   OvmfPkg: remove the Xen drivers from the AmdSev platform
>   OvmfPkg: switch IA32, IA32X64, X64 to the fw_cfg-only ACPI platform
>     driver
>   OvmfPkg: switch the AmdSev platform to the fw_cfg-only ACPI platform
>     driver
>   OvmfPkg/README: bump minimum QEMU version to 1.7.1, machine types to
>     1.7
>   OvmfPkg/AcpiPlatformDxe: fix header file warts
>   OvmfPkg/AcpiPlatformDxe: sort #includes and [LibraryClasses]
>   OvmfPkg/AcpiPlatformDxe/QemuLoader.h: remove QemuFwCfgLib class
>     dependency
>   OvmfPkg/AcpiPlatformDxe: move "QemuLoader.h" to IndustryStandard
>   OvmfPkg/AcpiPlatformDxe: consolidate #includes and [LibraryClasses]
>   OvmfPkg/XenAcpiPlatformDxe: create from AcpiPlatformDxe
>   OvmfPkg/AcpiPlatformDxe: remove the "AcpiPlatformDxe.inf" driver
>   OvmfPkg/XenAcpiPlatformDxe: remove the QEMU ACPI linker/loader client
>   OvmfPkg/XenAcpiPlatformDxe: remove QEMU fw_cfg dependency
>   OvmfPkg/XenAcpiPlatformDxe: remove the InstallAcpiTable() helper
>     function
>   OvmfPkg/XenAcpiPlatformDxe: remove OVMF's built-in ACPI tables
>   OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment
>   OvmfPkg/AcpiTables: remove unused module
>   OvmfPkg/OvmfXen: make "PcdPciDisableBusEnumeration" Fixed-at-Build
>   OvmfPkg/XenAcpiPlatformDxe: remove delayed ACPI table installation
>   OvmfPkg/PlatformPei: remove Xen support
>   OvmfPkg: drop PcdPciDisableBusEnumeration from the IA32, IA32X64, X64
>     DSCs
>   OvmfPkg: drop PcdPciDisableBusEnumeration from the AmdSev platform
>   OvmfPkg/Bhyve: make "PcdPciDisableBusEnumeration" Fixed-at-Build
>   OvmfPkg/OvmfXen: remove IncompatiblePciDeviceSupport DXE driver
>   OvmfPkg/Bhyve: remove IncompatiblePciDeviceSupport DXE driver
>   OvmfPkg/IncompatiblePciDeviceSupportDxe: remove
>     PcdPciDisableBusEnumeration
>   OvmfPkg/PciHostBridgeLib: consolidate #includes and INF file sections
>   OvmfPkg/PciHostBridgeLibScan: create from PciHostBridgeLib
>   OvmfPkg/Bhyve: consume PciHostBridgeLibScan
>   OvmfPkg/OvmfXen: consume PciHostBridgeLibScan
>   OvmfPkg/PciHostBridgeLib: remove Bhyve and Xen support
>   OvmfPkg/PciHostBridgeLibScan: remove QEMU (fw_cfg) support
>   OvmfPkg/PciHostBridgeLibScan: remove PcdOvmfHostBridgePciDevId
>   OvmfPkg/PciHostBridgeLibScan: clean up file names and file-top
>     comments
>   OvmfPkg/SmbiosPlatformDxe: clean up #includes and INF
>   OvmfPkg/SmbiosPlatformDxe: return EFI_NOT_FOUND if there is no SMBIOS
>     data
>   OvmfPkg/SmbiosPlatformDxe: locate SMBIOS protocol in
>     InstallAllStructures()
>   OvmfPkg/SmbiosPlatformDxe: split GetXenSmbiosTables() decl. to new
>     header
>   OvmfPkg/SmbiosPlatformDxe: declare InstallAllStructures() in header
>     file
>   OvmfPkg/SmbiosPlatformDxe: create Xen-specific module INF file
>   OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point
>   OvmfPkg: restrict XenPlatformLib to BdsDxe in the IA32, IA32X64, X64
>     DSCs
> 
>  Maintainers.txt                                                                                          |  10 +-
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c                                                                   | 262 --------
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h                                                                   |  50 +-
>  OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf                                                              |  71 --
>  OvmfPkg/AcpiPlatformDxe/BootScript.c                                                                     |   7 +-
>  OvmfPkg/AcpiPlatformDxe/EntryPoint.c                                                                     |   7 +-
>  OvmfPkg/AcpiPlatformDxe/PciDecoding.c                                                                    |   4 +-
>  OvmfPkg/AcpiPlatformDxe/Qemu.c                                                                           | 511 ---------------
>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c                                                                  |  21 +-
>  OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf                                                     |   5 +-
>  OvmfPkg/AcpiTables/AcpiTables.inf                                                                        |  38 --
>  OvmfPkg/AcpiTables/Dsdt.asl                                                                              | 692 --------------------
>  OvmfPkg/AcpiTables/Facp.aslc                                                                             |  89 ---
>  OvmfPkg/AcpiTables/Facs.aslc                                                                             |  78 ---
>  OvmfPkg/AcpiTables/Madt.aslc                                                                             | 153 -----
>  OvmfPkg/AcpiTables/Platform.h                                                                            |  68 --
>  OvmfPkg/AcpiTables/Ssdt.asl                                                                              |  13 -
>  OvmfPkg/AmdSev/AmdSevX64.dsc                                                                             |   9 +-
>  OvmfPkg/AmdSev/AmdSevX64.fdf                                                                             |  12 +-
>  OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c                                                             |   2 +-
>  OvmfPkg/Bhyve/BhyveX64.dsc                                                                               |   5 +-
>  OvmfPkg/Bhyve/BhyveX64.fdf                                                                               |   1 -
>  OvmfPkg/Bhyve/PlatformPei/PlatformPei.inf                                                                |   1 -
>  OvmfPkg/{AcpiPlatformDxe => Include/IndustryStandard}/QemuLoader.h                                       |   8 +-
>  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c                                   |  10 +-
>  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf                                 |   2 -
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c                                                      |  28 +-
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf                                                    |   8 +-
>  OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridge.h                               |   4 +-
>  OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c                                                  |  74 +++
>  OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.inf => PciHostBridgeLibScan/PciHostBridgeLibScan.inf} |  24 +-
>  OvmfPkg/Library/{PciHostBridgeLib/XenSupport.c => PciHostBridgeLibScan/ScanForRootBridges.c}             |  27 +-
>  OvmfPkg/OvmfPkgIa32.dsc                                                                                  |  10 +-
>  OvmfPkg/OvmfPkgIa32.fdf                                                                                  |  12 +-
>  OvmfPkg/OvmfPkgIa32X64.dsc                                                                               |  10 +-
>  OvmfPkg/OvmfPkgIa32X64.fdf                                                                               |  12 +-
>  OvmfPkg/OvmfPkgX64.dsc                                                                                   |  10 +-
>  OvmfPkg/OvmfPkgX64.fdf                                                                                   |  12 +-
>  OvmfPkg/OvmfXen.dsc                                                                                      |  10 +-
>  OvmfPkg/OvmfXen.fdf                                                                                      |  12 +-
>  OvmfPkg/PlatformPei/MemDetect.c                                                                          |  10 +-
>  OvmfPkg/PlatformPei/Platform.c                                                                           | 162 +++--
>  OvmfPkg/PlatformPei/Platform.h                                                                           |  17 -
>  OvmfPkg/PlatformPei/PlatformPei.inf                                                                      |   4 -
>  OvmfPkg/PlatformPei/Xen.c                                                                                | 222 -------
>  OvmfPkg/PlatformPei/Xen.h                                                                                |  39 --
>  OvmfPkg/README                                                                                           |  43 +-
>  OvmfPkg/SmbiosPlatformDxe/ArmXen.c                                                                       |   2 +-
>  OvmfPkg/SmbiosPlatformDxe/Qemu.c                                                                         |  41 +-
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.c                                                            |  79 +--
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h                                                            |  37 +-
>  OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf                                                          |  23 +-
>  OvmfPkg/SmbiosPlatformDxe/X86Xen.c                                                                       |   8 +-
>  OvmfPkg/SmbiosPlatformDxe/Xen.c                                                                          |  49 ++
>  OvmfPkg/SmbiosPlatformDxe/{ArmXen.c => XenSmbiosPlatformDxe.h}                                           |  20 +-
>  OvmfPkg/SmbiosPlatformDxe/{SmbiosPlatformDxe.inf => XenSmbiosPlatformDxe.inf}                            |  32 +-
>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c                                                                |  41 ++
>  OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h                                                                |  28 +
>  OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c                                                                  |  43 ++
>  OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Xen.c                                                    |  66 +-
>  OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf                                                        |  45 ++
>  OvmfPkg/XenPlatformPei/Platform.c                                                                        |   1 -
>  OvmfPkg/XenPlatformPei/Platform.h                                                                        |   5 -
>  OvmfPkg/XenPlatformPei/Xen.c                                                                             |  20 -
>  OvmfPkg/XenPlatformPei/XenPlatformPei.inf                                                                |   1 -
>  65 files changed, 593 insertions(+), 2827 deletions(-)
>  delete mode 100644 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
>  delete mode 100644 OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
>  delete mode 100644 OvmfPkg/AcpiPlatformDxe/Qemu.c
>  delete mode 100644 OvmfPkg/AcpiTables/AcpiTables.inf
>  delete mode 100644 OvmfPkg/AcpiTables/Dsdt.asl
>  delete mode 100644 OvmfPkg/AcpiTables/Facp.aslc
>  delete mode 100644 OvmfPkg/AcpiTables/Facs.aslc
>  delete mode 100644 OvmfPkg/AcpiTables/Madt.aslc
>  delete mode 100644 OvmfPkg/AcpiTables/Platform.h
>  delete mode 100644 OvmfPkg/AcpiTables/Ssdt.asl
>  rename OvmfPkg/{AcpiPlatformDxe => Include/IndustryStandard}/QemuLoader.h (94%)
>  rename OvmfPkg/Library/{PciHostBridgeLib => PciHostBridgeLibScan}/PciHostBridge.h (57%)
>  create mode 100644 OvmfPkg/Library/PciHostBridgeLibScan/PciHostBridgeLib.c
>  copy OvmfPkg/Library/{PciHostBridgeLib/PciHostBridgeLib.inf => PciHostBridgeLibScan/PciHostBridgeLibScan.inf} (51%)
>  rename OvmfPkg/Library/{PciHostBridgeLib/XenSupport.c => PciHostBridgeLibScan/ScanForRootBridges.c} (91%)
>  delete mode 100644 OvmfPkg/PlatformPei/Xen.c
>  delete mode 100644 OvmfPkg/PlatformPei/Xen.h
>  create mode 100644 OvmfPkg/SmbiosPlatformDxe/Xen.c
>  copy OvmfPkg/SmbiosPlatformDxe/{ArmXen.c => XenSmbiosPlatformDxe.h} (56%)
>  copy OvmfPkg/SmbiosPlatformDxe/{SmbiosPlatformDxe.inf => XenSmbiosPlatformDxe.inf} (65%)
>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.c
>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/AcpiPlatform.h
>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
>  rename OvmfPkg/{AcpiPlatformDxe => XenAcpiPlatformDxe}/Xen.c (82%)
>  create mode 100644 OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
> 
> 
> base-commit: cfa6ffb113f2c0d922034cc77c0d6c52eea05497
> 


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [edk2-devel] [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc
  2021-06-02  8:36 ` [edk2-devel] " Laszlo Ersek
@ 2021-06-04 14:02   ` Anthony PERARD
  2021-06-04 14:19     ` Laszlo Ersek
  2021-06-04 16:05     ` Laszlo Ersek
  0 siblings, 2 replies; 102+ messages in thread
From: Anthony PERARD @ 2021-06-04 14:02 UTC (permalink / raw)
  To: devel, lersek
  Cc: Julien Grall, Ard Biesheuvel, Philippe Mathieu-Daudé,
	xen-devel

On Wed, Jun 02, 2021 at 10:36:49AM +0200, Laszlo Ersek wrote:
> Anthony, Julien,
> 
> (or anyone else subscribed to xen-devel -- CC'd now),
> 
> On 05/26/21 22:14, Laszlo Ersek wrote:
> > Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
> > Repo:     https://pagure.io/lersek/edk2.git
> > Branch:   xen_split_bz_2122
> 
> can you please build the OvmfXen platform on this branch, and check if
> there are any regressions?

Hi Laszlo,

OvmfXen seems to be working fine with that branch applied.

Thanks,

-- 
Anthony PERARD

^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [edk2-devel] [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc
  2021-06-04 14:02   ` Anthony PERARD
@ 2021-06-04 14:19     ` Laszlo Ersek
  2021-06-04 16:05     ` Laszlo Ersek
  1 sibling, 0 replies; 102+ messages in thread
From: Laszlo Ersek @ 2021-06-04 14:19 UTC (permalink / raw)
  To: Anthony PERARD, devel
  Cc: Julien Grall, Ard Biesheuvel, Philippe Mathieu-Daudé,
	xen-devel

On 06/04/21 16:02, Anthony PERARD wrote:
> On Wed, Jun 02, 2021 at 10:36:49AM +0200, Laszlo Ersek wrote:
>> Anthony, Julien,
>>
>> (or anyone else subscribed to xen-devel -- CC'd now),
>>
>> On 05/26/21 22:14, Laszlo Ersek wrote:
>>> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
>>> Repo:     https://pagure.io/lersek/edk2.git
>>> Branch:   xen_split_bz_2122
>>
>> can you please build the OvmfXen platform on this branch, and check if
>> there are any regressions?
> 
> Hi Laszlo,
> 
> OvmfXen seems to be working fine with that branch applied.

Thank you very much!!!
Laszlo


^ permalink raw reply	[flat|nested] 102+ messages in thread

* Re: [edk2-devel] [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc
  2021-06-04 14:02   ` Anthony PERARD
  2021-06-04 14:19     ` Laszlo Ersek
@ 2021-06-04 16:05     ` Laszlo Ersek
  1 sibling, 0 replies; 102+ messages in thread
From: Laszlo Ersek @ 2021-06-04 16:05 UTC (permalink / raw)
  To: devel, anthony.perard
  Cc: Julien Grall, Ard Biesheuvel, Philippe Mathieu-Daudé,
	xen-devel

On 06/04/21 16:02, Anthony PERARD via groups.io wrote:
> On Wed, Jun 02, 2021 at 10:36:49AM +0200, Laszlo Ersek wrote:
>> Anthony, Julien,
>>
>> (or anyone else subscribed to xen-devel -- CC'd now),
>>
>> On 05/26/21 22:14, Laszlo Ersek wrote:
>>> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
>>> Repo:     https://pagure.io/lersek/edk2.git
>>> Branch:   xen_split_bz_2122
>>
>> can you please build the OvmfXen platform on this branch, and check if
>> there are any regressions?
> 
> Hi Laszlo,
> 
> OvmfXen seems to be working fine with that branch applied.

Series merged as commit range 924c2b847f0b..51adb689e1db, via
<https://github.com/tianocore/edk2/pull/1689>.

Thanks
Laszlo


^ permalink raw reply	[flat|nested] 102+ messages in thread

end of thread, other threads:[~2021-06-04 16:05 UTC | newest]

Thread overview: 102+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-26 20:14 [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Laszlo Ersek
2021-05-26 20:14 ` [PATCH 01/43] OvmfPkg: remove the Xen drivers from the IA32, IA32X64, and X64 platforms Laszlo Ersek
2021-05-27  8:22   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 02/43] OvmfPkg: remove the Xen drivers from the AmdSev platform Laszlo Ersek
2021-05-27  8:22   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 03/43] OvmfPkg: switch IA32, IA32X64, X64 to the fw_cfg-only ACPI platform driver Laszlo Ersek
2021-05-27 10:15   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 04/43] OvmfPkg: switch the AmdSev platform " Laszlo Ersek
2021-05-27 10:15   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 05/43] OvmfPkg/README: bump minimum QEMU version to 1.7.1, machine types to 1.7 Laszlo Ersek
2021-05-27  8:24   ` Philippe Mathieu-Daudé
2021-05-27  8:56     ` Laszlo Ersek
2021-05-26 20:14 ` [PATCH 06/43] OvmfPkg/AcpiPlatformDxe: fix header file warts Laszlo Ersek
2021-05-27  8:24   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 07/43] OvmfPkg/AcpiPlatformDxe: sort #includes and [LibraryClasses] Laszlo Ersek
2021-05-27  8:25   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 08/43] OvmfPkg/AcpiPlatformDxe/QemuLoader.h: remove QemuFwCfgLib class dependency Laszlo Ersek
2021-05-27  8:26   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 09/43] OvmfPkg/AcpiPlatformDxe: move "QemuLoader.h" to IndustryStandard Laszlo Ersek
2021-05-27  8:26   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 10/43] OvmfPkg/AcpiPlatformDxe: consolidate #includes and [LibraryClasses] Laszlo Ersek
2021-05-27  8:41   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 11/43] OvmfPkg/XenAcpiPlatformDxe: create from AcpiPlatformDxe Laszlo Ersek
2021-05-27 10:16   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 12/43] OvmfPkg/AcpiPlatformDxe: remove the "AcpiPlatformDxe.inf" driver Laszlo Ersek
2021-05-27 10:17   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 13/43] OvmfPkg/XenAcpiPlatformDxe: remove the QEMU ACPI linker/loader client Laszlo Ersek
2021-05-27  8:38   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 14/43] OvmfPkg/XenAcpiPlatformDxe: remove QEMU fw_cfg dependency Laszlo Ersek
2021-05-27  8:39   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 15/43] OvmfPkg/XenAcpiPlatformDxe: remove the InstallAcpiTable() helper function Laszlo Ersek
2021-05-27  9:39   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 16/43] OvmfPkg/XenAcpiPlatformDxe: remove OVMF's built-in ACPI tables Laszlo Ersek
2021-05-27  8:40   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 17/43] OvmfPkg/Bhyve/AcpiPlatformDxe: fix file path typo in comment Laszlo Ersek
2021-05-26 20:40   ` Rebecca Cran
2021-05-27  8:40   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 18/43] OvmfPkg/AcpiTables: remove unused module Laszlo Ersek
2021-05-27  8:27   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 19/43] OvmfPkg/OvmfXen: make "PcdPciDisableBusEnumeration" Fixed-at-Build Laszlo Ersek
2021-05-27  8:42   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 20/43] OvmfPkg/XenAcpiPlatformDxe: remove delayed ACPI table installation Laszlo Ersek
2021-05-27  8:28   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 21/43] OvmfPkg/PlatformPei: remove Xen support Laszlo Ersek
2021-05-27 10:20   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 22/43] OvmfPkg: drop PcdPciDisableBusEnumeration from the IA32, IA32X64, X64 DSCs Laszlo Ersek
2021-05-27  8:29   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 23/43] OvmfPkg: drop PcdPciDisableBusEnumeration from the AmdSev platform Laszlo Ersek
2021-05-27 10:21   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 24/43] OvmfPkg/Bhyve: make "PcdPciDisableBusEnumeration" Fixed-at-Build Laszlo Ersek
2021-05-26 20:41   ` Rebecca Cran
2021-05-27  8:43   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 25/43] OvmfPkg/OvmfXen: remove IncompatiblePciDeviceSupport DXE driver Laszlo Ersek
2021-05-27  8:29   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 26/43] OvmfPkg/Bhyve: " Laszlo Ersek
2021-05-27 10:23   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 27/43] OvmfPkg/IncompatiblePciDeviceSupportDxe: remove PcdPciDisableBusEnumeration Laszlo Ersek
2021-05-27  8:30   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 28/43] OvmfPkg/PciHostBridgeLib: consolidate #includes and INF file sections Laszlo Ersek
2021-05-27  8:31   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 29/43] OvmfPkg/PciHostBridgeLibScan: create from PciHostBridgeLib Laszlo Ersek
2021-05-31 14:52   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 30/43] OvmfPkg/Bhyve: consume PciHostBridgeLibScan Laszlo Ersek
2021-05-26 22:46   ` Rebecca Cran
2021-05-27  8:31   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 31/43] OvmfPkg/OvmfXen: " Laszlo Ersek
2021-05-27  8:31   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 32/43] OvmfPkg/PciHostBridgeLib: remove Bhyve and Xen support Laszlo Ersek
2021-05-27  8:32   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 33/43] OvmfPkg/PciHostBridgeLibScan: remove QEMU (fw_cfg) support Laszlo Ersek
2021-05-27 10:25   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 34/43] OvmfPkg/PciHostBridgeLibScan: remove PcdOvmfHostBridgePciDevId Laszlo Ersek
2021-05-27  8:33   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 35/43] OvmfPkg/PciHostBridgeLibScan: clean up file names and file-top comments Laszlo Ersek
2021-05-27  8:34   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 36/43] OvmfPkg/SmbiosPlatformDxe: clean up #includes and INF Laszlo Ersek
2021-05-27  8:34   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 37/43] OvmfPkg/SmbiosPlatformDxe: return EFI_NOT_FOUND if there is no SMBIOS data Laszlo Ersek
2021-05-27  8:45   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 38/43] OvmfPkg/SmbiosPlatformDxe: locate SMBIOS protocol in InstallAllStructures() Laszlo Ersek
2021-05-27  8:35   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 39/43] OvmfPkg/SmbiosPlatformDxe: split GetXenSmbiosTables() decl. to new header Laszlo Ersek
2021-05-31 14:54   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 40/43] OvmfPkg/SmbiosPlatformDxe: declare InstallAllStructures() in header file Laszlo Ersek
2021-05-31 15:00   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 41/43] OvmfPkg/SmbiosPlatformDxe: create Xen-specific module INF file Laszlo Ersek
2021-05-31 14:56   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 42/43] OvmfPkg/SmbiosPlatformDxe: split Xen entry point from QEMU entry point Laszlo Ersek
2021-05-31 15:03   ` Philippe Mathieu-Daudé
2021-05-26 20:14 ` [PATCH 43/43] OvmfPkg: restrict XenPlatformLib to BdsDxe in the IA32, IA32X64, X64 DSCs Laszlo Ersek
2021-05-31 14:58   ` Philippe Mathieu-Daudé
2021-05-27  7:34 ` [PATCH 00/43] OvmfPkg: remove Xen support from OvmfPkg*.dsc, in favor of OvmfXen.dsc Ard Biesheuvel
2021-05-27  8:55   ` Laszlo Ersek
2021-05-31 15:06     ` Philippe Mathieu-Daudé
2021-06-01  7:41       ` Laszlo Ersek
2021-05-27 13:07 ` Leif Lindholm
2021-05-27 13:09   ` Leif Lindholm
2021-05-27 16:30   ` Laszlo Ersek
2021-06-02  8:36 ` [edk2-devel] " Laszlo Ersek
2021-06-04 14:02   ` Anthony PERARD
2021-06-04 14:19     ` Laszlo Ersek
2021-06-04 16:05     ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox