public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Enable Cloud Hypervisor support in edk2
@ 2021-05-17  6:50 Jianyong Wu
  2021-05-17  6:50 ` [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor Jianyong Wu
                   ` (5 more replies)
  0 siblings, 6 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-17  6:50 UTC (permalink / raw)
  To: devel, lersek, ardb+tianocore, sami.mujawar
  Cc: hao.a.wu, justin.he, jianyong.wu

Cloud Hypervisor is an open source Virtual Machine Monitor (VMM) that
runs on top of KVM. Cloud Hypervisor is implemented in Rust and is based
on the rust-vmm crates. See [1] to find more.

To support UEFI, Cloud Hypervisor is introduced here.
There are three parts to be considered to do this enablements, that is:
  1. memory initialization

  2. specific ACPI service implementation
     compared with qemu, there is no device like Fw-cfg, so we has no
     elegant way to get the RSDP address. A specific ACPI implementation is
     introduced here.

  3. build configuration file

This enablement bases on the implentation for qemu so some code is
borrowed.

[1] https://github.com/cloud-hypervisor/cloud-hypervisor

Jianyong Wu (5):
  ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor
  MdeMoudlePkg: introduce new PCD for Acpi/rsdp
  ArmVirtPkg: enable ACPI for cloud hypervisor
  ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family
  Maintainers: update Maintainers file as new files/folders created

 MdeModulePkg/MdeModulePkg.dec                 |   7 +
 ArmVirtPkg/ArmVirtCloudHv.dsc                 | 455 ++++++++++++++++++
 ArmVirtPkg/ArmVirtCloudHv.fdf                 | 292 +++++++++++
 .../CloudHvAcpiPlatformDxe.inf                |  51 ++
 .../CloudHvHasAcpiDtDxe.inf                   |  43 ++
 .../CloudHvVirtMemInfoPeiLib.inf              |  47 ++
 .../CloudHvAcpiPlatformDxe/CloudHvAcpi.c      |  73 +++
 .../CloudHvHasAcpiDtDxe.c                     |  69 +++
 .../CloudHvVirtMemInfoLib.c                   |  94 ++++
 .../CloudHvVirtMemInfoPeiLibConstructor.c     | 100 ++++
 ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc       | 169 +++++++
 Maintainers.txt                               |   7 +
 12 files changed, 1407 insertions(+)
 create mode 100644 ArmVirtPkg/ArmVirtCloudHv.dsc
 create mode 100644 ArmVirtPkg/ArmVirtCloudHv.fdf
 create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
 create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
 create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
 create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
 create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
 create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
 create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c
 create mode 100644 ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc

-- 
2.17.1


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

* [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor
  2021-05-17  6:50 [PATCH v2 0/5] Enable Cloud Hypervisor support in edk2 Jianyong Wu
@ 2021-05-17  6:50 ` Jianyong Wu
  2021-05-18 20:20   ` Sami Mujawar
  2021-05-19  6:07   ` [edk2-devel] " Laszlo Ersek
  2021-05-17  6:50 ` [PATCH v2 2/5] MdeMoudlePkg: introduce new PCD for Acpi/rsdp Jianyong Wu
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-17  6:50 UTC (permalink / raw)
  To: devel, lersek, ardb+tianocore, sami.mujawar
  Cc: hao.a.wu, justin.he, jianyong.wu, Leif Lindholm

Cloud Hypervisor is kvm based VMM implemented in rust.

This library populates the system memory map for the
Cloud Hypervisor virtual platform.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
---
 .../CloudHvVirtMemInfoPeiLib.inf              |  47 ++++++++
 .../CloudHvVirtMemInfoLib.c                   |  94 ++++++++++++++++
 .../CloudHvVirtMemInfoPeiLibConstructor.c     | 100 ++++++++++++++++++
 3 files changed, 241 insertions(+)
 create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
 create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
 create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c

diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
new file mode 100644
index 000000000000..71dbf9c06ccc
--- /dev/null
+++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
@@ -0,0 +1,47 @@
+#/* @file
+#
+#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
+#  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#*/
+
+[Defines]
+  INF_VERSION                    = 0x0001001A
+  BASE_NAME                      = ClhVirtMemInfoPeiLib
+  FILE_GUID                      = 3E29D940-0591-EE6A-CAD4-223A9CF55E75
+  MODULE_TYPE                    = BASE
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = ArmVirtMemInfoLib|PEIM
+  CONSTRUCTOR                    = CloudHvVirtMemInfoPeiLibConstructor
+
+[Sources]
+  CloudHvVirtMemInfoLib.c
+  CloudHvVirtMemInfoPeiLibConstructor.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  ArmVirtPkg/ArmVirtPkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  ArmLib
+  BaseMemoryLib
+  DebugLib
+  FdtLib
+  PcdLib
+  MemoryAllocationLib
+
+[Pcd]
+  gArmTokenSpaceGuid.PcdFdBaseAddress
+  gArmTokenSpaceGuid.PcdFvBaseAddress
+  gArmTokenSpaceGuid.PcdSystemMemoryBase
+  gArmTokenSpaceGuid.PcdSystemMemorySize
+
+[FixedPcd]
+  gArmTokenSpaceGuid.PcdFdSize
+  gArmTokenSpaceGuid.PcdFvSize
+  gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
new file mode 100644
index 000000000000..69f4e6ab6cc4
--- /dev/null
+++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
@@ -0,0 +1,94 @@
+/** @file
+
+  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+#include <Library/ArmLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+
+// Number of Virtual Memory Map Descriptors
+#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS          5
+
+//
+// mach-virt's core peripherals such as the UART, the GIC and the RTC are
+// all mapped in the 'miscellaneous device I/O' region, which we just map
+// in its entirety rather than device by device. Note that it does not
+// cover any of the NOR flash banks or PCI resource windows.
+//
+#define MACH_VIRT_PERIPH_BASE       0x08000000
+#define MACH_VIRT_PERIPH_SIZE       SIZE_128MB
+
+//
+// in cloud-hypervisor, 0x0 ~ 0x8000000 is reserved as normal memory for UEFI
+//
+#define CLOUDHV_UEFI_MEM_BASE       0x0
+#define CLOUDHV_UEFI_MEM_SIZE       0x08000000
+
+/**
+  Return the Virtual Memory Map of your platform
+
+  This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU
+  on your platform.
+
+  @param[out]   VirtualMemoryMap    Array of ARM_MEMORY_REGION_DESCRIPTOR
+                                    describing a Physical-to-Virtual Memory
+                                    mapping. This array must be ended by a
+                                    zero-filled entry. The allocated memory
+                                    will not be freed.
+
+**/
+VOID
+ArmVirtGetMemoryMap (
+  OUT ARM_MEMORY_REGION_DESCRIPTOR   **VirtualMemoryMap
+  )
+{
+  ARM_MEMORY_REGION_DESCRIPTOR  *VirtualMemoryTable;
+
+  ASSERT (VirtualMemoryMap != NULL);
+
+  VirtualMemoryTable = AllocatePool (sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *
+                                     MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
+
+  if (VirtualMemoryTable == NULL) {
+    DEBUG ((DEBUG_ERROR, "%a: Error: Failed AllocatePool()\n", __FUNCTION__));
+    return;
+  }
+
+  // System DRAM
+  VirtualMemoryTable[0].PhysicalBase = PcdGet64 (PcdSystemMemoryBase);
+  VirtualMemoryTable[0].VirtualBase  = VirtualMemoryTable[0].PhysicalBase;
+  VirtualMemoryTable[0].Length       = PcdGet64 (PcdSystemMemorySize);
+  VirtualMemoryTable[0].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
+
+  DEBUG ((DEBUG_INFO, "%a: Dumping System DRAM Memory Map:\n"
+      "\tPhysicalBase: 0x%lX\n"
+      "\tVirtualBase: 0x%lX\n"
+      "\tLength: 0x%lX\n",
+      __FUNCTION__,
+      VirtualMemoryTable[0].PhysicalBase,
+      VirtualMemoryTable[0].VirtualBase,
+      VirtualMemoryTable[0].Length));
+
+  // Memory mapped peripherals (UART, RTC, GIC, virtio-mmio, etc)
+  VirtualMemoryTable[1].PhysicalBase = MACH_VIRT_PERIPH_BASE;
+  VirtualMemoryTable[1].VirtualBase  = MACH_VIRT_PERIPH_BASE;
+  VirtualMemoryTable[1].Length       = MACH_VIRT_PERIPH_SIZE;
+  VirtualMemoryTable[1].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
+  // Map the FV region as normal executable memory
+  VirtualMemoryTable[2].PhysicalBase = PcdGet64 (PcdFvBaseAddress);
+  VirtualMemoryTable[2].VirtualBase  = VirtualMemoryTable[2].PhysicalBase;
+  VirtualMemoryTable[2].Length       = FixedPcdGet32 (PcdFvSize);
+  VirtualMemoryTable[2].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
+
+  // End of Table
+  ZeroMem (&VirtualMemoryTable[3], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));
+
+  *VirtualMemoryMap = VirtualMemoryTable;
+}
diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c
new file mode 100644
index 000000000000..062dfcee1d66
--- /dev/null
+++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c
@@ -0,0 +1,100 @@
+/** @file
+
+  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
+#include <libfdt.h>
+
+RETURN_STATUS
+EFIAPI
+CloudHvVirtMemInfoPeiLibConstructor (
+  VOID
+  )
+{
+  VOID          *DeviceTreeBase;
+  INT32         Node, Prev;
+  UINT64        NewBase, CurBase;
+  UINT64        NewSize, CurSize;
+  CONST CHAR8   *Type;
+  INT32         Len;
+  CONST UINT64  *RegProp;
+  RETURN_STATUS PcdStatus;
+
+  NewBase = 0;
+  NewSize = 0;
+
+  DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
+  ASSERT (DeviceTreeBase != NULL);
+
+  //
+  // Make sure we have a valid device tree blob
+  //
+  ASSERT (fdt_check_header (DeviceTreeBase) == 0);
+
+  //
+  // Look for the lowest memory node
+  //
+  for (Prev = 0;; Prev = Node) {
+    Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
+    if (Node < 0) {
+      break;
+    }
+
+    //
+    // Check for memory node
+    //
+    Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len);
+    if (Type && AsciiStrnCmp (Type, "memory", Len) == 0) {
+      //
+      // Get the 'reg' property of this node. For now, we will assume
+      // two 8 byte quantities for base and size, respectively.
+      //
+      RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
+      if (RegProp != 0 && Len == (2 * sizeof (UINT64))) {
+
+        CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
+        CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));
+
+        DEBUG ((DEBUG_INFO, "%a: System RAM @ 0x%lx - 0x%lx\n",
+          __FUNCTION__, CurBase, CurBase + CurSize - 1));
+
+        if (NewBase > CurBase || NewBase == 0) {
+          NewBase = CurBase;
+          NewSize = CurSize;
+        }
+      } else {
+        DEBUG ((DEBUG_ERROR, "%a: Failed to parse FDT memory node\n",
+          __FUNCTION__));
+      }
+    }
+  }
+
+  //
+  // Make sure the start of DRAM matches our expectation
+  //
+  ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) == NewBase);
+  PcdStatus = PcdSet64S (PcdSystemMemorySize, NewSize);
+  ASSERT_RETURN_ERROR (PcdStatus);
+
+  //
+  // We need to make sure that the machine we are running on has at least
+  // 128 MB of memory configured, and is currently executing this binary from
+  // NOR flash. This prevents a device tree image in DRAM from getting
+  // clobbered when our caller installs permanent PEI RAM, before we have a
+  // chance of marking its location as reserved or copy it to a freshly
+  // allocated block in the permanent PEI RAM in the platform PEIM.
+  //
+  ASSERT (NewSize >= SIZE_128MB);
+  ASSERT (
+    (((UINT64)PcdGet64 (PcdFdBaseAddress) +
+      (UINT64)PcdGet32 (PcdFdSize)) <= NewBase) ||
+    ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize)));
+
+  return RETURN_SUCCESS;
+}
-- 
2.17.1


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

* [PATCH v2 2/5] MdeMoudlePkg: introduce new PCD for Acpi/rsdp
  2021-05-17  6:50 [PATCH v2 0/5] Enable Cloud Hypervisor support in edk2 Jianyong Wu
  2021-05-17  6:50 ` [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor Jianyong Wu
@ 2021-05-17  6:50 ` Jianyong Wu
  2021-05-18 20:25   ` Sami Mujawar
  2021-05-19  6:17   ` [edk2-devel] " Laszlo Ersek
  2021-05-17  6:50 ` [PATCH v2 3/5] ArmVirtPkg: enable ACPI for cloud hypervisor Jianyong Wu
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-17  6:50 UTC (permalink / raw)
  To: devel, lersek, ardb+tianocore, sami.mujawar
  Cc: hao.a.wu, justin.he, jianyong.wu, Jian J Wang

As there is lack of a machnism in Cloud Hypervisor to pass the base
address of Rsdp in Acpi, so a PCD varialbe is introduced here to
feed it.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
---
 MdeModulePkg/MdeModulePkg.dec | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 148395511034..4c8baac35a9e 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -910,6 +910,13 @@ [PcdsFixedAtBuild]
   # @Expression 0x80000001 | (gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable == 0xFFFFFFFFFFFFFFFF || gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable <= 0x0FFFFFFFFFFFFFFF)
   gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable|0|UINT64|0x30001015
 
+  ##
+  # This is the physical address of rsdp which is the core struct of Acpi.
+  # Some hypervisor may has no way to pass rsdp address to the guest, so a PCD
+  # is worth for those.
+  #
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress|0x0|UINT64|0x30001056
+
   ## Progress Code for OS Loader LoadImage start.<BR><BR>
   #  PROGRESS_CODE_OS_LOADER_LOAD   = (EFI_SOFTWARE_DXE_BS_DRIVER | (EFI_OEM_SPECIFIC | 0x00000000)) = 0x03058000<BR>
   # @Prompt Progress Code for OS Loader LoadImage start.
-- 
2.17.1


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

* [PATCH v2 3/5] ArmVirtPkg: enable ACPI for cloud hypervisor
  2021-05-17  6:50 [PATCH v2 0/5] Enable Cloud Hypervisor support in edk2 Jianyong Wu
  2021-05-17  6:50 ` [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor Jianyong Wu
  2021-05-17  6:50 ` [PATCH v2 2/5] MdeMoudlePkg: introduce new PCD for Acpi/rsdp Jianyong Wu
@ 2021-05-17  6:50 ` Jianyong Wu
  2021-05-18 20:26   ` Sami Mujawar
  2021-05-19  6:25   ` [edk2-devel] " Laszlo Ersek
  2021-05-17  6:50 ` [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family Jianyong Wu
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-17  6:50 UTC (permalink / raw)
  To: devel, lersek, ardb+tianocore, sami.mujawar
  Cc: hao.a.wu, justin.he, jianyong.wu

The current implementation of PlatformHasAcpiDt is not a common
library and is on behalf of qemu. So give a specific version for
Cloud Hypervisor here.

There is no device like Fw-cfg in qemu in Cloud Hypervisor, so a specific
Acpi handler is introduced here.

The handler implemented here is in a very simple way:
firstly, aquire the Rsdp address from the PCD varaible in the top
".dsc";
secondly, get the Xsdp address from Rsdp structure;
thirdly, get the Acpi tables following the Xsdp structrue and install it
one by one.

Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
---
 .../CloudHvAcpiPlatformDxe.inf                | 51 +++++++++++++
 .../CloudHvHasAcpiDtDxe.inf                   | 43 +++++++++++
 .../CloudHvAcpiPlatformDxe/CloudHvAcpi.c      | 73 +++++++++++++++++++
 .../CloudHvHasAcpiDtDxe.c                     | 69 ++++++++++++++++++
 4 files changed, 236 insertions(+)
 create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
 create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
 create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
 create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c

diff --git a/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
new file mode 100644
index 000000000000..63c74e84eb27
--- /dev/null
+++ b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
@@ -0,0 +1,51 @@
+## @file
+#  OVMF ACPI Platform Driver for Cloud Hypervisor
+#
+#  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = ClhFwCfgAcpiPlatform
+  FILE_GUID                      = 6c76e407-73f2-dc1c-938f-5d6c4691ea93
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = CloudHvAcpiPlatformEntryPoint
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+#  VALID_ARCHITECTURES           = IA32 X64 ARM AARCH64
+#
+
+[Sources]
+  CloudHvAcpi.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  MemoryAllocationLib
+  OrderedCollectionLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+
+[Protocols]
+  gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
+  gEfiPciIoProtocolGuid                         # PROTOCOL SOMETIMES_CONSUMED
+
+[Guids]
+  gRootBridgesConnectedEventGroupGuid
+
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress
+
+[Depex]
+  gEfiAcpiTableProtocolGuid
diff --git a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
new file mode 100644
index 000000000000..f511a4f5064c
--- /dev/null
+++ b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
@@ -0,0 +1,43 @@
+## @file
+# Decide whether the firmware should expose an ACPI- and/or a Device Tree-based
+# hardware description to the operating system.
+#
+# Copyright (c) 2017, Red Hat, Inc.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION                    = 1.25
+  BASE_NAME                      = ClhPlatformHasAcpiDtDxe
+  FILE_GUID                      = 71fe72f9-6dc1-199d-5054-13b4200ee88d
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = PlatformHasAcpiDt
+
+[Sources]
+  CloudHvHasAcpiDtDxe.c
+
+[Packages]
+  ArmVirtPkg/ArmVirtPkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  PcdLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+
+[Guids]
+  gEdkiiPlatformHasAcpiGuid       ## SOMETIMES_PRODUCES ## PROTOCOL
+  gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL
+
+[Pcd]
+  gArmVirtTokenSpaceGuid.PcdForceNoAcpi
+
+[Depex]
+  gEfiVariableArchProtocolGuid
diff --git a/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
new file mode 100644
index 000000000000..c2344e7b29fa
--- /dev/null
+++ b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
@@ -0,0 +1,73 @@
+#include <Library/BaseLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <IndustryStandard/Acpi63.h>
+#include <Protocol/AcpiTable.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/DebugLib.h>
+
+#define ACPI_ENTRY_SIZE 8
+#define XSDT_LEN 36
+
+STATIC
+EFI_ACPI_TABLE_PROTOCOL *
+FindAcpiTableProtocol (
+  VOID
+  )
+{
+  EFI_STATUS              Status;
+  EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
+
+  Status = gBS->LocateProtocol (
+                  &gEfiAcpiTableProtocolGuid,
+                  NULL,
+                  (VOID**)&AcpiTable
+                  );
+  ASSERT_EFI_ERROR (Status);
+  return AcpiTable;
+}
+
+EFI_STATUS
+EFIAPI
+InstallCloudHvAcpiTables (
+ IN     EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
+ )
+{
+  UINTN InstalledKey, TableSize;
+  UINT64 Rsdp, Xsdt, table_offset, PointerValue;
+  EFI_STATUS Status = 0;
+  int size;
+
+  Rsdp = PcdGet64 (PcdAcpiRsdpBaseAddress);
+  Xsdt = ((EFI_ACPI_6_3_ROOT_SYSTEM_DESCRIPTION_POINTER *)Rsdp)->XsdtAddress;
+  PointerValue = Xsdt;
+  table_offset = Xsdt;
+  size = ((EFI_ACPI_COMMON_HEADER *)PointerValue)->Length - XSDT_LEN;
+  table_offset += XSDT_LEN;
+
+  while(!Status && size > 0) {
+    PointerValue = *(UINT64 *)table_offset;
+    TableSize = ((EFI_ACPI_COMMON_HEADER *)PointerValue)->Length;
+    Status = AcpiProtocol->InstallAcpiTable (AcpiProtocol,
+             (VOID *)(UINT64)PointerValue, TableSize,
+             &InstalledKey);
+    table_offset += ACPI_ENTRY_SIZE;
+    size -= ACPI_ENTRY_SIZE;
+  }
+
+  return Status;
+}
+
+EFI_STATUS
+EFIAPI
+CloudHvAcpiPlatformEntryPoint (
+  IN EFI_HANDLE         ImageHandle,
+  IN EFI_SYSTEM_TABLE   *SystemTable
+  )
+{
+  EFI_STATUS                         Status;
+
+  Status = InstallCloudHvAcpiTables (FindAcpiTableProtocol ());
+  return Status;
+}
+
diff --git a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
new file mode 100644
index 000000000000..ae07c91f5705
--- /dev/null
+++ b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
@@ -0,0 +1,69 @@
+/** @file
+  Decide whether the firmware should expose an ACPI- and/or a Device Tree-based
+  hardware description to the operating system.
+
+  Copyright (c) 2017, Red Hat, Inc.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <Guid/PlatformHasAcpi.h>
+#include <Guid/PlatformHasDeviceTree.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+
+EFI_STATUS
+EFIAPI
+PlatformHasAcpiDt (
+  IN EFI_HANDLE       ImageHandle,
+  IN EFI_SYSTEM_TABLE *SystemTable
+  )
+{
+  EFI_STATUS           Status;
+
+  //
+  // If we fail to install any of the necessary protocols below, the OS will be
+  // unbootable anyway (due to lacking hardware description), so tolerate no
+  // errors here.
+  //
+  if (MAX_UINTN == MAX_UINT64 &&
+      !PcdGetBool (PcdForceNoAcpi))
+  {
+    Status = gBS->InstallProtocolInterface (
+                    &ImageHandle,
+                    &gEdkiiPlatformHasAcpiGuid,
+                    EFI_NATIVE_INTERFACE,
+                    NULL
+                    );
+    if (EFI_ERROR (Status)) {
+      goto Failed;
+    }
+
+    return Status;
+  }
+
+  //
+  // Expose the Device Tree otherwise.
+  //
+  Status = gBS->InstallProtocolInterface (
+                  &ImageHandle,
+                  &gEdkiiPlatformHasDeviceTreeGuid,
+                  EFI_NATIVE_INTERFACE,
+                  NULL
+                  );
+  if (EFI_ERROR (Status)) {
+    goto Failed;
+  }
+
+  return Status;
+
+Failed:
+  ASSERT_EFI_ERROR (Status);
+  CpuDeadLoop ();
+  //
+  // Keep compilers happy.
+  //
+  return Status;
+}
-- 
2.17.1


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

* [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family
  2021-05-17  6:50 [PATCH v2 0/5] Enable Cloud Hypervisor support in edk2 Jianyong Wu
                   ` (2 preceding siblings ...)
  2021-05-17  6:50 ` [PATCH v2 3/5] ArmVirtPkg: enable ACPI for cloud hypervisor Jianyong Wu
@ 2021-05-17  6:50 ` Jianyong Wu
  2021-05-18 20:26   ` Sami Mujawar
  2021-05-19  6:36   ` [edk2-devel] " Laszlo Ersek
  2021-05-17  6:50 ` [PATCH v2 5/5] Maintainers: update Maintainers file as new files/folders created Jianyong Wu
  2021-05-18 17:46 ` [edk2-devel] [PATCH v2 0/5] Enable Cloud Hypervisor support in edk2 Laszlo Ersek
  5 siblings, 2 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-17  6:50 UTC (permalink / raw)
  To: devel, lersek, ardb+tianocore, sami.mujawar
  Cc: hao.a.wu, justin.he, jianyong.wu, Leif Lindholm

Cloud Hypervisor is kvm based VMM and is implemented in rust. Just like
other VMMs it need UEFI support to let ACPI work. That's why
Cloud Hypervisor is introduced here.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: 
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
---
 ArmVirtPkg/ArmVirtCloudHv.dsc           | 455 ++++++++++++++++++++++++
 ArmVirtPkg/ArmVirtCloudHv.fdf           | 292 +++++++++++++++
 ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc | 169 +++++++++
 3 files changed, 916 insertions(+)
 create mode 100644 ArmVirtPkg/ArmVirtCloudHv.dsc
 create mode 100644 ArmVirtPkg/ArmVirtCloudHv.fdf
 create mode 100644 ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc

diff --git a/ArmVirtPkg/ArmVirtCloudHv.dsc b/ArmVirtPkg/ArmVirtCloudHv.dsc
new file mode 100644
index 000000000000..bf1f8c5a75ae
--- /dev/null
+++ b/ArmVirtPkg/ArmVirtCloudHv.dsc
@@ -0,0 +1,455 @@
+#
+#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
+#  Copyright (c) 2014, Linaro Limited. All rights reserved.
+#  Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+  PLATFORM_NAME                  = ArmVirtCloudHv
+  PLATFORM_GUID                  = DFFED32B-DFFE-D32B-DFFE-D32BDFFED32B
+  PLATFORM_VERSION               = 0.1
+  DSC_SPECIFICATION              = 0x00010005
+  OUTPUT_DIRECTORY               = Build/ArmVirtCloudHv-$(ARCH)
+  SUPPORTED_ARCHITECTURES        = AARCH64|ARM
+  BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
+  SKUID_IDENTIFIER               = DEFAULT
+  FLASH_DEFINITION               = ArmVirtPkg/ArmVirtCloudHv.fdf
+
+  #
+  # Defines for default states.  These can be changed on the command line.
+  # -D FLAG=VALUE
+  #
+  DEFINE TTY_TERMINAL            = FALSE
+  DEFINE SECURE_BOOT_ENABLE      = FALSE
+  DEFINE TPM2_ENABLE             = FALSE
+  DEFINE TPM2_CONFIG_ENABLE      = FALSE
+
+!include ArmVirtPkg/ArmVirt.dsc.inc
+
+[LibraryClasses.common]
+  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+
+  # Virtio Support
+  VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
+  VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
+  QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
+  QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
+  QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
+  QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
+
+  ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
+
+  TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
+  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+  PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+  PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf
+  CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
+  FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
+  QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
+  FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+  PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
+  PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
+  PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
+  PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
+
+!if $(TPM2_ENABLE) == TRUE
+  Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
+  Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
+  TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
+!else
+  TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
+!endif
+
+!include MdePkg/MdeLibs.dsc.inc
+
+[LibraryClasses.common.PEIM]
+  ArmVirtMemInfoLib|ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
+
+!if $(TPM2_ENABLE) == TRUE
+  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
+  ResetSystemLib|MdeModulePkg/Library/PeiResetSystemLib/PeiResetSystemLib.inf
+  Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.inf
+!endif
+
+[LibraryClasses.common.DXE_DRIVER]
+  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
+
+!if $(TPM2_ENABLE) == TRUE
+  Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf
+!endif
+
+[LibraryClasses.common.UEFI_DRIVER]
+  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
+
+[BuildOptions]
+!include NetworkPkg/NetworkBuildOptions.dsc.inc
+
+################################################################################
+#
+# Pcd Section - list of all EDK II PCD Entries defined by this Platform
+#
+################################################################################
+
+[PcdsFeatureFlag.common]
+  gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation|TRUE
+  gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation|TRUE
+
+  ## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
+  #  It could be set FALSE to save size.
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
+
+  gArmVirtTokenSpaceGuid.PcdTpm2SupportEnabled|$(TPM2_ENABLE)
+
+[PcdsFixedAtBuild.common]
+!if $(ARCH) == AARCH64
+  gArmTokenSpaceGuid.PcdVFPEnabled|1
+!endif
+
+  gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4007c000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
+  gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
+
+  # Rsdp base address in Cloud Hypervisor
+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress|0x40200000
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x4000000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x40000
+!if $(NETWORK_TLS_ENABLE) == TRUE
+  #
+  # The cumulative and individual VOLATILE variable size limits should be set
+  # high enough for accommodating several and/or large CA certificates.
+  #
+  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x80000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize|0x40000
+!endif
+
+  # Size of the region used by UEFI in permanent memory (Reserved 64MB)
+  gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000
+
+  #
+  # ARM PrimeCell
+  #
+
+  ## PL011 - Serial Terminal
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|38400
+
+  ## Default Terminal Type
+  ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
+!if $(TTY_TERMINAL) == TRUE
+  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
+  # Set terminal type to TtyTerm, the value encoded is EFI_TTY_TERM_GUID
+  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d, 0x91, 0x7d, 0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94}
+!else
+  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|1
+!endif
+
+  # System Memory Base -- fixed at 0x4000_0000
+  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x40000000
+
+  # initial location of the device tree blob passed by Cloud Hypervisor -- base of DRAM
+  gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x40000000
+
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
+  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
+
+  #
+  # The maximum physical I/O addressability of the processor, set with
+  # BuildCpuHob().
+  #
+  gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16
+
+  #
+  # Enable the non-executable DXE stack. (This gets set up by DxeIpl)
+  #
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE
+
+!if $(SECURE_BOOT_ENABLE) == TRUE
+  # override the default values from SecurityPkg to ensure images from all sources are verified in secure boot
+  gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
+  gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04
+  gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
+!endif
+
+  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|3
+  gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x20000
+
+[PcdsFixedAtBuild.AARCH64]
+  # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS entry point,
+  # if the entry point version is >= 3.0. AARCH64 OSes cannot assume the
+  # presence of the 32-bit entry point anyway (because many AARCH64 systems
+  # don't have 32-bit addressable physical RAM), and the additional allocations
+  # below 4 GB needlessly fragment the memory map. So expose the 64-bit entry
+  # point only, for entry point versions >= 3.0.
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosEntryPointProvideMethod|0x2
+
+[PcdsDynamicDefault.common]
+  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
+
+  ## If TRUE, OvmfPkg/AcpiPlatformDxe will not wait for PCI
+  #  enumeration to complete before installing ACPI tables.
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
+
+  # System Memory Size -- 1 MB initially, actual size will be fetched from DT
+  gArmTokenSpaceGuid.PcdSystemMemorySize|0x00100000
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
+
+  gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0
+  gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
+  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
+  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
+
+  #
+  # ARM General Interrupt Controller
+  #
+  gArmTokenSpaceGuid.PcdGicDistributorBase|0x0
+  gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x0
+  gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x0
+
+  ## PL031 RealTimeClock
+  gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
+
+  # set PcdPciExpressBaseAddress to MAX_UINT64, which signifies that this
+  # PCD and PcdPciDisableBusEnumeration above have not been assigned yet
+  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFFFF
+
+  gArmTokenSpaceGuid.PcdPciIoTranslation|0
+#  gArmTokenSpaceGuid.PcdPciIoTranslation|0x50000000
+
+  #
+  # TPM2 support
+  #
+  gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0
+!if $(TPM2_ENABLE) == TRUE
+  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
+  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0
+!endif
+
+[PcdsDynamicHii]
+  gArmVirtTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gArmVirtVariableGuid|0x0|FALSE|NV,BS
+
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS
+  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x8|3|NV,BS
+!endif
+
+################################################################################
+#
+# Components Section - list of all EDK II Modules needed by this Platform
+#
+################################################################################
+[Components.common]
+  #
+  # PEI Phase modules
+  #
+  ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
+  MdeModulePkg/Core/Pei/PeiMain.inf
+  MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
+    <LibraryClasses>
+      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  }
+  ArmPlatformPkg/PlatformPei/PlatformPeim.inf
+  ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
+  ArmPkg/Drivers/CpuPei/CpuPei.inf
+
+  MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
+
+!if $(TPM2_ENABLE) == TRUE
+  MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf {
+    <LibraryClasses>
+      ResetSystemLib|ArmVirtPkg/Library/ArmVirtPsciResetSystemPeiLib/ArmVirtPsciResetSystemPeiLib.inf
+  }
+  OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
+  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf {
+    <LibraryClasses>
+      HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
+      NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
+      NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
+      NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
+      NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
+      NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
+  }
+!endif
+
+  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
+    <LibraryClasses>
+      NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+  }
+
+  #
+  # DXE
+  #
+  MdeModulePkg/Core/Dxe/DxeMain.inf {
+    <LibraryClasses>
+      NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
+      DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+  }
+  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
+    <LibraryClasses>
+      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  }
+
+  #
+  # Architectural Protocols
+  #
+  ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
+    <LibraryClasses>
+      NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
+      # don't use unaligned CopyMem () on the UEFI varstore NOR flash region
+      BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  }
+!if $(SECURE_BOOT_ENABLE) == TRUE
+  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
+    <LibraryClasses>
+      NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
+!if $(TPM2_ENABLE) == TRUE
+      NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf
+!endif
+  }
+  SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
+  OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf
+!else
+  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+!endif
+  MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+  MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
+  MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
+  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf {
+    <LibraryClasses>
+      NULL|ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClientLib.inf
+  }
+  EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
+
+  MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+  MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
+  MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
+  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+  MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
+
+  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+
+  ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
+  ArmPkg/Drivers/TimerDxe/TimerDxe.inf {
+    <LibraryClasses>
+      NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
+  }
+  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+
+  #
+  # Status Code Routing
+  #
+  MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
+
+  #
+  # Platform Driver
+  #
+  ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
+  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+  ArmVirtPkg/HighMemDxe/HighMemDxe.inf
+  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
+  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
+  OvmfPkg/VirtioNetDxe/VirtioNet.inf
+  OvmfPkg/VirtioRngDxe/VirtioRng.inf
+
+  #
+  # FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
+  #
+  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+  MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+  MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  FatPkg/EnhancedFatDxe/Fat.inf
+  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
+  OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
+
+  #
+  # Bds
+  #
+  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
+    <LibraryClasses>
+      DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  }
+  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
+  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+  MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
+  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+  MdeModulePkg/Logo/LogoDxe.inf
+  MdeModulePkg/Application/UiApp/UiApp.inf {
+    <LibraryClasses>
+      NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
+      NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
+      NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
+  }
+  OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
+
+  #
+  # SCSI Bus and Disk Driver
+  #
+  MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
+  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
+
+  #
+  # PCI support
+  #
+  ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
+    <LibraryClasses>
+      NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
+  }
+  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
+  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
+    <LibraryClasses>
+      NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
+  }
+  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
+  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
+  OvmfPkg/Virtio10Dxe/Virtio10.inf
+
+  #
+  # TPM2 support
+  #
+!if $(TPM2_ENABLE) == TRUE
+  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf {
+    <LibraryClasses>
+      HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
+      Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf
+      NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf
+      NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
+      NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
+      NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
+      NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
+      NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
+  }
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
+!endif
+
+  #
+  # ACPI Support
+  #
+  ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
+[Components.AARCH64]
+  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+  ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf {
+    <LibraryClasses>
+      NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
+  }
diff --git a/ArmVirtPkg/ArmVirtCloudHv.fdf b/ArmVirtPkg/ArmVirtCloudHv.fdf
new file mode 100644
index 000000000000..3619a09ba8c5
--- /dev/null
+++ b/ArmVirtPkg/ArmVirtCloudHv.fdf
@@ -0,0 +1,292 @@
+#
+#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
+#  Copyright (c) 2014, Linaro Limited. All rights reserved.
+#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+################################################################################
+#
+# FD Section
+# The [FD] Section is made up of the definition statements and a
+# description of what goes into  the Flash Device Image.  Each FD section
+# defines one flash "device" image.  A flash device image may be one of
+# the following: Removable media bootable image (like a boot floppy
+# image,) an Option ROM image (that would be "flashed" into an add-in
+# card,) a System "Flash"  image (that would be burned into a system's
+# flash) or an Update ("Capsule") image that will be used to update and
+# existing system flash.
+#
+################################################################################
+
+[Defines]
+!if $(FD_SIZE_IN_MB) == 2
+  DEFINE FVMAIN_COMPACT_SIZE  = 0x1ff000
+!endif
+!if $(FD_SIZE_IN_MB) == 3
+  DEFINE FVMAIN_COMPACT_SIZE  = 0x2ff000
+!endif
+
+[FD.CLOUDHV_EFI]
+BaseAddress   = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress  # cloud-hypervisor assigns 0 - 0x8000000 for a BootROM
+Size          = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize         # The size in bytes of the FLASH Device
+ErasePolarity = 1
+
+# This one is tricky, it must be: BlockSize * NumBlocks = Size
+BlockSize     = 0x00001000
+NumBlocks     = $(FD_NUM_BLOCKS)
+
+################################################################################
+#
+# Following are lists of FD Region layout which correspond to the locations of different
+# images within the flash device.
+#
+# Regions must be defined in ascending order and may not overlap.
+#
+# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
+# the pipe "|" character, followed by the size of the region, also in hex with the leading
+# "0x" characters. Like:
+# Offset|Size
+# PcdOffsetCName|PcdSizeCName
+# RegionType <FV, DATA, or FILE>
+#
+################################################################################
+
+#
+# UEFI has trouble dealing with FVs that reside at physical address 0x0.
+# So instead, put a hardcoded 'jump to 0x1000' at offset 0x0, and put the
+# real FV at offset 0x1000
+#
+0x00000000|0x00001000
+DATA = {
+!if $(ARCH) == AARCH64
+  0x00, 0x04, 0x00, 0x14   # 'b 0x1000' in AArch64 ASM
+!else
+  0xfe, 0x03, 0x00, 0xea   # 'b 0x1000' in AArch32 ASM
+!endif
+}
+
+0x00001000|$(FVMAIN_COMPACT_SIZE)
+gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
+FV = FVMAIN_COMPACT
+
+!include VarStore.fdf.inc
+
+################################################################################
+#
+# FV Section
+#
+# [FV] section is used to define what components or modules are placed within a flash
+# device file.  This section also defines order the components and modules are positioned
+# within the image.  The [FV] section consists of define statements, set statements and
+# module statements.
+#
+################################################################################
+
+#!include ArmVirtCloudHvFvMain.fdf.inc
+
+
+
+[FV.FvMain]
+FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
+BlockSize          = 0x40
+NumBlocks          = 0         # This FV gets compressed so make it just big enough
+FvAlignment        = 16        # FV alignment and FV attributes setting.
+ERASE_POLARITY     = 1
+MEMORY_MAPPED      = TRUE
+STICKY_WRITE       = TRUE
+LOCK_CAP           = TRUE
+LOCK_STATUS        = TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP  = TRUE
+WRITE_STATUS       = TRUE
+WRITE_LOCK_CAP     = TRUE
+WRITE_LOCK_STATUS  = TRUE
+READ_DISABLED_CAP  = TRUE
+READ_ENABLED_CAP   = TRUE
+READ_STATUS        = TRUE
+READ_LOCK_CAP      = TRUE
+READ_LOCK_STATUS   = TRUE
+
+  INF MdeModulePkg/Core/Dxe/DxeMain.inf
+  INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
+  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
+
+  #
+  # PI DXE Drivers producing Architectural Protocols (EFI Services)
+  #
+  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+  INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+  INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
+!if $(SECURE_BOOT_ENABLE) == TRUE
+  INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
+!endif
+  INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
+  INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
+  INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
+  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
+  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+
+  #
+  # Multiple Console IO support
+  #
+  INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+  INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
+  INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
+  INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
+
+  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
+  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+
+  #
+  # FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
+  #
+  INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+  INF FatPkg/EnhancedFatDxe/Fat.inf
+  INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
+  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
+
+  #
+  # Status Code Routing
+  #
+  INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
+
+  #
+  # Platform Driver
+  #
+  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
+  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
+  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
+  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
+
+  #
+  # UEFI application (Shell Embedded Boot Loader)
+  #
+  INF ShellPkg/Application/Shell/Shell.inf
+  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+  INF ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
+  INF OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
+
+  #
+  # Bds
+  #
+  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
+  INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
+  INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+  INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
+  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+  INF MdeModulePkg/Application/UiApp/UiApp.inf
+  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
+
+  #
+  # SCSI Bus and Disk Driver
+  #
+  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
+  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
+
+  #
+  # ACPI Support
+  #
+  INF ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
+!if $(ARCH) == AARCH64
+  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+  INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+  INF ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
+
+  #
+  # EBC support
+  #
+  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
+!endif
+
+  #
+  # PCI support
+  #
+  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
+  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
+  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
+  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
+  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
+
+  #
+  # TPM2 support
+  #
+!if $(TPM2_ENABLE) == TRUE
+  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
+!endif
+
+  #
+  # TianoCore logo (splash screen)
+  #
+  INF MdeModulePkg/Logo/LogoDxe.inf
+
+  #
+  # Ramdisk support
+  #
+  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
+
+
+
+
+
+
+
+
+
+
+
+
+[FV.FVMAIN_COMPACT]
+FvAlignment        = 16
+ERASE_POLARITY     = 1
+MEMORY_MAPPED      = TRUE
+STICKY_WRITE       = TRUE
+LOCK_CAP           = TRUE
+LOCK_STATUS        = TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP  = TRUE
+WRITE_STATUS       = TRUE
+WRITE_LOCK_CAP     = TRUE
+WRITE_LOCK_STATUS  = TRUE
+READ_DISABLED_CAP  = TRUE
+READ_ENABLED_CAP   = TRUE
+READ_STATUS        = TRUE
+READ_LOCK_CAP      = TRUE
+READ_LOCK_STATUS   = TRUE
+
+  INF ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
+  INF MdeModulePkg/Core/Pei/PeiMain.inf
+  INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
+  INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
+  INF ArmPkg/Drivers/CpuPei/CpuPei.inf
+  INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
+  INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
+  INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
+
+!if $(TPM2_ENABLE) == TRUE
+  INF MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf
+  INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
+  INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
+!endif
+
+  FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
+    SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
+      SECTION FV_IMAGE = FVMAIN
+    }
+  }
+
+!include ArmVirtRules.fdf.inc
diff --git a/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
new file mode 100644
index 000000000000..51041e889ef4
--- /dev/null
+++ b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
@@ -0,0 +1,169 @@
+#
+#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
+#  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
+#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+################################################################################
+#
+# FV Section
+#
+# [FV] section is used to define what components or modules are placed within a flash
+# device file.  This section also defines order the components and modules are positioned
+# within the image.  The [FV] section consists of define statements, set statements and
+# module statements.
+#
+################################################################################
+
+[FV.FvMain]
+FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
+BlockSize          = 0x40
+NumBlocks          = 0         # This FV gets compressed so make it just big enough
+FvAlignment        = 16        # FV alignment and FV attributes setting.
+ERASE_POLARITY     = 1
+MEMORY_MAPPED      = TRUE
+STICKY_WRITE       = TRUE
+LOCK_CAP           = TRUE
+LOCK_STATUS        = TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP  = TRUE
+WRITE_STATUS       = TRUE
+WRITE_LOCK_CAP     = TRUE
+WRITE_LOCK_STATUS  = TRUE
+READ_DISABLED_CAP  = TRUE
+READ_ENABLED_CAP   = TRUE
+READ_STATUS        = TRUE
+READ_LOCK_CAP      = TRUE
+READ_LOCK_STATUS   = TRUE
+
+  INF MdeModulePkg/Core/Dxe/DxeMain.inf
+  INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
+  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
+  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
+
+  #
+  # PI DXE Drivers producing Architectural Protocols (EFI Services)
+  #
+  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+  INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+  INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
+!if $(SECURE_BOOT_ENABLE) == TRUE
+  INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
+!endif
+  INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
+  INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
+  INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
+  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
+  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+
+  #
+  # Multiple Console IO support
+  #
+  INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+  INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
+  INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
+  INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
+
+  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
+  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
+
+  #
+  # FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
+  #
+  INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+  INF FatPkg/EnhancedFatDxe/Fat.inf
+  INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
+  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
+
+  #
+  # Status Code Routing
+  #
+  INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
+
+  #
+  # Platform Driver
+  #
+  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
+  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
+  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
+  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
+
+  #
+  # UEFI application (Shell Embedded Boot Loader)
+  #
+  INF ShellPkg/Application/Shell/Shell.inf
+  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+  INF ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
+  INF OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
+
+  #
+  # Bds
+  #
+  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
+  INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
+  INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+  INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
+  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+  INF MdeModulePkg/Application/UiApp/UiApp.inf
+  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
+
+  #
+  # SCSI Bus and Disk Driver
+  #
+  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
+  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
+
+  #
+  # ACPI Support
+  #
+  INF ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
+!if $(ARCH) == AARCH64
+  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+  INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+  INF ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
+
+  #
+  # EBC support
+  #
+  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
+!endif
+
+  #
+  # PCI support
+  #
+  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
+  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
+  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
+  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
+  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
+  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
+
+  #
+  # TPM2 support
+  #
+!if $(TPM2_ENABLE) == TRUE
+  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
+!if $(TPM2_CONFIG_ENABLE) == TRUE
+  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
+!endif
+!endif
+
+  #
+  # TianoCore logo (splash screen)
+  #
+  INF MdeModulePkg/Logo/LogoDxe.inf
+
+  #
+  # Ramdisk support
+  #
+  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
-- 
2.17.1


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

* [PATCH v2 5/5] Maintainers: update Maintainers file as new files/folders created
  2021-05-17  6:50 [PATCH v2 0/5] Enable Cloud Hypervisor support in edk2 Jianyong Wu
                   ` (3 preceding siblings ...)
  2021-05-17  6:50 ` [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family Jianyong Wu
@ 2021-05-17  6:50 ` Jianyong Wu
  2021-05-18 20:26   ` Sami Mujawar
  2021-05-19  6:39   ` [edk2-devel] " Laszlo Ersek
  2021-05-18 17:46 ` [edk2-devel] [PATCH v2 0/5] Enable Cloud Hypervisor support in edk2 Laszlo Ersek
  5 siblings, 2 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-17  6:50 UTC (permalink / raw)
  To: devel, lersek, ardb+tianocore, sami.mujawar
  Cc: hao.a.wu, justin.he, jianyong.wu

Create new entry for Cloud Hypervisor and assign reviewer to Sami
Mujawar.

Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
---
 Maintainers.txt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index cafe6b1ab85d..f8fae067c656 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -167,6 +167,13 @@ F: ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/
 F: ArmVirtPkg/Library/NorFlashKvmtoolLib/
 R: Sami Mujawar <sami.mujawar@arm.com>
 
+ArmVirtPkg: Cloud Hypervisor emulated platform support
+F: ArmVirtPkg/ArmVirtCloudHv*
+F: ArmVirtPkg/CloudHvAcpiPlatformDxe/
+F: ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/
+F: ArmVirtPkg/Library/CloudHvVirtMemInfoLib/
+R: Sami Mujawar <sami.mujawar@arm.com>
+
 BaseTools
 F: BaseTools/
 W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
-- 
2.17.1


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

* Re: [edk2-devel] [PATCH v2 0/5] Enable Cloud Hypervisor support in edk2
  2021-05-17  6:50 [PATCH v2 0/5] Enable Cloud Hypervisor support in edk2 Jianyong Wu
                   ` (4 preceding siblings ...)
  2021-05-17  6:50 ` [PATCH v2 5/5] Maintainers: update Maintainers file as new files/folders created Jianyong Wu
@ 2021-05-18 17:46 ` Laszlo Ersek
  5 siblings, 0 replies; 30+ messages in thread
From: Laszlo Ersek @ 2021-05-18 17:46 UTC (permalink / raw)
  To: devel, jianyong.wu, ardb+tianocore, sami.mujawar; +Cc: hao.a.wu, justin.he

On 05/17/21 08:50, Jianyong Wu wrote:
> Cloud Hypervisor is an open source Virtual Machine Monitor (VMM) that
> runs on top of KVM. Cloud Hypervisor is implemented in Rust and is based
> on the rust-vmm crates. See [1] to find more.
> 
> To support UEFI, Cloud Hypervisor is introduced here.
> There are three parts to be considered to do this enablements, that is:
>   1. memory initialization
> 
>   2. specific ACPI service implementation
>      compared with qemu, there is no device like Fw-cfg, so we has no
>      elegant way to get the RSDP address. A specific ACPI implementation is
>      introduced here.
> 
>   3. build configuration file
> 
> This enablement bases on the implentation for qemu so some code is
> borrowed.
> 
> [1] https://github.com/cloud-hypervisor/cloud-hypervisor
> 
> Jianyong Wu (5):
>   ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor
>   MdeMoudlePkg: introduce new PCD for Acpi/rsdp
>   ArmVirtPkg: enable ACPI for cloud hypervisor
>   ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family
>   Maintainers: update Maintainers file as new files/folders created
> 
>  MdeModulePkg/MdeModulePkg.dec                 |   7 +
>  ArmVirtPkg/ArmVirtCloudHv.dsc                 | 455 ++++++++++++++++++
>  ArmVirtPkg/ArmVirtCloudHv.fdf                 | 292 +++++++++++
>  .../CloudHvAcpiPlatformDxe.inf                |  51 ++
>  .../CloudHvHasAcpiDtDxe.inf                   |  43 ++
>  .../CloudHvVirtMemInfoPeiLib.inf              |  47 ++
>  .../CloudHvAcpiPlatformDxe/CloudHvAcpi.c      |  73 +++
>  .../CloudHvHasAcpiDtDxe.c                     |  69 +++
>  .../CloudHvVirtMemInfoLib.c                   |  94 ++++
>  .../CloudHvVirtMemInfoPeiLibConstructor.c     | 100 ++++
>  ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc       | 169 +++++++
>  Maintainers.txt                               |   7 +
>  12 files changed, 1407 insertions(+)
>  create mode 100644 ArmVirtPkg/ArmVirtCloudHv.dsc
>  create mode 100644 ArmVirtPkg/ArmVirtCloudHv.fdf
>  create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
>  create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
>  create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
>  create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
>  create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
>  create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
>  create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c
>  create mode 100644 ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> 

Confirming that I got this in my review queue. I'll need some time to
get to it; please bear with me.

Thanks,
Laszlo


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

* Re: [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor
  2021-05-17  6:50 ` [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor Jianyong Wu
@ 2021-05-18 20:20   ` Sami Mujawar
  2021-05-27  2:18     ` Jianyong Wu
  2021-05-19  6:07   ` [edk2-devel] " Laszlo Ersek
  1 sibling, 1 reply; 30+ messages in thread
From: Sami Mujawar @ 2021-05-18 20:20 UTC (permalink / raw)
  To: Jianyong Wu, devel, lersek, ardb+tianocore
  Cc: hao.a.wu, justin.he, Leif Lindholm, nd

Hi Jianyon,

Thank you for this patch.

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar

On 17/05/2021 07:50 AM, Jianyong Wu wrote:
> Cloud Hypervisor is kvm based VMM implemented in rust.
>
> This library populates the system memory map for the
> Cloud Hypervisor virtual platform.
>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> ---
>   .../CloudHvVirtMemInfoPeiLib.inf              |  47 ++++++++
>   .../CloudHvVirtMemInfoLib.c                   |  94 ++++++++++++++++
>   .../CloudHvVirtMemInfoPeiLibConstructor.c     | 100 ++++++++++++++++++
>   3 files changed, 241 insertions(+)
>   create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
>   create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
>   create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c
>
> diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
> new file mode 100644
> index 000000000000..71dbf9c06ccc
> --- /dev/null
> +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
> @@ -0,0 +1,47 @@
> +#/* @file
> +#
> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> +#  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +#*/
> +
> +[Defines]
> +  INF_VERSION                    = 0x0001001A
> +  BASE_NAME                      = ClhVirtMemInfoPeiLib
> +  FILE_GUID                      = 3E29D940-0591-EE6A-CAD4-223A9CF55E75
> +  MODULE_TYPE                    = BASE
> +  VERSION_STRING                 = 1.0
> +  LIBRARY_CLASS                  = ArmVirtMemInfoLib|PEIM
> +  CONSTRUCTOR                    = CloudHvVirtMemInfoPeiLibConstructor
> +
> +[Sources]
> +  CloudHvVirtMemInfoLib.c
> +  CloudHvVirtMemInfoPeiLibConstructor.c
> +
> +[Packages]
> +  ArmPkg/ArmPkg.dec
> +  ArmVirtPkg/ArmVirtPkg.dec
> +  EmbeddedPkg/EmbeddedPkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  MdePkg/MdePkg.dec
> +
> +[LibraryClasses]
> +  ArmLib
> +  BaseMemoryLib
> +  DebugLib
> +  FdtLib
> +  PcdLib
> +  MemoryAllocationLib
> +
> +[Pcd]
> +  gArmTokenSpaceGuid.PcdFdBaseAddress
> +  gArmTokenSpaceGuid.PcdFvBaseAddress
> +  gArmTokenSpaceGuid.PcdSystemMemoryBase
> +  gArmTokenSpaceGuid.PcdSystemMemorySize
> +
> +[FixedPcd]
> +  gArmTokenSpaceGuid.PcdFdSize
> +  gArmTokenSpaceGuid.PcdFvSize
> +  gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
> diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
> new file mode 100644
> index 000000000000..69f4e6ab6cc4
> --- /dev/null
> +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
> @@ -0,0 +1,94 @@
> +/** @file
> +
> +  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Base.h>
> +#include <Library/ArmLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/MemoryAllocationLib.h>
> +
> +// Number of Virtual Memory Map Descriptors
> +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS          5
> +
> +//
> +// mach-virt's core peripherals such as the UART, the GIC and the RTC are
> +// all mapped in the 'miscellaneous device I/O' region, which we just map
> +// in its entirety rather than device by device. Note that it does not
> +// cover any of the NOR flash banks or PCI resource windows.
> +//
> +#define MACH_VIRT_PERIPH_BASE       0x08000000
> +#define MACH_VIRT_PERIPH_SIZE       SIZE_128MB
> +
> +//
> +// in cloud-hypervisor, 0x0 ~ 0x8000000 is reserved as normal memory for UEFI
> +//
> +#define CLOUDHV_UEFI_MEM_BASE       0x0
> +#define CLOUDHV_UEFI_MEM_SIZE       0x08000000
[SAMI] The above macros are not used anywhere. Can these be removed?
If so, the code in this patch would be very similar to 
ArmVirtPkg\Library\QemuVirtMemInfoLib. To avoid code duplication, would 
it be possible to use QemuVirtMemInfoPeiLib.inf instead?
[/SAMI]
> +
> +/**
> +  Return the Virtual Memory Map of your platform
> +
> +  This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU
> +  on your platform.
> +
> +  @param[out]   VirtualMemoryMap    Array of ARM_MEMORY_REGION_DESCRIPTOR
> +                                    describing a Physical-to-Virtual Memory
> +                                    mapping. This array must be ended by a
> +                                    zero-filled entry. The allocated memory
> +                                    will not be freed.
> +
> +**/
> +VOID
> +ArmVirtGetMemoryMap (
> +  OUT ARM_MEMORY_REGION_DESCRIPTOR   **VirtualMemoryMap
> +  )
> +{
> +  ARM_MEMORY_REGION_DESCRIPTOR  *VirtualMemoryTable;
> +
> +  ASSERT (VirtualMemoryMap != NULL);
> +
> +  VirtualMemoryTable = AllocatePool (sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *
> +                                     MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
> +
> +  if (VirtualMemoryTable == NULL) {
> +    DEBUG ((DEBUG_ERROR, "%a: Error: Failed AllocatePool()\n", __FUNCTION__));
> +    return;
> +  }
> +
> +  // System DRAM
> +  VirtualMemoryTable[0].PhysicalBase = PcdGet64 (PcdSystemMemoryBase);
> +  VirtualMemoryTable[0].VirtualBase  = VirtualMemoryTable[0].PhysicalBase;
> +  VirtualMemoryTable[0].Length       = PcdGet64 (PcdSystemMemorySize);
> +  VirtualMemoryTable[0].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> +
> +  DEBUG ((DEBUG_INFO, "%a: Dumping System DRAM Memory Map:\n"
> +      "\tPhysicalBase: 0x%lX\n"
> +      "\tVirtualBase: 0x%lX\n"
> +      "\tLength: 0x%lX\n",
> +      __FUNCTION__,
> +      VirtualMemoryTable[0].PhysicalBase,
> +      VirtualMemoryTable[0].VirtualBase,
> +      VirtualMemoryTable[0].Length));
> +
> +  // Memory mapped peripherals (UART, RTC, GIC, virtio-mmio, etc)
> +  VirtualMemoryTable[1].PhysicalBase = MACH_VIRT_PERIPH_BASE;
> +  VirtualMemoryTable[1].VirtualBase  = MACH_VIRT_PERIPH_BASE;
> +  VirtualMemoryTable[1].Length       = MACH_VIRT_PERIPH_SIZE;
> +  VirtualMemoryTable[1].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> +
> +  // Map the FV region as normal executable memory
> +  VirtualMemoryTable[2].PhysicalBase = PcdGet64 (PcdFvBaseAddress);
> +  VirtualMemoryTable[2].VirtualBase  = VirtualMemoryTable[2].PhysicalBase;
> +  VirtualMemoryTable[2].Length       = FixedPcdGet32 (PcdFvSize);
> +  VirtualMemoryTable[2].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> +
> +  // End of Table
> +  ZeroMem (&VirtualMemoryTable[3], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));
> +
> +  *VirtualMemoryMap = VirtualMemoryTable;
> +}
> diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c
> new file mode 100644
> index 000000000000..062dfcee1d66
> --- /dev/null
> +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c
> @@ -0,0 +1,100 @@
> +/** @file
> +
> +  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Base.h>
> +#include <Library/DebugLib.h>
> +#include <Library/PcdLib.h>
> +#include <libfdt.h>
> +
> +RETURN_STATUS
> +EFIAPI
> +CloudHvVirtMemInfoPeiLibConstructor (
> +  VOID
> +  )
> +{
> +  VOID          *DeviceTreeBase;
> +  INT32         Node, Prev;
> +  UINT64        NewBase, CurBase;
> +  UINT64        NewSize, CurSize;
> +  CONST CHAR8   *Type;
> +  INT32         Len;
> +  CONST UINT64  *RegProp;
> +  RETURN_STATUS PcdStatus;
> +
> +  NewBase = 0;
> +  NewSize = 0;
> +
> +  DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
> +  ASSERT (DeviceTreeBase != NULL);
> +
> +  //
> +  // Make sure we have a valid device tree blob
> +  //
> +  ASSERT (fdt_check_header (DeviceTreeBase) == 0);
> +
> +  //
> +  // Look for the lowest memory node
> +  //
> +  for (Prev = 0;; Prev = Node) {
> +    Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
> +    if (Node < 0) {
> +      break;
> +    }
> +
> +    //
> +    // Check for memory node
> +    //
> +    Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len);
> +    if (Type && AsciiStrnCmp (Type, "memory", Len) == 0) {
> +      //
> +      // Get the 'reg' property of this node. For now, we will assume
> +      // two 8 byte quantities for base and size, respectively.
> +      //
> +      RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
> +      if (RegProp != 0 && Len == (2 * sizeof (UINT64))) {
> +
> +        CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
> +        CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));
> +
> +        DEBUG ((DEBUG_INFO, "%a: System RAM @ 0x%lx - 0x%lx\n",
> +          __FUNCTION__, CurBase, CurBase + CurSize - 1));
> +
> +        if (NewBase > CurBase || NewBase == 0) {
> +          NewBase = CurBase;
> +          NewSize = CurSize;
> +        }
> +      } else {
> +        DEBUG ((DEBUG_ERROR, "%a: Failed to parse FDT memory node\n",
> +          __FUNCTION__));
> +      }
> +    }
> +  }
> +
> +  //
> +  // Make sure the start of DRAM matches our expectation
> +  //
> +  ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) == NewBase);
> +  PcdStatus = PcdSet64S (PcdSystemMemorySize, NewSize);
> +  ASSERT_RETURN_ERROR (PcdStatus);
> +
> +  //
> +  // We need to make sure that the machine we are running on has at least
> +  // 128 MB of memory configured, and is currently executing this binary from
> +  // NOR flash. This prevents a device tree image in DRAM from getting
> +  // clobbered when our caller installs permanent PEI RAM, before we have a
> +  // chance of marking its location as reserved or copy it to a freshly
> +  // allocated block in the permanent PEI RAM in the platform PEIM.
> +  //
> +  ASSERT (NewSize >= SIZE_128MB);
> +  ASSERT (
> +    (((UINT64)PcdGet64 (PcdFdBaseAddress) +
> +      (UINT64)PcdGet32 (PcdFdSize)) <= NewBase) ||
> +    ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize)));
> +
> +  return RETURN_SUCCESS;
> +}


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

* Re: [PATCH v2 2/5] MdeMoudlePkg: introduce new PCD for Acpi/rsdp
  2021-05-17  6:50 ` [PATCH v2 2/5] MdeMoudlePkg: introduce new PCD for Acpi/rsdp Jianyong Wu
@ 2021-05-18 20:25   ` Sami Mujawar
  2021-05-27  2:31     ` Jianyong Wu
  2021-05-19  6:17   ` [edk2-devel] " Laszlo Ersek
  1 sibling, 1 reply; 30+ messages in thread
From: Sami Mujawar @ 2021-05-18 20:25 UTC (permalink / raw)
  To: Jianyong Wu, devel, lersek, ardb+tianocore
  Cc: hao.a.wu, justin.he, Jian J Wang, nd

Hi Jianyon,

Thank you for this patch.

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar


On 17/05/2021 07:50 AM, Jianyong Wu wrote:
> As there is lack of a machnism in Cloud Hypervisor to pass the base
> address of Rsdp in Acpi, so a PCD varialbe is introduced here to
[SAMI] Please fix the following typos: 'machnism' & 'varialbe'
> feed it.
>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> ---
>   MdeModulePkg/MdeModulePkg.dec | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
> index 148395511034..4c8baac35a9e 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -910,6 +910,13 @@ [PcdsFixedAtBuild]
>     # @Expression 0x80000001 | (gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable == 0xFFFFFFFFFFFFFFFF || gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable <= 0x0FFFFFFFFFFFFFFF)
>     gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable|0|UINT64|0x30001015
>   
> +  ##
> +  # This is the physical address of rsdp which is the core struct of Acpi.
> +  # Some hypervisor may has no way to pass rsdp address to the guest, so a PCD
> +  # is worth for those.
> +  #
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress|0x0|UINT64|0x30001056
[SAMI] Can this PCD be defined in ArmVirtPkg\ArmVirtPkg.dec ?
> +
>     ## Progress Code for OS Loader LoadImage start.<BR><BR>
>     #  PROGRESS_CODE_OS_LOADER_LOAD   = (EFI_SOFTWARE_DXE_BS_DRIVER | (EFI_OEM_SPECIFIC | 0x00000000)) = 0x03058000<BR>
>     # @Prompt Progress Code for OS Loader LoadImage start.


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

* Re: [PATCH v2 3/5] ArmVirtPkg: enable ACPI for cloud hypervisor
  2021-05-17  6:50 ` [PATCH v2 3/5] ArmVirtPkg: enable ACPI for cloud hypervisor Jianyong Wu
@ 2021-05-18 20:26   ` Sami Mujawar
  2021-05-27  2:57     ` Jianyong Wu
  2021-05-19  6:25   ` [edk2-devel] " Laszlo Ersek
  1 sibling, 1 reply; 30+ messages in thread
From: Sami Mujawar @ 2021-05-18 20:26 UTC (permalink / raw)
  To: Jianyong Wu, devel, lersek, ardb+tianocore; +Cc: hao.a.wu, justin.he, nd

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

Hi Jianyon,

Thank you for this patch.

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar


On 17/05/2021 07:50 AM, Jianyong Wu wrote:
> The current implementation of PlatformHasAcpiDt is not a common
> library and is on behalf of qemu. So give a specific version for
> Cloud Hypervisor here.
>
> There is no device like Fw-cfg in qemu in Cloud Hypervisor, so a specific
> Acpi handler is introduced here.
>
> The handler implemented here is in a very simple way:
> firstly, aquire the Rsdp address from the PCD varaible in the top
> ".dsc";
> secondly, get the Xsdp address from Rsdp structure;
> thirdly, get the Acpi tables following the Xsdp structrue and install it
> one by one.
>
> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> ---
>   .../CloudHvAcpiPlatformDxe.inf                | 51 +++++++++++++
>   .../CloudHvHasAcpiDtDxe.inf                   | 43 +++++++++++
>   .../CloudHvAcpiPlatformDxe/CloudHvAcpi.c      | 73 +++++++++++++++++++
>   .../CloudHvHasAcpiDtDxe.c                     | 69 ++++++++++++++++++
>   4 files changed, 236 insertions(+)
>   create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
>   create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
>   create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
>   create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
[SAMI] I think these should be split as 2 patches covering 
CloudHvAcpiPlatformDx/* and CloudHvPlatformHasAcpiDtDx/*
>
> diff --git a/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> new file mode 100644
> index 000000000000..63c74e84eb27
> --- /dev/null
> +++ b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> @@ -0,0 +1,51 @@
> +## @file
> +#  OVMF ACPI Platform Driver for Cloud Hypervisor
[SAMI] I think the reference to OVMF can be removed, right?
> +#
> +#  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010005
> +  BASE_NAME                      = ClhFwCfgAcpiPlatform
[SAMI] Can ClhFwCfgAcpiPlatform be changed to CloudHvAcpiPlatform?
> +  FILE_GUID                      = 6c76e407-73f2-dc1c-938f-5d6c4691ea93
> +  MODULE_TYPE                    = DXE_DRIVER
> +  VERSION_STRING                 = 1.0
> +  ENTRY_POINT                    = CloudHvAcpiPlatformEntryPoint
> +
> +#
> +# The following information is for reference only and not required by the build tools.
> +#
> +#  VALID_ARCHITECTURES           = IA32 X64 ARM AARCH64
[SAMI] Minor. The above line is just a comment, but can you revisit 
this, please?
> +#
> +
> +[Sources]
> +  CloudHvAcpi.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  OvmfPkg/OvmfPkg.dec
> +
> +[LibraryClasses]
> +  BaseLib
> +  DebugLib
> +  MemoryAllocationLib
> +  OrderedCollectionLib
> +  UefiBootServicesTableLib
> +  UefiDriverEntryPoint
> +
> +[Protocols]
> +  gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
> +  gEfiPciIoProtocolGuid                         # PROTOCOL SOMETIMES_CONSUMED
[SAMI] gEfiPciIoProtocolGuidis not used in this module.
> +
> +[Guids]
> +  gRootBridgesConnectedEventGroupGuid
[SAMI] gRootBridgesConnectedEventGroupGuid not used in this module.
> +
> +[Pcd]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
[SAMI] PcdPciDisableBusEnumerationis not used in this module.
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress
> +
> +[Depex]
> +  gEfiAcpiTableProtocolGuid
> diff --git a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> new file mode 100644
> index 000000000000..f511a4f5064c
> --- /dev/null
> +++ b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> @@ -0,0 +1,43 @@
> +## @file
> +# Decide whether the firmware should expose an ACPI- and/or a Device Tree-based
> +# hardware description to the operating system.
> +#
> +# Copyright (c) 2017, Red Hat, Inc.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +
> +[Defines]
> +  INF_VERSION                    = 1.25
> +  BASE_NAME                      = ClhPlatformHasAcpiDtDxe
[SAMI] Is it possible to change the Clh prefix to CloudHv. Same comment 
for other places in this patch series.
> +  FILE_GUID                      = 71fe72f9-6dc1-199d-5054-13b4200ee88d
> +  MODULE_TYPE                    = DXE_DRIVER
> +  VERSION_STRING                 = 1.0
> +  ENTRY_POINT                    = PlatformHasAcpiDt
> +
> +[Sources]
> +  CloudHvHasAcpiDtDxe.c
> +
> +[Packages]
> +  ArmVirtPkg/ArmVirtPkg.dec
> +  EmbeddedPkg/EmbeddedPkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  MdePkg/MdePkg.dec
> +  OvmfPkg/OvmfPkg.dec
> +
> +[LibraryClasses]
> +  BaseLib
> +  DebugLib
> +  PcdLib
> +  UefiBootServicesTableLib
> +  UefiDriverEntryPoint
> +
> +[Guids]
> +  gEdkiiPlatformHasAcpiGuid       ## SOMETIMES_PRODUCES ## PROTOCOL
> +  gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL
> +
> +[Pcd]
> +  gArmVirtTokenSpaceGuid.PcdForceNoAcpi
> +
> +[Depex]
> +  gEfiVariableArchProtocolGuid
> diff --git a/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
> new file mode 100644
> index 000000000000..c2344e7b29fa
> --- /dev/null
> +++ b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
> @@ -0,0 +1,73 @@
[SAMI] File license header is missing.
> +#include <Library/BaseLib.h>
> +#include <Library/MemoryAllocationLib.h>
> +#include <IndustryStandard/Acpi63.h>
> +#include <Protocol/AcpiTable.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +#include <Library/UefiDriverEntryPoint.h>
> +#include <Library/DebugLib.h>
> +
> +#define ACPI_ENTRY_SIZE 8
> +#define XSDT_LEN 36
> +
> +STATIC
> +EFI_ACPI_TABLE_PROTOCOL *
> +FindAcpiTableProtocol (
> +  VOID
> +  )
[SAMI] Please add doxygen header for function. Same comment for other 
functions introduced in this series.
> +{
> +  EFI_STATUS              Status;
> +  EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
> +
> +  Status = gBS->LocateProtocol (
> +                  &gEfiAcpiTableProtocolGuid,
> +                  NULL,
> +                  (VOID**)&AcpiTable
> +                  );
> +  ASSERT_EFI_ERROR (Status);
> +  return AcpiTable;
> +}
> +
> +EFI_STATUS
> +EFIAPI
> +InstallCloudHvAcpiTables (
> + IN     EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
> + )
> +{
> +  UINTN InstalledKey, TableSize;
> +  UINT64 Rsdp, Xsdt, table_offset, PointerValue;
[SAMI] Please have a look at variable naming conventions in EDKII coding 
standard at 
https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/4_naming_conventions 

> +  EFI_STATUS Status = 0;
[SAMI] Status = EFI_SUCCESS.
> +  int size;
[SAMI] UINTN should be used instead of 'int'. Also variable name does 
not confirm to coding standard.
> +
> +  Rsdp = PcdGet64 (PcdAcpiRsdpBaseAddress);
> +  Xsdt = ((EFI_ACPI_6_3_ROOT_SYSTEM_DESCRIPTION_POINTER *)Rsdp)->XsdtAddress;
> +  PointerValue = Xsdt;
> +  table_offset = Xsdt;
> +  size = ((EFI_ACPI_COMMON_HEADER *)PointerValue)->Length - XSDT_LEN;
> +  table_offset += XSDT_LEN;
[SAMI] I think the macro name XSDT_LEN is a bit misleading. 'sizeof 
(EFI_ACPI_DESCRIPTION_HEADER)' should be used instead of XSDT_LEN.
> +
> +  while(!Status && size > 0) {
[SAMI] Status is not boolean, use'EFI_ERROR (Status)' instead. Also use 
paranthesis to add clarity.
> +    PointerValue = *(UINT64 *)table_offset;
> +    TableSize = ((EFI_ACPI_COMMON_HEADER *)PointerValue)->Length;
> +    Status = AcpiProtocol->InstallAcpiTable (AcpiProtocol,
> +             (VOID *)(UINT64)PointerValue, TableSize,
> +             &InstalledKey);
[SAMI] See coding convention for spacing rules at 
https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/5_source_files/52_spacing
> +    table_offset += ACPI_ENTRY_SIZE;
> +    size -= ACPI_ENTRY_SIZE;
> +  }
[SAMI] Can you look at simplifying the code in this function, please? 
You could refer to 
https://github.com/tianocore/edk2/blob/master/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c#L131..L139

> +
> +  return Status;
> +}
> +
> +EFI_STATUS
> +EFIAPI
> +CloudHvAcpiPlatformEntryPoint (
> +  IN EFI_HANDLE         ImageHandle,
> +  IN EFI_SYSTEM_TABLE   *SystemTable
> +  )
> +{
> +  EFI_STATUS                         Status;
> +
> +  Status = InstallCloudHvAcpiTables (FindAcpiTableProtocol ());
> +  return Status;
> +}
> +
> diff --git a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
> new file mode 100644
> index 000000000000..ae07c91f5705
> --- /dev/null
> +++ b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
> @@ -0,0 +1,69 @@
> +/** @file
> +  Decide whether the firmware should expose an ACPI- and/or a Device Tree-based
> +  hardware description to the operating system.
> +
> +  Copyright (c) 2017, Red Hat, Inc.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include <Guid/PlatformHasAcpi.h>
> +#include <Guid/PlatformHasDeviceTree.h>
> +#include <Library/BaseLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/PcdLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +
> +EFI_STATUS
> +EFIAPI
> +PlatformHasAcpiDt (
> +  IN EFI_HANDLE       ImageHandle,
> +  IN EFI_SYSTEM_TABLE *SystemTable
> +  )
> +{
> +  EFI_STATUS           Status;
> +
> +  //
> +  // If we fail to install any of the necessary protocols below, the OS will be
> +  // unbootable anyway (due to lacking hardware description), so tolerate no
> +  // errors here.
> +  //
> +  if (MAX_UINTN == MAX_UINT64 &&
> +      !PcdGetBool (PcdForceNoAcpi))
> +  {
> +    Status = gBS->InstallProtocolInterface (
> +                    &ImageHandle,
> +                    &gEdkiiPlatformHasAcpiGuid,
> +                    EFI_NATIVE_INTERFACE,
> +                    NULL
> +                    );
> +    if (EFI_ERROR (Status)) {
> +      goto Failed;
> +    }
> +
> +    return Status;
> +  }
> +
> +  //
> +  // Expose the Device Tree otherwise.
> +  //
> +  Status = gBS->InstallProtocolInterface (
> +                  &ImageHandle,
> +                  &gEdkiiPlatformHasDeviceTreeGuid,
> +                  EFI_NATIVE_INTERFACE,
> +                  NULL
> +                  );
> +  if (EFI_ERROR (Status)) {
> +    goto Failed;
> +  }
> +
> +  return Status;
> +
> +Failed:
> +  ASSERT_EFI_ERROR (Status);
> +  CpuDeadLoop ();
> +  //
> +  // Keep compilers happy.
> +  //
> +  return Status;
> +}


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

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

* Re: [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family
  2021-05-17  6:50 ` [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family Jianyong Wu
@ 2021-05-18 20:26   ` Sami Mujawar
  2021-05-27  6:19     ` Jianyong Wu
  2021-05-19  6:36   ` [edk2-devel] " Laszlo Ersek
  1 sibling, 1 reply; 30+ messages in thread
From: Sami Mujawar @ 2021-05-18 20:26 UTC (permalink / raw)
  To: Jianyong Wu, devel, lersek, ardb+tianocore
  Cc: hao.a.wu, justin.he, Leif Lindholm, nd

Hi Jianyon,

Thank you for this patch.

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar


On 17/05/2021 07:50 AM, Jianyong Wu wrote:
> Cloud Hypervisor is kvm based VMM and is implemented in rust. Just like
> other VMMs it need UEFI support to let ACPI work. That's why
> Cloud Hypervisor is introduced here.
>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc:
> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> ---
>   ArmVirtPkg/ArmVirtCloudHv.dsc           | 455 ++++++++++++++++++++++++
>   ArmVirtPkg/ArmVirtCloudHv.fdf           | 292 +++++++++++++++
>   ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc | 169 +++++++++
>   3 files changed, 916 insertions(+)
>   create mode 100644 ArmVirtPkg/ArmVirtCloudHv.dsc
>   create mode 100644 ArmVirtPkg/ArmVirtCloudHv.fdf
>   create mode 100644 ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
>
> diff --git a/ArmVirtPkg/ArmVirtCloudHv.dsc b/ArmVirtPkg/ArmVirtCloudHv.dsc
> new file mode 100644
> index 000000000000..bf1f8c5a75ae
> --- /dev/null
> +++ b/ArmVirtPkg/ArmVirtCloudHv.dsc
> @@ -0,0 +1,455 @@
> +#
> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> +#  Copyright (c) 2014, Linaro Limited. All rights reserved.
> +#  Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +#
> +
> +################################################################################
> +#
> +# Defines Section - statements that will be processed to create a Makefile.
> +#
> +################################################################################
> +[Defines]
> +  PLATFORM_NAME                  = ArmVirtCloudHv
> +  PLATFORM_GUID                  = DFFED32B-DFFE-D32B-DFFE-D32BDFFED32B
> +  PLATFORM_VERSION               = 0.1
> +  DSC_SPECIFICATION              = 0x00010005
> +  OUTPUT_DIRECTORY               = Build/ArmVirtCloudHv-$(ARCH)
> +  SUPPORTED_ARCHITECTURES        = AARCH64|ARM
> +  BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
> +  SKUID_IDENTIFIER               = DEFAULT
> +  FLASH_DEFINITION               = ArmVirtPkg/ArmVirtCloudHv.fdf
> +
> +  #
> +  # Defines for default states.  These can be changed on the command line.
> +  # -D FLAG=VALUE
> +  #
> +  DEFINE TTY_TERMINAL            = FALSE
> +  DEFINE SECURE_BOOT_ENABLE      = FALSE
> +  DEFINE TPM2_ENABLE             = FALSE
> +  DEFINE TPM2_CONFIG_ENABLE      = FALSE
> +
> +!include ArmVirtPkg/ArmVirt.dsc.inc
> +
> +[LibraryClasses.common]
> +  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
> +  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
> +
> +  # Virtio Support
> +  VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
> +  VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
> +  QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
> +  QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
> +  QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
> +  QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
[SAMI] Does Cloud Hypervisor support Qemu-FwCfg? If not, then are the 
above 4 libraries needed?
> +
> +  ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
> +
> +  TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
> +  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
> +  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
> +  PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
[SAMI] The above instance of PlatformBootManagerLibhas a dependency on 
Qemu-FwCfg, right?
> +  PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf
> +  CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
> +  FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
> +  QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
[SAMI] Qemu-FwCfg dependency?
> +  FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
> +  PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
> +  PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
> +  PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
> +  PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> +
> +!if $(TPM2_ENABLE) == TRUE
> +  Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
> +  Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
[SAMI] Is this supported by Cloud Hypervisor?
> +  TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
> +!else
> +  TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
> +!endif
> +
> +!include MdePkg/MdeLibs.dsc.inc
> +
> +[LibraryClasses.common.PEIM]
> +  ArmVirtMemInfoLib|ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
> +
> +!if $(TPM2_ENABLE) == TRUE
> +  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> +  ResetSystemLib|MdeModulePkg/Library/PeiResetSystemLib/PeiResetSystemLib.inf
> +  Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.inf
> +!endif
> +
> +[LibraryClasses.common.DXE_DRIVER]
> +  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
> +
> +!if $(TPM2_ENABLE) == TRUE
> +  Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf
> +!endif
> +
> +[LibraryClasses.common.UEFI_DRIVER]
> +  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
> +
> +[BuildOptions]
> +!include NetworkPkg/NetworkBuildOptions.dsc.inc
> +
> +################################################################################
> +#
> +# Pcd Section - list of all EDK II PCD Entries defined by this Platform
> +#
> +################################################################################
> +
> +[PcdsFeatureFlag.common]
> +  gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation|TRUE
> +  gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation|TRUE
> +
> +  ## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
> +  #  It could be set FALSE to save size.
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
> +
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
> +
> +  gArmVirtTokenSpaceGuid.PcdTpm2SupportEnabled|$(TPM2_ENABLE)
> +
> +[PcdsFixedAtBuild.common]
> +!if $(ARCH) == AARCH64
> +  gArmTokenSpaceGuid.PcdVFPEnabled|1
> +!endif
> +
> +  gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4007c000
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
> +  gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> +
> +  # Rsdp base address in Cloud Hypervisor
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress|0x40200000
> +
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x4000000
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x40000
> +!if $(NETWORK_TLS_ENABLE) == TRUE
> +  #
> +  # The cumulative and individual VOLATILE variable size limits should be set
> +  # high enough for accommodating several and/or large CA certificates.
> +  #
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x80000
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize|0x40000
> +!endif
> +
> +  # Size of the region used by UEFI in permanent memory (Reserved 64MB)
> +  gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000
> +
> +  #
> +  # ARM PrimeCell
> +  #
> +
> +  ## PL011 - Serial Terminal
> +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|38400
> +
> +  ## Default Terminal Type
> +  ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
> +!if $(TTY_TERMINAL) == TRUE
> +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
> +  # Set terminal type to TtyTerm, the value encoded is EFI_TTY_TERM_GUID
> +  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d, 0x91, 0x7d, 0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94}
> +!else
> +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|1
> +!endif
> +
> +  # System Memory Base -- fixed at 0x4000_0000
> +  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x40000000
> +
> +  # initial location of the device tree blob passed by Cloud Hypervisor -- base of DRAM
> +  gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x40000000
> +
> +
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
> +
> +  #
> +  # The maximum physical I/O addressability of the processor, set with
> +  # BuildCpuHob().
> +  #
> +  gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16
> +
> +  #
> +  # Enable the non-executable DXE stack. (This gets set up by DxeIpl)
> +  #
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE
> +
> +!if $(SECURE_BOOT_ENABLE) == TRUE
> +  # override the default values from SecurityPkg to ensure images from all sources are verified in secure boot
> +  gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
> +  gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04
> +  gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
> +!endif
> +
> +  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|3
> +  gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x20000
> +
> +[PcdsFixedAtBuild.AARCH64]
> +  # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS entry point,
> +  # if the entry point version is >= 3.0. AARCH64 OSes cannot assume the
> +  # presence of the 32-bit entry point anyway (because many AARCH64 systems
> +  # don't have 32-bit addressable physical RAM), and the additional allocations
> +  # below 4 GB needlessly fragment the memory map. So expose the 64-bit entry
> +  # point only, for entry point versions >= 3.0.
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosEntryPointProvideMethod|0x2
> +
> +[PcdsDynamicDefault.common]
> +  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
> +
> +  ## If TRUE, OvmfPkg/AcpiPlatformDxe will not wait for PCI
> +  #  enumeration to complete before installing ACPI tables.
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
> +
> +  # System Memory Size -- 1 MB initially, actual size will be fetched from DT
> +  gArmTokenSpaceGuid.PcdSystemMemorySize|0x00100000
> +
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
> +
> +  gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0
> +  gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
> +  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
> +  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
> +
> +  #
> +  # ARM General Interrupt Controller
> +  #
> +  gArmTokenSpaceGuid.PcdGicDistributorBase|0x0
> +  gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x0
> +  gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x0
> +
> +  ## PL031 RealTimeClock
> +  gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
> +
> +  # set PcdPciExpressBaseAddress to MAX_UINT64, which signifies that this
> +  # PCD and PcdPciDisableBusEnumeration above have not been assigned yet
> +  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFFFF
> +
> +  gArmTokenSpaceGuid.PcdPciIoTranslation|0
> +#  gArmTokenSpaceGuid.PcdPciIoTranslation|0x50000000
[SAMI] Remove commented code.
> +
> +  #
> +  # TPM2 support
> +  #
> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0
> +!if $(TPM2_ENABLE) == TRUE
> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0
> +!endif
> +
> +[PcdsDynamicHii]
> +  gArmVirtTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gArmVirtVariableGuid|0x0|FALSE|NV,BS
> +
> +!if $(TPM2_CONFIG_ENABLE) == TRUE
> +  gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS
> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x8|3|NV,BS
> +!endif
> +
> +################################################################################
> +#
> +# Components Section - list of all EDK II Modules needed by this Platform
> +#
> +################################################################################
> +[Components.common]
> +  #
> +  # PEI Phase modules
> +  #
> +  ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
> +  MdeModulePkg/Core/Pei/PeiMain.inf
> +  MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
> +    <LibraryClasses>
> +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> +  }
> +  ArmPlatformPkg/PlatformPei/PlatformPeim.inf
> +  ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
> +  ArmPkg/Drivers/CpuPei/CpuPei.inf
> +
> +  MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
> +
> +!if $(TPM2_ENABLE) == TRUE
> +  MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf {
> +    <LibraryClasses>
> +      ResetSystemLib|ArmVirtPkg/Library/ArmVirtPsciResetSystemPeiLib/ArmVirtPsciResetSystemPeiLib.inf
> +  }
> +  OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> +  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf {
> +    <LibraryClasses>
> +      HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
> +  }
> +!endif
> +
> +  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
> +    <LibraryClasses>
> +      NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
> +  }
> +
> +  #
> +  # DXE
> +  #
> +  MdeModulePkg/Core/Dxe/DxeMain.inf {
> +    <LibraryClasses>
> +      NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
> +      DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> +  }
> +  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
> +    <LibraryClasses>
> +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> +  }
> +
> +  #
> +  # Architectural Protocols
> +  #
> +  ArmPkg/Drivers/CpuDxe/CpuDxe.inf
> +  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> +  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
> +    <LibraryClasses>
> +      NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
> +      # don't use unaligned CopyMem () on the UEFI varstore NOR flash region
> +      BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
> +  }
> +!if $(SECURE_BOOT_ENABLE) == TRUE
> +  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
> +    <LibraryClasses>
> +      NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
> +!if $(TPM2_ENABLE) == TRUE
> +      NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf
> +!endif
> +  }
> +  SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
> +  OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf
> +!else
> +  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> +!endif
> +  MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> +  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
> +  MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
> +  MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
> +  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf {
> +    <LibraryClasses>
> +      NULL|ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClientLib.inf
> +  }
> +  EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> +
> +  MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> +  MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> +  MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
> +  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> +  MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> +
> +  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> +
> +  ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> +  ArmPkg/Drivers/TimerDxe/TimerDxe.inf {
> +    <LibraryClasses>
> +      NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
> +  }
> +  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> +
> +  #
> +  # Status Code Routing
> +  #
> +  MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
> +
> +  #
> +  # Platform Driver
> +  #
> +  ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> +  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> +  ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> +  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> +  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> +  OvmfPkg/VirtioNetDxe/VirtioNet.inf
> +  OvmfPkg/VirtioRngDxe/VirtioRng.inf
> +
> +  #
> +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
> +  #
> +  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> +  MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> +  MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  FatPkg/EnhancedFatDxe/Fat.inf
> +  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> +  OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> +
> +  #
> +  # Bds
> +  #
> +  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
> +    <LibraryClasses>
> +      DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> +  }
> +  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> +  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> +  MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
> +  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> +  MdeModulePkg/Logo/LogoDxe.inf
> +  MdeModulePkg/Application/UiApp/UiApp.inf {
> +    <LibraryClasses>
> +      NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
> +      NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
> +      NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
> +  }
> +  OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
[SAMI] Qemu-FwCfg dependency?
> +
> +  #
> +  # SCSI Bus and Disk Driver
> +  #
> +  MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> +  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> +
> +  #
> +  # PCI support
> +  #
> +  ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
> +    <LibraryClasses>
> +      NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
> +  }
> +  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> +  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
> +    <LibraryClasses>
> +      NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
> +  }
> +  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> +  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> +  OvmfPkg/Virtio10Dxe/Virtio10.inf
> +
> +  #
> +  # TPM2 support
> +  #
> +!if $(TPM2_ENABLE) == TRUE
> +  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf {
> +    <LibraryClasses>
> +      HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
> +      Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf
> +      NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
> +  }
> +!if $(TPM2_CONFIG_ENABLE) == TRUE
> +  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> +!endif
> +!endif
> +
> +  #
> +  # ACPI Support
> +  #
> +  ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> +[Components.AARCH64]
> +  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
> +  ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf {
> +    <LibraryClasses>
> +      NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
> +  }
> diff --git a/ArmVirtPkg/ArmVirtCloudHv.fdf b/ArmVirtPkg/ArmVirtCloudHv.fdf
> new file mode 100644
> index 000000000000..3619a09ba8c5
> --- /dev/null
> +++ b/ArmVirtPkg/ArmVirtCloudHv.fdf
> @@ -0,0 +1,292 @@
> +#
> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> +#  Copyright (c) 2014, Linaro Limited. All rights reserved.
> +#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +
> +################################################################################
> +#
> +# FD Section
> +# The [FD] Section is made up of the definition statements and a
> +# description of what goes into  the Flash Device Image.  Each FD section
> +# defines one flash "device" image.  A flash device image may be one of
> +# the following: Removable media bootable image (like a boot floppy
> +# image,) an Option ROM image (that would be "flashed" into an add-in
> +# card,) a System "Flash"  image (that would be burned into a system's
> +# flash) or an Update ("Capsule") image that will be used to update and
> +# existing system flash.
> +#
> +################################################################################
> +
> +[Defines]
> +!if $(FD_SIZE_IN_MB) == 2
> +  DEFINE FVMAIN_COMPACT_SIZE  = 0x1ff000
> +!endif
> +!if $(FD_SIZE_IN_MB) == 3
> +  DEFINE FVMAIN_COMPACT_SIZE  = 0x2ff000
> +!endif
> +
> +[FD.CLOUDHV_EFI]
> +BaseAddress   = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress  # cloud-hypervisor assigns 0 - 0x8000000 for a BootROM
> +Size          = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize         # The size in bytes of the FLASH Device
> +ErasePolarity = 1
> +
> +# This one is tricky, it must be: BlockSize * NumBlocks = Size
> +BlockSize     = 0x00001000
> +NumBlocks     = $(FD_NUM_BLOCKS)
> +
> +################################################################################
> +#
> +# Following are lists of FD Region layout which correspond to the locations of different
> +# images within the flash device.
> +#
> +# Regions must be defined in ascending order and may not overlap.
> +#
> +# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
> +# the pipe "|" character, followed by the size of the region, also in hex with the leading
> +# "0x" characters. Like:
> +# Offset|Size
> +# PcdOffsetCName|PcdSizeCName
> +# RegionType <FV, DATA, or FILE>
> +#
> +################################################################################
> +
> +#
> +# UEFI has trouble dealing with FVs that reside at physical address 0x0.
> +# So instead, put a hardcoded 'jump to 0x1000' at offset 0x0, and put the
> +# real FV at offset 0x1000
> +#
> +0x00000000|0x00001000
> +DATA = {
> +!if $(ARCH) == AARCH64
> +  0x00, 0x04, 0x00, 0x14   # 'b 0x1000' in AArch64 ASM
> +!else
> +  0xfe, 0x03, 0x00, 0xea   # 'b 0x1000' in AArch32 ASM
> +!endif
> +}
> +
> +0x00001000|$(FVMAIN_COMPACT_SIZE)
> +gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> +FV = FVMAIN_COMPACT
> +
> +!include VarStore.fdf.inc
> +
> +################################################################################
> +#
> +# FV Section
> +#
> +# [FV] section is used to define what components or modules are placed within a flash
> +# device file.  This section also defines order the components and modules are positioned
> +# within the image.  The [FV] section consists of define statements, set statements and
> +# module statements.
> +#
> +################################################################################
> +
> +#!include ArmVirtCloudHvFvMain.fdf.inc
> +
> +
> +
> +[FV.FvMain]
> +FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
> +BlockSize          = 0x40
> +NumBlocks          = 0         # This FV gets compressed so make it just big enough
> +FvAlignment        = 16        # FV alignment and FV attributes setting.
> +ERASE_POLARITY     = 1
> +MEMORY_MAPPED      = TRUE
> +STICKY_WRITE       = TRUE
> +LOCK_CAP           = TRUE
> +LOCK_STATUS        = TRUE
> +WRITE_DISABLED_CAP = TRUE
> +WRITE_ENABLED_CAP  = TRUE
> +WRITE_STATUS       = TRUE
> +WRITE_LOCK_CAP     = TRUE
> +WRITE_LOCK_STATUS  = TRUE
> +READ_DISABLED_CAP  = TRUE
> +READ_ENABLED_CAP   = TRUE
> +READ_STATUS        = TRUE
> +READ_LOCK_CAP      = TRUE
> +READ_LOCK_STATUS   = TRUE
> +
> +  INF MdeModulePkg/Core/Dxe/DxeMain.inf
> +  INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> +  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> +  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> +  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> +
> +  #
> +  # PI DXE Drivers producing Architectural Protocols (EFI Services)
> +  #
> +  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
> +  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> +  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> +  INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> +  INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
> +  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
> +!if $(SECURE_BOOT_ENABLE) == TRUE
> +  INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
> +!endif
> +  INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
> +  INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
> +  INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
> +  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> +  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> +
> +  #
> +  # Multiple Console IO support
> +  #
> +  INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> +  INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> +  INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
> +  INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> +  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> +
> +  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
> +  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> +
> +  #
> +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
> +  #
> +  INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> +  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> +  INF FatPkg/EnhancedFatDxe/Fat.inf
> +  INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> +  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> +
> +  #
> +  # Status Code Routing
> +  #
> +  INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
> +
> +  #
> +  # Platform Driver
> +  #
> +  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> +  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
> +  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> +  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
> +
> +  #
> +  # UEFI application (Shell Embedded Boot Loader)
> +  #
> +  INF ShellPkg/Application/Shell/Shell.inf
> +  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
> +  INF ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
> +  INF OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
> +
> +  #
> +  # Bds
> +  #
> +  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
> +  INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> +  INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> +  INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
> +  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> +  INF MdeModulePkg/Application/UiApp/UiApp.inf
> +  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
[SAMI] Qemu-FwCfg dependency? Also check at other places in the fdf and 
fdf.inc file.
> +
> +  #
> +  # SCSI Bus and Disk Driver
> +  #
> +  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> +  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> +
> +  #
> +  # ACPI Support
> +  #
> +  INF ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> +!if $(ARCH) == AARCH64
> +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> +  INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
> +  INF ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> +
> +  #
> +  # EBC support
> +  #
> +  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> +!endif
> +
> +  #
> +  # PCI support
> +  #
> +  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
> +  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> +  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
> +  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> +  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> +  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
> +
> +  #
> +  # TPM2 support
> +  #
> +!if $(TPM2_ENABLE) == TRUE
> +  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> +!if $(TPM2_CONFIG_ENABLE) == TRUE
> +  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> +!endif
> +!endif
> +
> +  #
> +  # TianoCore logo (splash screen)
> +  #
> +  INF MdeModulePkg/Logo/LogoDxe.inf
> +
> +  #
> +  # Ramdisk support
> +  #
> +  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
[SAMI] Remove empty lines.
> +[FV.FVMAIN_COMPACT]
> +FvAlignment        = 16
> +ERASE_POLARITY     = 1
> +MEMORY_MAPPED      = TRUE
> +STICKY_WRITE       = TRUE
> +LOCK_CAP           = TRUE
> +LOCK_STATUS        = TRUE
> +WRITE_DISABLED_CAP = TRUE
> +WRITE_ENABLED_CAP  = TRUE
> +WRITE_STATUS       = TRUE
> +WRITE_LOCK_CAP     = TRUE
> +WRITE_LOCK_STATUS  = TRUE
> +READ_DISABLED_CAP  = TRUE
> +READ_ENABLED_CAP   = TRUE
> +READ_STATUS        = TRUE
> +READ_LOCK_CAP      = TRUE
> +READ_LOCK_STATUS   = TRUE
> +
> +  INF ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
> +  INF MdeModulePkg/Core/Pei/PeiMain.inf
> +  INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
> +  INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
> +  INF ArmPkg/Drivers/CpuPei/CpuPei.inf
> +  INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
> +  INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
> +  INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
> +
> +!if $(TPM2_ENABLE) == TRUE
> +  INF MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf
> +  INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> +  INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
> +!endif
> +
> +  FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
> +    SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
> +      SECTION FV_IMAGE = FVMAIN
> +    }
> +  }
> +
> +!include ArmVirtRules.fdf.inc
> diff --git a/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> new file mode 100644
> index 000000000000..51041e889ef4
> --- /dev/null
> +++ b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> @@ -0,0 +1,169 @@
> +#
> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> +#  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
> +#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +
> +################################################################################
> +#
> +# FV Section
> +#
> +# [FV] section is used to define what components or modules are placed within a flash
> +# device file.  This section also defines order the components and modules are positioned
> +# within the image.  The [FV] section consists of define statements, set statements and
> +# module statements.
> +#
> +################################################################################
> +
> +[FV.FvMain]
> +FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
> +BlockSize          = 0x40
> +NumBlocks          = 0         # This FV gets compressed so make it just big enough
> +FvAlignment        = 16        # FV alignment and FV attributes setting.
> +ERASE_POLARITY     = 1
> +MEMORY_MAPPED      = TRUE
> +STICKY_WRITE       = TRUE
> +LOCK_CAP           = TRUE
> +LOCK_STATUS        = TRUE
> +WRITE_DISABLED_CAP = TRUE
> +WRITE_ENABLED_CAP  = TRUE
> +WRITE_STATUS       = TRUE
> +WRITE_LOCK_CAP     = TRUE
> +WRITE_LOCK_STATUS  = TRUE
> +READ_DISABLED_CAP  = TRUE
> +READ_ENABLED_CAP   = TRUE
> +READ_STATUS        = TRUE
> +READ_LOCK_CAP      = TRUE
> +READ_LOCK_STATUS   = TRUE
> +
> +  INF MdeModulePkg/Core/Dxe/DxeMain.inf
> +  INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> +  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> +  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> +  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> +
> +  #
> +  # PI DXE Drivers producing Architectural Protocols (EFI Services)
> +  #
> +  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
> +  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> +  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> +  INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> +  INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
> +  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
> +!if $(SECURE_BOOT_ENABLE) == TRUE
> +  INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
> +!endif
> +  INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
> +  INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
> +  INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
> +  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> +  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> +
> +  #
> +  # Multiple Console IO support
> +  #
> +  INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> +  INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> +  INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
> +  INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> +  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> +
> +  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
> +  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> +
> +  #
> +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
> +  #
> +  INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> +  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> +  INF FatPkg/EnhancedFatDxe/Fat.inf
> +  INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> +  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> +
> +  #
> +  # Status Code Routing
> +  #
> +  INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
> +
> +  #
> +  # Platform Driver
> +  #
> +  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> +  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
> +  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> +  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
> +
> +  #
> +  # UEFI application (Shell Embedded Boot Loader)
> +  #
> +  INF ShellPkg/Application/Shell/Shell.inf
> +  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
> +  INF ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
> +  INF OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
> +
> +  #
> +  # Bds
> +  #
> +  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
> +  INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> +  INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> +  INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
> +  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> +  INF MdeModulePkg/Application/UiApp/UiApp.inf
> +  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
> +
> +  #
> +  # SCSI Bus and Disk Driver
> +  #
> +  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> +  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> +
> +  #
> +  # ACPI Support
> +  #
> +  INF ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> +!if $(ARCH) == AARCH64
> +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> +  INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
> +  INF ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> +
> +  #
> +  # EBC support
> +  #
> +  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> +!endif
> +
> +  #
> +  # PCI support
> +  #
> +  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
> +  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> +  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
> +  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> +  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> +  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
> +
> +  #
> +  # TPM2 support
> +  #
> +!if $(TPM2_ENABLE) == TRUE
> +  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> +!if $(TPM2_CONFIG_ENABLE) == TRUE
> +  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> +!endif
> +!endif
> +
> +  #
> +  # TianoCore logo (splash screen)
> +  #
> +  INF MdeModulePkg/Logo/LogoDxe.inf
> +
> +  #
> +  # Ramdisk support
> +  #
> +  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf


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

* Re: [PATCH v2 5/5] Maintainers: update Maintainers file as new files/folders created
  2021-05-17  6:50 ` [PATCH v2 5/5] Maintainers: update Maintainers file as new files/folders created Jianyong Wu
@ 2021-05-18 20:26   ` Sami Mujawar
  2021-05-19  6:55     ` Laszlo Ersek
  2021-05-19  6:39   ` [edk2-devel] " Laszlo Ersek
  1 sibling, 1 reply; 30+ messages in thread
From: Sami Mujawar @ 2021-05-18 20:26 UTC (permalink / raw)
  To: Jianyong Wu, devel, lersek, ardb+tianocore; +Cc: hao.a.wu, justin.he, nd

Hi Jianyon,

Thank you for including this patch in the series. There is a patch on 
the mailing list to add me as a reviewer for ArmVirtPkg at package level.
Therefore, this patch would no longer be needed. Apologies for not 
communicating this to you earlier.

Regards,

Sami Mujawar


On 17/05/2021 07:50 AM, Jianyong Wu wrote:
> Create new entry for Cloud Hypervisor and assign reviewer to Sami
> Mujawar.
>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> ---
>   Maintainers.txt | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/Maintainers.txt b/Maintainers.txt
> index cafe6b1ab85d..f8fae067c656 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -167,6 +167,13 @@ F: ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/
>   F: ArmVirtPkg/Library/NorFlashKvmtoolLib/
>   R: Sami Mujawar <sami.mujawar@arm.com>
>   
> +ArmVirtPkg: Cloud Hypervisor emulated platform support
> +F: ArmVirtPkg/ArmVirtCloudHv*
> +F: ArmVirtPkg/CloudHvAcpiPlatformDxe/
> +F: ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/
> +F: ArmVirtPkg/Library/CloudHvVirtMemInfoLib/
> +R: Sami Mujawar <sami.mujawar@arm.com>
> +
>   BaseTools
>   F: BaseTools/
>   W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools


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

* Re: [edk2-devel] [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor
  2021-05-17  6:50 ` [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor Jianyong Wu
  2021-05-18 20:20   ` Sami Mujawar
@ 2021-05-19  6:07   ` Laszlo Ersek
  2021-05-19  6:11     ` Laszlo Ersek
  1 sibling, 1 reply; 30+ messages in thread
From: Laszlo Ersek @ 2021-05-19  6:07 UTC (permalink / raw)
  To: devel, jianyong.wu, ardb+tianocore, sami.mujawar
  Cc: hao.a.wu, justin.he, Leif Lindholm

On 05/17/21 08:50, Jianyong Wu wrote:
> Cloud Hypervisor is kvm based VMM implemented in rust.
> 
> This library populates the system memory map for the
> Cloud Hypervisor virtual platform.
> 
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> ---
>  .../CloudHvVirtMemInfoPeiLib.inf              |  47 ++++++++
>  .../CloudHvVirtMemInfoLib.c                   |  94 ++++++++++++++++
>  .../CloudHvVirtMemInfoPeiLibConstructor.c     | 100 ++++++++++++++++++
>  3 files changed, 241 insertions(+)
>  create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
>  create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
>  create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c
> 
> diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
> new file mode 100644
> index 000000000000..71dbf9c06ccc
> --- /dev/null
> +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
> @@ -0,0 +1,47 @@
> +#/* @file
> +#
> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.

(1) New file, please refresh the end year in the (C) notice.

> +#  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +#*/
> +
> +[Defines]
> +  INF_VERSION                    = 0x0001001A
> +  BASE_NAME                      = ClhVirtMemInfoPeiLib
> +  FILE_GUID                      = 3E29D940-0591-EE6A-CAD4-223A9CF55E75
> +  MODULE_TYPE                    = BASE
> +  VERSION_STRING                 = 1.0
> +  LIBRARY_CLASS                  = ArmVirtMemInfoLib|PEIM
> +  CONSTRUCTOR                    = CloudHvVirtMemInfoPeiLibConstructor
> +
> +[Sources]
> +  CloudHvVirtMemInfoLib.c
> +  CloudHvVirtMemInfoPeiLibConstructor.c
> +
> +[Packages]
> +  ArmPkg/ArmPkg.dec
> +  ArmVirtPkg/ArmVirtPkg.dec
> +  EmbeddedPkg/EmbeddedPkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  MdePkg/MdePkg.dec
> +
> +[LibraryClasses]
> +  ArmLib
> +  BaseMemoryLib
> +  DebugLib
> +  FdtLib
> +  PcdLib
> +  MemoryAllocationLib
> +
> +[Pcd]
> +  gArmTokenSpaceGuid.PcdFdBaseAddress
> +  gArmTokenSpaceGuid.PcdFvBaseAddress
> +  gArmTokenSpaceGuid.PcdSystemMemoryBase
> +  gArmTokenSpaceGuid.PcdSystemMemorySize
> +
> +[FixedPcd]
> +  gArmTokenSpaceGuid.PcdFdSize
> +  gArmTokenSpaceGuid.PcdFvSize
> +  gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
> diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
> new file mode 100644
> index 000000000000..69f4e6ab6cc4
> --- /dev/null
> +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
> @@ -0,0 +1,94 @@
> +/** @file
> +
> +  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.

(2) New file, ARM (C) missing.

> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Base.h>
> +#include <Library/ArmLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/MemoryAllocationLib.h>
> +
> +// Number of Virtual Memory Map Descriptors
> +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS          5
> +
> +//
> +// mach-virt's core peripherals such as the UART, the GIC and the RTC are
> +// all mapped in the 'miscellaneous device I/O' region, which we just map
> +// in its entirety rather than device by device. Note that it does not
> +// cover any of the NOR flash banks or PCI resource windows.
> +//
> +#define MACH_VIRT_PERIPH_BASE       0x08000000
> +#define MACH_VIRT_PERIPH_SIZE       SIZE_128MB
> +
> +//
> +// in cloud-hypervisor, 0x0 ~ 0x8000000 is reserved as normal memory for UEFI
> +//
> +#define CLOUDHV_UEFI_MEM_BASE       0x0
> +#define CLOUDHV_UEFI_MEM_SIZE       0x08000000
> +
> +/**
> +  Return the Virtual Memory Map of your platform
> +
> +  This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU
> +  on your platform.
> +
> +  @param[out]   VirtualMemoryMap    Array of ARM_MEMORY_REGION_DESCRIPTOR
> +                                    describing a Physical-to-Virtual Memory
> +                                    mapping. This array must be ended by a
> +                                    zero-filled entry. The allocated memory
> +                                    will not be freed.
> +
> +**/
> +VOID
> +ArmVirtGetMemoryMap (
> +  OUT ARM_MEMORY_REGION_DESCRIPTOR   **VirtualMemoryMap
> +  )
> +{
> +  ARM_MEMORY_REGION_DESCRIPTOR  *VirtualMemoryTable;
> +
> +  ASSERT (VirtualMemoryMap != NULL);
> +
> +  VirtualMemoryTable = AllocatePool (sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *
> +                                     MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
> +
> +  if (VirtualMemoryTable == NULL) {
> +    DEBUG ((DEBUG_ERROR, "%a: Error: Failed AllocatePool()\n", __FUNCTION__));
> +    return;
> +  }
> +
> +  // System DRAM
> +  VirtualMemoryTable[0].PhysicalBase = PcdGet64 (PcdSystemMemoryBase);
> +  VirtualMemoryTable[0].VirtualBase  = VirtualMemoryTable[0].PhysicalBase;
> +  VirtualMemoryTable[0].Length       = PcdGet64 (PcdSystemMemorySize);
> +  VirtualMemoryTable[0].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> +
> +  DEBUG ((DEBUG_INFO, "%a: Dumping System DRAM Memory Map:\n"
> +      "\tPhysicalBase: 0x%lX\n"
> +      "\tVirtualBase: 0x%lX\n"
> +      "\tLength: 0x%lX\n",
> +      __FUNCTION__,
> +      VirtualMemoryTable[0].PhysicalBase,
> +      VirtualMemoryTable[0].VirtualBase,
> +      VirtualMemoryTable[0].Length));
> +
> +  // Memory mapped peripherals (UART, RTC, GIC, virtio-mmio, etc)
> +  VirtualMemoryTable[1].PhysicalBase = MACH_VIRT_PERIPH_BASE;
> +  VirtualMemoryTable[1].VirtualBase  = MACH_VIRT_PERIPH_BASE;
> +  VirtualMemoryTable[1].Length       = MACH_VIRT_PERIPH_SIZE;
> +  VirtualMemoryTable[1].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> +
> +  // Map the FV region as normal executable memory
> +  VirtualMemoryTable[2].PhysicalBase = PcdGet64 (PcdFvBaseAddress);
> +  VirtualMemoryTable[2].VirtualBase  = VirtualMemoryTable[2].PhysicalBase;
> +  VirtualMemoryTable[2].Length       = FixedPcdGet32 (PcdFvSize);
> +  VirtualMemoryTable[2].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> +
> +  // End of Table
> +  ZeroMem (&VirtualMemoryTable[3], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));
> +
> +  *VirtualMemoryMap = VirtualMemoryTable;
> +}
> diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c
> new file mode 100644
> index 000000000000..062dfcee1d66
> --- /dev/null
> +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c
> @@ -0,0 +1,100 @@
> +/** @file
> +
> +  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.

(3) New file, ARM (C) missing.

With those updates:

Acked-by: Laszlo Ersek <lersek@redhat.com>

(BTW I'd like at least one of Ard, Leif, and Sami to give an R-b for
this patch set.)

Thanks,
Laszlo

> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Base.h>
> +#include <Library/DebugLib.h>
> +#include <Library/PcdLib.h>
> +#include <libfdt.h>
> +
> +RETURN_STATUS
> +EFIAPI
> +CloudHvVirtMemInfoPeiLibConstructor (
> +  VOID
> +  )
> +{
> +  VOID          *DeviceTreeBase;
> +  INT32         Node, Prev;
> +  UINT64        NewBase, CurBase;
> +  UINT64        NewSize, CurSize;
> +  CONST CHAR8   *Type;
> +  INT32         Len;
> +  CONST UINT64  *RegProp;
> +  RETURN_STATUS PcdStatus;
> +
> +  NewBase = 0;
> +  NewSize = 0;
> +
> +  DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
> +  ASSERT (DeviceTreeBase != NULL);
> +
> +  //
> +  // Make sure we have a valid device tree blob
> +  //
> +  ASSERT (fdt_check_header (DeviceTreeBase) == 0);
> +
> +  //
> +  // Look for the lowest memory node
> +  //
> +  for (Prev = 0;; Prev = Node) {
> +    Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
> +    if (Node < 0) {
> +      break;
> +    }
> +
> +    //
> +    // Check for memory node
> +    //
> +    Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len);
> +    if (Type && AsciiStrnCmp (Type, "memory", Len) == 0) {
> +      //
> +      // Get the 'reg' property of this node. For now, we will assume
> +      // two 8 byte quantities for base and size, respectively.
> +      //
> +      RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
> +      if (RegProp != 0 && Len == (2 * sizeof (UINT64))) {
> +
> +        CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
> +        CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));
> +
> +        DEBUG ((DEBUG_INFO, "%a: System RAM @ 0x%lx - 0x%lx\n",
> +          __FUNCTION__, CurBase, CurBase + CurSize - 1));
> +
> +        if (NewBase > CurBase || NewBase == 0) {
> +          NewBase = CurBase;
> +          NewSize = CurSize;
> +        }
> +      } else {
> +        DEBUG ((DEBUG_ERROR, "%a: Failed to parse FDT memory node\n",
> +          __FUNCTION__));
> +      }
> +    }
> +  }
> +
> +  //
> +  // Make sure the start of DRAM matches our expectation
> +  //
> +  ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) == NewBase);
> +  PcdStatus = PcdSet64S (PcdSystemMemorySize, NewSize);
> +  ASSERT_RETURN_ERROR (PcdStatus);
> +
> +  //
> +  // We need to make sure that the machine we are running on has at least
> +  // 128 MB of memory configured, and is currently executing this binary from
> +  // NOR flash. This prevents a device tree image in DRAM from getting
> +  // clobbered when our caller installs permanent PEI RAM, before we have a
> +  // chance of marking its location as reserved or copy it to a freshly
> +  // allocated block in the permanent PEI RAM in the platform PEIM.
> +  //
> +  ASSERT (NewSize >= SIZE_128MB);
> +  ASSERT (
> +    (((UINT64)PcdGet64 (PcdFdBaseAddress) +
> +      (UINT64)PcdGet32 (PcdFdSize)) <= NewBase) ||
> +    ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize)));
> +
> +  return RETURN_SUCCESS;
> +}
> 


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

* Re: [edk2-devel] [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor
  2021-05-19  6:07   ` [edk2-devel] " Laszlo Ersek
@ 2021-05-19  6:11     ` Laszlo Ersek
  2021-05-27  6:39       ` Jianyong Wu
  0 siblings, 1 reply; 30+ messages in thread
From: Laszlo Ersek @ 2021-05-19  6:11 UTC (permalink / raw)
  To: devel, jianyong.wu, ardb+tianocore, sami.mujawar
  Cc: hao.a.wu, justin.he, Leif Lindholm

Sorry, just noticed:

On 05/19/21 08:07, Laszlo Ersek wrote:
> On 05/17/21 08:50, Jianyong Wu wrote:
>> Cloud Hypervisor is kvm based VMM implemented in rust.
>>
>> This library populates the system memory map for the
>> Cloud Hypervisor virtual platform.
>>
>> Cc: Laszlo Ersek <lersek@redhat.com>
>> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
>> Cc: Leif Lindholm <leif@nuviainc.com>
>> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
>> ---
>>  .../CloudHvVirtMemInfoPeiLib.inf              |  47 ++++++++
>>  .../CloudHvVirtMemInfoLib.c                   |  94 ++++++++++++++++
>>  .../CloudHvVirtMemInfoPeiLibConstructor.c     | 100 ++++++++++++++++++
>>  3 files changed, 241 insertions(+)
>>  create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
>>  create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
>>  create mode 100644 ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c
>>
>> diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
>> new file mode 100644
>> index 000000000000..71dbf9c06ccc
>> --- /dev/null
>> +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
>> @@ -0,0 +1,47 @@
>> +#/* @file
>> +#
>> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> 
> (1) New file, please refresh the end year in the (C) notice.
> 
>> +#  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
>> +#
>> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
>> +#
>> +#*/
>> +
>> +[Defines]
>> +  INF_VERSION                    = 0x0001001A
>> +  BASE_NAME                      = ClhVirtMemInfoPeiLib

(4) s/Clh/CloudHv/

Thanks
Laszlo

>> +  FILE_GUID                      = 3E29D940-0591-EE6A-CAD4-223A9CF55E75
>> +  MODULE_TYPE                    = BASE
>> +  VERSION_STRING                 = 1.0
>> +  LIBRARY_CLASS                  = ArmVirtMemInfoLib|PEIM
>> +  CONSTRUCTOR                    = CloudHvVirtMemInfoPeiLibConstructor
>> +
>> +[Sources]
>> +  CloudHvVirtMemInfoLib.c
>> +  CloudHvVirtMemInfoPeiLibConstructor.c
>> +
>> +[Packages]
>> +  ArmPkg/ArmPkg.dec
>> +  ArmVirtPkg/ArmVirtPkg.dec
>> +  EmbeddedPkg/EmbeddedPkg.dec
>> +  MdeModulePkg/MdeModulePkg.dec
>> +  MdePkg/MdePkg.dec
>> +
>> +[LibraryClasses]
>> +  ArmLib
>> +  BaseMemoryLib
>> +  DebugLib
>> +  FdtLib
>> +  PcdLib
>> +  MemoryAllocationLib
>> +
>> +[Pcd]
>> +  gArmTokenSpaceGuid.PcdFdBaseAddress
>> +  gArmTokenSpaceGuid.PcdFvBaseAddress
>> +  gArmTokenSpaceGuid.PcdSystemMemoryBase
>> +  gArmTokenSpaceGuid.PcdSystemMemorySize
>> +
>> +[FixedPcd]
>> +  gArmTokenSpaceGuid.PcdFdSize
>> +  gArmTokenSpaceGuid.PcdFvSize
>> +  gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
>> diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
>> new file mode 100644
>> index 000000000000..69f4e6ab6cc4
>> --- /dev/null
>> +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
>> @@ -0,0 +1,94 @@
>> +/** @file
>> +
>> +  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> 
> (2) New file, ARM (C) missing.
> 
>> +
>> +  SPDX-License-Identifier: BSD-2-Clause-Patent
>> +
>> +**/
>> +
>> +#include <Base.h>
>> +#include <Library/ArmLib.h>
>> +#include <Library/BaseMemoryLib.h>
>> +#include <Library/DebugLib.h>
>> +#include <Library/MemoryAllocationLib.h>
>> +
>> +// Number of Virtual Memory Map Descriptors
>> +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS          5
>> +
>> +//
>> +// mach-virt's core peripherals such as the UART, the GIC and the RTC are
>> +// all mapped in the 'miscellaneous device I/O' region, which we just map
>> +// in its entirety rather than device by device. Note that it does not
>> +// cover any of the NOR flash banks or PCI resource windows.
>> +//
>> +#define MACH_VIRT_PERIPH_BASE       0x08000000
>> +#define MACH_VIRT_PERIPH_SIZE       SIZE_128MB
>> +
>> +//
>> +// in cloud-hypervisor, 0x0 ~ 0x8000000 is reserved as normal memory for UEFI
>> +//
>> +#define CLOUDHV_UEFI_MEM_BASE       0x0
>> +#define CLOUDHV_UEFI_MEM_SIZE       0x08000000
>> +
>> +/**
>> +  Return the Virtual Memory Map of your platform
>> +
>> +  This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU
>> +  on your platform.
>> +
>> +  @param[out]   VirtualMemoryMap    Array of ARM_MEMORY_REGION_DESCRIPTOR
>> +                                    describing a Physical-to-Virtual Memory
>> +                                    mapping. This array must be ended by a
>> +                                    zero-filled entry. The allocated memory
>> +                                    will not be freed.
>> +
>> +**/
>> +VOID
>> +ArmVirtGetMemoryMap (
>> +  OUT ARM_MEMORY_REGION_DESCRIPTOR   **VirtualMemoryMap
>> +  )
>> +{
>> +  ARM_MEMORY_REGION_DESCRIPTOR  *VirtualMemoryTable;
>> +
>> +  ASSERT (VirtualMemoryMap != NULL);
>> +
>> +  VirtualMemoryTable = AllocatePool (sizeof (ARM_MEMORY_REGION_DESCRIPTOR) *
>> +                                     MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
>> +
>> +  if (VirtualMemoryTable == NULL) {
>> +    DEBUG ((DEBUG_ERROR, "%a: Error: Failed AllocatePool()\n", __FUNCTION__));
>> +    return;
>> +  }
>> +
>> +  // System DRAM
>> +  VirtualMemoryTable[0].PhysicalBase = PcdGet64 (PcdSystemMemoryBase);
>> +  VirtualMemoryTable[0].VirtualBase  = VirtualMemoryTable[0].PhysicalBase;
>> +  VirtualMemoryTable[0].Length       = PcdGet64 (PcdSystemMemorySize);
>> +  VirtualMemoryTable[0].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
>> +
>> +  DEBUG ((DEBUG_INFO, "%a: Dumping System DRAM Memory Map:\n"
>> +      "\tPhysicalBase: 0x%lX\n"
>> +      "\tVirtualBase: 0x%lX\n"
>> +      "\tLength: 0x%lX\n",
>> +      __FUNCTION__,
>> +      VirtualMemoryTable[0].PhysicalBase,
>> +      VirtualMemoryTable[0].VirtualBase,
>> +      VirtualMemoryTable[0].Length));
>> +
>> +  // Memory mapped peripherals (UART, RTC, GIC, virtio-mmio, etc)
>> +  VirtualMemoryTable[1].PhysicalBase = MACH_VIRT_PERIPH_BASE;
>> +  VirtualMemoryTable[1].VirtualBase  = MACH_VIRT_PERIPH_BASE;
>> +  VirtualMemoryTable[1].Length       = MACH_VIRT_PERIPH_SIZE;
>> +  VirtualMemoryTable[1].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
>> +
>> +  // Map the FV region as normal executable memory
>> +  VirtualMemoryTable[2].PhysicalBase = PcdGet64 (PcdFvBaseAddress);
>> +  VirtualMemoryTable[2].VirtualBase  = VirtualMemoryTable[2].PhysicalBase;
>> +  VirtualMemoryTable[2].Length       = FixedPcdGet32 (PcdFvSize);
>> +  VirtualMemoryTable[2].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
>> +
>> +  // End of Table
>> +  ZeroMem (&VirtualMemoryTable[3], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));
>> +
>> +  *VirtualMemoryMap = VirtualMemoryTable;
>> +}
>> diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c
>> new file mode 100644
>> index 000000000000..062dfcee1d66
>> --- /dev/null
>> +++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibConstructor.c
>> @@ -0,0 +1,100 @@
>> +/** @file
>> +
>> +  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> 
> (3) New file, ARM (C) missing.
> 
> With those updates:
> 
> Acked-by: Laszlo Ersek <lersek@redhat.com>
> 
> (BTW I'd like at least one of Ard, Leif, and Sami to give an R-b for
> this patch set.)
> 
> Thanks,
> Laszlo
> 
>> +
>> +  SPDX-License-Identifier: BSD-2-Clause-Patent
>> +
>> +**/
>> +
>> +#include <Base.h>
>> +#include <Library/DebugLib.h>
>> +#include <Library/PcdLib.h>
>> +#include <libfdt.h>
>> +
>> +RETURN_STATUS
>> +EFIAPI
>> +CloudHvVirtMemInfoPeiLibConstructor (
>> +  VOID
>> +  )
>> +{
>> +  VOID          *DeviceTreeBase;
>> +  INT32         Node, Prev;
>> +  UINT64        NewBase, CurBase;
>> +  UINT64        NewSize, CurSize;
>> +  CONST CHAR8   *Type;
>> +  INT32         Len;
>> +  CONST UINT64  *RegProp;
>> +  RETURN_STATUS PcdStatus;
>> +
>> +  NewBase = 0;
>> +  NewSize = 0;
>> +
>> +  DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
>> +  ASSERT (DeviceTreeBase != NULL);
>> +
>> +  //
>> +  // Make sure we have a valid device tree blob
>> +  //
>> +  ASSERT (fdt_check_header (DeviceTreeBase) == 0);
>> +
>> +  //
>> +  // Look for the lowest memory node
>> +  //
>> +  for (Prev = 0;; Prev = Node) {
>> +    Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
>> +    if (Node < 0) {
>> +      break;
>> +    }
>> +
>> +    //
>> +    // Check for memory node
>> +    //
>> +    Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len);
>> +    if (Type && AsciiStrnCmp (Type, "memory", Len) == 0) {
>> +      //
>> +      // Get the 'reg' property of this node. For now, we will assume
>> +      // two 8 byte quantities for base and size, respectively.
>> +      //
>> +      RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
>> +      if (RegProp != 0 && Len == (2 * sizeof (UINT64))) {
>> +
>> +        CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
>> +        CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));
>> +
>> +        DEBUG ((DEBUG_INFO, "%a: System RAM @ 0x%lx - 0x%lx\n",
>> +          __FUNCTION__, CurBase, CurBase + CurSize - 1));
>> +
>> +        if (NewBase > CurBase || NewBase == 0) {
>> +          NewBase = CurBase;
>> +          NewSize = CurSize;
>> +        }
>> +      } else {
>> +        DEBUG ((DEBUG_ERROR, "%a: Failed to parse FDT memory node\n",
>> +          __FUNCTION__));
>> +      }
>> +    }
>> +  }
>> +
>> +  //
>> +  // Make sure the start of DRAM matches our expectation
>> +  //
>> +  ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) == NewBase);
>> +  PcdStatus = PcdSet64S (PcdSystemMemorySize, NewSize);
>> +  ASSERT_RETURN_ERROR (PcdStatus);
>> +
>> +  //
>> +  // We need to make sure that the machine we are running on has at least
>> +  // 128 MB of memory configured, and is currently executing this binary from
>> +  // NOR flash. This prevents a device tree image in DRAM from getting
>> +  // clobbered when our caller installs permanent PEI RAM, before we have a
>> +  // chance of marking its location as reserved or copy it to a freshly
>> +  // allocated block in the permanent PEI RAM in the platform PEIM.
>> +  //
>> +  ASSERT (NewSize >= SIZE_128MB);
>> +  ASSERT (
>> +    (((UINT64)PcdGet64 (PcdFdBaseAddress) +
>> +      (UINT64)PcdGet32 (PcdFdSize)) <= NewBase) ||
>> +    ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize)));
>> +
>> +  return RETURN_SUCCESS;
>> +}
>>
> 


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

* Re: [edk2-devel] [PATCH v2 2/5] MdeMoudlePkg: introduce new PCD for Acpi/rsdp
  2021-05-17  6:50 ` [PATCH v2 2/5] MdeMoudlePkg: introduce new PCD for Acpi/rsdp Jianyong Wu
  2021-05-18 20:25   ` Sami Mujawar
@ 2021-05-19  6:17   ` Laszlo Ersek
  2021-05-27  2:42     ` Jianyong Wu
  1 sibling, 1 reply; 30+ messages in thread
From: Laszlo Ersek @ 2021-05-19  6:17 UTC (permalink / raw)
  To: devel, jianyong.wu, ardb+tianocore, sami.mujawar
  Cc: hao.a.wu, justin.he, Jian J Wang

On 05/17/21 08:50, Jianyong Wu wrote:
> As there is lack of a machnism in Cloud Hypervisor to pass the base
> address of Rsdp in Acpi, so a PCD varialbe is introduced here to
> feed it.
> 
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> ---
>  MdeModulePkg/MdeModulePkg.dec | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
> index 148395511034..4c8baac35a9e 100644
> --- a/MdeModulePkg/MdeModulePkg.dec
> +++ b/MdeModulePkg/MdeModulePkg.dec
> @@ -910,6 +910,13 @@ [PcdsFixedAtBuild]
>    # @Expression 0x80000001 | (gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable == 0xFFFFFFFFFFFFFFFF || gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable <= 0x0FFFFFFFFFFFFFFF)
>    gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable|0|UINT64|0x30001015
>  
> +  ##
> +  # This is the physical address of rsdp which is the core struct of Acpi.
> +  # Some hypervisor may has no way to pass rsdp address to the guest, so a PCD
> +  # is worth for those.
> +  #
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress|0x0|UINT64|0x30001056
> +
>    ## Progress Code for OS Loader LoadImage start.<BR><BR>
>    #  PROGRESS_CODE_OS_LOADER_LOAD   = (EFI_SOFTWARE_DXE_BS_DRIVER | (EFI_OEM_SPECIFIC | 0x00000000)) = 0x03058000<BR>
>    # @Prompt Progress Code for OS Loader LoadImage start.
> 

This PCD is not useful enough to be placed in MdeModulePkg -- it is only
used in the next two patches, which are for ArmVirtPkg.

(1) Therefore, please add the PCD to the "ArmVirtPkg.dec" file.

(2) The PCD should arguably refer to "CloudHv" in the name.

(3) In my opinion, this patch (once reimplemented for ArmVirtPkg.dec)
should be squashed into the CloudHvAcpiPlatformDxe patch. The PCD is
being introduced *for* CloudHvAcpiPlatformDxe, and *only* for that
driver. In such cases, we usually keep the DEC modifications in the same
patch as the driver addition, assuming the PCD goes in the same package
as the driver.

(4) "some hypervisor" in the DEC comment is bogus. Please be as explicit
about the use case as possible.

Thanks
Laszlo


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

* Re: [edk2-devel] [PATCH v2 3/5] ArmVirtPkg: enable ACPI for cloud hypervisor
  2021-05-17  6:50 ` [PATCH v2 3/5] ArmVirtPkg: enable ACPI for cloud hypervisor Jianyong Wu
  2021-05-18 20:26   ` Sami Mujawar
@ 2021-05-19  6:25   ` Laszlo Ersek
  2021-05-27  3:18     ` Jianyong Wu
  1 sibling, 1 reply; 30+ messages in thread
From: Laszlo Ersek @ 2021-05-19  6:25 UTC (permalink / raw)
  To: devel, jianyong.wu, ardb+tianocore, sami.mujawar; +Cc: hao.a.wu, justin.he

On 05/17/21 08:50, Jianyong Wu wrote:
> The current implementation of PlatformHasAcpiDt is not a common
> library and is on behalf of qemu. So give a specific version for
> Cloud Hypervisor here.
> 
> There is no device like Fw-cfg in qemu in Cloud Hypervisor, so a specific
> Acpi handler is introduced here.
> 
> The handler implemented here is in a very simple way:
> firstly, aquire the Rsdp address from the PCD varaible in the top
> ".dsc";
> secondly, get the Xsdp address from Rsdp structure;
> thirdly, get the Acpi tables following the Xsdp structrue and install it

(1) Please consider running a spell checker on the commit message
("aquire" should be "acquire", "varaible" should be "variable",
"structrue" should be "structure"). Having this many typos in a short
commit message gives the patch a rushed vibe.

> one by one.
> 
> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> ---
>  .../CloudHvAcpiPlatformDxe.inf                | 51 +++++++++++++
>  .../CloudHvHasAcpiDtDxe.inf                   | 43 +++++++++++
>  .../CloudHvAcpiPlatformDxe/CloudHvAcpi.c      | 73 +++++++++++++++++++
>  .../CloudHvHasAcpiDtDxe.c                     | 69 ++++++++++++++++++
>  4 files changed, 236 insertions(+)
>  create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
>  create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
>  create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
>  create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c

(2) Unless there is a specific reason for adding both drivers in the
same patch, please split them to separate patches.

> 
> diff --git a/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> new file mode 100644
> index 000000000000..63c74e84eb27
> --- /dev/null
> +++ b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> @@ -0,0 +1,51 @@
> +## @file
> +#  OVMF ACPI Platform Driver for Cloud Hypervisor
> +#
> +#  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>

(3) Missing ARM (C).

> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010005
> +  BASE_NAME                      = ClhFwCfgAcpiPlatform

(4) This should be "CloudHvAcpiPlatformDxe", matching the basename of
the INF file.

> +  FILE_GUID                      = 6c76e407-73f2-dc1c-938f-5d6c4691ea93
> +  MODULE_TYPE                    = DXE_DRIVER
> +  VERSION_STRING                 = 1.0
> +  ENTRY_POINT                    = CloudHvAcpiPlatformEntryPoint
> +
> +#
> +# The following information is for reference only and not required by the build tools.
> +#
> +#  VALID_ARCHITECTURES           = IA32 X64 ARM AARCH64

(5) Do you really want this driver to be used on, say, IA32?

> +#
> +
> +[Sources]
> +  CloudHvAcpi.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  OvmfPkg/OvmfPkg.dec
> +
> +[LibraryClasses]
> +  BaseLib
> +  DebugLib
> +  MemoryAllocationLib
> +  OrderedCollectionLib
> +  UefiBootServicesTableLib
> +  UefiDriverEntryPoint
> +
> +[Protocols]
> +  gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
> +  gEfiPciIoProtocolGuid                         # PROTOCOL SOMETIMES_CONSUMED
> +
> +[Guids]
> +  gRootBridgesConnectedEventGroupGuid
> +
> +[Pcd]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress
> +
> +[Depex]
> +  gEfiAcpiTableProtocolGuid
> diff --git a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> new file mode 100644
> index 000000000000..f511a4f5064c
> --- /dev/null
> +++ b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> @@ -0,0 +1,43 @@
> +## @file
> +# Decide whether the firmware should expose an ACPI- and/or a Device Tree-based
> +# hardware description to the operating system.
> +#
> +# Copyright (c) 2017, Red Hat, Inc.

(6) ARM (C) missing.

> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +
> +[Defines]
> +  INF_VERSION                    = 1.25
> +  BASE_NAME                      = ClhPlatformHasAcpiDtDxe

(7) Should be "CloudHvHasAcpiDtDxe".

> +  FILE_GUID                      = 71fe72f9-6dc1-199d-5054-13b4200ee88d
> +  MODULE_TYPE                    = DXE_DRIVER
> +  VERSION_STRING                 = 1.0
> +  ENTRY_POINT                    = PlatformHasAcpiDt
> +
> +[Sources]
> +  CloudHvHasAcpiDtDxe.c
> +
> +[Packages]
> +  ArmVirtPkg/ArmVirtPkg.dec
> +  EmbeddedPkg/EmbeddedPkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  MdePkg/MdePkg.dec
> +  OvmfPkg/OvmfPkg.dec
> +
> +[LibraryClasses]
> +  BaseLib
> +  DebugLib
> +  PcdLib
> +  UefiBootServicesTableLib
> +  UefiDriverEntryPoint
> +
> +[Guids]
> +  gEdkiiPlatformHasAcpiGuid       ## SOMETIMES_PRODUCES ## PROTOCOL
> +  gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL
> +
> +[Pcd]
> +  gArmVirtTokenSpaceGuid.PcdForceNoAcpi
> +
> +[Depex]
> +  gEfiVariableArchProtocolGuid
> diff --git a/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
> new file mode 100644
> index 000000000000..c2344e7b29fa
> --- /dev/null
> +++ b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
> @@ -0,0 +1,73 @@
> +#include <Library/BaseLib.h>
> +#include <Library/MemoryAllocationLib.h>
> +#include <IndustryStandard/Acpi63.h>
> +#include <Protocol/AcpiTable.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +#include <Library/UefiDriverEntryPoint.h>
> +#include <Library/DebugLib.h>

(8) File-top comment block missing altogether, including the @file
Doxygen directive plus short explanation, ARM (C) notice,
"SPDX-License-Identifier".

> +
> +#define ACPI_ENTRY_SIZE 8
> +#define XSDT_LEN 36
> +
> +STATIC
> +EFI_ACPI_TABLE_PROTOCOL *
> +FindAcpiTableProtocol (
> +  VOID
> +  )
> +{
> +  EFI_STATUS              Status;
> +  EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
> +
> +  Status = gBS->LocateProtocol (
> +                  &gEfiAcpiTableProtocolGuid,
> +                  NULL,
> +                  (VOID**)&AcpiTable
> +                  );
> +  ASSERT_EFI_ERROR (Status);
> +  return AcpiTable;
> +}
> +
> +EFI_STATUS
> +EFIAPI
> +InstallCloudHvAcpiTables (
> + IN     EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
> + )
> +{
> +  UINTN InstalledKey, TableSize;
> +  UINT64 Rsdp, Xsdt, table_offset, PointerValue;
> +  EFI_STATUS Status = 0;
> +  int size;
> +
> +  Rsdp = PcdGet64 (PcdAcpiRsdpBaseAddress);
> +  Xsdt = ((EFI_ACPI_6_3_ROOT_SYSTEM_DESCRIPTION_POINTER *)Rsdp)->XsdtAddress;
> +  PointerValue = Xsdt;
> +  table_offset = Xsdt;
> +  size = ((EFI_ACPI_COMMON_HEADER *)PointerValue)->Length - XSDT_LEN;
> +  table_offset += XSDT_LEN;
> +
> +  while(!Status && size > 0) {
> +    PointerValue = *(UINT64 *)table_offset;
> +    TableSize = ((EFI_ACPI_COMMON_HEADER *)PointerValue)->Length;
> +    Status = AcpiProtocol->InstallAcpiTable (AcpiProtocol,
> +             (VOID *)(UINT64)PointerValue, TableSize,
> +             &InstalledKey);
> +    table_offset += ACPI_ENTRY_SIZE;
> +    size -= ACPI_ENTRY_SIZE;
> +  }
> +
> +  return Status;
> +}
> +
> +EFI_STATUS
> +EFIAPI
> +CloudHvAcpiPlatformEntryPoint (
> +  IN EFI_HANDLE         ImageHandle,
> +  IN EFI_SYSTEM_TABLE   *SystemTable
> +  )
> +{
> +  EFI_STATUS                         Status;
> +
> +  Status = InstallCloudHvAcpiTables (FindAcpiTableProtocol ());
> +  return Status;
> +}
> +
> diff --git a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
> new file mode 100644
> index 000000000000..ae07c91f5705
> --- /dev/null
> +++ b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
> @@ -0,0 +1,69 @@
> +/** @file
> +  Decide whether the firmware should expose an ACPI- and/or a Device Tree-based
> +  hardware description to the operating system.
> +
> +  Copyright (c) 2017, Red Hat, Inc.

(9) ARM (C) missing.

> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include <Guid/PlatformHasAcpi.h>
> +#include <Guid/PlatformHasDeviceTree.h>
> +#include <Library/BaseLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/PcdLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +
> +EFI_STATUS
> +EFIAPI
> +PlatformHasAcpiDt (
> +  IN EFI_HANDLE       ImageHandle,
> +  IN EFI_SYSTEM_TABLE *SystemTable
> +  )
> +{
> +  EFI_STATUS           Status;
> +
> +  //
> +  // If we fail to install any of the necessary protocols below, the OS will be
> +  // unbootable anyway (due to lacking hardware description), so tolerate no
> +  // errors here.
> +  //
> +  if (MAX_UINTN == MAX_UINT64 &&
> +      !PcdGetBool (PcdForceNoAcpi))
> +  {
> +    Status = gBS->InstallProtocolInterface (
> +                    &ImageHandle,
> +                    &gEdkiiPlatformHasAcpiGuid,
> +                    EFI_NATIVE_INTERFACE,
> +                    NULL
> +                    );
> +    if (EFI_ERROR (Status)) {
> +      goto Failed;
> +    }
> +
> +    return Status;
> +  }
> +
> +  //
> +  // Expose the Device Tree otherwise.
> +  //
> +  Status = gBS->InstallProtocolInterface (
> +                  &ImageHandle,
> +                  &gEdkiiPlatformHasDeviceTreeGuid,
> +                  EFI_NATIVE_INTERFACE,
> +                  NULL
> +                  );
> +  if (EFI_ERROR (Status)) {
> +    goto Failed;
> +  }
> +
> +  return Status;
> +
> +Failed:
> +  ASSERT_EFI_ERROR (Status);
> +  CpuDeadLoop ();
> +  //
> +  // Keep compilers happy.
> +  //
> +  return Status;
> +}
> 

I've only pointed out what I consider the bare minimum for my ACK; the
actual logic in the patch will still need an R-b from Ard and/or Leif
and/or Sami.

Thanks
Laszlo


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

* Re: [edk2-devel] [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family
  2021-05-17  6:50 ` [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family Jianyong Wu
  2021-05-18 20:26   ` Sami Mujawar
@ 2021-05-19  6:36   ` Laszlo Ersek
  2021-05-27  6:23     ` Jianyong Wu
  1 sibling, 1 reply; 30+ messages in thread
From: Laszlo Ersek @ 2021-05-19  6:36 UTC (permalink / raw)
  To: devel, jianyong.wu, ardb+tianocore, sami.mujawar
  Cc: hao.a.wu, justin.he, Leif Lindholm

On 05/17/21 08:50, Jianyong Wu wrote:
> Cloud Hypervisor is kvm based VMM and is implemented in rust. Just like
> other VMMs it need UEFI support to let ACPI work. That's why
> Cloud Hypervisor is introduced here.
> 
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: 

(1) Empty CC?

> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> ---
>  ArmVirtPkg/ArmVirtCloudHv.dsc           | 455 ++++++++++++++++++++++++
>  ArmVirtPkg/ArmVirtCloudHv.fdf           | 292 +++++++++++++++
>  ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc | 169 +++++++++
>  3 files changed, 916 insertions(+)
>  create mode 100644 ArmVirtPkg/ArmVirtCloudHv.dsc
>  create mode 100644 ArmVirtPkg/ArmVirtCloudHv.fdf
>  create mode 100644 ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> 
> diff --git a/ArmVirtPkg/ArmVirtCloudHv.dsc b/ArmVirtPkg/ArmVirtCloudHv.dsc
> new file mode 100644
> index 000000000000..bf1f8c5a75ae
> --- /dev/null
> +++ b/ArmVirtPkg/ArmVirtCloudHv.dsc
> @@ -0,0 +1,455 @@
> +#
> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.

(2) Please update the end year on the ARM (C).

> +#  Copyright (c) 2014, Linaro Limited. All rights reserved.
> +#  Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +#
> +
> +################################################################################
> +#
> +# Defines Section - statements that will be processed to create a Makefile.
> +#
> +################################################################################
> +[Defines]
> +  PLATFORM_NAME                  = ArmVirtCloudHv
> +  PLATFORM_GUID                  = DFFED32B-DFFE-D32B-DFFE-D32BDFFED32B
> +  PLATFORM_VERSION               = 0.1
> +  DSC_SPECIFICATION              = 0x00010005
> +  OUTPUT_DIRECTORY               = Build/ArmVirtCloudHv-$(ARCH)
> +  SUPPORTED_ARCHITECTURES        = AARCH64|ARM
> +  BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
> +  SKUID_IDENTIFIER               = DEFAULT
> +  FLASH_DEFINITION               = ArmVirtPkg/ArmVirtCloudHv.fdf
> +
> +  #
> +  # Defines for default states.  These can be changed on the command line.
> +  # -D FLAG=VALUE
> +  #
> +  DEFINE TTY_TERMINAL            = FALSE
> +  DEFINE SECURE_BOOT_ENABLE      = FALSE
> +  DEFINE TPM2_ENABLE             = FALSE
> +  DEFINE TPM2_CONFIG_ENABLE      = FALSE
> +
> +!include ArmVirtPkg/ArmVirt.dsc.inc
> +
> +[LibraryClasses.common]
> +  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
> +  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
> +
> +  # Virtio Support
> +  VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
> +  VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
> +  QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
> +  QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
> +  QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf
> +  QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf
> +
> +  ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.inf
> +
> +  TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
> +  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
> +  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
> +  PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> +  PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf
> +  CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
> +  FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
> +  QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
> +  FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
> +  PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
> +  PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
> +  PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
> +  PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> +
> +!if $(TPM2_ENABLE) == TRUE
> +  Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
> +  Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/DxeTcg2PhysicalPresenceLib.inf
> +  TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeTpmMeasurementLib.inf
> +!else
> +  TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
> +!endif
> +
> +!include MdePkg/MdeLibs.dsc.inc
> +
> +[LibraryClasses.common.PEIM]
> +  ArmVirtMemInfoLib|ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
> +
> +!if $(TPM2_ENABLE) == TRUE
> +  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> +  ResetSystemLib|MdeModulePkg/Library/PeiResetSystemLib/PeiResetSystemLib.inf
> +  Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibDTpm.inf
> +!endif
> +
> +[LibraryClasses.common.DXE_DRIVER]
> +  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
> +
> +!if $(TPM2_ENABLE) == TRUE
> +  Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf
> +!endif
> +
> +[LibraryClasses.common.UEFI_DRIVER]
> +  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
> +
> +[BuildOptions]
> +!include NetworkPkg/NetworkBuildOptions.dsc.inc
> +
> +################################################################################
> +#
> +# Pcd Section - list of all EDK II PCD Entries defined by this Platform
> +#
> +################################################################################
> +
> +[PcdsFeatureFlag.common]
> +  gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation|TRUE
> +  gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation|TRUE
> +
> +  ## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
> +  #  It could be set FALSE to save size.
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
> +
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
> +
> +  gArmVirtTokenSpaceGuid.PcdTpm2SupportEnabled|$(TPM2_ENABLE)
> +
> +[PcdsFixedAtBuild.common]
> +!if $(ARCH) == AARCH64
> +  gArmTokenSpaceGuid.PcdVFPEnabled|1
> +!endif
> +
> +  gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4007c000
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
> +  gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> +
> +  # Rsdp base address in Cloud Hypervisor
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress|0x40200000
> +
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x4000000
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x40000
> +!if $(NETWORK_TLS_ENABLE) == TRUE
> +  #
> +  # The cumulative and individual VOLATILE variable size limits should be set
> +  # high enough for accommodating several and/or large CA certificates.
> +  #
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x80000
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize|0x40000
> +!endif
> +
> +  # Size of the region used by UEFI in permanent memory (Reserved 64MB)
> +  gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000
> +
> +  #
> +  # ARM PrimeCell
> +  #
> +
> +  ## PL011 - Serial Terminal
> +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|38400
> +
> +  ## Default Terminal Type
> +  ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM
> +!if $(TTY_TERMINAL) == TRUE
> +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
> +  # Set terminal type to TtyTerm, the value encoded is EFI_TTY_TERM_GUID
> +  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d, 0x91, 0x7d, 0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51, 0xef, 0x94}
> +!else
> +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|1
> +!endif
> +
> +  # System Memory Base -- fixed at 0x4000_0000
> +  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x40000000
> +
> +  # initial location of the device tree blob passed by Cloud Hypervisor -- base of DRAM
> +  gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x40000000
> +
> +
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
> +
> +  #
> +  # The maximum physical I/O addressability of the processor, set with
> +  # BuildCpuHob().
> +  #
> +  gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16
> +
> +  #
> +  # Enable the non-executable DXE stack. (This gets set up by DxeIpl)
> +  #
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE
> +
> +!if $(SECURE_BOOT_ENABLE) == TRUE
> +  # override the default values from SecurityPkg to ensure images from all sources are verified in secure boot
> +  gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
> +  gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04
> +  gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
> +!endif
> +
> +  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|3
> +  gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x20000
> +
> +[PcdsFixedAtBuild.AARCH64]
> +  # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS entry point,
> +  # if the entry point version is >= 3.0. AARCH64 OSes cannot assume the
> +  # presence of the 32-bit entry point anyway (because many AARCH64 systems
> +  # don't have 32-bit addressable physical RAM), and the additional allocations
> +  # below 4 GB needlessly fragment the memory map. So expose the 64-bit entry
> +  # point only, for entry point versions >= 3.0.
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosEntryPointProvideMethod|0x2
> +
> +[PcdsDynamicDefault.common]
> +  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
> +
> +  ## If TRUE, OvmfPkg/AcpiPlatformDxe will not wait for PCI
> +  #  enumeration to complete before installing ACPI tables.
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
> +
> +  # System Memory Size -- 1 MB initially, actual size will be fetched from DT
> +  gArmTokenSpaceGuid.PcdSystemMemorySize|0x00100000
> +
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
> +
> +  gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0
> +  gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
> +  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
> +  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
> +
> +  #
> +  # ARM General Interrupt Controller
> +  #
> +  gArmTokenSpaceGuid.PcdGicDistributorBase|0x0
> +  gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x0
> +  gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x0
> +
> +  ## PL031 RealTimeClock
> +  gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
> +
> +  # set PcdPciExpressBaseAddress to MAX_UINT64, which signifies that this
> +  # PCD and PcdPciDisableBusEnumeration above have not been assigned yet
> +  gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFFFF
> +
> +  gArmTokenSpaceGuid.PcdPciIoTranslation|0
> +#  gArmTokenSpaceGuid.PcdPciIoTranslation|0x50000000
> +
> +  #
> +  # TPM2 support
> +  #
> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0
> +!if $(TPM2_ENABLE) == TRUE
> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0
> +!endif
> +
> +[PcdsDynamicHii]
> +  gArmVirtTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gArmVirtVariableGuid|0x0|FALSE|NV,BS
> +
> +!if $(TPM2_CONFIG_ENABLE) == TRUE
> +  gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS
> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x8|3|NV,BS
> +!endif
> +
> +################################################################################
> +#
> +# Components Section - list of all EDK II Modules needed by this Platform
> +#
> +################################################################################
> +[Components.common]
> +  #
> +  # PEI Phase modules
> +  #
> +  ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
> +  MdeModulePkg/Core/Pei/PeiMain.inf
> +  MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
> +    <LibraryClasses>
> +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> +  }
> +  ArmPlatformPkg/PlatformPei/PlatformPeim.inf
> +  ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
> +  ArmPkg/Drivers/CpuPei/CpuPei.inf
> +
> +  MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
> +
> +!if $(TPM2_ENABLE) == TRUE
> +  MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf {
> +    <LibraryClasses>
> +      ResetSystemLib|ArmVirtPkg/Library/ArmVirtPsciResetSystemPeiLib/ArmVirtPsciResetSystemPeiLib.inf
> +  }
> +  OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> +  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf {
> +    <LibraryClasses>
> +      HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
> +  }
> +!endif
> +
> +  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
> +    <LibraryClasses>
> +      NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
> +  }
> +
> +  #
> +  # DXE
> +  #
> +  MdeModulePkg/Core/Dxe/DxeMain.inf {
> +    <LibraryClasses>
> +      NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
> +      DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> +  }
> +  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
> +    <LibraryClasses>
> +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> +  }
> +
> +  #
> +  # Architectural Protocols
> +  #
> +  ArmPkg/Drivers/CpuDxe/CpuDxe.inf
> +  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> +  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
> +    <LibraryClasses>
> +      NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
> +      # don't use unaligned CopyMem () on the UEFI varstore NOR flash region
> +      BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
> +  }
> +!if $(SECURE_BOOT_ENABLE) == TRUE
> +  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
> +    <LibraryClasses>
> +      NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
> +!if $(TPM2_ENABLE) == TRUE
> +      NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBootLib.inf
> +!endif
> +  }
> +  SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
> +  OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf
> +!else
> +  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> +!endif
> +  MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> +  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
> +  MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
> +  MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
> +  EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf {
> +    <LibraryClasses>
> +      NULL|ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClientLib.inf
> +  }
> +  EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> +
> +  MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> +  MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> +  MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
> +  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> +  MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> +
> +  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> +
> +  ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> +  ArmPkg/Drivers/TimerDxe/TimerDxe.inf {
> +    <LibraryClasses>
> +      NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.inf
> +  }
> +  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> +
> +  #
> +  # Status Code Routing
> +  #
> +  MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
> +
> +  #
> +  # Platform Driver
> +  #
> +  ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> +  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> +  ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> +  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> +  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> +  OvmfPkg/VirtioNetDxe/VirtioNet.inf
> +  OvmfPkg/VirtioRngDxe/VirtioRng.inf
> +
> +  #
> +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
> +  #
> +  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> +  MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> +  MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  FatPkg/EnhancedFatDxe/Fat.inf
> +  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> +  OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> +
> +  #
> +  # Bds
> +  #
> +  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
> +    <LibraryClasses>
> +      DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> +  }
> +  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> +  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> +  MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
> +  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> +  MdeModulePkg/Logo/LogoDxe.inf
> +  MdeModulePkg/Application/UiApp/UiApp.inf {
> +    <LibraryClasses>
> +      NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
> +      NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
> +      NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
> +  }
> +  OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
> +
> +  #
> +  # SCSI Bus and Disk Driver
> +  #
> +  MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> +  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> +
> +  #
> +  # PCI support
> +  #
> +  ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
> +    <LibraryClasses>
> +      NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
> +  }
> +  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> +  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
> +    <LibraryClasses>
> +      NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
> +  }
> +  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> +  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> +  OvmfPkg/Virtio10Dxe/Virtio10.inf
> +
> +  #
> +  # TPM2 support
> +  #
> +!if $(TPM2_ENABLE) == TRUE
> +  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf {
> +    <LibraryClasses>
> +      HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterDxe.inf
> +      Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf
> +      NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.inf
> +      NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
> +  }
> +!if $(TPM2_CONFIG_ENABLE) == TRUE
> +  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> +!endif
> +!endif
> +
> +  #
> +  # ACPI Support
> +  #
> +  ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> +[Components.AARCH64]
> +  MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
> +  ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf {
> +    <LibraryClasses>
> +      NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
> +  }
> diff --git a/ArmVirtPkg/ArmVirtCloudHv.fdf b/ArmVirtPkg/ArmVirtCloudHv.fdf
> new file mode 100644
> index 000000000000..3619a09ba8c5
> --- /dev/null
> +++ b/ArmVirtPkg/ArmVirtCloudHv.fdf
> @@ -0,0 +1,292 @@
> +#
> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.

(3) Please update the end year on the ARM (C).


> +#  Copyright (c) 2014, Linaro Limited. All rights reserved.
> +#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +
> +################################################################################
> +#
> +# FD Section
> +# The [FD] Section is made up of the definition statements and a
> +# description of what goes into  the Flash Device Image.  Each FD section
> +# defines one flash "device" image.  A flash device image may be one of
> +# the following: Removable media bootable image (like a boot floppy
> +# image,) an Option ROM image (that would be "flashed" into an add-in
> +# card,) a System "Flash"  image (that would be burned into a system's
> +# flash) or an Update ("Capsule") image that will be used to update and
> +# existing system flash.
> +#
> +################################################################################
> +
> +[Defines]
> +!if $(FD_SIZE_IN_MB) == 2
> +  DEFINE FVMAIN_COMPACT_SIZE  = 0x1ff000
> +!endif
> +!if $(FD_SIZE_IN_MB) == 3
> +  DEFINE FVMAIN_COMPACT_SIZE  = 0x2ff000
> +!endif
> +
> +[FD.CLOUDHV_EFI]
> +BaseAddress   = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress  # cloud-hypervisor assigns 0 - 0x8000000 for a BootROM
> +Size          = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize         # The size in bytes of the FLASH Device
> +ErasePolarity = 1
> +
> +# This one is tricky, it must be: BlockSize * NumBlocks = Size
> +BlockSize     = 0x00001000
> +NumBlocks     = $(FD_NUM_BLOCKS)
> +
> +################################################################################
> +#
> +# Following are lists of FD Region layout which correspond to the locations of different
> +# images within the flash device.
> +#
> +# Regions must be defined in ascending order and may not overlap.
> +#
> +# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
> +# the pipe "|" character, followed by the size of the region, also in hex with the leading
> +# "0x" characters. Like:
> +# Offset|Size
> +# PcdOffsetCName|PcdSizeCName
> +# RegionType <FV, DATA, or FILE>
> +#
> +################################################################################
> +
> +#
> +# UEFI has trouble dealing with FVs that reside at physical address 0x0.
> +# So instead, put a hardcoded 'jump to 0x1000' at offset 0x0, and put the
> +# real FV at offset 0x1000
> +#
> +0x00000000|0x00001000
> +DATA = {
> +!if $(ARCH) == AARCH64
> +  0x00, 0x04, 0x00, 0x14   # 'b 0x1000' in AArch64 ASM
> +!else
> +  0xfe, 0x03, 0x00, 0xea   # 'b 0x1000' in AArch32 ASM
> +!endif
> +}
> +
> +0x00001000|$(FVMAIN_COMPACT_SIZE)
> +gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> +FV = FVMAIN_COMPACT
> +
> +!include VarStore.fdf.inc
> +
> +################################################################################
> +#
> +# FV Section
> +#
> +# [FV] section is used to define what components or modules are placed within a flash
> +# device file.  This section also defines order the components and modules are positioned
> +# within the image.  The [FV] section consists of define statements, set statements and
> +# module statements.
> +#
> +################################################################################
> +
> +#!include ArmVirtCloudHvFvMain.fdf.inc

(4) This '!include' directive, together with the
"ArmVirtCloudHvFvMain.fdf.inc" file, should have been dropped from the
patch, as the FvMain firmware volume's description (GUID
2A88A00E-E267-C8BF-0E80-AE1BD504ED90) is already included (embedded) in
"ArmVirtCloudHv.fdf".

> +
> +
> +
> +[FV.FvMain]
> +FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
> +BlockSize          = 0x40
> +NumBlocks          = 0         # This FV gets compressed so make it just big enough
> +FvAlignment        = 16        # FV alignment and FV attributes setting.
> +ERASE_POLARITY     = 1
> +MEMORY_MAPPED      = TRUE
> +STICKY_WRITE       = TRUE
> +LOCK_CAP           = TRUE
> +LOCK_STATUS        = TRUE
> +WRITE_DISABLED_CAP = TRUE
> +WRITE_ENABLED_CAP  = TRUE
> +WRITE_STATUS       = TRUE
> +WRITE_LOCK_CAP     = TRUE
> +WRITE_LOCK_STATUS  = TRUE
> +READ_DISABLED_CAP  = TRUE
> +READ_ENABLED_CAP   = TRUE
> +READ_STATUS        = TRUE
> +READ_LOCK_CAP      = TRUE
> +READ_LOCK_STATUS   = TRUE
> +
> +  INF MdeModulePkg/Core/Dxe/DxeMain.inf
> +  INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> +  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> +  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> +  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> +
> +  #
> +  # PI DXE Drivers producing Architectural Protocols (EFI Services)
> +  #
> +  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
> +  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> +  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> +  INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> +  INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
> +  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
> +!if $(SECURE_BOOT_ENABLE) == TRUE
> +  INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
> +!endif
> +  INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
> +  INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
> +  INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
> +  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> +  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> +
> +  #
> +  # Multiple Console IO support
> +  #
> +  INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> +  INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> +  INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
> +  INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> +  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> +
> +  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
> +  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> +
> +  #
> +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
> +  #
> +  INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> +  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> +  INF FatPkg/EnhancedFatDxe/Fat.inf
> +  INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> +  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> +
> +  #
> +  # Status Code Routing
> +  #
> +  INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
> +
> +  #
> +  # Platform Driver
> +  #
> +  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> +  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
> +  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> +  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
> +
> +  #
> +  # UEFI application (Shell Embedded Boot Loader)
> +  #
> +  INF ShellPkg/Application/Shell/Shell.inf
> +  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
> +  INF ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
> +  INF OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
> +
> +  #
> +  # Bds
> +  #
> +  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
> +  INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> +  INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> +  INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
> +  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> +  INF MdeModulePkg/Application/UiApp/UiApp.inf
> +  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
> +
> +  #
> +  # SCSI Bus and Disk Driver
> +  #
> +  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> +  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> +
> +  #
> +  # ACPI Support
> +  #
> +  INF ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> +!if $(ARCH) == AARCH64
> +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> +  INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
> +  INF ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> +
> +  #
> +  # EBC support
> +  #
> +  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> +!endif
> +
> +  #
> +  # PCI support
> +  #
> +  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
> +  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> +  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
> +  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> +  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> +  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
> +
> +  #
> +  # TPM2 support
> +  #
> +!if $(TPM2_ENABLE) == TRUE
> +  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> +!if $(TPM2_CONFIG_ENABLE) == TRUE
> +  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> +!endif
> +!endif
> +
> +  #
> +  # TianoCore logo (splash screen)
> +  #
> +  INF MdeModulePkg/Logo/LogoDxe.inf
> +
> +  #
> +  # Ramdisk support
> +  #
> +  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +

(5) I guess this is where the content pasted from
"ArmVirtCloudHvFvMain.fdf.inc" ends, and you made some room for that
content in advance -- but these empty lines should have been removed
ultimately.

Please review your own patches carefully before posting them to the list.

Laszlo

> +[FV.FVMAIN_COMPACT]
> +FvAlignment        = 16
> +ERASE_POLARITY     = 1
> +MEMORY_MAPPED      = TRUE
> +STICKY_WRITE       = TRUE
> +LOCK_CAP           = TRUE
> +LOCK_STATUS        = TRUE
> +WRITE_DISABLED_CAP = TRUE
> +WRITE_ENABLED_CAP  = TRUE
> +WRITE_STATUS       = TRUE
> +WRITE_LOCK_CAP     = TRUE
> +WRITE_LOCK_STATUS  = TRUE
> +READ_DISABLED_CAP  = TRUE
> +READ_ENABLED_CAP   = TRUE
> +READ_STATUS        = TRUE
> +READ_LOCK_CAP      = TRUE
> +READ_LOCK_STATUS   = TRUE
> +
> +  INF ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
> +  INF MdeModulePkg/Core/Pei/PeiMain.inf
> +  INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf
> +  INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
> +  INF ArmPkg/Drivers/CpuPei/CpuPei.inf
> +  INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
> +  INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
> +  INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
> +
> +!if $(TPM2_ENABLE) == TRUE
> +  INF MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf
> +  INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> +  INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
> +!endif
> +
> +  FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
> +    SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
> +      SECTION FV_IMAGE = FVMAIN
> +    }
> +  }
> +
> +!include ArmVirtRules.fdf.inc
> diff --git a/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> new file mode 100644
> index 000000000000..51041e889ef4
> --- /dev/null
> +++ b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> @@ -0,0 +1,169 @@
> +#
> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> +#  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
> +#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +
> +################################################################################
> +#
> +# FV Section
> +#
> +# [FV] section is used to define what components or modules are placed within a flash
> +# device file.  This section also defines order the components and modules are positioned
> +# within the image.  The [FV] section consists of define statements, set statements and
> +# module statements.
> +#
> +################################################################################
> +
> +[FV.FvMain]
> +FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
> +BlockSize          = 0x40
> +NumBlocks          = 0         # This FV gets compressed so make it just big enough
> +FvAlignment        = 16        # FV alignment and FV attributes setting.
> +ERASE_POLARITY     = 1
> +MEMORY_MAPPED      = TRUE
> +STICKY_WRITE       = TRUE
> +LOCK_CAP           = TRUE
> +LOCK_STATUS        = TRUE
> +WRITE_DISABLED_CAP = TRUE
> +WRITE_ENABLED_CAP  = TRUE
> +WRITE_STATUS       = TRUE
> +WRITE_LOCK_CAP     = TRUE
> +WRITE_LOCK_STATUS  = TRUE
> +READ_DISABLED_CAP  = TRUE
> +READ_ENABLED_CAP   = TRUE
> +READ_STATUS        = TRUE
> +READ_LOCK_CAP      = TRUE
> +READ_LOCK_STATUS   = TRUE
> +
> +  INF MdeModulePkg/Core/Dxe/DxeMain.inf
> +  INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> +  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> +  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> +  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> +
> +  #
> +  # PI DXE Drivers producing Architectural Protocols (EFI Services)
> +  #
> +  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
> +  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> +  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> +  INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> +  INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
> +  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
> +!if $(SECURE_BOOT_ENABLE) == TRUE
> +  INF SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
> +!endif
> +  INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
> +  INF MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.inf
> +  INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
> +  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> +  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> +
> +  #
> +  # Multiple Console IO support
> +  #
> +  INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> +  INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> +  INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
> +  INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> +  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> +
> +  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
> +  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> +
> +  #
> +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem + virtio-fs
> +  #
> +  INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> +  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> +  INF FatPkg/EnhancedFatDxe/Fat.inf
> +  INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
> +  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> +  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> +
> +  #
> +  # Status Code Routing
> +  #
> +  INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
> +
> +  #
> +  # Platform Driver
> +  #
> +  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> +  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
> +  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> +  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
> +
> +  #
> +  # UEFI application (Shell Embedded Boot Loader)
> +  #
> +  INF ShellPkg/Application/Shell/Shell.inf
> +  INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
> +  INF ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf
> +  INF OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellCommand.inf
> +
> +  #
> +  # Bds
> +  #
> +  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
> +  INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> +  INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> +  INF MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
> +  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> +  INF MdeModulePkg/Application/UiApp/UiApp.inf
> +  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
> +
> +  #
> +  # SCSI Bus and Disk Driver
> +  #
> +  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> +  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> +
> +  #
> +  # ACPI Support
> +  #
> +  INF ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> +!if $(ARCH) == AARCH64
> +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> +  INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
> +  INF ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> +
> +  #
> +  # EBC support
> +  #
> +  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> +!endif
> +
> +  #
> +  # PCI support
> +  #
> +  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
> +  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> +  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
> +  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> +  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> +  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
> +
> +  #
> +  # TPM2 support
> +  #
> +!if $(TPM2_ENABLE) == TRUE
> +  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> +!if $(TPM2_CONFIG_ENABLE) == TRUE
> +  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> +!endif
> +!endif
> +
> +  #
> +  # TianoCore logo (splash screen)
> +  #
> +  INF MdeModulePkg/Logo/LogoDxe.inf
> +
> +  #
> +  # Ramdisk support
> +  #
> +  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
> 


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

* Re: [edk2-devel] [PATCH v2 5/5] Maintainers: update Maintainers file as new files/folders created
  2021-05-17  6:50 ` [PATCH v2 5/5] Maintainers: update Maintainers file as new files/folders created Jianyong Wu
  2021-05-18 20:26   ` Sami Mujawar
@ 2021-05-19  6:39   ` Laszlo Ersek
  1 sibling, 0 replies; 30+ messages in thread
From: Laszlo Ersek @ 2021-05-19  6:39 UTC (permalink / raw)
  To: devel, jianyong.wu, ardb+tianocore, sami.mujawar; +Cc: hao.a.wu, justin.he

On 05/17/21 08:50, Jianyong Wu wrote:
> Create new entry for Cloud Hypervisor and assign reviewer to Sami
> Mujawar.
> 
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> ---
>  Maintainers.txt | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index cafe6b1ab85d..f8fae067c656 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -167,6 +167,13 @@ F: ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/
>  F: ArmVirtPkg/Library/NorFlashKvmtoolLib/
>  R: Sami Mujawar <sami.mujawar@arm.com>
>  
> +ArmVirtPkg: Cloud Hypervisor emulated platform support
> +F: ArmVirtPkg/ArmVirtCloudHv*
> +F: ArmVirtPkg/CloudHvAcpiPlatformDxe/
> +F: ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/
> +F: ArmVirtPkg/Library/CloudHvVirtMemInfoLib/
> +R: Sami Mujawar <sami.mujawar@arm.com>
> +
>  BaseTools
>  F: BaseTools/
>  W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
> 

This patch is obsolete due to:

  [edk2-devel] [PATCH] Maintainers.txt: add Sami Mujawar as top-level ArmVirtPkg reviewer

  https://edk2.groups.io/g/devel/message/75116
  https://listman.redhat.com/archives/edk2-devel-archive/2021-May/msg00432.html
  msgid: <20210514114857.12286-1-lersek@redhat.com>

so please drop it.

Thanks
Laszlo


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

* Re: [PATCH v2 5/5] Maintainers: update Maintainers file as new files/folders created
  2021-05-18 20:26   ` Sami Mujawar
@ 2021-05-19  6:55     ` Laszlo Ersek
  2021-05-27  6:28       ` Jianyong Wu
  0 siblings, 1 reply; 30+ messages in thread
From: Laszlo Ersek @ 2021-05-19  6:55 UTC (permalink / raw)
  To: Sami Mujawar, Jianyong Wu, devel, ardb+tianocore; +Cc: hao.a.wu, justin.he, nd

Hi Sami,

On 05/18/21 22:26, Sami Mujawar wrote:
> Hi Jianyon,
> 
> Thank you for including this patch in the series. There is a patch on
> the mailing list to add me as a reviewer for ArmVirtPkg at package level.
> Therefore, this patch would no longer be needed. Apologies for not
> communicating this to you earlier.

thank you for reviewing this patch series -- I'm really happy about your
careful review! I did my own (superficial) review as first thing this
morning, before looking at my new mail, and I highly appreciate that you
provided an in-depth review before I asked!

Kudos!
Laszlo


> 
> Regards,
> 
> Sami Mujawar
> 
> 
> On 17/05/2021 07:50 AM, Jianyong Wu wrote:
>> Create new entry for Cloud Hypervisor and assign reviewer to Sami
>> Mujawar.
>>
>> Cc: Sami Mujawar <sami.mujawar@arm.com>
>> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
>> ---
>>   Maintainers.txt | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/Maintainers.txt b/Maintainers.txt
>> index cafe6b1ab85d..f8fae067c656 100644
>> --- a/Maintainers.txt
>> +++ b/Maintainers.txt
>> @@ -167,6 +167,13 @@ F: ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/
>>   F: ArmVirtPkg/Library/NorFlashKvmtoolLib/
>>   R: Sami Mujawar <sami.mujawar@arm.com>
>>   +ArmVirtPkg: Cloud Hypervisor emulated platform support
>> +F: ArmVirtPkg/ArmVirtCloudHv*
>> +F: ArmVirtPkg/CloudHvAcpiPlatformDxe/
>> +F: ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/
>> +F: ArmVirtPkg/Library/CloudHvVirtMemInfoLib/
>> +R: Sami Mujawar <sami.mujawar@arm.com>
>> +
>>   BaseTools
>>   F: BaseTools/
>>   W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
> 


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

* Re: [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor
  2021-05-18 20:20   ` Sami Mujawar
@ 2021-05-27  2:18     ` Jianyong Wu
  0 siblings, 0 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-27  2:18 UTC (permalink / raw)
  To: Sami Mujawar, devel@edk2.groups.io, lersek@redhat.com,
	ardb+tianocore@kernel.org
  Cc: hao.a.wu@intel.com, Justin He, Leif Lindholm, nd

Hi Sami,

> -----Original Message-----
> From: Sami Mujawar <Sami.Mujawar@arm.com>
> Sent: Wednesday, May 19, 2021 4:21 AM
> To: Jianyong Wu <Jianyong.Wu@arm.com>; devel@edk2.groups.io;
> lersek@redhat.com; ardb+tianocore@kernel.org
> Cc: hao.a.wu@intel.com; Justin He <Justin.He@arm.com>; Leif Lindholm
> <leif@nuviainc.com>; nd <nd@arm.com>
> Subject: Re: [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for
> Cloud Hypervisor
> 
> Hi Jianyon,
> 
> Thank you for this patch.
> 
> Please find my response inline marked [SAMI].
> 
> Regards,
> 
> Sami Mujawar
> 
> On 17/05/2021 07:50 AM, Jianyong Wu wrote:
> > Cloud Hypervisor is kvm based VMM implemented in rust.
> >
> > This library populates the system memory map for the Cloud Hypervisor
> > virtual platform.
> >
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> > Cc: Leif Lindholm <leif@nuviainc.com>
> > Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> > ---
> >   .../CloudHvVirtMemInfoPeiLib.inf              |  47 ++++++++
> >   .../CloudHvVirtMemInfoLib.c                   |  94 ++++++++++++++++
> >   .../CloudHvVirtMemInfoPeiLibConstructor.c     | 100
> ++++++++++++++++++
> >   3 files changed, 241 insertions(+)
> >   create mode 100644
> ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
> >   create mode 100644
> ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
> >   create mode 100644
> >
> ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibCon
> st
> > ructor.c
> >
> > diff --git
> >
> a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.i
> n
> > f
> >
> b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.i
> n
> > f
> > new file mode 100644
> > index 000000000000..71dbf9c06ccc
> > --- /dev/null
> > +++
> b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLi
> > +++ b.inf
> > @@ -0,0 +1,47 @@
> > +#/* @file
> > +#
> > +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> > +#  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> > +#
> > +#  SPDX-License-Identifier: BSD-2-Clause-Patent # #*/
> > +
> > +[Defines]
> > +  INF_VERSION                    = 0x0001001A
> > +  BASE_NAME                      = ClhVirtMemInfoPeiLib
> > +  FILE_GUID                      = 3E29D940-0591-EE6A-CAD4-223A9CF55E75
> > +  MODULE_TYPE                    = BASE
> > +  VERSION_STRING                 = 1.0
> > +  LIBRARY_CLASS                  = ArmVirtMemInfoLib|PEIM
> > +  CONSTRUCTOR                    = CloudHvVirtMemInfoPeiLibConstructor
> > +
> > +[Sources]
> > +  CloudHvVirtMemInfoLib.c
> > +  CloudHvVirtMemInfoPeiLibConstructor.c
> > +
> > +[Packages]
> > +  ArmPkg/ArmPkg.dec
> > +  ArmVirtPkg/ArmVirtPkg.dec
> > +  EmbeddedPkg/EmbeddedPkg.dec
> > +  MdeModulePkg/MdeModulePkg.dec
> > +  MdePkg/MdePkg.dec
> > +
> > +[LibraryClasses]
> > +  ArmLib
> > +  BaseMemoryLib
> > +  DebugLib
> > +  FdtLib
> > +  PcdLib
> > +  MemoryAllocationLib
> > +
> > +[Pcd]
> > +  gArmTokenSpaceGuid.PcdFdBaseAddress
> > +  gArmTokenSpaceGuid.PcdFvBaseAddress
> > +  gArmTokenSpaceGuid.PcdSystemMemoryBase
> > +  gArmTokenSpaceGuid.PcdSystemMemorySize
> > +
> > +[FixedPcd]
> > +  gArmTokenSpaceGuid.PcdFdSize
> > +  gArmTokenSpaceGuid.PcdFvSize
> > +  gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
> > diff --git
> > a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
> > b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
> > new file mode 100644
> > index 000000000000..69f4e6ab6cc4
> > --- /dev/null
> > +++
> b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
> > @@ -0,0 +1,94 @@
> > +/** @file
> > +
> > +  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#include <Base.h>
> > +#include <Library/ArmLib.h>
> > +#include <Library/BaseMemoryLib.h>
> > +#include <Library/DebugLib.h>
> > +#include <Library/MemoryAllocationLib.h>
> > +
> > +// Number of Virtual Memory Map Descriptors
> > +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS          5
> > +
> > +//
> > +// mach-virt's core peripherals such as the UART, the GIC and the RTC
> > +are // all mapped in the 'miscellaneous device I/O' region, which we
> > +just map // in its entirety rather than device by device. Note that
> > +it does not // cover any of the NOR flash banks or PCI resource windows.
> > +//
> > +#define MACH_VIRT_PERIPH_BASE       0x08000000
> > +#define MACH_VIRT_PERIPH_SIZE       SIZE_128MB
> > +
> > +//
> > +// in cloud-hypervisor, 0x0 ~ 0x8000000 is reserved as normal memory
> > +for UEFI //
> > +#define CLOUDHV_UEFI_MEM_BASE       0x0
> > +#define CLOUDHV_UEFI_MEM_SIZE       0x08000000
> [SAMI] The above macros are not used anywhere. Can these be removed?
> If so, the code in this patch would be very similar to
> ArmVirtPkg\Library\QemuVirtMemInfoLib. To avoid code duplication, would
> it be possible to use QemuVirtMemInfoPeiLib.inf instead?
> [/SAMI]

Yeah, these 2 lines of code should be removed and this file is copied from qemu part.
We changed Cloud Hypervisor and its memory layout is very similar with qemu now.
Maybe we can reuse the qemu code for now and rebuild it if need in the future, as the Cloud Hypervisor
are in fast developing.

thanks
Jianyong

> > +
> > +/**
> > +  Return the Virtual Memory Map of your platform
> > +
> > +  This Virtual Memory Map is used by MemoryInitPei Module to
> > + initialize the MMU  on your platform.
> > +
> > +  @param[out]   VirtualMemoryMap    Array of
> ARM_MEMORY_REGION_DESCRIPTOR
> > +                                    describing a Physical-to-Virtual Memory
> > +                                    mapping. This array must be ended by a
> > +                                    zero-filled entry. The allocated memory
> > +                                    will not be freed.
> > +
> > +**/
> > +VOID
> > +ArmVirtGetMemoryMap (
> > +  OUT ARM_MEMORY_REGION_DESCRIPTOR   **VirtualMemoryMap
> > +  )
> > +{
> > +  ARM_MEMORY_REGION_DESCRIPTOR  *VirtualMemoryTable;
> > +
> > +  ASSERT (VirtualMemoryMap != NULL);
> > +
> > +  VirtualMemoryTable = AllocatePool (sizeof
> (ARM_MEMORY_REGION_DESCRIPTOR) *
> > +
> > + MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
> > +
> > +  if (VirtualMemoryTable == NULL) {
> > +    DEBUG ((DEBUG_ERROR, "%a: Error: Failed AllocatePool()\n",
> __FUNCTION__));
> > +    return;
> > +  }
> > +
> > +  // System DRAM
> > +  VirtualMemoryTable[0].PhysicalBase = PcdGet64
> > + (PcdSystemMemoryBase);  VirtualMemoryTable[0].VirtualBase  =
> VirtualMemoryTable[0].PhysicalBase;
> > +  VirtualMemoryTable[0].Length       = PcdGet64 (PcdSystemMemorySize);
> > +  VirtualMemoryTable[0].Attributes   =
> ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> > +
> > +  DEBUG ((DEBUG_INFO, "%a: Dumping System DRAM Memory Map:\n"
> > +      "\tPhysicalBase: 0x%lX\n"
> > +      "\tVirtualBase: 0x%lX\n"
> > +      "\tLength: 0x%lX\n",
> > +      __FUNCTION__,
> > +      VirtualMemoryTable[0].PhysicalBase,
> > +      VirtualMemoryTable[0].VirtualBase,
> > +      VirtualMemoryTable[0].Length));
> > +
> > +  // Memory mapped peripherals (UART, RTC, GIC, virtio-mmio, etc)
> > + VirtualMemoryTable[1].PhysicalBase = MACH_VIRT_PERIPH_BASE;
> > + VirtualMemoryTable[1].VirtualBase  = MACH_VIRT_PERIPH_BASE;
> > +  VirtualMemoryTable[1].Length       = MACH_VIRT_PERIPH_SIZE;
> > +  VirtualMemoryTable[1].Attributes   =
> ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> > +
> > +  // Map the FV region as normal executable memory
> > + VirtualMemoryTable[2].PhysicalBase = PcdGet64 (PcdFvBaseAddress);
> > + VirtualMemoryTable[2].VirtualBase  =
> VirtualMemoryTable[2].PhysicalBase;
> > +  VirtualMemoryTable[2].Length       = FixedPcdGet32 (PcdFvSize);
> > +  VirtualMemoryTable[2].Attributes   =
> ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> > +
> > +  // End of Table
> > +  ZeroMem (&VirtualMemoryTable[3], sizeof
> > + (ARM_MEMORY_REGION_DESCRIPTOR));
> > +
> > +  *VirtualMemoryMap = VirtualMemoryTable; }
> > diff --git
> >
> a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibC
> on
> > structor.c
> >
> b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibC
> on
> > structor.c
> > new file mode 100644
> > index 000000000000..062dfcee1d66
> > --- /dev/null
> > +++
> b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLi
> > +++ bConstructor.c
> > @@ -0,0 +1,100 @@
> > +/** @file
> > +
> > +  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#include <Base.h>
> > +#include <Library/DebugLib.h>
> > +#include <Library/PcdLib.h>
> > +#include <libfdt.h>
> > +
> > +RETURN_STATUS
> > +EFIAPI
> > +CloudHvVirtMemInfoPeiLibConstructor (
> > +  VOID
> > +  )
> > +{
> > +  VOID          *DeviceTreeBase;
> > +  INT32         Node, Prev;
> > +  UINT64        NewBase, CurBase;
> > +  UINT64        NewSize, CurSize;
> > +  CONST CHAR8   *Type;
> > +  INT32         Len;
> > +  CONST UINT64  *RegProp;
> > +  RETURN_STATUS PcdStatus;
> > +
> > +  NewBase = 0;
> > +  NewSize = 0;
> > +
> > +  DeviceTreeBase = (VOID *)(UINTN)PcdGet64
> > + (PcdDeviceTreeInitialBaseAddress);
> > +  ASSERT (DeviceTreeBase != NULL);
> > +
> > +  //
> > +  // Make sure we have a valid device tree blob  //  ASSERT
> > + (fdt_check_header (DeviceTreeBase) == 0);
> > +
> > +  //
> > +  // Look for the lowest memory node
> > +  //
> > +  for (Prev = 0;; Prev = Node) {
> > +    Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
> > +    if (Node < 0) {
> > +      break;
> > +    }
> > +
> > +    //
> > +    // Check for memory node
> > +    //
> > +    Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len);
> > +    if (Type && AsciiStrnCmp (Type, "memory", Len) == 0) {
> > +      //
> > +      // Get the 'reg' property of this node. For now, we will assume
> > +      // two 8 byte quantities for base and size, respectively.
> > +      //
> > +      RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
> > +      if (RegProp != 0 && Len == (2 * sizeof (UINT64))) {
> > +
> > +        CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
> > +        CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));
> > +
> > +        DEBUG ((DEBUG_INFO, "%a: System RAM @ 0x%lx - 0x%lx\n",
> > +          __FUNCTION__, CurBase, CurBase + CurSize - 1));
> > +
> > +        if (NewBase > CurBase || NewBase == 0) {
> > +          NewBase = CurBase;
> > +          NewSize = CurSize;
> > +        }
> > +      } else {
> > +        DEBUG ((DEBUG_ERROR, "%a: Failed to parse FDT memory node\n",
> > +          __FUNCTION__));
> > +      }
> > +    }
> > +  }
> > +
> > +  //
> > +  // Make sure the start of DRAM matches our expectation  //  ASSERT
> > + (FixedPcdGet64 (PcdSystemMemoryBase) == NewBase);  PcdStatus =
> > + PcdSet64S (PcdSystemMemorySize, NewSize);  ASSERT_RETURN_ERROR
> > + (PcdStatus);
> > +
> > +  //
> > +  // We need to make sure that the machine we are running on has at
> > + least  // 128 MB of memory configured, and is currently executing
> > + this binary from  // NOR flash. This prevents a device tree image in
> > + DRAM from getting  // clobbered when our caller installs permanent
> > + PEI RAM, before we have a  // chance of marking its location as
> > + reserved or copy it to a freshly  // allocated block in the permanent PEI
> RAM in the platform PEIM.
> > +  //
> > +  ASSERT (NewSize >= SIZE_128MB);
> > +  ASSERT (
> > +    (((UINT64)PcdGet64 (PcdFdBaseAddress) +
> > +      (UINT64)PcdGet32 (PcdFdSize)) <= NewBase) ||
> > +    ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize)));
> > +
> > +  return RETURN_SUCCESS;
> > +}


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

* Re: [PATCH v2 2/5] MdeMoudlePkg: introduce new PCD for Acpi/rsdp
  2021-05-18 20:25   ` Sami Mujawar
@ 2021-05-27  2:31     ` Jianyong Wu
  0 siblings, 0 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-27  2:31 UTC (permalink / raw)
  To: Sami Mujawar, devel@edk2.groups.io, lersek@redhat.com,
	ardb+tianocore@kernel.org
  Cc: hao.a.wu@intel.com, Justin He, Jian J Wang, nd

Hi Sami,

> -----Original Message-----
> From: Sami Mujawar <Sami.Mujawar@arm.com>
> Sent: Wednesday, May 19, 2021 4:26 AM
> To: Jianyong Wu <Jianyong.Wu@arm.com>; devel@edk2.groups.io;
> lersek@redhat.com; ardb+tianocore@kernel.org
> Cc: hao.a.wu@intel.com; Justin He <Justin.He@arm.com>; Jian J Wang
> <jian.j.wang@intel.com>; nd <nd@arm.com>
> Subject: Re: [PATCH v2 2/5] MdeMoudlePkg: introduce new PCD for
> Acpi/rsdp
> 
> Hi Jianyon,
> 
> Thank you for this patch.
> 
> Please find my response inline marked [SAMI].
> 
> Regards,
> 
> Sami Mujawar
> 
> 
> On 17/05/2021 07:50 AM, Jianyong Wu wrote:
> > As there is lack of a machnism in Cloud Hypervisor to pass the base
> > address of Rsdp in Acpi, so a PCD varialbe is introduced here to
> [SAMI] Please fix the following typos: 'machnism' & 'varialbe'
> > feed it.
> >
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Cc: Jian J Wang <jian.j.wang@intel.com>
> > Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> > ---
> >   MdeModulePkg/MdeModulePkg.dec | 7 +++++++
> >   1 file changed, 7 insertions(+)
> >
> > diff --git a/MdeModulePkg/MdeModulePkg.dec
> > b/MdeModulePkg/MdeModulePkg.dec index
> 148395511034..4c8baac35a9e
> > 100644
> > --- a/MdeModulePkg/MdeModulePkg.dec
> > +++ b/MdeModulePkg/MdeModulePkg.dec
> > @@ -910,6 +910,13 @@ [PcdsFixedAtBuild]
> >     # @Expression 0x80000001 |
> (gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable
> == 0xFFFFFFFFFFFFFFFF ||
> gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable <=
> 0x0FFFFFFFFFFFFFFF)
> >
> >
> gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable|0|
> UINT6
> > 4|0x30001015
> >
> > +  ##
> > +  # This is the physical address of rsdp which is the core struct of Acpi.
> > +  # Some hypervisor may has no way to pass rsdp address to the guest,
> > + so a PCD  # is worth for those.
> > +  #
> > +
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress|0x0|UINT64
> |0x3
> > + 0001056
> [SAMI] Can this PCD be defined in ArmVirtPkg\ArmVirtPkg.dec ?

Ok, It's better to do this change.

Thanks
Jianyong 
> > +
> >     ## Progress Code for OS Loader LoadImage start.<BR><BR>
> >     #  PROGRESS_CODE_OS_LOADER_LOAD   =
> (EFI_SOFTWARE_DXE_BS_DRIVER | (EFI_OEM_SPECIFIC | 0x00000000)) =
> 0x03058000<BR>
> >     # @Prompt Progress Code for OS Loader LoadImage start.


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

* Re: [edk2-devel] [PATCH v2 2/5] MdeMoudlePkg: introduce new PCD for Acpi/rsdp
  2021-05-19  6:17   ` [edk2-devel] " Laszlo Ersek
@ 2021-05-27  2:42     ` Jianyong Wu
  0 siblings, 0 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-27  2:42 UTC (permalink / raw)
  To: Laszlo Ersek, devel@edk2.groups.io, ardb+tianocore@kernel.org,
	Sami Mujawar
  Cc: hao.a.wu@intel.com, Justin He, Jian J Wang

Hi Laszlo,

> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Wednesday, May 19, 2021 2:17 PM
> To: devel@edk2.groups.io; Jianyong Wu <Jianyong.Wu@arm.com>;
> ardb+tianocore@kernel.org; Sami Mujawar <Sami.Mujawar@arm.com>
> Cc: hao.a.wu@intel.com; Justin He <Justin.He@arm.com>; Jian J Wang
> <jian.j.wang@intel.com>
> Subject: Re: [edk2-devel] [PATCH v2 2/5] MdeMoudlePkg: introduce new
> PCD for Acpi/rsdp
>
> On 05/17/21 08:50, Jianyong Wu wrote:
> > As there is lack of a machnism in Cloud Hypervisor to pass the base
> > address of Rsdp in Acpi, so a PCD varialbe is introduced here to feed
> > it.
> >
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Cc: Jian J Wang <jian.j.wang@intel.com>
> > Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> > ---
> >  MdeModulePkg/MdeModulePkg.dec | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/MdeModulePkg/MdeModulePkg.dec
> > b/MdeModulePkg/MdeModulePkg.dec index
> 148395511034..4c8baac35a9e
> > 100644
> > --- a/MdeModulePkg/MdeModulePkg.dec
> > +++ b/MdeModulePkg/MdeModulePkg.dec
> > @@ -910,6 +910,13 @@ [PcdsFixedAtBuild]
> >    # @Expression 0x80000001 |
> (gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable
> == 0xFFFFFFFFFFFFFFFF ||
> gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable <=
> 0x0FFFFFFFFFFFFFFF)
> >
> >
> gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable|0|
> UINT6
> > 4|0x30001015
> >
> > +  ##
> > +  # This is the physical address of rsdp which is the core struct of Acpi.
> > +  # Some hypervisor may has no way to pass rsdp address to the guest,
> > + so a PCD  # is worth for those.
> > +  #
> > +
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress|0x0|UINT64
> |0x3
> > + 0001056
> > +
> >    ## Progress Code for OS Loader LoadImage start.<BR><BR>
> >    #  PROGRESS_CODE_OS_LOADER_LOAD   =
> (EFI_SOFTWARE_DXE_BS_DRIVER | (EFI_OEM_SPECIFIC | 0x00000000)) =
> 0x03058000<BR>
> >    # @Prompt Progress Code for OS Loader LoadImage start.
> >
>
> This PCD is not useful enough to be placed in MdeModulePkg -- it is only
> used in the next two patches, which are for ArmVirtPkg.
>
> (1) Therefore, please add the PCD to the "ArmVirtPkg.dec" file.
>
> (2) The PCD should arguably refer to "CloudHv" in the name.
>
> (3) In my opinion, this patch (once reimplemented for ArmVirtPkg.dec)
> should be squashed into the CloudHvAcpiPlatformDxe patch. The PCD is
> being introduced *for* CloudHvAcpiPlatformDxe, and *only* for that driver.
> In such cases, we usually keep the DEC modifications in the same patch as
> the driver addition, assuming the PCD goes in the same package as the driver.
>
> (4) "some hypervisor" in the DEC comment is bogus. Please be as explicit
> about the use case as possible.

OK,  that's better.

Thanks
Jianyong

>
> Thanks
> Laszlo

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

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

* Re: [PATCH v2 3/5] ArmVirtPkg: enable ACPI for cloud hypervisor
  2021-05-18 20:26   ` Sami Mujawar
@ 2021-05-27  2:57     ` Jianyong Wu
  0 siblings, 0 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-27  2:57 UTC (permalink / raw)
  To: Sami Mujawar, devel@edk2.groups.io, lersek@redhat.com,
	ardb+tianocore@kernel.org
  Cc: hao.a.wu@intel.com, Justin He, nd

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

Hi Sami,

Thanks for lots of great comments here, I will fix it one by one.

Thanks
Jianyong

From: Sami Mujawar <Sami.Mujawar@arm.com>
Sent: Wednesday, May 19, 2021 4:26 AM
To: Jianyong Wu <Jianyong.Wu@arm.com>; devel@edk2.groups.io; lersek@redhat.com; ardb+tianocore@kernel.org
Cc: hao.a.wu@intel.com; Justin He <Justin.He@arm.com>; nd <nd@arm.com>
Subject: Re: [PATCH v2 3/5] ArmVirtPkg: enable ACPI for cloud hypervisor


Hi Jianyon,

Thank you for this patch.

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar

On 17/05/2021 07:50 AM, Jianyong Wu wrote:

The current implementation of PlatformHasAcpiDt is not a common

library and is on behalf of qemu. So give a specific version for

Cloud Hypervisor here.



There is no device like Fw-cfg in qemu in Cloud Hypervisor, so a specific

Acpi handler is introduced here.



The handler implemented here is in a very simple way:

firstly, aquire the Rsdp address from the PCD varaible in the top

".dsc";

secondly, get the Xsdp address from Rsdp structure;

thirdly, get the Acpi tables following the Xsdp structrue and install it

one by one.



Signed-off-by: Jianyong Wu <jianyong.wu@arm.com><mailto:jianyong.wu@arm.com>

---

 .../CloudHvAcpiPlatformDxe.inf                | 51 +++++++++++++

 .../CloudHvHasAcpiDtDxe.inf                   | 43 +++++++++++

 .../CloudHvAcpiPlatformDxe/CloudHvAcpi.c      | 73 +++++++++++++++++++

 .../CloudHvHasAcpiDtDxe.c                     | 69 ++++++++++++++++++

 4 files changed, 236 insertions(+)

 create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf

 create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf

 create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c

 create mode 100644 ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
[SAMI] I think these should be split as 2 patches covering CloudHvAcpiPlatformDx/* and CloudHvPlatformHasAcpiDtDx/*





diff --git a/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf

new file mode 100644

index 000000000000..63c74e84eb27

--- /dev/null

+++ b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf

@@ -0,0 +1,51 @@

+## @file

+#  OVMF ACPI Platform Driver for Cloud Hypervisor
[SAMI] I think the reference to OVMF can be removed, right?




+#

+#  Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.<BR>

+#  SPDX-License-Identifier: BSD-2-Clause-Patent

+#

+##

+

+[Defines]

+  INF_VERSION                    = 0x00010005

+  BASE_NAME                      = ClhFwCfgAcpiPlatform
[SAMI] Can ClhFwCfgAcpiPlatform  be changed to CloudHvAcpiPlatform?



+  FILE_GUID                      = 6c76e407-73f2-dc1c-938f-5d6c4691ea93

+  MODULE_TYPE                    = DXE_DRIVER

+  VERSION_STRING                 = 1.0

+  ENTRY_POINT                    = CloudHvAcpiPlatformEntryPoint

+

+#

+# The following information is for reference only and not required by the build tools.

+#

+#  VALID_ARCHITECTURES           = IA32 X64 ARM AARCH64
[SAMI] Minor. The above line is just a comment, but can you revisit this, please?




+#

+

+[Sources]

+  CloudHvAcpi.c

+

+[Packages]

+  MdePkg/MdePkg.dec

+  MdeModulePkg/MdeModulePkg.dec

+  OvmfPkg/OvmfPkg.dec

+

+[LibraryClasses]

+  BaseLib

+  DebugLib

+  MemoryAllocationLib

+  OrderedCollectionLib

+  UefiBootServicesTableLib

+  UefiDriverEntryPoint

+

+[Protocols]

+  gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED

+  gEfiPciIoProtocolGuid                         # PROTOCOL SOMETIMES_CONSUMED
[SAMI] gEfiPciIoProtocolGuidis not used in this module.




+

+[Guids]

+  gRootBridgesConnectedEventGroupGuid
[SAMI] gRootBridgesConnectedEventGroupGuid not used in this module.



+

+[Pcd]

+  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
[SAMI] PcdPciDisableBusEnumerationis not used in this module.




+  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress

+

+[Depex]

+  gEfiAcpiTableProtocolGuid

diff --git a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf

new file mode 100644

index 000000000000..f511a4f5064c

--- /dev/null

+++ b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf

@@ -0,0 +1,43 @@

+## @file

+# Decide whether the firmware should expose an ACPI- and/or a Device Tree-based

+# hardware description to the operating system.

+#

+# Copyright (c) 2017, Red Hat, Inc.

+#

+# SPDX-License-Identifier: BSD-2-Clause-Patent

+##

+

+[Defines]

+  INF_VERSION                    = 1.25

+  BASE_NAME                      = ClhPlatformHasAcpiDtDxe
[SAMI] Is it possible to change the Clh prefix to CloudHv. Same comment for other places in this patch series.



+  FILE_GUID                      = 71fe72f9-6dc1-199d-5054-13b4200ee88d

+  MODULE_TYPE                    = DXE_DRIVER

+  VERSION_STRING                 = 1.0

+  ENTRY_POINT                    = PlatformHasAcpiDt

+

+[Sources]

+  CloudHvHasAcpiDtDxe.c

+

+[Packages]

+  ArmVirtPkg/ArmVirtPkg.dec

+  EmbeddedPkg/EmbeddedPkg.dec

+  MdeModulePkg/MdeModulePkg.dec

+  MdePkg/MdePkg.dec

+  OvmfPkg/OvmfPkg.dec

+

+[LibraryClasses]

+  BaseLib

+  DebugLib

+  PcdLib

+  UefiBootServicesTableLib

+  UefiDriverEntryPoint

+

+[Guids]

+  gEdkiiPlatformHasAcpiGuid       ## SOMETIMES_PRODUCES ## PROTOCOL

+  gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ## PROTOCOL

+

+[Pcd]

+  gArmVirtTokenSpaceGuid.PcdForceNoAcpi

+

+[Depex]

+  gEfiVariableArchProtocolGuid

diff --git a/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c

new file mode 100644

index 000000000000..c2344e7b29fa

--- /dev/null

+++ b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c

@@ -0,0 +1,73 @@
[SAMI] File license header is missing.




+#include <Library/BaseLib.h>

+#include <Library/MemoryAllocationLib.h>

+#include <IndustryStandard/Acpi63.h>

+#include <Protocol/AcpiTable.h>

+#include <Library/UefiBootServicesTableLib.h>

+#include <Library/UefiDriverEntryPoint.h>

+#include <Library/DebugLib.h>

+

+#define ACPI_ENTRY_SIZE 8

+#define XSDT_LEN 36

+

+STATIC

+EFI_ACPI_TABLE_PROTOCOL *

+FindAcpiTableProtocol (

+  VOID

+  )
[SAMI] Please add doxygen header for function. Same comment for other functions introduced in this series.




+{

+  EFI_STATUS              Status;

+  EFI_ACPI_TABLE_PROTOCOL *AcpiTable;

+

+  Status = gBS->LocateProtocol (

+                  &gEfiAcpiTableProtocolGuid,

+                  NULL,

+                  (VOID**)&AcpiTable

+                  );

+  ASSERT_EFI_ERROR (Status);

+  return AcpiTable;

+}

+

+EFI_STATUS

+EFIAPI

+InstallCloudHvAcpiTables (

+ IN     EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol

+ )

+{

+  UINTN InstalledKey, TableSize;

+  UINT64 Rsdp, Xsdt, table_offset, PointerValue;
[SAMI] Please have a look at variable naming conventions in EDKII coding standard at https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/4_naming_conventions




+  EFI_STATUS Status = 0;
[SAMI] Status = EFI_SUCCESS.




+  int size;
[SAMI] UINTN should be used instead of 'int'. Also variable name does not confirm to coding standard.




+

+  Rsdp = PcdGet64 (PcdAcpiRsdpBaseAddress);

+  Xsdt = ((EFI_ACPI_6_3_ROOT_SYSTEM_DESCRIPTION_POINTER *)Rsdp)->XsdtAddress;

+  PointerValue = Xsdt;

+  table_offset = Xsdt;

+  size = ((EFI_ACPI_COMMON_HEADER *)PointerValue)->Length - XSDT_LEN;

+  table_offset += XSDT_LEN;
[SAMI] I think the macro name XSDT_LEN is a bit misleading. 'sizeof (EFI_ACPI_DESCRIPTION_HEADER)' should be used instead of XSDT_LEN.




+

+  while(!Status && size > 0) {
[SAMI] Status is not boolean, use 'EFI_ERROR (Status)' instead. Also use paranthesis to add clarity.




+    PointerValue = *(UINT64 *)table_offset;

+    TableSize = ((EFI_ACPI_COMMON_HEADER *)PointerValue)->Length;

+    Status = AcpiProtocol->InstallAcpiTable (AcpiProtocol,

+             (VOID *)(UINT64)PointerValue, TableSize,

+             &InstalledKey);
[SAMI] See coding convention for spacing rules at https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/5_source_files/52_spacing




+    table_offset += ACPI_ENTRY_SIZE;

+    size -= ACPI_ENTRY_SIZE;

+  }
[SAMI] Can you look at simplifying the code in this function, please? You could refer to https://github.com/tianocore/edk2/blob/master/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Xsdt/XsdtParser.c#L131..L139





+

+  return Status;

+}

+

+EFI_STATUS

+EFIAPI

+CloudHvAcpiPlatformEntryPoint (

+  IN EFI_HANDLE         ImageHandle,

+  IN EFI_SYSTEM_TABLE   *SystemTable

+  )

+{

+  EFI_STATUS                         Status;

+

+  Status = InstallCloudHvAcpiTables (FindAcpiTableProtocol ());

+  return Status;

+}

+

diff --git a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c

new file mode 100644

index 000000000000..ae07c91f5705

--- /dev/null

+++ b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c

@@ -0,0 +1,69 @@

+/** @file

+  Decide whether the firmware should expose an ACPI- and/or a Device Tree-based

+  hardware description to the operating system.

+

+  Copyright (c) 2017, Red Hat, Inc.

+

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+**/

+

+#include <Guid/PlatformHasAcpi.h>

+#include <Guid/PlatformHasDeviceTree.h>

+#include <Library/BaseLib.h>

+#include <Library/DebugLib.h>

+#include <Library/PcdLib.h>

+#include <Library/UefiBootServicesTableLib.h>

+

+EFI_STATUS

+EFIAPI

+PlatformHasAcpiDt (

+  IN EFI_HANDLE       ImageHandle,

+  IN EFI_SYSTEM_TABLE *SystemTable

+  )

+{

+  EFI_STATUS           Status;

+

+  //

+  // If we fail to install any of the necessary protocols below, the OS will be

+  // unbootable anyway (due to lacking hardware description), so tolerate no

+  // errors here.

+  //

+  if (MAX_UINTN == MAX_UINT64 &&

+      !PcdGetBool (PcdForceNoAcpi))

+  {

+    Status = gBS->InstallProtocolInterface (

+                    &ImageHandle,

+                    &gEdkiiPlatformHasAcpiGuid,

+                    EFI_NATIVE_INTERFACE,

+                    NULL

+                    );

+    if (EFI_ERROR (Status)) {

+      goto Failed;

+    }

+

+    return Status;

+  }

+

+  //

+  // Expose the Device Tree otherwise.

+  //

+  Status = gBS->InstallProtocolInterface (

+                  &ImageHandle,

+                  &gEdkiiPlatformHasDeviceTreeGuid,

+                  EFI_NATIVE_INTERFACE,

+                  NULL

+                  );

+  if (EFI_ERROR (Status)) {

+    goto Failed;

+  }

+

+  return Status;

+

+Failed:

+  ASSERT_EFI_ERROR (Status);

+  CpuDeadLoop ();

+  //

+  // Keep compilers happy.

+  //

+  return Status;

+}


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

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

* Re: [edk2-devel] [PATCH v2 3/5] ArmVirtPkg: enable ACPI for cloud hypervisor
  2021-05-19  6:25   ` [edk2-devel] " Laszlo Ersek
@ 2021-05-27  3:18     ` Jianyong Wu
  0 siblings, 0 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-27  3:18 UTC (permalink / raw)
  To: Laszlo Ersek, devel@edk2.groups.io, ardb+tianocore@kernel.org,
	Sami Mujawar
  Cc: hao.a.wu@intel.com, Justin He

Hi Laszlo,

> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Wednesday, May 19, 2021 2:26 PM
> To: devel@edk2.groups.io; Jianyong Wu <Jianyong.Wu@arm.com>;
> ardb+tianocore@kernel.org; Sami Mujawar <Sami.Mujawar@arm.com>
> Cc: hao.a.wu@intel.com; Justin He <Justin.He@arm.com>
> Subject: Re: [edk2-devel] [PATCH v2 3/5] ArmVirtPkg: enable ACPI for cloud
> hypervisor
>
> On 05/17/21 08:50, Jianyong Wu wrote:
> > The current implementation of PlatformHasAcpiDt is not a common
> > library and is on behalf of qemu. So give a specific version for Cloud
> > Hypervisor here.
> >
> > There is no device like Fw-cfg in qemu in Cloud Hypervisor, so a
> > specific Acpi handler is introduced here.
> >
> > The handler implemented here is in a very simple way:
> > firstly, aquire the Rsdp address from the PCD varaible in the top
> > ".dsc"; secondly, get the Xsdp address from Rsdp structure; thirdly,
> > get the Acpi tables following the Xsdp structrue and install it
>
> (1) Please consider running a spell checker on the commit message ("aquire"
> should be "acquire", "varaible" should be "variable", "structrue" should be
> "structure"). Having this many typos in a short commit message gives the
> patch a rushed vibe.
>
> > one by one.

Thanks for reminder, I will do the spell check before sending out next time.

> >
> > Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> > ---
> >  .../CloudHvAcpiPlatformDxe.inf                | 51 +++++++++++++
> >  .../CloudHvHasAcpiDtDxe.inf                   | 43 +++++++++++
> >  .../CloudHvAcpiPlatformDxe/CloudHvAcpi.c      | 73
> +++++++++++++++++++
> >  .../CloudHvHasAcpiDtDxe.c                     | 69 ++++++++++++++++++
> >  4 files changed, 236 insertions(+)
> >  create mode 100644
> > ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> >  create mode 100644
> > ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> >  create mode 100644 ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
> >  create mode 100644
> > ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
>
> (2) Unless there is a specific reason for adding both drivers in the same patch,
> please split them to separate patches.

Ok
>
> >
> > diff --git
> > a/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> > b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> > new file mode 100644
> > index 000000000000..63c74e84eb27
> > --- /dev/null
> > +++ b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> > @@ -0,0 +1,51 @@
> > +## @file
> > +#  OVMF ACPI Platform Driver for Cloud Hypervisor # #  Copyright (c)
> > +2008 - 2014, Intel Corporation. All rights reserved.<BR>
>
> (3) Missing ARM (C).

Yeah, I will add it.

>
> > +#  SPDX-License-Identifier: BSD-2-Clause-Patent # ##
> > +
> > +[Defines]
> > +  INF_VERSION                    = 0x00010005
> > +  BASE_NAME                      = ClhFwCfgAcpiPlatform
>
> (4) This should be "CloudHvAcpiPlatformDxe", matching the basename of the
> INF file.
Yeah,

>
> > +  FILE_GUID                      = 6c76e407-73f2-dc1c-938f-5d6c4691ea93
> > +  MODULE_TYPE                    = DXE_DRIVER
> > +  VERSION_STRING                 = 1.0
> > +  ENTRY_POINT                    = CloudHvAcpiPlatformEntryPoint
> > +
> > +#
> > +# The following information is for reference only and not required by the
> build tools.
> > +#
> > +#  VALID_ARCHITECTURES           = IA32 X64 ARM AARCH64
>
> (5) Do you really want this driver to be used on, say, IA32?
>
No, I will only keep AArch64 here as I'm sure arm32 can use it.

> > +#
> > +
> > +[Sources]
> > +  CloudHvAcpi.c
> > +
> > +[Packages]
> > +  MdePkg/MdePkg.dec
> > +  MdeModulePkg/MdeModulePkg.dec
> > +  OvmfPkg/OvmfPkg.dec
> > +
> > +[LibraryClasses]
> > +  BaseLib
> > +  DebugLib
> > +  MemoryAllocationLib
> > +  OrderedCollectionLib
> > +  UefiBootServicesTableLib
> > +  UefiDriverEntryPoint
> > +
> > +[Protocols]
> > +  gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
> > +  gEfiPciIoProtocolGuid                         # PROTOCOL SOMETIMES_CONSUMED
> > +
> > +[Guids]
> > +  gRootBridgesConnectedEventGroupGuid
> > +
> > +[Pcd]
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress
> > +
> > +[Depex]
> > +  gEfiAcpiTableProtocolGuid
> > diff --git
> > a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> > b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> > new file mode 100644
> > index 000000000000..f511a4f5064c
> > --- /dev/null
> > +++
> b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> > @@ -0,0 +1,43 @@
> > +## @file
> > +# Decide whether the firmware should expose an ACPI- and/or a Device
> > +Tree-based # hardware description to the operating system.
> > +#
> > +# Copyright (c) 2017, Red Hat, Inc.
>
> (6) ARM (C) missing.
Sure,

>
> > +#
> > +# SPDX-License-Identifier: BSD-2-Clause-Patent ##
> > +
> > +[Defines]
> > +  INF_VERSION                    = 1.25
> > +  BASE_NAME                      = ClhPlatformHasAcpiDtDxe
>
> (7) Should be "CloudHvHasAcpiDtDxe".

Ok
>
> > +  FILE_GUID                      = 71fe72f9-6dc1-199d-5054-13b4200ee88d
> > +  MODULE_TYPE                    = DXE_DRIVER
> > +  VERSION_STRING                 = 1.0
> > +  ENTRY_POINT                    = PlatformHasAcpiDt
> > +
> > +[Sources]
> > +  CloudHvHasAcpiDtDxe.c
> > +
> > +[Packages]
> > +  ArmVirtPkg/ArmVirtPkg.dec
> > +  EmbeddedPkg/EmbeddedPkg.dec
> > +  MdeModulePkg/MdeModulePkg.dec
> > +  MdePkg/MdePkg.dec
> > +  OvmfPkg/OvmfPkg.dec
> > +
> > +[LibraryClasses]
> > +  BaseLib
> > +  DebugLib
> > +  PcdLib
> > +  UefiBootServicesTableLib
> > +  UefiDriverEntryPoint
> > +
> > +[Guids]
> > +  gEdkiiPlatformHasAcpiGuid       ## SOMETIMES_PRODUCES ## PROTOCOL
> > +  gEdkiiPlatformHasDeviceTreeGuid ## SOMETIMES_PRODUCES ##
> PROTOCOL
> > +
> > +[Pcd]
> > +  gArmVirtTokenSpaceGuid.PcdForceNoAcpi
> > +
> > +[Depex]
> > +  gEfiVariableArchProtocolGuid
> > diff --git a/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
> > b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
> > new file mode 100644
> > index 000000000000..c2344e7b29fa
> > --- /dev/null
> > +++ b/ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpi.c
> > @@ -0,0 +1,73 @@
> > +#include <Library/BaseLib.h>
> > +#include <Library/MemoryAllocationLib.h> #include
> > +<IndustryStandard/Acpi63.h> #include <Protocol/AcpiTable.h> #include
> > +<Library/UefiBootServicesTableLib.h>
> > +#include <Library/UefiDriverEntryPoint.h> #include
> > +<Library/DebugLib.h>
>
> (8) File-top comment block missing altogether, including the @file Doxygen
> directive plus short explanation, ARM (C) notice, "SPDX-License-Identifier".
>
Yeah, will add it.

> > +
> > +#define ACPI_ENTRY_SIZE 8
> > +#define XSDT_LEN 36
> > +
> > +STATIC
> > +EFI_ACPI_TABLE_PROTOCOL *
> > +FindAcpiTableProtocol (
> > +  VOID
> > +  )
> > +{
> > +  EFI_STATUS              Status;
> > +  EFI_ACPI_TABLE_PROTOCOL *AcpiTable;
> > +
> > +  Status = gBS->LocateProtocol (
> > +                  &gEfiAcpiTableProtocolGuid,
> > +                  NULL,
> > +                  (VOID**)&AcpiTable
> > +                  );
> > +  ASSERT_EFI_ERROR (Status);
> > +  return AcpiTable;
> > +}
> > +
> > +EFI_STATUS
> > +EFIAPI
> > +InstallCloudHvAcpiTables (
> > + IN     EFI_ACPI_TABLE_PROTOCOL       *AcpiProtocol
> > + )
> > +{
> > +  UINTN InstalledKey, TableSize;
> > +  UINT64 Rsdp, Xsdt, table_offset, PointerValue;
> > +  EFI_STATUS Status = 0;
> > +  int size;
> > +
> > +  Rsdp = PcdGet64 (PcdAcpiRsdpBaseAddress);  Xsdt =
> > + ((EFI_ACPI_6_3_ROOT_SYSTEM_DESCRIPTION_POINTER *)Rsdp)-
> >XsdtAddress;
> > + PointerValue = Xsdt;  table_offset = Xsdt;  size =
> > + ((EFI_ACPI_COMMON_HEADER *)PointerValue)->Length - XSDT_LEN;
> > + table_offset += XSDT_LEN;
> > +
> > +  while(!Status && size > 0) {
> > +    PointerValue = *(UINT64 *)table_offset;
> > +    TableSize = ((EFI_ACPI_COMMON_HEADER *)PointerValue)->Length;
> > +    Status = AcpiProtocol->InstallAcpiTable (AcpiProtocol,
> > +             (VOID *)(UINT64)PointerValue, TableSize,
> > +             &InstalledKey);
> > +    table_offset += ACPI_ENTRY_SIZE;
> > +    size -= ACPI_ENTRY_SIZE;
> > +  }
> > +
> > +  return Status;
> > +}
> > +
> > +EFI_STATUS
> > +EFIAPI
> > +CloudHvAcpiPlatformEntryPoint (
> > +  IN EFI_HANDLE         ImageHandle,
> > +  IN EFI_SYSTEM_TABLE   *SystemTable
> > +  )
> > +{
> > +  EFI_STATUS                         Status;
> > +
> > +  Status = InstallCloudHvAcpiTables (FindAcpiTableProtocol ());
> > +  return Status;
> > +}
> > +
> > diff --git
> > a/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
> > b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
> > new file mode 100644
> > index 000000000000..ae07c91f5705
> > --- /dev/null
> > +++
> b/ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.c
> > @@ -0,0 +1,69 @@
> > +/** @file
> > +  Decide whether the firmware should expose an ACPI- and/or a Device
> > +Tree-based
> > +  hardware description to the operating system.
> > +
> > +  Copyright (c) 2017, Red Hat, Inc.
>
> (9) ARM (C) missing.
>
Sure

> > +
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent **/
> > +
> > +#include <Guid/PlatformHasAcpi.h>
> > +#include <Guid/PlatformHasDeviceTree.h> #include <Library/BaseLib.h>
> > +#include <Library/DebugLib.h> #include <Library/PcdLib.h> #include
> > +<Library/UefiBootServicesTableLib.h>
> > +
> > +EFI_STATUS
> > +EFIAPI
> > +PlatformHasAcpiDt (
> > +  IN EFI_HANDLE       ImageHandle,
> > +  IN EFI_SYSTEM_TABLE *SystemTable
> > +  )
> > +{
> > +  EFI_STATUS           Status;
> > +
> > +  //
> > +  // If we fail to install any of the necessary protocols below, the
> > + OS will be  // unbootable anyway (due to lacking hardware
> > + description), so tolerate no  // errors here.
> > +  //
> > +  if (MAX_UINTN == MAX_UINT64 &&
> > +      !PcdGetBool (PcdForceNoAcpi))
> > +  {
> > +    Status = gBS->InstallProtocolInterface (
> > +                    &ImageHandle,
> > +                    &gEdkiiPlatformHasAcpiGuid,
> > +                    EFI_NATIVE_INTERFACE,
> > +                    NULL
> > +                    );
> > +    if (EFI_ERROR (Status)) {
> > +      goto Failed;
> > +    }
> > +
> > +    return Status;
> > +  }
> > +
> > +  //
> > +  // Expose the Device Tree otherwise.
> > +  //
> > +  Status = gBS->InstallProtocolInterface (
> > +                  &ImageHandle,
> > +                  &gEdkiiPlatformHasDeviceTreeGuid,
> > +                  EFI_NATIVE_INTERFACE,
> > +                  NULL
> > +                  );
> > +  if (EFI_ERROR (Status)) {
> > +    goto Failed;
> > +  }
> > +
> > +  return Status;
> > +
> > +Failed:
> > +  ASSERT_EFI_ERROR (Status);
> > +  CpuDeadLoop ();
> > +  //
> > +  // Keep compilers happy.
> > +  //
> > +  return Status;
> > +}
> >
>
> I've only pointed out what I consider the bare minimum for my ACK; the
> actual logic in the patch will still need an R-b from Ard and/or Leif and/or Sami.
>
Thanks
Jianyong Wu


> Thanks
> Laszlo

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

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

* Re: [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family
  2021-05-18 20:26   ` Sami Mujawar
@ 2021-05-27  6:19     ` Jianyong Wu
  2021-05-29  7:43       ` Sami Mujawar
  0 siblings, 1 reply; 30+ messages in thread
From: Jianyong Wu @ 2021-05-27  6:19 UTC (permalink / raw)
  To: Sami Mujawar, devel@edk2.groups.io, lersek@redhat.com,
	ardb+tianocore@kernel.org
  Cc: hao.a.wu@intel.com, Justin He, Leif Lindholm, nd

Hi Sami,

> -----Original Message-----
> From: Sami Mujawar <Sami.Mujawar@arm.com>
> Sent: Wednesday, May 19, 2021 4:27 AM
> To: Jianyong Wu <Jianyong.Wu@arm.com>; devel@edk2.groups.io;
> lersek@redhat.com; ardb+tianocore@kernel.org
> Cc: hao.a.wu@intel.com; Justin He <Justin.He@arm.com>; Leif Lindholm
> <leif@nuviainc.com>; nd <nd@arm.com>
> Subject: Re: [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2
> family
> 
> Hi Jianyon,
> 
> Thank you for this patch.
> 
> Please find my response inline marked [SAMI].
> 
> Regards,
> 
> Sami Mujawar
> 
> 
> On 17/05/2021 07:50 AM, Jianyong Wu wrote:
> > Cloud Hypervisor is kvm based VMM and is implemented in rust. Just
> > like other VMMs it need UEFI support to let ACPI work. That's why
> > Cloud Hypervisor is introduced here.
> >
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Leif Lindholm <leif@nuviainc.com>
> > Cc:
> > Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> > ---
> >   ArmVirtPkg/ArmVirtCloudHv.dsc           | 455
> ++++++++++++++++++++++++
> >   ArmVirtPkg/ArmVirtCloudHv.fdf           | 292 +++++++++++++++
> >   ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc | 169 +++++++++
> >   3 files changed, 916 insertions(+)
> >   create mode 100644 ArmVirtPkg/ArmVirtCloudHv.dsc
> >   create mode 100644 ArmVirtPkg/ArmVirtCloudHv.fdf
> >   create mode 100644 ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> >
> > diff --git a/ArmVirtPkg/ArmVirtCloudHv.dsc
> > b/ArmVirtPkg/ArmVirtCloudHv.dsc new file mode 100644 index
> > 000000000000..bf1f8c5a75ae
> > --- /dev/null
> > +++ b/ArmVirtPkg/ArmVirtCloudHv.dsc
> > @@ -0,0 +1,455 @@
> > +#
> > +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> > +#  Copyright (c) 2014, Linaro Limited. All rights reserved.
> > +#  Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
> > +#
> > +#  SPDX-License-Identifier: BSD-2-Clause-Patent # #
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# Defines Section - statements that will be processed to create a Makefile.
> > +#
> >
> +#########################################################
> ############
> > +###########
> > +[Defines]
> > +  PLATFORM_NAME                  = ArmVirtCloudHv
> > +  PLATFORM_GUID                  = DFFED32B-DFFE-D32B-DFFE-D32BDFFED32B
> > +  PLATFORM_VERSION               = 0.1
> > +  DSC_SPECIFICATION              = 0x00010005
> > +  OUTPUT_DIRECTORY               = Build/ArmVirtCloudHv-$(ARCH)
> > +  SUPPORTED_ARCHITECTURES        = AARCH64|ARM
> > +  BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
> > +  SKUID_IDENTIFIER               = DEFAULT
> > +  FLASH_DEFINITION               = ArmVirtPkg/ArmVirtCloudHv.fdf
> > +
> > +  #
> > +  # Defines for default states.  These can be changed on the command line.
> > +  # -D FLAG=VALUE
> > +  #
> > +  DEFINE TTY_TERMINAL            = FALSE
> > +  DEFINE SECURE_BOOT_ENABLE      = FALSE
> > +  DEFINE TPM2_ENABLE             = FALSE
> > +  DEFINE TPM2_CONFIG_ENABLE      = FALSE
> > +
> > +!include ArmVirtPkg/ArmVirt.dsc.inc
> > +
> > +[LibraryClasses.common]
> > +  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
> > +  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
> > +
> > +  # Virtio Support
> > +  VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
> > +
> > +
> VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDe
> > + viceLib.inf
> > + QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
> > +
> > +
> QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3Li
> bNull
> > + .inf
> > +
> QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/
> Qe
> > + muFwCfgSimpleParserLib.inf
> > +
> QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/Generic
> Qemu
> > + LoadImageLib.inf
> [SAMI] Does Cloud Hypervisor support Qemu-FwCfg? If not, then are the
> above 4 libraries needed?

Hi Sami, I think CloudHv doesn't dependent on qemu-fwcfg, so I have tried to remove the dependencies. But I find it difficult to do that.
Some implicit codes depend on qemu-cfg that I can't do workaround. E.g.
 
In OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
"
 Status = QemuFwCfgFindFile ("etc/extra-pci-roots", &FwCfgItem, &FwCfgSize);
  if (EFI_ERROR (Status) || FwCfgSize != sizeof ExtraRootBridges) {
    ExtraRootBridges = 0;
  } else {
    QemuFwCfgSelectItem (FwCfgItem);
    QemuFwCfgReadBytes (FwCfgSize, &ExtraRootBridges);
"
I don't know how to do with it. So, I keep it here.
Maybe I need your help if these dependencies should be removed.

> > +
> > +
> > +
> ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatform
> > + LibNull.inf
> > +
> > +  TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
> > +
> > +
> CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.
> > + inf  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
> > +
> > +
> PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/Pla
> > + tformBootManagerLib.inf
> [SAMI] The above instance of PlatformBootManagerLibhas a dependency on
> Qemu-FwCfg, right?
> > +
> > +
> PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBm
> > + PrintScLib.inf
> > +
> CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Custo
> > + mizedDisplayLib.inf
> > +
> FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBuffer
> > + BltLib.inf
> > +
> QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrder
> Lib.i
> > + nf
> [SAMI] Qemu-FwCfg dependency?
Sure

> > +
> > + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib
> > + .inf
> > + PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdP
> > + roducerLib.inf
> > +
> PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibP
> > + ci.inf
> > + PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBr
> > + idgeLib.inf
> > + PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciH
> > + ostBridgeUtilityLib.inf
> > +
> > +!if $(TPM2_ENABLE) == TRUE
> > +
> >
> +Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2Command
> Lib.inf
> > +
> >
> +Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/
> D
> > +xeTcg2PhysicalPresenceLib.inf
> [SAMI] Is this supported by Cloud Hypervisor?
No, should be removed.

> > +
> >
> +TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeT
> pmMeas
> > +urementLib.inf
> > +!else
> > +
> >
> +TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/T
> pmMeasu
> > +rementLibNull.inf
> > +!endif
> > +
> > +!include MdePkg/MdeLibs.dsc.inc
> > +
> > +[LibraryClasses.common.PEIM]
> > +
> >
> +ArmVirtMemInfoLib|ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHv
> Vir
> > +tMemInfoPeiLib.inf
> > +
> > +!if $(TPM2_ENABLE) == TRUE
> > +  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> > +
> >
> +ResetSystemLib|MdeModulePkg/Library/PeiResetSystemLib/PeiResetSyst
> emL
> > +ib.inf
> > +
> >
> +Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibD
> Tpm
> > +.inf
> > +!endif
> > +
> > +[LibraryClasses.common.DXE_DRIVER]
> > +
> >
> +ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/D
> xeRe
> > +portStatusCodeLib.inf
> > +
> > +!if $(TPM2_ENABLE) == TRUE
> > +
> >
> +Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg
> 2
> > +.inf
> > +!endif
> > +
> > +[LibraryClasses.common.UEFI_DRIVER]
> > +  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
> > +
> > +[BuildOptions]
> > +!include NetworkPkg/NetworkBuildOptions.dsc.inc
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# Pcd Section - list of all EDK II PCD Entries defined by this
> > +Platform #
> >
> +#########################################################
> ############
> > +###########
> > +
> > +[PcdsFeatureFlag.common]
> > +  gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation|TRUE
> > +
> gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation|TRUE
> > +
> > +  ## If TRUE, Graphics Output Protocol will be installed on virtual handle
> created by ConsplitterDxe.
> > +  #  It could be set FALSE to save size.
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
> > +
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
> > +
> > +  gArmVirtTokenSpaceGuid.PcdTpm2SupportEnabled|$(TPM2_ENABLE)
> > +
> > +[PcdsFixedAtBuild.common]
> > +!if $(ARCH) == AARCH64
> > +  gArmTokenSpaceGuid.PcdVFPEnabled|1
> > +!endif
> > +
> > +  gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4007c000
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
> > +  gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> > +
> > +  # Rsdp base address in Cloud Hypervisor
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress|0x40200000
> > +
> > +
> >
> +gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x40
> 0000
> > +0
> > +
> >
> +gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x400
> 00
> > +!if $(NETWORK_TLS_ENABLE) == TRUE
> > +  #
> > +  # The cumulative and individual VOLATILE variable size limits
> > +should be set
> > +  # high enough for accommodating several and/or large CA certificates.
> > +  #
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x80000
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize|0x40000
> > +!endif
> > +
> > +  # Size of the region used by UEFI in permanent memory (Reserved
> > + 64MB)
> > +
> gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x040000
> 00
> > +
> > +  #
> > +  # ARM PrimeCell
> > +  #
> > +
> > +  ## PL011 - Serial Terminal
> > +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|38400
> > +
> > +  ## Default Terminal Type
> > +  ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM !if
> > +$(TTY_TERMINAL) == TRUE
> > +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
> > +  # Set terminal type to TtyTerm, the value encoded is
> > +EFI_TTY_TERM_GUID
> > +  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d,
> 0x91,
> > +0x7d, 0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51,
> > +0xef, 0x94} !else
> > +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|1
> > +!endif
> > +
> > +  # System Memory Base -- fixed at 0x4000_0000
> > +  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x40000000
> > +
> > +  # initial location of the device tree blob passed by Cloud
> > + Hypervisor -- base of DRAM
> > +  gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x40000000
> > +
> > +
> > +
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationC
> hange
> > + |FALSE
> gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{
> > + 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a,
> > + 0xb6, 0xf4, 0x66, 0x23, 0x31 }
> > +
> > +  #
> > +  # The maximum physical I/O addressability of the processor, set
> > + with  # BuildCpuHob().
> > +  #
> > +  gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16
> > +
> > +  #
> > +  # Enable the non-executable DXE stack. (This gets set up by DxeIpl)
> > + #  gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE
> > +
> > +!if $(SECURE_BOOT_ENABLE) == TRUE
> > +  # override the default values from SecurityPkg to ensure images
> > +from all sources are verified in secure boot
> > +
> >
> +gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x
> 0
> > +4
> > +
> >
> +gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x
> > +04
> > +
> >
> +gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPoli
> c
> > +y|0x04
> > +!endif
> > +
> > +  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|3
> > +  gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x20000
> > +
> > +[PcdsFixedAtBuild.AARCH64]
> > +  # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS
> > +entry point,
> > +  # if the entry point version is >= 3.0. AARCH64 OSes cannot assume
> > +the
> > +  # presence of the 32-bit entry point anyway (because many AARCH64
> > +systems
> > +  # don't have 32-bit addressable physical RAM), and the additional
> > +allocations
> > +  # below 4 GB needlessly fragment the memory map. So expose the
> > +64-bit entry
> > +  # point only, for entry point versions >= 3.0.
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosEntryPointProvideMethod|0
> x2
> > +
> > +[PcdsDynamicDefault.common]
> > +  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
> > +
> > +  ## If TRUE, OvmfPkg/AcpiPlatformDxe will not wait for PCI  #
> > + enumeration to complete before installing ACPI tables.
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
> > +
> > +  # System Memory Size -- 1 MB initially, actual size will be fetched
> > + from DT
> > +  gArmTokenSpaceGuid.PcdSystemMemorySize|0x00100000
> > +
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
> > +
> > +  gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0
> > +  gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
> > +  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
> > +  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
> > +
> > +  #
> > +  # ARM General Interrupt Controller
> > +  #
> > +  gArmTokenSpaceGuid.PcdGicDistributorBase|0x0
> > +  gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x0
> > +  gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x0
> > +
> > +  ## PL031 RealTimeClock
> > +  gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
> > +
> > +  # set PcdPciExpressBaseAddress to MAX_UINT64, which signifies that
> > + this  # PCD and PcdPciDisableBusEnumeration above have not been
> > + assigned yet
> > +
> gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFF
> FF
> > +
> > +  gArmTokenSpaceGuid.PcdPciIoTranslation|0
> > +#  gArmTokenSpaceGuid.PcdPciIoTranslation|0x50000000
> [SAMI] Remove commented code.
Yeah

> > +
> > +  #
> > +  # TPM2 support
> > +  #
> > +  gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0
> > +!if $(TPM2_ENABLE) == TRUE
> > +  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00,
> > +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > +0x00, 0x00}
> > +  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0
> > +!endif
> > +
> > +[PcdsDynamicHii]
> > +
> >
> +gArmVirtTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gArmVirtVaria
> ble
> > +Guid|0x0|FALSE|NV,BS
> > +
> > +!if $(TPM2_CONFIG_ENABLE) == TRUE
> > +
> >
> +gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TC
> > +G2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS
> > +
> >
> +gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"
> |gTc
> > +g2ConfigFormSetGuid|0x8|3|NV,BS
> > +!endif
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# Components Section - list of all EDK II Modules needed by this
> > +Platform #
> >
> +#########################################################
> ############
> > +###########
> > +[Components.common]
> > +  #
> > +  # PEI Phase modules
> > +  #
> > +  ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
> > +  MdeModulePkg/Core/Pei/PeiMain.inf
> > +  MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
> > +    <LibraryClasses>
> > +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> > +  }
> > +  ArmPlatformPkg/PlatformPei/PlatformPeim.inf
> > +  ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
> > +  ArmPkg/Drivers/CpuPei/CpuPei.inf
> > +
> > +  MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
> > +
> > +!if $(TPM2_ENABLE) == TRUE
> > +  MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf {
> > +    <LibraryClasses>
> > +
> >
> +ResetSystemLib|ArmVirtPkg/Library/ArmVirtPsciResetSystemPeiLib/ArmVi
> r
> > +tPsciResetSystemPeiLib.inf
> > +  }
> > +  OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> > +  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf {
> > +    <LibraryClasses>
> > +
> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoR
> outerPei.inf
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.in
> f
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.in
> f
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.in
> f
> > +
> > +NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
> > +  }
> > +!endif
> > +
> > +  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
> > +    <LibraryClasses>
> > +
> > +
> NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDec
> ompre
> > + ssLib.inf
> > +  }
> > +
> > +  #
> > +  # DXE
> > +  #
> > +  MdeModulePkg/Core/Dxe/DxeMain.inf {
> > +    <LibraryClasses>
> > +
> NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32G
> uidedSectionExtractLib.inf
> > +
> > + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> > +  }
> > +  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
> > +    <LibraryClasses>
> > +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> > +  }
> > +
> > +  #
> > +  # Architectural Protocols
> > +  #
> > +  ArmPkg/Drivers/CpuDxe/CpuDxe.inf
> > +  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> > +
> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
> > +    <LibraryClasses>
> > +      NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
> > +      # don't use unaligned CopyMem () on the UEFI varstore NOR flash
> region
> > +
> BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
> > +  }
> > +!if $(SECURE_BOOT_ENABLE) == TRUE
> > +  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
> > +    <LibraryClasses>
> > +
> > +NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerification
> > +Lib.inf
> > +!if $(TPM2_ENABLE) == TRUE
> > +
> >
> +NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBo
> otLib.
> > +inf
> > +!endif
> > +  }
> > +
> >
> +SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf
> i
> > +gDxe.inf
> > +  OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf
> > +!else
> > +  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> > +!endif
> > +  MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> > +
> >
> +MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i
> n
> > +f
> > +
> >
> +MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCou
> nterRun
> > +timeDxe.inf
> > +
> >
> +MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
> Dxe.in
> > +f
> > +
> EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf {
> > +    <LibraryClasses>
> > +
> >
> +NULL|ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClien
> > +tLib.inf
> > +  }
> > +  EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> > +
> > +
> MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> > +  MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> > +
> > +
> MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleD
> xe
> > + .inf  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> > +  MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> > +
> > +  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> > +
> > +  ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> > +  ArmPkg/Drivers/TimerDxe/TimerDxe.inf {
> > +    <LibraryClasses>
> > +
> > + NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClie
> > + ntLib.inf
> > +  }
> > +  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> > +
> > +  #
> > +  # Status Code Routing
> > +  #
> > +
> > +
> MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportSt
> atu
> > + sCodeRouterRuntimeDxe.inf
> > +
> > +  #
> > +  # Platform Driver
> > +  #
> > +  ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> > +  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> > +  ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> > +  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> > +  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> > +  OvmfPkg/VirtioNetDxe/VirtioNet.inf
> > +  OvmfPkg/VirtioRngDxe/VirtioRng.inf
> > +
> > +  #
> > +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem +
> > + virtio-fs  #  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> > +  MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> > +
> > +
> MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i
> > + nf
> > +  FatPkg/EnhancedFatDxe/Fat.inf
> > +  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> > +  OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> > +
> > +  #
> > +  # Bds
> > +  #
> > +  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
> > +    <LibraryClasses>
> > +
> DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> > +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> > +  }
> > +  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> > +  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> > +
> > +
> MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManager
> Dxe
> > + .inf  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > +  MdeModulePkg/Logo/LogoDxe.inf
> > +  MdeModulePkg/Application/UiApp/UiApp.inf {
> > +    <LibraryClasses>
> > +
> NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
> > +
> NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
> > +
> > +
> NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMainte
> nanc
> > + eManagerUiLib.inf
> > +  }
> > +  OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
> [SAMI] Qemu-FwCfg dependency?
Yeah

> > +
> > +  #
> > +  # SCSI Bus and Disk Driver
> > +  #
> > +  MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> > +  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> > +
> > +  #
> > +  # PCI support
> > +  #
> > +  ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
> > +    <LibraryClasses>
> > +
> > + NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.in
> > + f
> > +  }
> > +  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > +  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
> > +    <LibraryClasses>
> > +
> > + NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.in
> > + f
> > +  }
> > +  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> > +  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> > +  OvmfPkg/Virtio10Dxe/Virtio10.inf
> > +
> > +  #
> > +  # TPM2 support
> > +  #
> > +!if $(TPM2_ENABLE) == TRUE
> > +  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf {
> > +    <LibraryClasses>
> > +
> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoR
> outerDxe.inf
> > +
> Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibR
> outerDxe.inf
> > +
> NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.in
> f
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.in
> f
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.in
> f
> > +
> > +NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
> > +  }
> > +!if $(TPM2_CONFIG_ENABLE) == TRUE
> > +  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> > +!endif
> > +!endif
> > +
> > +  #
> > +  # ACPI Support
> > +  #
> > +  ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> > +[Components.AARCH64]
> > +
> >
> +MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap
> hics
> > +ResourceTableDxe.inf
> > +  ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf {
> > +    <LibraryClasses>
> > +
> >
> +NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
> > +  }
> > diff --git a/ArmVirtPkg/ArmVirtCloudHv.fdf
> > b/ArmVirtPkg/ArmVirtCloudHv.fdf new file mode 100644 index
> > 000000000000..3619a09ba8c5
> > --- /dev/null
> > +++ b/ArmVirtPkg/ArmVirtCloudHv.fdf
> > @@ -0,0 +1,292 @@
> > +#
> > +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> > +#  Copyright (c) 2014, Linaro Limited. All rights reserved.
> > +#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> > +#
> > +#  SPDX-License-Identifier: BSD-2-Clause-Patent #
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# FD Section
> > +# The [FD] Section is made up of the definition statements and a #
> > +description of what goes into  the Flash Device Image.  Each FD
> > +section # defines one flash "device" image.  A flash device image may
> > +be one of # the following: Removable media bootable image (like a
> > +boot floppy # image,) an Option ROM image (that would be "flashed"
> > +into an add-in # card,) a System "Flash"  image (that would be burned
> > +into a system's # flash) or an Update ("Capsule") image that will be
> > +used to update and # existing system flash.
> > +#
> >
> +#########################################################
> ############
> > +###########
> > +
> > +[Defines]
> > +!if $(FD_SIZE_IN_MB) == 2
> > +  DEFINE FVMAIN_COMPACT_SIZE  = 0x1ff000 !endif !if $(FD_SIZE_IN_MB)
> > +== 3
> > +  DEFINE FVMAIN_COMPACT_SIZE  = 0x2ff000 !endif
> > +
> > +[FD.CLOUDHV_EFI]
> > +BaseAddress   = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress  #
> cloud-hypervisor assigns 0 - 0x8000000 for a BootROM
> > +Size          = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize         # The size in
> bytes of the FLASH Device
> > +ErasePolarity = 1
> > +
> > +# This one is tricky, it must be: BlockSize * NumBlocks = Size
> > +BlockSize     = 0x00001000
> > +NumBlocks     = $(FD_NUM_BLOCKS)
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# Following are lists of FD Region layout which correspond to the
> > +locations of different # images within the flash device.
> > +#
> > +# Regions must be defined in ascending order and may not overlap.
> > +#
> > +# A Layout Region start with a eight digit hex offset (leading "0x"
> > +required) followed by # the pipe "|" character, followed by the size
> > +of the region, also in hex with the leading # "0x" characters. Like:
> > +# Offset|Size
> > +# PcdOffsetCName|PcdSizeCName
> > +# RegionType <FV, DATA, or FILE>
> > +#
> >
> +#########################################################
> ############
> > +###########
> > +
> > +#
> > +# UEFI has trouble dealing with FVs that reside at physical address 0x0.
> > +# So instead, put a hardcoded 'jump to 0x1000' at offset 0x0, and put
> > +the # real FV at offset 0x1000 #
> > +0x00000000|0x00001000
> > +DATA = {
> > +!if $(ARCH) == AARCH64
> > +  0x00, 0x04, 0x00, 0x14   # 'b 0x1000' in AArch64 ASM
> > +!else
> > +  0xfe, 0x03, 0x00, 0xea   # 'b 0x1000' in AArch32 ASM
> > +!endif
> > +}
> > +
> > +0x00001000|$(FVMAIN_COMPACT_SIZE)
> >
> +gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> > +FV = FVMAIN_COMPACT
> > +
> > +!include VarStore.fdf.inc
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# FV Section
> > +#
> > +# [FV] section is used to define what components or modules are
> > +placed within a flash # device file.  This section also defines order
> > +the components and modules are positioned # within the image.  The
> > +[FV] section consists of define statements, set statements and # module
> statements.
> > +#
> >
> +#########################################################
> ############
> > +###########
> > +
> > +#!include ArmVirtCloudHvFvMain.fdf.inc
> > +
> > +
> > +
> > +[FV.FvMain]
> > +FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
> > +BlockSize          = 0x40
> > +NumBlocks          = 0         # This FV gets compressed so make it just big
> enough
> > +FvAlignment        = 16        # FV alignment and FV attributes setting.
> > +ERASE_POLARITY     = 1
> > +MEMORY_MAPPED      = TRUE
> > +STICKY_WRITE       = TRUE
> > +LOCK_CAP           = TRUE
> > +LOCK_STATUS        = TRUE
> > +WRITE_DISABLED_CAP = TRUE
> > +WRITE_ENABLED_CAP  = TRUE
> > +WRITE_STATUS       = TRUE
> > +WRITE_LOCK_CAP     = TRUE
> > +WRITE_LOCK_STATUS  = TRUE
> > +READ_DISABLED_CAP  = TRUE
> > +READ_ENABLED_CAP   = TRUE
> > +READ_STATUS        = TRUE
> > +READ_LOCK_CAP      = TRUE
> > +READ_LOCK_STATUS   = TRUE
> > +
> > +  INF MdeModulePkg/Core/Dxe/DxeMain.inf  INF
> > + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> > +  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> > +  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> > +  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> > +
> > +  #
> > +  # PI DXE Drivers producing Architectural Protocols (EFI Services)
> > +  #
> > +  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
> > +  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> > +  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> > +  INF
> MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> > +  INF
> >
> +MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i
> n
> > +f
> > +  INF
> >
> +MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
> > +!if $(SECURE_BOOT_ENABLE) == TRUE
> > +  INF
> >
> +SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf
> i
> > +gDxe.inf
> > +!endif
> > +  INF
> >
> +MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCou
> nterRun
> > +timeDxe.inf
> > +  INF
> >
> +MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
> Dxe.in
> > +f
> > +  INF
> EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
> > +  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> > +  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> > +
> > +  #
> > +  # Multiple Console IO support
> > +  #
> > +  INF
> > +
> MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> > +  INF
> > + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> > +  INF
> > +
> MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleD
> xe
> > + .inf  INF
> MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> > +  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> > +
> > +  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> > +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
> > +  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> > +
> > +  #
> > +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem +
> > + virtio-fs  #  INF
> > + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> > +  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> > +  INF FatPkg/EnhancedFatDxe/Fat.inf
> > +  INF
> > +
> MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i
> > + nf  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> > +  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> > +
> > +  #
> > +  # Status Code Routing
> > +  #
> > +  INF
> > +
> MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportSt
> atu
> > + sCodeRouterRuntimeDxe.inf
> > +
> > +  #
> > +  # Platform Driver
> > +  #
> > +  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> > +  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
> > +  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> > +  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
> > +
> > +  #
> > +  # UEFI application (Shell Embedded Boot Loader)  #  INF
> > + ShellPkg/Application/Shell/Shell.inf
> > +  INF
> > +
> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.
> inf
> > +  INF
> > +
> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand
> .inf
> > +  INF
> > +
> OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellComma
> n
> > + d.inf
> > +
> > +  #
> > +  # Bds
> > +  #
> > +  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
> > +  INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> > +  INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> > +  INF
> > +
> MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManager
> Dxe
> > + .inf  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > +  INF MdeModulePkg/Application/UiApp/UiApp.inf
> > +  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
> [SAMI] Qemu-FwCfg dependency? Also check at other places in the fdf and
> fdf.inc file.

Yeah, it's a tough work for me.

> > +
> > +  #
> > +  # SCSI Bus and Disk Driver
> > +  #
> > +  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> > +  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> > +
> > +  #
> > +  # ACPI Support
> > +  #
> > +  INF
> ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> > +!if $(ARCH) == AARCH64
> > +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> > +  INF
> >
> +MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap
> hics
> > +ResourceTableDxe.inf
> > +  INF ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> > +
> > +  #
> > +  # EBC support
> > +  #
> > +  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> > +!endif
> > +
> > +  #
> > +  # PCI support
> > +  #
> > +  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
> > +  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > +  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
> > +  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> > +  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> > +  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
> > +
> > +  #
> > +  # TPM2 support
> > +  #
> > +!if $(TPM2_ENABLE) == TRUE
> > +  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> > +!if $(TPM2_CONFIG_ENABLE) == TRUE
> > +  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> > +!endif
> > +!endif
> > +
> > +  #
> > +  # TianoCore logo (splash screen)
> > +  #
> > +  INF MdeModulePkg/Logo/LogoDxe.inf
> > +
> > +  #
> > +  # Ramdisk support
> > +  #
> > +  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> [SAMI] Remove empty lines.

Oh, it's my bad.

Thanks
Jianyong

> > +[FV.FVMAIN_COMPACT]
> > +FvAlignment        = 16
> > +ERASE_POLARITY     = 1
> > +MEMORY_MAPPED      = TRUE
> > +STICKY_WRITE       = TRUE
> > +LOCK_CAP           = TRUE
> > +LOCK_STATUS        = TRUE
> > +WRITE_DISABLED_CAP = TRUE
> > +WRITE_ENABLED_CAP  = TRUE
> > +WRITE_STATUS       = TRUE
> > +WRITE_LOCK_CAP     = TRUE
> > +WRITE_LOCK_STATUS  = TRUE
> > +READ_DISABLED_CAP  = TRUE
> > +READ_ENABLED_CAP   = TRUE
> > +READ_STATUS        = TRUE
> > +READ_LOCK_CAP      = TRUE
> > +READ_LOCK_STATUS   = TRUE
> > +
> > +  INF ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
> > +  INF MdeModulePkg/Core/Pei/PeiMain.inf  INF
> > + ArmPlatformPkg/PlatformPei/PlatformPeim.inf
> > +  INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
> > +  INF ArmPkg/Drivers/CpuPei/CpuPei.inf  INF
> > + MdeModulePkg/Universal/PCD/Pei/Pcd.inf
> > +  INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
> > +  INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
> > +
> > +!if $(TPM2_ENABLE) == TRUE
> > +  INF MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf
> > +  INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> > +  INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
> > +!endif
> > +
> > +  FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
> > +    SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF
> PROCESSING_REQUIRED = TRUE {
> > +      SECTION FV_IMAGE = FVMAIN
> > +    }
> > +  }
> > +
> > +!include ArmVirtRules.fdf.inc
> > diff --git a/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> > b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> > new file mode 100644
> > index 000000000000..51041e889ef4
> > --- /dev/null
> > +++ b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> > @@ -0,0 +1,169 @@
> > +#
> > +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> > +#  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
> > +#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
> > +#
> > +#  SPDX-License-Identifier: BSD-2-Clause-Patent #
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# FV Section
> > +#
> > +# [FV] section is used to define what components or modules are
> > +placed within a flash # device file.  This section also defines order
> > +the components and modules are positioned # within the image.  The
> > +[FV] section consists of define statements, set statements and # module
> statements.
> > +#
> >
> +#########################################################
> ############
> > +###########
> > +
> > +[FV.FvMain]
> > +FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
> > +BlockSize          = 0x40
> > +NumBlocks          = 0         # This FV gets compressed so make it just big
> enough
> > +FvAlignment        = 16        # FV alignment and FV attributes setting.
> > +ERASE_POLARITY     = 1
> > +MEMORY_MAPPED      = TRUE
> > +STICKY_WRITE       = TRUE
> > +LOCK_CAP           = TRUE
> > +LOCK_STATUS        = TRUE
> > +WRITE_DISABLED_CAP = TRUE
> > +WRITE_ENABLED_CAP  = TRUE
> > +WRITE_STATUS       = TRUE
> > +WRITE_LOCK_CAP     = TRUE
> > +WRITE_LOCK_STATUS  = TRUE
> > +READ_DISABLED_CAP  = TRUE
> > +READ_ENABLED_CAP   = TRUE
> > +READ_STATUS        = TRUE
> > +READ_LOCK_CAP      = TRUE
> > +READ_LOCK_STATUS   = TRUE
> > +
> > +  INF MdeModulePkg/Core/Dxe/DxeMain.inf  INF
> > + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> > +  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> > +  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> > +  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> > +
> > +  #
> > +  # PI DXE Drivers producing Architectural Protocols (EFI Services)
> > +  #
> > +  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
> > +  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> > +  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> > +  INF
> MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> > +  INF
> >
> +MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i
> n
> > +f
> > +  INF
> >
> +MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
> > +!if $(SECURE_BOOT_ENABLE) == TRUE
> > +  INF
> >
> +SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf
> i
> > +gDxe.inf
> > +!endif
> > +  INF
> >
> +MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCou
> nterRun
> > +timeDxe.inf
> > +  INF
> >
> +MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
> Dxe.in
> > +f
> > +  INF
> EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
> > +  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> > +  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> > +
> > +  #
> > +  # Multiple Console IO support
> > +  #
> > +  INF
> > +
> MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> > +  INF
> > + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> > +  INF
> > +
> MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleD
> xe
> > + .inf  INF
> MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> > +  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> > +
> > +  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> > +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
> > +  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> > +
> > +  #
> > +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem +
> > + virtio-fs  #  INF
> > + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> > +  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> > +  INF FatPkg/EnhancedFatDxe/Fat.inf
> > +  INF
> > +
> MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i
> > + nf  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> > +  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> > +
> > +  #
> > +  # Status Code Routing
> > +  #
> > +  INF
> > +
> MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportSt
> atu
> > + sCodeRouterRuntimeDxe.inf
> > +
> > +  #
> > +  # Platform Driver
> > +  #
> > +  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> > +  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
> > +  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> > +  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
> > +
> > +  #
> > +  # UEFI application (Shell Embedded Boot Loader)  #  INF
> > + ShellPkg/Application/Shell/Shell.inf
> > +  INF
> > +
> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.
> inf
> > +  INF
> > +
> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand
> .inf
> > +  INF
> > +
> OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellComma
> n
> > + d.inf
> > +
> > +  #
> > +  # Bds
> > +  #
> > +  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
> > +  INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> > +  INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> > +  INF
> > +
> MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManager
> Dxe
> > + .inf  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > +  INF MdeModulePkg/Application/UiApp/UiApp.inf
> > +  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
> > +
> > +  #
> > +  # SCSI Bus and Disk Driver
> > +  #
> > +  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> > +  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> > +
> > +  #
> > +  # ACPI Support
> > +  #
> > +  INF
> ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> > +!if $(ARCH) == AARCH64
> > +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> > +  INF
> >
> +MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap
> hics
> > +ResourceTableDxe.inf
> > +  INF ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> > +
> > +  #
> > +  # EBC support
> > +  #
> > +  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> > +!endif
> > +
> > +  #
> > +  # PCI support
> > +  #
> > +  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
> > +  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > +  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
> > +  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> > +  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> > +  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
> > +
> > +  #
> > +  # TPM2 support
> > +  #
> > +!if $(TPM2_ENABLE) == TRUE
> > +  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> > +!if $(TPM2_CONFIG_ENABLE) == TRUE
> > +  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> > +!endif
> > +!endif
> > +
> > +  #
> > +  # TianoCore logo (splash screen)
> > +  #
> > +  INF MdeModulePkg/Logo/LogoDxe.inf
> > +
> > +  #
> > +  # Ramdisk support
> > +  #
> > +  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf


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

* Re: [edk2-devel] [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family
  2021-05-19  6:36   ` [edk2-devel] " Laszlo Ersek
@ 2021-05-27  6:23     ` Jianyong Wu
  0 siblings, 0 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-27  6:23 UTC (permalink / raw)
  To: Laszlo Ersek, devel@edk2.groups.io, ardb+tianocore@kernel.org,
	Sami Mujawar
  Cc: hao.a.wu@intel.com, Justin He, Leif Lindholm

Hi Laszlo,

> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Wednesday, May 19, 2021 2:37 PM
> To: devel@edk2.groups.io; Jianyong Wu <Jianyong.Wu@arm.com>;
> ardb+tianocore@kernel.org; Sami Mujawar <Sami.Mujawar@arm.com>
> Cc: hao.a.wu@intel.com; Justin He <Justin.He@arm.com>; Leif Lindholm
> <leif@nuviainc.com>
> Subject: Re: [edk2-devel] [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud
> Hypervisor to edk2 family
>
> On 05/17/21 08:50, Jianyong Wu wrote:
> > Cloud Hypervisor is kvm based VMM and is implemented in rust. Just
> > like other VMMs it need UEFI support to let ACPI work. That's why
> > Cloud Hypervisor is introduced here.
> >
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Leif Lindholm <leif@nuviainc.com>
> > Cc:
>
> (1) Empty CC?
>
> > Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> > ---
> >  ArmVirtPkg/ArmVirtCloudHv.dsc           | 455
> ++++++++++++++++++++++++
> >  ArmVirtPkg/ArmVirtCloudHv.fdf           | 292 +++++++++++++++
> >  ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc | 169 +++++++++
> >  3 files changed, 916 insertions(+)
> >  create mode 100644 ArmVirtPkg/ArmVirtCloudHv.dsc  create mode 100644
> > ArmVirtPkg/ArmVirtCloudHv.fdf  create mode 100644
> > ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> >
> > diff --git a/ArmVirtPkg/ArmVirtCloudHv.dsc
> > b/ArmVirtPkg/ArmVirtCloudHv.dsc new file mode 100644 index
> > 000000000000..bf1f8c5a75ae
> > --- /dev/null
> > +++ b/ArmVirtPkg/ArmVirtCloudHv.dsc
> > @@ -0,0 +1,455 @@
> > +#
> > +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>
> (2) Please update the end year on the ARM (C).
Ok

>
> > +#  Copyright (c) 2014, Linaro Limited. All rights reserved.
> > +#  Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
> > +#
> > +#  SPDX-License-Identifier: BSD-2-Clause-Patent # #
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# Defines Section - statements that will be processed to create a Makefile.
> > +#
> >
> +#########################################################
> ############
> > +###########
> > +[Defines]
> > +  PLATFORM_NAME                  = ArmVirtCloudHv
> > +  PLATFORM_GUID                  = DFFED32B-DFFE-D32B-DFFE-D32BDFFED32B
> > +  PLATFORM_VERSION               = 0.1
> > +  DSC_SPECIFICATION              = 0x00010005
> > +  OUTPUT_DIRECTORY               = Build/ArmVirtCloudHv-$(ARCH)
> > +  SUPPORTED_ARCHITECTURES        = AARCH64|ARM
> > +  BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
> > +  SKUID_IDENTIFIER               = DEFAULT
> > +  FLASH_DEFINITION               = ArmVirtPkg/ArmVirtCloudHv.fdf
> > +
> > +  #
> > +  # Defines for default states.  These can be changed on the command line.
> > +  # -D FLAG=VALUE
> > +  #
> > +  DEFINE TTY_TERMINAL            = FALSE
> > +  DEFINE SECURE_BOOT_ENABLE      = FALSE
> > +  DEFINE TPM2_ENABLE             = FALSE
> > +  DEFINE TPM2_CONFIG_ENABLE      = FALSE
> > +
> > +!include ArmVirtPkg/ArmVirt.dsc.inc
> > +
> > +[LibraryClasses.common]
> > +  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
> > +  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
> > +
> > +  # Virtio Support
> > +  VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
> > +
> > +
> VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDe
> > + viceLib.inf
> > + QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
> > +
> > +
> QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3Li
> bNull
> > + .inf
> > +
> QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/
> Qe
> > + muFwCfgSimpleParserLib.inf
> > +
> QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/Generic
> Qemu
> > + LoadImageLib.inf
> > +
> > +
> > +
> ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatform
> > + LibNull.inf
> > +
> > +  TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
> > +
> > +
> CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.
> > + inf  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
> > +
> > +
> PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/Pla
> > + tformBootManagerLib.inf
> > +
> PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBm
> > + PrintScLib.inf
> > +
> CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Custo
> > + mizedDisplayLib.inf
> > +
> FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBuffer
> > + BltLib.inf
> > +
> QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrder
> Lib.i
> > + nf
> > + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib
> > + .inf
> > + PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdP
> > + roducerLib.inf
> > +
> PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibP
> > + ci.inf
> > + PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBr
> > + idgeLib.inf
> > + PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciH
> > + ostBridgeUtilityLib.inf
> > +
> > +!if $(TPM2_ENABLE) == TRUE
> > +
> >
> +Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2Command
> Lib.inf
> > +
> >
> +Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/
> D
> > +xeTcg2PhysicalPresenceLib.inf
> > +
> >
> +TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeT
> pmMeas
> > +urementLib.inf
> > +!else
> > +
> >
> +TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/T
> pmMeasu
> > +rementLibNull.inf
> > +!endif
> > +
> > +!include MdePkg/MdeLibs.dsc.inc
> > +
> > +[LibraryClasses.common.PEIM]
> > +
> >
> +ArmVirtMemInfoLib|ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHv
> Vir
> > +tMemInfoPeiLib.inf
> > +
> > +!if $(TPM2_ENABLE) == TRUE
> > +  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> > +
> >
> +ResetSystemLib|MdeModulePkg/Library/PeiResetSystemLib/PeiResetSyst
> emL
> > +ib.inf
> > +
> >
> +Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibD
> Tpm
> > +.inf
> > +!endif
> > +
> > +[LibraryClasses.common.DXE_DRIVER]
> > +
> >
> +ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/D
> xeRe
> > +portStatusCodeLib.inf
> > +
> > +!if $(TPM2_ENABLE) == TRUE
> > +
> >
> +Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg
> 2
> > +.inf
> > +!endif
> > +
> > +[LibraryClasses.common.UEFI_DRIVER]
> > +  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
> > +
> > +[BuildOptions]
> > +!include NetworkPkg/NetworkBuildOptions.dsc.inc
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# Pcd Section - list of all EDK II PCD Entries defined by this
> > +Platform #
> >
> +#########################################################
> ############
> > +###########
> > +
> > +[PcdsFeatureFlag.common]
> > +  gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation|TRUE
> > +
> gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation|TRUE
> > +
> > +  ## If TRUE, Graphics Output Protocol will be installed on virtual handle
> created by ConsplitterDxe.
> > +  #  It could be set FALSE to save size.
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
> > +
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
> > +
> > +  gArmVirtTokenSpaceGuid.PcdTpm2SupportEnabled|$(TPM2_ENABLE)
> > +
> > +[PcdsFixedAtBuild.common]
> > +!if $(ARCH) == AARCH64
> > +  gArmTokenSpaceGuid.PcdVFPEnabled|1
> > +!endif
> > +
> > +  gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4007c000
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
> > +  gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> > +
> > +  # Rsdp base address in Cloud Hypervisor
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress|0x40200000
> > +
> > +
> >
> +gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x40
> 0000
> > +0
> > +
> >
> +gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x400
> 00
> > +!if $(NETWORK_TLS_ENABLE) == TRUE
> > +  #
> > +  # The cumulative and individual VOLATILE variable size limits
> > +should be set
> > +  # high enough for accommodating several and/or large CA certificates.
> > +  #
> > +  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x80000
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize|0x40000
> > +!endif
> > +
> > +  # Size of the region used by UEFI in permanent memory (Reserved
> > + 64MB)
> > +
> gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x040000
> 00
> > +
> > +  #
> > +  # ARM PrimeCell
> > +  #
> > +
> > +  ## PL011 - Serial Terminal
> > +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|38400
> > +
> > +  ## Default Terminal Type
> > +  ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM !if
> > +$(TTY_TERMINAL) == TRUE
> > +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
> > +  # Set terminal type to TtyTerm, the value encoded is
> > +EFI_TTY_TERM_GUID
> > +  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d,
> 0x91,
> > +0x7d, 0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51,
> > +0xef, 0x94} !else
> > +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|1
> > +!endif
> > +
> > +  # System Memory Base -- fixed at 0x4000_0000
> > +  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x40000000
> > +
> > +  # initial location of the device tree blob passed by Cloud
> > + Hypervisor -- base of DRAM
> > +  gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x40000000
> > +
> > +
> > +
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationC
> hange
> > + |FALSE
> gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{
> > + 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a,
> > + 0xb6, 0xf4, 0x66, 0x23, 0x31 }
> > +
> > +  #
> > +  # The maximum physical I/O addressability of the processor, set
> > + with  # BuildCpuHob().
> > +  #
> > +  gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16
> > +
> > +  #
> > +  # Enable the non-executable DXE stack. (This gets set up by DxeIpl)
> > + #  gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE
> > +
> > +!if $(SECURE_BOOT_ENABLE) == TRUE
> > +  # override the default values from SecurityPkg to ensure images
> > +from all sources are verified in secure boot
> > +
> >
> +gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x
> 0
> > +4
> > +
> >
> +gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x
> > +04
> > +
> >
> +gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPoli
> c
> > +y|0x04
> > +!endif
> > +
> > +  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|3
> > +  gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x20000
> > +
> > +[PcdsFixedAtBuild.AARCH64]
> > +  # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS
> > +entry point,
> > +  # if the entry point version is >= 3.0. AARCH64 OSes cannot assume
> > +the
> > +  # presence of the 32-bit entry point anyway (because many AARCH64
> > +systems
> > +  # don't have 32-bit addressable physical RAM), and the additional
> > +allocations
> > +  # below 4 GB needlessly fragment the memory map. So expose the
> > +64-bit entry
> > +  # point only, for entry point versions >= 3.0.
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosEntryPointProvideMethod|0
> x2
> > +
> > +[PcdsDynamicDefault.common]
> > +  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
> > +
> > +  ## If TRUE, OvmfPkg/AcpiPlatformDxe will not wait for PCI  #
> > + enumeration to complete before installing ACPI tables.
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
> > +
> > +  # System Memory Size -- 1 MB initially, actual size will be fetched
> > + from DT
> > +  gArmTokenSpaceGuid.PcdSystemMemorySize|0x00100000
> > +
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
> > +
> > +  gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0
> > +  gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
> > +  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
> > +  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
> > +
> > +  #
> > +  # ARM General Interrupt Controller
> > +  #
> > +  gArmTokenSpaceGuid.PcdGicDistributorBase|0x0
> > +  gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x0
> > +  gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x0
> > +
> > +  ## PL031 RealTimeClock
> > +  gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
> > +
> > +  # set PcdPciExpressBaseAddress to MAX_UINT64, which signifies that
> > + this  # PCD and PcdPciDisableBusEnumeration above have not been
> > + assigned yet
> > +
> gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFF
> FF
> > +
> > +  gArmTokenSpaceGuid.PcdPciIoTranslation|0
> > +#  gArmTokenSpaceGuid.PcdPciIoTranslation|0x50000000
> > +
> > +  #
> > +  # TPM2 support
> > +  #
> > +  gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0
> > +!if $(TPM2_ENABLE) == TRUE
> > +  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00,
> > +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > +0x00, 0x00}
> > +  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0
> > +!endif
> > +
> > +[PcdsDynamicHii]
> > +
> >
> +gArmVirtTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gArmVirtVaria
> ble
> > +Guid|0x0|FALSE|NV,BS
> > +
> > +!if $(TPM2_CONFIG_ENABLE) == TRUE
> > +
> >
> +gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TC
> > +G2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS
> > +
> >
> +gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"
> |gTc
> > +g2ConfigFormSetGuid|0x8|3|NV,BS
> > +!endif
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# Components Section - list of all EDK II Modules needed by this
> > +Platform #
> >
> +#########################################################
> ############
> > +###########
> > +[Components.common]
> > +  #
> > +  # PEI Phase modules
> > +  #
> > +  ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
> > +  MdeModulePkg/Core/Pei/PeiMain.inf
> > +  MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
> > +    <LibraryClasses>
> > +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> > +  }
> > +  ArmPlatformPkg/PlatformPei/PlatformPeim.inf
> > +  ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
> > +  ArmPkg/Drivers/CpuPei/CpuPei.inf
> > +
> > +  MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
> > +
> > +!if $(TPM2_ENABLE) == TRUE
> > +  MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf {
> > +    <LibraryClasses>
> > +
> >
> +ResetSystemLib|ArmVirtPkg/Library/ArmVirtPsciResetSystemPeiLib/ArmVi
> r
> > +tPsciResetSystemPeiLib.inf
> > +  }
> > +  OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> > +  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf {
> > +    <LibraryClasses>
> > +
> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoR
> outerPei.inf
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.in
> f
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.in
> f
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.in
> f
> > +
> > +NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
> > +  }
> > +!endif
> > +
> > +  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
> > +    <LibraryClasses>
> > +
> > +
> NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDec
> ompre
> > + ssLib.inf
> > +  }
> > +
> > +  #
> > +  # DXE
> > +  #
> > +  MdeModulePkg/Core/Dxe/DxeMain.inf {
> > +    <LibraryClasses>
> > +
> NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32G
> uidedSectionExtractLib.inf
> > +
> > + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> > +  }
> > +  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
> > +    <LibraryClasses>
> > +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> > +  }
> > +
> > +  #
> > +  # Architectural Protocols
> > +  #
> > +  ArmPkg/Drivers/CpuDxe/CpuDxe.inf
> > +  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> > +
> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
> > +    <LibraryClasses>
> > +      NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
> > +      # don't use unaligned CopyMem () on the UEFI varstore NOR flash
> region
> > +
> BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
> > +  }
> > +!if $(SECURE_BOOT_ENABLE) == TRUE
> > +  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
> > +    <LibraryClasses>
> > +
> > +NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerification
> > +Lib.inf
> > +!if $(TPM2_ENABLE) == TRUE
> > +
> >
> +NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBo
> otLib.
> > +inf
> > +!endif
> > +  }
> > +
> >
> +SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf
> i
> > +gDxe.inf
> > +  OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf
> > +!else
> > +  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> > +!endif
> > +  MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> > +
> >
> +MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i
> n
> > +f
> > +
> >
> +MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCou
> nterRun
> > +timeDxe.inf
> > +
> >
> +MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
> Dxe.in
> > +f
> > +
> EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf {
> > +    <LibraryClasses>
> > +
> >
> +NULL|ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClien
> > +tLib.inf
> > +  }
> > +  EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> > +
> > +
> MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> > +  MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> > +
> > +
> MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleD
> xe
> > + .inf  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> > +  MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> > +
> > +  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> > +
> > +  ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> > +  ArmPkg/Drivers/TimerDxe/TimerDxe.inf {
> > +    <LibraryClasses>
> > +
> > + NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClie
> > + ntLib.inf
> > +  }
> > +  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> > +
> > +  #
> > +  # Status Code Routing
> > +  #
> > +
> > +
> MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportSt
> atu
> > + sCodeRouterRuntimeDxe.inf
> > +
> > +  #
> > +  # Platform Driver
> > +  #
> > +  ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> > +  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> > +  ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> > +  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> > +  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> > +  OvmfPkg/VirtioNetDxe/VirtioNet.inf
> > +  OvmfPkg/VirtioRngDxe/VirtioRng.inf
> > +
> > +  #
> > +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem +
> > + virtio-fs  #  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> > +  MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> > +
> > +
> MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i
> > + nf
> > +  FatPkg/EnhancedFatDxe/Fat.inf
> > +  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> > +  OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> > +
> > +  #
> > +  # Bds
> > +  #
> > +  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
> > +    <LibraryClasses>
> > +
> DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> > +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> > +  }
> > +  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> > +  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> > +
> > +
> MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManager
> Dxe
> > + .inf  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > +  MdeModulePkg/Logo/LogoDxe.inf
> > +  MdeModulePkg/Application/UiApp/UiApp.inf {
> > +    <LibraryClasses>
> > +
> NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
> > +
> NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
> > +
> > +
> NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMainte
> nanc
> > + eManagerUiLib.inf
> > +  }
> > +  OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
> > +
> > +  #
> > +  # SCSI Bus and Disk Driver
> > +  #
> > +  MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> > +  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> > +
> > +  #
> > +  # PCI support
> > +  #
> > +  ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
> > +    <LibraryClasses>
> > +
> > + NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.in
> > + f
> > +  }
> > +  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > +  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
> > +    <LibraryClasses>
> > +
> > + NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.in
> > + f
> > +  }
> > +  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> > +  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> > +  OvmfPkg/Virtio10Dxe/Virtio10.inf
> > +
> > +  #
> > +  # TPM2 support
> > +  #
> > +!if $(TPM2_ENABLE) == TRUE
> > +  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf {
> > +    <LibraryClasses>
> > +
> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoR
> outerDxe.inf
> > +
> Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibR
> outerDxe.inf
> > +
> NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.in
> f
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.in
> f
> > +
> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.in
> f
> > +
> > +NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
> > +  }
> > +!if $(TPM2_CONFIG_ENABLE) == TRUE
> > +  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> > +!endif
> > +!endif
> > +
> > +  #
> > +  # ACPI Support
> > +  #
> > +  ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> > +[Components.AARCH64]
> > +
> >
> +MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap
> hics
> > +ResourceTableDxe.inf
> > +  ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf {
> > +    <LibraryClasses>
> > +
> >
> +NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
> > +  }
> > diff --git a/ArmVirtPkg/ArmVirtCloudHv.fdf
> > b/ArmVirtPkg/ArmVirtCloudHv.fdf new file mode 100644 index
> > 000000000000..3619a09ba8c5
> > --- /dev/null
> > +++ b/ArmVirtPkg/ArmVirtCloudHv.fdf
> > @@ -0,0 +1,292 @@
> > +#
> > +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>
> (3) Please update the end year on the ARM (C).
Ok

>
>
> > +#  Copyright (c) 2014, Linaro Limited. All rights reserved.
> > +#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> > +#
> > +#  SPDX-License-Identifier: BSD-2-Clause-Patent #
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# FD Section
> > +# The [FD] Section is made up of the definition statements and a #
> > +description of what goes into  the Flash Device Image.  Each FD
> > +section # defines one flash "device" image.  A flash device image may
> > +be one of # the following: Removable media bootable image (like a
> > +boot floppy # image,) an Option ROM image (that would be "flashed"
> > +into an add-in # card,) a System "Flash"  image (that would be burned
> > +into a system's # flash) or an Update ("Capsule") image that will be
> > +used to update and # existing system flash.
> > +#
> >
> +#########################################################
> ############
> > +###########
> > +
> > +[Defines]
> > +!if $(FD_SIZE_IN_MB) == 2
> > +  DEFINE FVMAIN_COMPACT_SIZE  = 0x1ff000 !endif !if $(FD_SIZE_IN_MB)
> > +== 3
> > +  DEFINE FVMAIN_COMPACT_SIZE  = 0x2ff000 !endif
> > +
> > +[FD.CLOUDHV_EFI]
> > +BaseAddress   = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress  #
> cloud-hypervisor assigns 0 - 0x8000000 for a BootROM
> > +Size          = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize         # The size in
> bytes of the FLASH Device
> > +ErasePolarity = 1
> > +
> > +# This one is tricky, it must be: BlockSize * NumBlocks = Size
> > +BlockSize     = 0x00001000
> > +NumBlocks     = $(FD_NUM_BLOCKS)
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# Following are lists of FD Region layout which correspond to the
> > +locations of different # images within the flash device.
> > +#
> > +# Regions must be defined in ascending order and may not overlap.
> > +#
> > +# A Layout Region start with a eight digit hex offset (leading "0x"
> > +required) followed by # the pipe "|" character, followed by the size
> > +of the region, also in hex with the leading # "0x" characters. Like:
> > +# Offset|Size
> > +# PcdOffsetCName|PcdSizeCName
> > +# RegionType <FV, DATA, or FILE>
> > +#
> >
> +#########################################################
> ############
> > +###########
> > +
> > +#
> > +# UEFI has trouble dealing with FVs that reside at physical address 0x0.
> > +# So instead, put a hardcoded 'jump to 0x1000' at offset 0x0, and put
> > +the # real FV at offset 0x1000 #
> > +0x00000000|0x00001000
> > +DATA = {
> > +!if $(ARCH) == AARCH64
> > +  0x00, 0x04, 0x00, 0x14   # 'b 0x1000' in AArch64 ASM
> > +!else
> > +  0xfe, 0x03, 0x00, 0xea   # 'b 0x1000' in AArch32 ASM
> > +!endif
> > +}
> > +
> > +0x00001000|$(FVMAIN_COMPACT_SIZE)
> >
> +gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> > +FV = FVMAIN_COMPACT
> > +
> > +!include VarStore.fdf.inc
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# FV Section
> > +#
> > +# [FV] section is used to define what components or modules are
> > +placed within a flash # device file.  This section also defines order
> > +the components and modules are positioned # within the image.  The
> > +[FV] section consists of define statements, set statements and # module
> statements.
> > +#
> >
> +#########################################################
> ############
> > +###########
> > +
> > +#!include ArmVirtCloudHvFvMain.fdf.inc
>
> (4) This '!include' directive, together with the
> "ArmVirtCloudHvFvMain.fdf.inc" file, should have been dropped from the
> patch, as the FvMain firmware volume's description (GUID
> 2A88A00E-E267-C8BF-0E80-AE1BD504ED90) is already included (embedded)
> in "ArmVirtCloudHv.fdf".
>
Sure, it's my fault.

> > +
> > +
> > +
> > +[FV.FvMain]
> > +FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
> > +BlockSize          = 0x40
> > +NumBlocks          = 0         # This FV gets compressed so make it just big
> enough
> > +FvAlignment        = 16        # FV alignment and FV attributes setting.
> > +ERASE_POLARITY     = 1
> > +MEMORY_MAPPED      = TRUE
> > +STICKY_WRITE       = TRUE
> > +LOCK_CAP           = TRUE
> > +LOCK_STATUS        = TRUE
> > +WRITE_DISABLED_CAP = TRUE
> > +WRITE_ENABLED_CAP  = TRUE
> > +WRITE_STATUS       = TRUE
> > +WRITE_LOCK_CAP     = TRUE
> > +WRITE_LOCK_STATUS  = TRUE
> > +READ_DISABLED_CAP  = TRUE
> > +READ_ENABLED_CAP   = TRUE
> > +READ_STATUS        = TRUE
> > +READ_LOCK_CAP      = TRUE
> > +READ_LOCK_STATUS   = TRUE
> > +
> > +  INF MdeModulePkg/Core/Dxe/DxeMain.inf  INF
> > + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> > +  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> > +  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> > +  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> > +
> > +  #
> > +  # PI DXE Drivers producing Architectural Protocols (EFI Services)
> > +  #
> > +  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
> > +  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> > +  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> > +  INF
> MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> > +  INF
> >
> +MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i
> n
> > +f
> > +  INF
> >
> +MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
> > +!if $(SECURE_BOOT_ENABLE) == TRUE
> > +  INF
> >
> +SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf
> i
> > +gDxe.inf
> > +!endif
> > +  INF
> >
> +MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCou
> nterRun
> > +timeDxe.inf
> > +  INF
> >
> +MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
> Dxe.in
> > +f
> > +  INF
> EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
> > +  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> > +  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> > +
> > +  #
> > +  # Multiple Console IO support
> > +  #
> > +  INF
> > +
> MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> > +  INF
> > + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> > +  INF
> > +
> MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleD
> xe
> > + .inf  INF
> MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> > +  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> > +
> > +  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> > +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
> > +  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> > +
> > +  #
> > +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem +
> > + virtio-fs  #  INF
> > + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> > +  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> > +  INF FatPkg/EnhancedFatDxe/Fat.inf
> > +  INF
> > +
> MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i
> > + nf  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> > +  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> > +
> > +  #
> > +  # Status Code Routing
> > +  #
> > +  INF
> > +
> MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportSt
> atu
> > + sCodeRouterRuntimeDxe.inf
> > +
> > +  #
> > +  # Platform Driver
> > +  #
> > +  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> > +  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
> > +  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> > +  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
> > +
> > +  #
> > +  # UEFI application (Shell Embedded Boot Loader)  #  INF
> > + ShellPkg/Application/Shell/Shell.inf
> > +  INF
> > +
> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.
> inf
> > +  INF
> > +
> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand
> .inf
> > +  INF
> > +
> OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellComma
> n
> > + d.inf
> > +
> > +  #
> > +  # Bds
> > +  #
> > +  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
> > +  INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> > +  INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> > +  INF
> > +
> MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManager
> Dxe
> > + .inf  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > +  INF MdeModulePkg/Application/UiApp/UiApp.inf
> > +  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
> > +
> > +  #
> > +  # SCSI Bus and Disk Driver
> > +  #
> > +  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> > +  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> > +
> > +  #
> > +  # ACPI Support
> > +  #
> > +  INF
> ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> > +!if $(ARCH) == AARCH64
> > +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> > +  INF
> >
> +MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap
> hics
> > +ResourceTableDxe.inf
> > +  INF ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> > +
> > +  #
> > +  # EBC support
> > +  #
> > +  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> > +!endif
> > +
> > +  #
> > +  # PCI support
> > +  #
> > +  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
> > +  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > +  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
> > +  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> > +  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> > +  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
> > +
> > +  #
> > +  # TPM2 support
> > +  #
> > +!if $(TPM2_ENABLE) == TRUE
> > +  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> > +!if $(TPM2_CONFIG_ENABLE) == TRUE
> > +  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> > +!endif
> > +!endif
> > +
> > +  #
> > +  # TianoCore logo (splash screen)
> > +  #
> > +  INF MdeModulePkg/Logo/LogoDxe.inf
> > +
> > +  #
> > +  # Ramdisk support
> > +  #
> > +  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
> > +
>
> (5) I guess this is where the content pasted from
> "ArmVirtCloudHvFvMain.fdf.inc" ends, and you made some room for that
> content in advance -- but these empty lines should have been removed
> ultimately.
>
> Please review your own patches carefully before posting them to the list.
>
Thanks Laszlo, I'll be more carefully.

Thanks
Jianyong

> Laszlo
>
> > +[FV.FVMAIN_COMPACT]
> > +FvAlignment        = 16
> > +ERASE_POLARITY     = 1
> > +MEMORY_MAPPED      = TRUE
> > +STICKY_WRITE       = TRUE
> > +LOCK_CAP           = TRUE
> > +LOCK_STATUS        = TRUE
> > +WRITE_DISABLED_CAP = TRUE
> > +WRITE_ENABLED_CAP  = TRUE
> > +WRITE_STATUS       = TRUE
> > +WRITE_LOCK_CAP     = TRUE
> > +WRITE_LOCK_STATUS  = TRUE
> > +READ_DISABLED_CAP  = TRUE
> > +READ_ENABLED_CAP   = TRUE
> > +READ_STATUS        = TRUE
> > +READ_LOCK_CAP      = TRUE
> > +READ_LOCK_STATUS   = TRUE
> > +
> > +  INF ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
> > +  INF MdeModulePkg/Core/Pei/PeiMain.inf  INF
> > + ArmPlatformPkg/PlatformPei/PlatformPeim.inf
> > +  INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
> > +  INF ArmPkg/Drivers/CpuPei/CpuPei.inf  INF
> > + MdeModulePkg/Universal/PCD/Pei/Pcd.inf
> > +  INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
> > +  INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
> > +
> > +!if $(TPM2_ENABLE) == TRUE
> > +  INF MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf
> > +  INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> > +  INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
> > +!endif
> > +
> > +  FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
> > +    SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF
> PROCESSING_REQUIRED = TRUE {
> > +      SECTION FV_IMAGE = FVMAIN
> > +    }
> > +  }
> > +
> > +!include ArmVirtRules.fdf.inc
> > diff --git a/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> > b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> > new file mode 100644
> > index 000000000000..51041e889ef4
> > --- /dev/null
> > +++ b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> > @@ -0,0 +1,169 @@
> > +#
> > +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> > +#  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
> > +#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
> > +#
> > +#  SPDX-License-Identifier: BSD-2-Clause-Patent #
> > +
> >
> +#########################################################
> ############
> > +###########
> > +#
> > +# FV Section
> > +#
> > +# [FV] section is used to define what components or modules are
> > +placed within a flash # device file.  This section also defines order
> > +the components and modules are positioned # within the image.  The
> > +[FV] section consists of define statements, set statements and # module
> statements.
> > +#
> >
> +#########################################################
> ############
> > +###########
> > +
> > +[FV.FvMain]
> > +FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
> > +BlockSize          = 0x40
> > +NumBlocks          = 0         # This FV gets compressed so make it just big
> enough
> > +FvAlignment        = 16        # FV alignment and FV attributes setting.
> > +ERASE_POLARITY     = 1
> > +MEMORY_MAPPED      = TRUE
> > +STICKY_WRITE       = TRUE
> > +LOCK_CAP           = TRUE
> > +LOCK_STATUS        = TRUE
> > +WRITE_DISABLED_CAP = TRUE
> > +WRITE_ENABLED_CAP  = TRUE
> > +WRITE_STATUS       = TRUE
> > +WRITE_LOCK_CAP     = TRUE
> > +WRITE_LOCK_STATUS  = TRUE
> > +READ_DISABLED_CAP  = TRUE
> > +READ_ENABLED_CAP   = TRUE
> > +READ_STATUS        = TRUE
> > +READ_LOCK_CAP      = TRUE
> > +READ_LOCK_STATUS   = TRUE
> > +
> > +  INF MdeModulePkg/Core/Dxe/DxeMain.inf  INF
> > + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> > +  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> > +  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> > +  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> > +
> > +  #
> > +  # PI DXE Drivers producing Architectural Protocols (EFI Services)
> > +  #
> > +  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
> > +  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> > +  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> > +  INF
> MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> > +  INF
> >
> +MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i
> n
> > +f
> > +  INF
> >
> +MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
> > +!if $(SECURE_BOOT_ENABLE) == TRUE
> > +  INF
> >
> +SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf
> i
> > +gDxe.inf
> > +!endif
> > +  INF
> >
> +MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCou
> nterRun
> > +timeDxe.inf
> > +  INF
> >
> +MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
> Dxe.in
> > +f
> > +  INF
> EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
> > +  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> > +  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> > +
> > +  #
> > +  # Multiple Console IO support
> > +  #
> > +  INF
> > +
> MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> > +  INF
> > + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> > +  INF
> > +
> MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleD
> xe
> > + .inf  INF
> MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> > +  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> > +
> > +  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> > +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
> > +  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> > +
> > +  #
> > +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem +
> > + virtio-fs  #  INF
> > + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> > +  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> > +  INF FatPkg/EnhancedFatDxe/Fat.inf
> > +  INF
> > +
> MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i
> > + nf  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> > +  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> > +
> > +  #
> > +  # Status Code Routing
> > +  #
> > +  INF
> > +
> MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportSt
> atu
> > + sCodeRouterRuntimeDxe.inf
> > +
> > +  #
> > +  # Platform Driver
> > +  #
> > +  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> > +  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
> > +  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> > +  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
> > +
> > +  #
> > +  # UEFI application (Shell Embedded Boot Loader)  #  INF
> > + ShellPkg/Application/Shell/Shell.inf
> > +  INF
> > +
> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.
> inf
> > +  INF
> > +
> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand
> .inf
> > +  INF
> > +
> OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellComma
> n
> > + d.inf
> > +
> > +  #
> > +  # Bds
> > +  #
> > +  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
> > +  INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> > +  INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> > +  INF
> > +
> MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManager
> Dxe
> > + .inf  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> > +  INF MdeModulePkg/Application/UiApp/UiApp.inf
> > +  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
> > +
> > +  #
> > +  # SCSI Bus and Disk Driver
> > +  #
> > +  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> > +  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> > +
> > +  #
> > +  # ACPI Support
> > +  #
> > +  INF
> ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> > +!if $(ARCH) == AARCH64
> > +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> > +  INF
> >
> +MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap
> hics
> > +ResourceTableDxe.inf
> > +  INF ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> > +
> > +  #
> > +  # EBC support
> > +  #
> > +  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> > +!endif
> > +
> > +  #
> > +  # PCI support
> > +  #
> > +  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
> > +  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > +  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
> > +  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> > +  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> > +  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
> > +
> > +  #
> > +  # TPM2 support
> > +  #
> > +!if $(TPM2_ENABLE) == TRUE
> > +  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> > +!if $(TPM2_CONFIG_ENABLE) == TRUE
> > +  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> > +!endif
> > +!endif
> > +
> > +  #
> > +  # TianoCore logo (splash screen)
> > +  #
> > +  INF MdeModulePkg/Logo/LogoDxe.inf
> > +
> > +  #
> > +  # Ramdisk support
> > +  #
> > +  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
> >

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

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

* Re: [PATCH v2 5/5] Maintainers: update Maintainers file as new files/folders created
  2021-05-19  6:55     ` Laszlo Ersek
@ 2021-05-27  6:28       ` Jianyong Wu
  0 siblings, 0 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-27  6:28 UTC (permalink / raw)
  To: Laszlo Ersek, Sami Mujawar; +Cc: Justin He, nd, devel@edk2.groups.io

Hi Sami, Laszlo,

Sorry for late reply, thanks for nice review work from both of you. Very helpful for me.

Thanks
Jianyong

> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Wednesday, May 19, 2021 2:55 PM
> To: Sami Mujawar <Sami.Mujawar@arm.com>; Jianyong Wu
> <Jianyong.Wu@arm.com>; devel@edk2.groups.io;
> ardb+tianocore@kernel.org
> Cc: hao.a.wu@intel.com; Justin He <Justin.He@arm.com>; nd <nd@arm.com>
> Subject: Re: [PATCH v2 5/5] Maintainers: update Maintainers file as new
> files/folders created
> 
> Hi Sami,
> 
> On 05/18/21 22:26, Sami Mujawar wrote:
> > Hi Jianyon,
> >
> > Thank you for including this patch in the series. There is a patch on
> > the mailing list to add me as a reviewer for ArmVirtPkg at package level.
> > Therefore, this patch would no longer be needed. Apologies for not
> > communicating this to you earlier.
> 
> thank you for reviewing this patch series -- I'm really happy about your
> careful review! I did my own (superficial) review as first thing this morning,
> before looking at my new mail, and I highly appreciate that you provided an
> in-depth review before I asked!
> 
> Kudos!
> Laszlo
> 
> 
> >
> > Regards,
> >
> > Sami Mujawar
> >
> >
> > On 17/05/2021 07:50 AM, Jianyong Wu wrote:
> >> Create new entry for Cloud Hypervisor and assign reviewer to Sami
> >> Mujawar.
> >>
> >> Cc: Sami Mujawar <sami.mujawar@arm.com>
> >> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> >> ---
> >>   Maintainers.txt | 7 +++++++
> >>   1 file changed, 7 insertions(+)
> >>
> >> diff --git a/Maintainers.txt b/Maintainers.txt index
> >> cafe6b1ab85d..f8fae067c656 100644
> >> --- a/Maintainers.txt
> >> +++ b/Maintainers.txt
> >> @@ -167,6 +167,13 @@ F: ArmVirtPkg/Library/KvmtoolVirtMemInfoLib/
> >>   F: ArmVirtPkg/Library/NorFlashKvmtoolLib/
> >>   R: Sami Mujawar <sami.mujawar@arm.com>
> >>   +ArmVirtPkg: Cloud Hypervisor emulated platform support
> >> +F: ArmVirtPkg/ArmVirtCloudHv*
> >> +F: ArmVirtPkg/CloudHvAcpiPlatformDxe/
> >> +F: ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/
> >> +F: ArmVirtPkg/Library/CloudHvVirtMemInfoLib/
> >> +R: Sami Mujawar <sami.mujawar@arm.com>
> >> +
> >>   BaseTools
> >>   F: BaseTools/
> >>   W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
> >


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

* Re: [edk2-devel] [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor
  2021-05-19  6:11     ` Laszlo Ersek
@ 2021-05-27  6:39       ` Jianyong Wu
  0 siblings, 0 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-05-27  6:39 UTC (permalink / raw)
  To: Laszlo Ersek, devel@edk2.groups.io, ardb+tianocore@kernel.org,
	Sami Mujawar
  Cc: hao.a.wu@intel.com, Justin He, Leif Lindholm

Hi Laszlo,

Based on comments from Sami, maybe I need remove this patch and reuse the qemu memory initialization lib code. Thank for your comments.

Thanks
Jianyong

> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Wednesday, May 19, 2021 2:12 PM
> To: devel@edk2.groups.io; Jianyong Wu <Jianyong.Wu@arm.com>;
> ardb+tianocore@kernel.org; Sami Mujawar <Sami.Mujawar@arm.com>
> Cc: hao.a.wu@intel.com; Justin He <Justin.He@arm.com>; Leif Lindholm
> <leif@nuviainc.com>
> Subject: Re: [edk2-devel] [PATCH v2 1/5] ArmVirtPkg: Library: Memory
> initialization for Cloud Hypervisor
>
> Sorry, just noticed:
>
> On 05/19/21 08:07, Laszlo Ersek wrote:
> > On 05/17/21 08:50, Jianyong Wu wrote:
> >> Cloud Hypervisor is kvm based VMM implemented in rust.
> >>
> >> This library populates the system memory map for the Cloud Hypervisor
> >> virtual platform.
> >>
> >> Cc: Laszlo Ersek <lersek@redhat.com>
> >> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> >> Cc: Leif Lindholm <leif@nuviainc.com>
> >> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> >> ---
> >>  .../CloudHvVirtMemInfoPeiLib.inf              |  47 ++++++++
> >>  .../CloudHvVirtMemInfoLib.c                   |  94 ++++++++++++++++
> >>  .../CloudHvVirtMemInfoPeiLibConstructor.c     | 100
> ++++++++++++++++++
> >>  3 files changed, 241 insertions(+)
> >>  create mode 100644
> >>
> ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
> >>  create mode 100644
> >> ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
> >>  create mode 100644
> >>
> ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibCon
> s
> >> tructor.c
> >>
> >> diff --git
> >>
> a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.i
> >> nf
> >>
> b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.i
> >> nf
> >> new file mode 100644
> >> index 000000000000..71dbf9c06ccc
> >> --- /dev/null
> >> +++
> b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiL
> >> +++ ib.inf
> >> @@ -0,0 +1,47 @@
> >> +#/* @file
> >> +#
> >> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> >
> > (1) New file, please refresh the end year in the (C) notice.

> >
> >> +#  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> >> +#
> >> +#  SPDX-License-Identifier: BSD-2-Clause-Patent # #*/
> >> +
> >> +[Defines]
> >> +  INF_VERSION                    = 0x0001001A
> >> +  BASE_NAME                      = ClhVirtMemInfoPeiLib
>
> (4) s/Clh/CloudHv/
>
> Thanks
> Laszlo
>
> >> +  FILE_GUID                      = 3E29D940-0591-EE6A-CAD4-223A9CF55E75
> >> +  MODULE_TYPE                    = BASE
> >> +  VERSION_STRING                 = 1.0
> >> +  LIBRARY_CLASS                  = ArmVirtMemInfoLib|PEIM
> >> +  CONSTRUCTOR                    = CloudHvVirtMemInfoPeiLibConstructor
> >> +
> >> +[Sources]
> >> +  CloudHvVirtMemInfoLib.c
> >> +  CloudHvVirtMemInfoPeiLibConstructor.c
> >> +
> >> +[Packages]
> >> +  ArmPkg/ArmPkg.dec
> >> +  ArmVirtPkg/ArmVirtPkg.dec
> >> +  EmbeddedPkg/EmbeddedPkg.dec
> >> +  MdeModulePkg/MdeModulePkg.dec
> >> +  MdePkg/MdePkg.dec
> >> +
> >> +[LibraryClasses]
> >> +  ArmLib
> >> +  BaseMemoryLib
> >> +  DebugLib
> >> +  FdtLib
> >> +  PcdLib
> >> +  MemoryAllocationLib
> >> +
> >> +[Pcd]
> >> +  gArmTokenSpaceGuid.PcdFdBaseAddress
> >> +  gArmTokenSpaceGuid.PcdFvBaseAddress
> >> +  gArmTokenSpaceGuid.PcdSystemMemoryBase
> >> +  gArmTokenSpaceGuid.PcdSystemMemorySize
> >> +
> >> +[FixedPcd]
> >> +  gArmTokenSpaceGuid.PcdFdSize
> >> +  gArmTokenSpaceGuid.PcdFvSize
> >> +  gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
> >> diff --git
> >> a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
> >> b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
> >> new file mode 100644
> >> index 000000000000..69f4e6ab6cc4
> >> --- /dev/null
> >> +++
> b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.
> >> +++ c
> >> @@ -0,0 +1,94 @@
> >> +/** @file
> >> +
> >> +  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> >
> > (2) New file, ARM (C) missing.
> >
> >> +
> >> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> >> +
> >> +**/
> >> +
> >> +#include <Base.h>
> >> +#include <Library/ArmLib.h>
> >> +#include <Library/BaseMemoryLib.h>
> >> +#include <Library/DebugLib.h>
> >> +#include <Library/MemoryAllocationLib.h>
> >> +
> >> +// Number of Virtual Memory Map Descriptors
> >> +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS          5
> >> +
> >> +//
> >> +// mach-virt's core peripherals such as the UART, the GIC and the
> >> +RTC are // all mapped in the 'miscellaneous device I/O' region,
> >> +which we just map // in its entirety rather than device by device.
> >> +Note that it does not // cover any of the NOR flash banks or PCI resource
> windows.
> >> +//
> >> +#define MACH_VIRT_PERIPH_BASE       0x08000000
> >> +#define MACH_VIRT_PERIPH_SIZE       SIZE_128MB
> >> +
> >> +//
> >> +// in cloud-hypervisor, 0x0 ~ 0x8000000 is reserved as normal memory
> >> +for UEFI //
> >> +#define CLOUDHV_UEFI_MEM_BASE       0x0
> >> +#define CLOUDHV_UEFI_MEM_SIZE       0x08000000
> >> +
> >> +/**
> >> +  Return the Virtual Memory Map of your platform
> >> +
> >> +  This Virtual Memory Map is used by MemoryInitPei Module to
> >> + initialize the MMU  on your platform.
> >> +
> >> +  @param[out]   VirtualMemoryMap    Array of
> ARM_MEMORY_REGION_DESCRIPTOR
> >> +                                    describing a Physical-to-Virtual Memory
> >> +                                    mapping. This array must be ended by a
> >> +                                    zero-filled entry. The allocated memory
> >> +                                    will not be freed.
> >> +
> >> +**/
> >> +VOID
> >> +ArmVirtGetMemoryMap (
> >> +  OUT ARM_MEMORY_REGION_DESCRIPTOR   **VirtualMemoryMap
> >> +  )
> >> +{
> >> +  ARM_MEMORY_REGION_DESCRIPTOR  *VirtualMemoryTable;
> >> +
> >> +  ASSERT (VirtualMemoryMap != NULL);
> >> +
> >> +  VirtualMemoryTable = AllocatePool (sizeof
> (ARM_MEMORY_REGION_DESCRIPTOR) *
> >> +
> >> + MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
> >> +
> >> +  if (VirtualMemoryTable == NULL) {
> >> +    DEBUG ((DEBUG_ERROR, "%a: Error: Failed AllocatePool()\n",
> __FUNCTION__));
> >> +    return;
> >> +  }
> >> +
> >> +  // System DRAM
> >> +  VirtualMemoryTable[0].PhysicalBase = PcdGet64
> >> + (PcdSystemMemoryBase);  VirtualMemoryTable[0].VirtualBase  =
> VirtualMemoryTable[0].PhysicalBase;
> >> +  VirtualMemoryTable[0].Length       = PcdGet64 (PcdSystemMemorySize);
> >> +  VirtualMemoryTable[0].Attributes   =
> ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> >> +
> >> +  DEBUG ((DEBUG_INFO, "%a: Dumping System DRAM Memory Map:\n"
> >> +      "\tPhysicalBase: 0x%lX\n"
> >> +      "\tVirtualBase: 0x%lX\n"
> >> +      "\tLength: 0x%lX\n",
> >> +      __FUNCTION__,
> >> +      VirtualMemoryTable[0].PhysicalBase,
> >> +      VirtualMemoryTable[0].VirtualBase,
> >> +      VirtualMemoryTable[0].Length));
> >> +
> >> +  // Memory mapped peripherals (UART, RTC, GIC, virtio-mmio, etc)
> >> + VirtualMemoryTable[1].PhysicalBase = MACH_VIRT_PERIPH_BASE;
> >> + VirtualMemoryTable[1].VirtualBase  = MACH_VIRT_PERIPH_BASE;
> >> +  VirtualMemoryTable[1].Length       = MACH_VIRT_PERIPH_SIZE;
> >> +  VirtualMemoryTable[1].Attributes   =
> ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> >> +
> >> +  // Map the FV region as normal executable memory
> >> + VirtualMemoryTable[2].PhysicalBase = PcdGet64 (PcdFvBaseAddress);
> >> + VirtualMemoryTable[2].VirtualBase  =
> VirtualMemoryTable[2].PhysicalBase;
> >> +  VirtualMemoryTable[2].Length       = FixedPcdGet32 (PcdFvSize);
> >> +  VirtualMemoryTable[2].Attributes   =
> ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
> >> +
> >> +  // End of Table
> >> +  ZeroMem (&VirtualMemoryTable[3], sizeof
> >> + (ARM_MEMORY_REGION_DESCRIPTOR));
> >> +
> >> +  *VirtualMemoryMap = VirtualMemoryTable; }
> >> diff --git
> >>
> a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibC
> o
> >> nstructor.c
> >>
> b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLibC
> o
> >> nstructor.c
> >> new file mode 100644
> >> index 000000000000..062dfcee1d66
> >> --- /dev/null
> >> +++
> b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiL
> >> +++ ibConstructor.c
> >> @@ -0,0 +1,100 @@
> >> +/** @file
> >> +
> >> +  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
> >
> > (3) New file, ARM (C) missing.
> >
> > With those updates:
> >
> > Acked-by: Laszlo Ersek <lersek@redhat.com>
> >
> > (BTW I'd like at least one of Ard, Leif, and Sami to give an R-b for
> > this patch set.)
> >
> > Thanks,
> > Laszlo
> >
> >> +
> >> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> >> +
> >> +**/
> >> +
> >> +#include <Base.h>
> >> +#include <Library/DebugLib.h>
> >> +#include <Library/PcdLib.h>
> >> +#include <libfdt.h>
> >> +
> >> +RETURN_STATUS
> >> +EFIAPI
> >> +CloudHvVirtMemInfoPeiLibConstructor (
> >> +  VOID
> >> +  )
> >> +{
> >> +  VOID          *DeviceTreeBase;
> >> +  INT32         Node, Prev;
> >> +  UINT64        NewBase, CurBase;
> >> +  UINT64        NewSize, CurSize;
> >> +  CONST CHAR8   *Type;
> >> +  INT32         Len;
> >> +  CONST UINT64  *RegProp;
> >> +  RETURN_STATUS PcdStatus;
> >> +
> >> +  NewBase = 0;
> >> +  NewSize = 0;
> >> +
> >> +  DeviceTreeBase = (VOID *)(UINTN)PcdGet64
> >> + (PcdDeviceTreeInitialBaseAddress);
> >> +  ASSERT (DeviceTreeBase != NULL);
> >> +
> >> +  //
> >> +  // Make sure we have a valid device tree blob  //  ASSERT
> >> + (fdt_check_header (DeviceTreeBase) == 0);
> >> +
> >> +  //
> >> +  // Look for the lowest memory node  //  for (Prev = 0;; Prev =
> >> + Node) {
> >> +    Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
> >> +    if (Node < 0) {
> >> +      break;
> >> +    }
> >> +
> >> +    //
> >> +    // Check for memory node
> >> +    //
> >> +    Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len);
> >> +    if (Type && AsciiStrnCmp (Type, "memory", Len) == 0) {
> >> +      //
> >> +      // Get the 'reg' property of this node. For now, we will assume
> >> +      // two 8 byte quantities for base and size, respectively.
> >> +      //
> >> +      RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
> >> +      if (RegProp != 0 && Len == (2 * sizeof (UINT64))) {
> >> +
> >> +        CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
> >> +        CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));
> >> +
> >> +        DEBUG ((DEBUG_INFO, "%a: System RAM @ 0x%lx - 0x%lx\n",
> >> +          __FUNCTION__, CurBase, CurBase + CurSize - 1));
> >> +
> >> +        if (NewBase > CurBase || NewBase == 0) {
> >> +          NewBase = CurBase;
> >> +          NewSize = CurSize;
> >> +        }
> >> +      } else {
> >> +        DEBUG ((DEBUG_ERROR, "%a: Failed to parse FDT memory node\n",
> >> +          __FUNCTION__));
> >> +      }
> >> +    }
> >> +  }
> >> +
> >> +  //
> >> +  // Make sure the start of DRAM matches our expectation  //  ASSERT
> >> + (FixedPcdGet64 (PcdSystemMemoryBase) == NewBase);  PcdStatus =
> >> + PcdSet64S (PcdSystemMemorySize, NewSize);
> ASSERT_RETURN_ERROR
> >> + (PcdStatus);
> >> +
> >> +  //
> >> +  // We need to make sure that the machine we are running on has at
> >> + least  // 128 MB of memory configured, and is currently executing
> >> + this binary from  // NOR flash. This prevents a device tree image
> >> + in DRAM from getting  // clobbered when our caller installs
> >> + permanent PEI RAM, before we have a  // chance of marking its
> >> + location as reserved or copy it to a freshly  // allocated block in the
> permanent PEI RAM in the platform PEIM.
> >> +  //
> >> +  ASSERT (NewSize >= SIZE_128MB);
> >> +  ASSERT (
> >> +    (((UINT64)PcdGet64 (PcdFdBaseAddress) +
> >> +      (UINT64)PcdGet32 (PcdFdSize)) <= NewBase) ||
> >> +    ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize)));
> >> +
> >> +  return RETURN_SUCCESS;
> >> +}
> >>
> >

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

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

* Re: [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family
  2021-05-27  6:19     ` Jianyong Wu
@ 2021-05-29  7:43       ` Sami Mujawar
  2021-06-01  7:51         ` Jianyong Wu
  0 siblings, 1 reply; 30+ messages in thread
From: Sami Mujawar @ 2021-05-29  7:43 UTC (permalink / raw)
  To: Jianyong Wu, devel@edk2.groups.io, lersek@redhat.com,
	ardb+tianocore@kernel.org
  Cc: hao.a.wu@intel.com, Justin He, Leif Lindholm, nd

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

Hi Jianyon,

Please find my response inline marked [SAMI].

Regards,

Sami Mujawar

On 27/05/2021 07:19 AM, Jianyong Wu wrote:
> Hi Sami,
>
>> -----Original Message-----
>> From: Sami Mujawar <Sami.Mujawar@arm.com>
>> Sent: Wednesday, May 19, 2021 4:27 AM
>> To: Jianyong Wu <Jianyong.Wu@arm.com>; devel@edk2.groups.io;
>> lersek@redhat.com; ardb+tianocore@kernel.org
>> Cc: hao.a.wu@intel.com; Justin He <Justin.He@arm.com>; Leif Lindholm
>> <leif@nuviainc.com>; nd <nd@arm.com>
>> Subject: Re: [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2
>> family
>>
>> Hi Jianyon,
>>
>> Thank you for this patch.
>>
>> Please find my response inline marked [SAMI].
>>
>> Regards,
>>
>> Sami Mujawar
>>
>>
>> On 17/05/2021 07:50 AM, Jianyong Wu wrote:
>>> Cloud Hypervisor is kvm based VMM and is implemented in rust. Just
>>> like other VMMs it need UEFI support to let ACPI work. That's why
>>> Cloud Hypervisor is introduced here.
>>>
>>> Cc: Laszlo Ersek <lersek@redhat.com>
>>> Cc: Leif Lindholm <leif@nuviainc.com>
>>> Cc:
>>> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
>>> ---
>>>    ArmVirtPkg/ArmVirtCloudHv.dsc           | 455
>> ++++++++++++++++++++++++
>>>    ArmVirtPkg/ArmVirtCloudHv.fdf           | 292 +++++++++++++++
>>>    ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc | 169 +++++++++
>>>    3 files changed, 916 insertions(+)
>>>    create mode 100644 ArmVirtPkg/ArmVirtCloudHv.dsc
>>>    create mode 100644 ArmVirtPkg/ArmVirtCloudHv.fdf
>>>    create mode 100644 ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
>>>
>>> diff --git a/ArmVirtPkg/ArmVirtCloudHv.dsc
>>> b/ArmVirtPkg/ArmVirtCloudHv.dsc new file mode 100644 index
>>> 000000000000..bf1f8c5a75ae
>>> --- /dev/null
>>> +++ b/ArmVirtPkg/ArmVirtCloudHv.dsc
>>> @@ -0,0 +1,455 @@
>>> +#
>>> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>>> +#  Copyright (c) 2014, Linaro Limited. All rights reserved.
>>> +#  Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
>>> +#
>>> +#  SPDX-License-Identifier: BSD-2-Clause-Patent # #
>>> +
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +#
>>> +# Defines Section - statements that will be processed to create a Makefile.
>>> +#
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +[Defines]
>>> +  PLATFORM_NAME                  = ArmVirtCloudHv
>>> +  PLATFORM_GUID                  = DFFED32B-DFFE-D32B-DFFE-D32BDFFED32B
>>> +  PLATFORM_VERSION               = 0.1
>>> +  DSC_SPECIFICATION              = 0x00010005
>>> +  OUTPUT_DIRECTORY               = Build/ArmVirtCloudHv-$(ARCH)
>>> +  SUPPORTED_ARCHITECTURES        = AARCH64|ARM
>>> +  BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
>>> +  SKUID_IDENTIFIER               = DEFAULT
>>> +  FLASH_DEFINITION               = ArmVirtPkg/ArmVirtCloudHv.fdf
>>> +
>>> +  #
>>> +  # Defines for default states.  These can be changed on the command line.
>>> +  # -D FLAG=VALUE
>>> +  #
>>> +  DEFINE TTY_TERMINAL            = FALSE
>>> +  DEFINE SECURE_BOOT_ENABLE      = FALSE
>>> +  DEFINE TPM2_ENABLE             = FALSE
>>> +  DEFINE TPM2_CONFIG_ENABLE      = FALSE
>>> +
>>> +!include ArmVirtPkg/ArmVirt.dsc.inc
>>> +
>>> +[LibraryClasses.common]
>>> +  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
>>> +  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
>>> +
>>> +  # Virtio Support
>>> +  VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
>>> +
>>> +
>> VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDe
>>> + viceLib.inf
>>> + QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
>>> +
>>> +
>> QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3Li
>> bNull
>>> + .inf
>>> +
>> QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/
>> Qe
>>> + muFwCfgSimpleParserLib.inf
>>> +
>> QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/Generic
>> Qemu
>>> + LoadImageLib.inf
>> [SAMI] Does Cloud Hypervisor support Qemu-FwCfg? If not, then are the
>> above 4 libraries needed?
> Hi Sami, I think CloudHv doesn't dependent on qemu-fwcfg, so I have tried to remove the dependencies. But I find it difficult to do that.
> Some implicit codes depend on qemu-cfg that I can't do workaround. E.g.
>   
> In OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
> "
>   Status = QemuFwCfgFindFile ("etc/extra-pci-roots", &FwCfgItem, &FwCfgSize);
>    if (EFI_ERROR (Status) || FwCfgSize != sizeof ExtraRootBridges) {
>      ExtraRootBridges = 0;
>    } else {
>      QemuFwCfgSelectItem (FwCfgItem);
>      QemuFwCfgReadBytes (FwCfgSize, &ExtraRootBridges);
> "
> I don't know how to do with it. So, I keep it here.
> Maybe I need your help if these dependencies should be removed.
[SAMI] I am working on a patch series that adds ACPI and PCI support for 
Kvmtool firmware. So, I may just have the patch you need. The patch is 
an instance of PciHostBridgeUtilityLib without the FwCfg and I think it 
should work for Choud Hypervisor too.
If you can try the attached patch and let me know if it works; I will 
reword the patch so that it is common for both Kvmtool and Cloud 
Hypervisor and post it to the mailing list.
Please let me know if you face any issues.
[/SAMI]
>>> +
>>> +
>>> +
>> ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatform
>>> + LibNull.inf
>>> +
>>> +  TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
>>> +
>>> +
>> CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.
>>> + inf  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
>>> +
>>> +
>> PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/Pla
>>> + tformBootManagerLib.inf
>> [SAMI] The above instance of PlatformBootManagerLibhas a dependency on
>> Qemu-FwCfg, right?
>>> +
>>> +
>> PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBm
>>> + PrintScLib.inf
>>> +
>> CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Custo
>>> + mizedDisplayLib.inf
>>> +
>> FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBuffer
>>> + BltLib.inf
>>> +
>> QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrder
>> Lib.i
>>> + nf
>> [SAMI] Qemu-FwCfg dependency?
> Sure
>
>>> +
>>> + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib
>>> + .inf
>>> + PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdP
>>> + roducerLib.inf
>>> +
>> PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibP
>>> + ci.inf
>>> + PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBr
>>> + idgeLib.inf
>>> + PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciH
>>> + ostBridgeUtilityLib.inf
>>> +
>>> +!if $(TPM2_ENABLE) == TRUE
>>> +
>>>
>> +Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2Command
>> Lib.inf
>>> +
>>>
>> +Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/
>> D
>>> +xeTcg2PhysicalPresenceLib.inf
>> [SAMI] Is this supported by Cloud Hypervisor?
> No, should be removed.
>
>>> +
>>>
>> +TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeT
>> pmMeas
>>> +urementLib.inf
>>> +!else
>>> +
>>>
>> +TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/T
>> pmMeasu
>>> +rementLibNull.inf
>>> +!endif
>>> +
>>> +!include MdePkg/MdeLibs.dsc.inc
>>> +
>>> +[LibraryClasses.common.PEIM]
>>> +
>>>
>> +ArmVirtMemInfoLib|ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHv
>> Vir
>>> +tMemInfoPeiLib.inf
>>> +
>>> +!if $(TPM2_ENABLE) == TRUE
>>> +  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
>>> +
>>>
>> +ResetSystemLib|MdeModulePkg/Library/PeiResetSystemLib/PeiResetSyst
>> emL
>>> +ib.inf
>>> +
>>>
>> +Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibD
>> Tpm
>>> +.inf
>>> +!endif
>>> +
>>> +[LibraryClasses.common.DXE_DRIVER]
>>> +
>>>
>> +ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/D
>> xeRe
>>> +portStatusCodeLib.inf
>>> +
>>> +!if $(TPM2_ENABLE) == TRUE
>>> +
>>>
>> +Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg
>> 2
>>> +.inf
>>> +!endif
>>> +
>>> +[LibraryClasses.common.UEFI_DRIVER]
>>> +  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
>>> +
>>> +[BuildOptions]
>>> +!include NetworkPkg/NetworkBuildOptions.dsc.inc
>>> +
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +#
>>> +# Pcd Section - list of all EDK II PCD Entries defined by this
>>> +Platform #
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +
>>> +[PcdsFeatureFlag.common]
>>> +  gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation|TRUE
>>> +
>> gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation|TRUE
>>> +
>>> +  ## If TRUE, Graphics Output Protocol will be installed on virtual handle
>> created by ConsplitterDxe.
>>> +  #  It could be set FALSE to save size.
>>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
>>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
>>> +
>>> +
>> gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
>>> +
>>> +  gArmVirtTokenSpaceGuid.PcdTpm2SupportEnabled|$(TPM2_ENABLE)
>>> +
>>> +[PcdsFixedAtBuild.common]
>>> +!if $(ARCH) == AARCH64
>>> +  gArmTokenSpaceGuid.PcdVFPEnabled|1
>>> +!endif
>>> +
>>> +  gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4007c000
>>> +
>> gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
>>> +  gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
>>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
>>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
>>> +
>>> +  # Rsdp base address in Cloud Hypervisor
>>> +
>> gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress|0x40200000
>>> +
>>> +
>>>
>> +gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x40
>> 0000
>>> +0
>>> +
>>>
>> +gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x400
>> 00
>>> +!if $(NETWORK_TLS_ENABLE) == TRUE
>>> +  #
>>> +  # The cumulative and individual VOLATILE variable size limits
>>> +should be set
>>> +  # high enough for accommodating several and/or large CA certificates.
>>> +  #
>>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x80000
>>> +
>> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize|0x40000
>>> +!endif
>>> +
>>> +  # Size of the region used by UEFI in permanent memory (Reserved
>>> + 64MB)
>>> +
>> gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x040000
>> 00
>>> +
>>> +  #
>>> +  # ARM PrimeCell
>>> +  #
>>> +
>>> +  ## PL011 - Serial Terminal
>>> +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|38400
>>> +
>>> +  ## Default Terminal Type
>>> +  ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM !if
>>> +$(TTY_TERMINAL) == TRUE
>>> +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
>>> +  # Set terminal type to TtyTerm, the value encoded is
>>> +EFI_TTY_TERM_GUID
>>> +  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d,
>> 0x91,
>>> +0x7d, 0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51,
>>> +0xef, 0x94} !else
>>> +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|1
>>> +!endif
>>> +
>>> +  # System Memory Base -- fixed at 0x4000_0000
>>> +  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x40000000
>>> +
>>> +  # initial location of the device tree blob passed by Cloud
>>> + Hypervisor -- base of DRAM
>>> +  gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x40000000
>>> +
>>> +
>>> +
>>> +
>> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationC
>> hange
>>> + |FALSE
>> gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{
>>> + 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a,
>>> + 0xb6, 0xf4, 0x66, 0x23, 0x31 }
>>> +
>>> +  #
>>> +  # The maximum physical I/O addressability of the processor, set
>>> + with  # BuildCpuHob().
>>> +  #
>>> +  gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16
>>> +
>>> +  #
>>> +  # Enable the non-executable DXE stack. (This gets set up by DxeIpl)
>>> + #  gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE
>>> +
>>> +!if $(SECURE_BOOT_ENABLE) == TRUE
>>> +  # override the default values from SecurityPkg to ensure images
>>> +from all sources are verified in secure boot
>>> +
>>>
>> +gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x
>> 0
>>> +4
>>> +
>>>
>> +gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x
>>> +04
>>> +
>>>
>> +gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPoli
>> c
>>> +y|0x04
>>> +!endif
>>> +
>>> +  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|3
>>> +  gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x20000
>>> +
>>> +[PcdsFixedAtBuild.AARCH64]
>>> +  # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS
>>> +entry point,
>>> +  # if the entry point version is >= 3.0. AARCH64 OSes cannot assume
>>> +the
>>> +  # presence of the 32-bit entry point anyway (because many AARCH64
>>> +systems
>>> +  # don't have 32-bit addressable physical RAM), and the additional
>>> +allocations
>>> +  # below 4 GB needlessly fragment the memory map. So expose the
>>> +64-bit entry
>>> +  # point only, for entry point versions >= 3.0.
>>> +
>> gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosEntryPointProvideMethod|0
>> x2
>>> +
>>> +[PcdsDynamicDefault.common]
>>> +  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
>>> +
>>> +  ## If TRUE, OvmfPkg/AcpiPlatformDxe will not wait for PCI  #
>>> + enumeration to complete before installing ACPI tables.
>>> +
>> gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
>>> +
>>> +  # System Memory Size -- 1 MB initially, actual size will be fetched
>>> + from DT
>>> +  gArmTokenSpaceGuid.PcdSystemMemorySize|0x00100000
>>> +
>>> +
>> gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
>>> +
>>> +  gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0
>>> +  gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
>>> +  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
>>> +  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
>>> +
>>> +  #
>>> +  # ARM General Interrupt Controller
>>> +  #
>>> +  gArmTokenSpaceGuid.PcdGicDistributorBase|0x0
>>> +  gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x0
>>> +  gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x0
>>> +
>>> +  ## PL031 RealTimeClock
>>> +  gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
>>> +
>>> +  # set PcdPciExpressBaseAddress to MAX_UINT64, which signifies that
>>> + this  # PCD and PcdPciDisableBusEnumeration above have not been
>>> + assigned yet
>>> +
>> gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFF
>> FF
>>> +
>>> +  gArmTokenSpaceGuid.PcdPciIoTranslation|0
>>> +#  gArmTokenSpaceGuid.PcdPciIoTranslation|0x50000000
>> [SAMI] Remove commented code.
> Yeah
>
>>> +
>>> +  #
>>> +  # TPM2 support
>>> +  #
>>> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0
>>> +!if $(TPM2_ENABLE) == TRUE
>>> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00, 0x00,
>>> +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
>>> +0x00, 0x00}
>>> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0
>>> +!endif
>>> +
>>> +[PcdsDynamicHii]
>>> +
>>>
>> +gArmVirtTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gArmVirtVaria
>> ble
>>> +Guid|0x0|FALSE|NV,BS
>>> +
>>> +!if $(TPM2_CONFIG_ENABLE) == TRUE
>>> +
>>>
>> +gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TC
>>> +G2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS
>>> +
>>>
>> +gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"
>> |gTc
>>> +g2ConfigFormSetGuid|0x8|3|NV,BS
>>> +!endif
>>> +
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +#
>>> +# Components Section - list of all EDK II Modules needed by this
>>> +Platform #
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +[Components.common]
>>> +  #
>>> +  # PEI Phase modules
>>> +  #
>>> +  ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
>>> +  MdeModulePkg/Core/Pei/PeiMain.inf
>>> +  MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
>>> +    <LibraryClasses>
>>> +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>>> +  }
>>> +  ArmPlatformPkg/PlatformPei/PlatformPeim.inf
>>> +  ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
>>> +  ArmPkg/Drivers/CpuPei/CpuPei.inf
>>> +
>>> +  MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
>>> +
>>> +!if $(TPM2_ENABLE) == TRUE
>>> +  MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf {
>>> +    <LibraryClasses>
>>> +
>>>
>> +ResetSystemLib|ArmVirtPkg/Library/ArmVirtPsciResetSystemPeiLib/ArmVi
>> r
>>> +tPsciResetSystemPeiLib.inf
>>> +  }
>>> +  OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
>>> +  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf {
>>> +    <LibraryClasses>
>>> +
>> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoR
>> outerPei.inf
>>> +
>> NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
>>> +
>> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.in
>> f
>>> +
>> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.in
>> f
>>> +
>> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.in
>> f
>>> +
>>> +NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
>>> +  }
>>> +!endif
>>> +
>>> +  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
>>> +    <LibraryClasses>
>>> +
>>> +
>> NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDec
>> ompre
>>> + ssLib.inf
>>> +  }
>>> +
>>> +  #
>>> +  # DXE
>>> +  #
>>> +  MdeModulePkg/Core/Dxe/DxeMain.inf {
>>> +    <LibraryClasses>
>>> +
>> NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32G
>> uidedSectionExtractLib.inf
>>> +
>>> + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
>>> +  }
>>> +  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
>>> +    <LibraryClasses>
>>> +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>>> +  }
>>> +
>>> +  #
>>> +  # Architectural Protocols
>>> +  #
>>> +  ArmPkg/Drivers/CpuDxe/CpuDxe.inf
>>> +  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
>>> +
>> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
>>> +    <LibraryClasses>
>>> +      NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
>>> +      # don't use unaligned CopyMem () on the UEFI varstore NOR flash
>> region
>>> +
>> BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
>>> +  }
>>> +!if $(SECURE_BOOT_ENABLE) == TRUE
>>> +  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
>>> +    <LibraryClasses>
>>> +
>>> +NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerification
>>> +Lib.inf
>>> +!if $(TPM2_ENABLE) == TRUE
>>> +
>>>
>> +NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBo
>> otLib.
>>> +inf
>>> +!endif
>>> +  }
>>> +
>>>
>> +SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf
>> i
>>> +gDxe.inf
>>> +  OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf
>>> +!else
>>> +  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
>>> +!endif
>>> +  MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
>>> +
>>>
>> +MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i
>> n
>>> +f
>>> +
>>>
>> +MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCou
>> nterRun
>>> +timeDxe.inf
>>> +
>>>
>> +MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
>> Dxe.in
>>> +f
>>> +
>> EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf {
>>> +    <LibraryClasses>
>>> +
>>>
>> +NULL|ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClien
>>> +tLib.inf
>>> +  }
>>> +  EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
>>> +
>>> +
>> MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
>>> +  MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
>>> +
>>> +
>> MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleD
>> xe
>>> + .inf  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
>>> +  MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
>>> +
>>> +  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
>>> +
>>> +  ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
>>> +  ArmPkg/Drivers/TimerDxe/TimerDxe.inf {
>>> +    <LibraryClasses>
>>> +
>>> + NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClie
>>> + ntLib.inf
>>> +  }
>>> +  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
>>> +
>>> +  #
>>> +  # Status Code Routing
>>> +  #
>>> +
>>> +
>> MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportSt
>> atu
>>> + sCodeRouterRuntimeDxe.inf
>>> +
>>> +  #
>>> +  # Platform Driver
>>> +  #
>>> +  ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
>>> +  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
>>> +  ArmVirtPkg/HighMemDxe/HighMemDxe.inf
>>> +  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
>>> +  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
>>> +  OvmfPkg/VirtioNetDxe/VirtioNet.inf
>>> +  OvmfPkg/VirtioRngDxe/VirtioRng.inf
>>> +
>>> +  #
>>> +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem +
>>> + virtio-fs  #  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>>> +  MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>>> +
>>> +
>> MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i
>>> + nf
>>> +  FatPkg/EnhancedFatDxe/Fat.inf
>>> +  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
>>> +  OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
>>> +
>>> +  #
>>> +  # Bds
>>> +  #
>>> +  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
>>> +    <LibraryClasses>
>>> +
>> DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
>>> +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
>>> +  }
>>> +  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
>>> +  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
>>> +
>>> +
>> MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManager
>> Dxe
>>> + .inf  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>>> +  MdeModulePkg/Logo/LogoDxe.inf
>>> +  MdeModulePkg/Application/UiApp/UiApp.inf {
>>> +    <LibraryClasses>
>>> +
>> NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
>>> +
>> NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
>>> +
>>> +
>> NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMainte
>> nanc
>>> + eManagerUiLib.inf
>>> +  }
>>> +  OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
>> [SAMI] Qemu-FwCfg dependency?
> Yeah
>
>>> +
>>> +  #
>>> +  # SCSI Bus and Disk Driver
>>> +  #
>>> +  MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
>>> +  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
>>> +
>>> +  #
>>> +  # PCI support
>>> +  #
>>> +  ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
>>> +    <LibraryClasses>
>>> +
>>> + NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.in
>>> + f
>>> +  }
>>> +  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
>>> +  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
>>> +    <LibraryClasses>
>>> +
>>> + NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.in
>>> + f
>>> +  }
>>> +  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
>>> +  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
>>> +  OvmfPkg/Virtio10Dxe/Virtio10.inf
>>> +
>>> +  #
>>> +  # TPM2 support
>>> +  #
>>> +!if $(TPM2_ENABLE) == TRUE
>>> +  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf {
>>> +    <LibraryClasses>
>>> +
>> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoR
>> outerDxe.inf
>>> +
>> Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibR
>> outerDxe.inf
>>> +
>> NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf
>>> +
>> NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
>>> +
>> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.in
>> f
>>> +
>> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.in
>> f
>>> +
>> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.in
>> f
>>> +
>>> +NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
>>> +  }
>>> +!if $(TPM2_CONFIG_ENABLE) == TRUE
>>> +  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
>>> +!endif
>>> +!endif
>>> +
>>> +  #
>>> +  # ACPI Support
>>> +  #
>>> +  ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
>>> +[Components.AARCH64]
>>> +
>>>
>> +MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap
>> hics
>>> +ResourceTableDxe.inf
>>> +  ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf {
>>> +    <LibraryClasses>
>>> +
>>>
>> +NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
>>> +  }
>>> diff --git a/ArmVirtPkg/ArmVirtCloudHv.fdf
>>> b/ArmVirtPkg/ArmVirtCloudHv.fdf new file mode 100644 index
>>> 000000000000..3619a09ba8c5
>>> --- /dev/null
>>> +++ b/ArmVirtPkg/ArmVirtCloudHv.fdf
>>> @@ -0,0 +1,292 @@
>>> +#
>>> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>>> +#  Copyright (c) 2014, Linaro Limited. All rights reserved.
>>> +#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
>>> +#
>>> +#  SPDX-License-Identifier: BSD-2-Clause-Patent #
>>> +
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +#
>>> +# FD Section
>>> +# The [FD] Section is made up of the definition statements and a #
>>> +description of what goes into  the Flash Device Image.  Each FD
>>> +section # defines one flash "device" image.  A flash device image may
>>> +be one of # the following: Removable media bootable image (like a
>>> +boot floppy # image,) an Option ROM image (that would be "flashed"
>>> +into an add-in # card,) a System "Flash"  image (that would be burned
>>> +into a system's # flash) or an Update ("Capsule") image that will be
>>> +used to update and # existing system flash.
>>> +#
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +
>>> +[Defines]
>>> +!if $(FD_SIZE_IN_MB) == 2
>>> +  DEFINE FVMAIN_COMPACT_SIZE  = 0x1ff000 !endif !if $(FD_SIZE_IN_MB)
>>> +== 3
>>> +  DEFINE FVMAIN_COMPACT_SIZE  = 0x2ff000 !endif
>>> +
>>> +[FD.CLOUDHV_EFI]
>>> +BaseAddress   = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress  #
>> cloud-hypervisor assigns 0 - 0x8000000 for a BootROM
>>> +Size          = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize         # The size in
>> bytes of the FLASH Device
>>> +ErasePolarity = 1
>>> +
>>> +# This one is tricky, it must be: BlockSize * NumBlocks = Size
>>> +BlockSize     = 0x00001000
>>> +NumBlocks     = $(FD_NUM_BLOCKS)
>>> +
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +#
>>> +# Following are lists of FD Region layout which correspond to the
>>> +locations of different # images within the flash device.
>>> +#
>>> +# Regions must be defined in ascending order and may not overlap.
>>> +#
>>> +# A Layout Region start with a eight digit hex offset (leading "0x"
>>> +required) followed by # the pipe "|" character, followed by the size
>>> +of the region, also in hex with the leading # "0x" characters. Like:
>>> +# Offset|Size
>>> +# PcdOffsetCName|PcdSizeCName
>>> +# RegionType <FV, DATA, or FILE>
>>> +#
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +
>>> +#
>>> +# UEFI has trouble dealing with FVs that reside at physical address 0x0.
>>> +# So instead, put a hardcoded 'jump to 0x1000' at offset 0x0, and put
>>> +the # real FV at offset 0x1000 #
>>> +0x00000000|0x00001000
>>> +DATA = {
>>> +!if $(ARCH) == AARCH64
>>> +  0x00, 0x04, 0x00, 0x14   # 'b 0x1000' in AArch64 ASM
>>> +!else
>>> +  0xfe, 0x03, 0x00, 0xea   # 'b 0x1000' in AArch32 ASM
>>> +!endif
>>> +}
>>> +
>>> +0x00001000|$(FVMAIN_COMPACT_SIZE)
>>>
>> +gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
>>> +FV = FVMAIN_COMPACT
>>> +
>>> +!include VarStore.fdf.inc
>>> +
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +#
>>> +# FV Section
>>> +#
>>> +# [FV] section is used to define what components or modules are
>>> +placed within a flash # device file.  This section also defines order
>>> +the components and modules are positioned # within the image.  The
>>> +[FV] section consists of define statements, set statements and # module
>> statements.
>>> +#
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +
>>> +#!include ArmVirtCloudHvFvMain.fdf.inc
>>> +
>>> +
>>> +
>>> +[FV.FvMain]
>>> +FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
>>> +BlockSize          = 0x40
>>> +NumBlocks          = 0         # This FV gets compressed so make it just big
>> enough
>>> +FvAlignment        = 16        # FV alignment and FV attributes setting.
>>> +ERASE_POLARITY     = 1
>>> +MEMORY_MAPPED      = TRUE
>>> +STICKY_WRITE       = TRUE
>>> +LOCK_CAP           = TRUE
>>> +LOCK_STATUS        = TRUE
>>> +WRITE_DISABLED_CAP = TRUE
>>> +WRITE_ENABLED_CAP  = TRUE
>>> +WRITE_STATUS       = TRUE
>>> +WRITE_LOCK_CAP     = TRUE
>>> +WRITE_LOCK_STATUS  = TRUE
>>> +READ_DISABLED_CAP  = TRUE
>>> +READ_ENABLED_CAP   = TRUE
>>> +READ_STATUS        = TRUE
>>> +READ_LOCK_CAP      = TRUE
>>> +READ_LOCK_STATUS   = TRUE
>>> +
>>> +  INF MdeModulePkg/Core/Dxe/DxeMain.inf  INF
>>> + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
>>> +  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
>>> +  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
>>> +  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
>>> +
>>> +  #
>>> +  # PI DXE Drivers producing Architectural Protocols (EFI Services)
>>> +  #
>>> +  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
>>> +  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
>>> +  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
>>> +  INF
>> MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
>>> +  INF
>>>
>> +MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i
>> n
>>> +f
>>> +  INF
>>>
>> +MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
>>> +!if $(SECURE_BOOT_ENABLE) == TRUE
>>> +  INF
>>>
>> +SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf
>> i
>>> +gDxe.inf
>>> +!endif
>>> +  INF
>>>
>> +MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCou
>> nterRun
>>> +timeDxe.inf
>>> +  INF
>>>
>> +MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
>> Dxe.in
>>> +f
>>> +  INF
>> EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
>>> +  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
>>> +  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
>>> +
>>> +  #
>>> +  # Multiple Console IO support
>>> +  #
>>> +  INF
>>> +
>> MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
>>> +  INF
>>> + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
>>> +  INF
>>> +
>> MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleD
>> xe
>>> + .inf  INF
>> MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
>>> +  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
>>> +
>>> +  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
>>> +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
>>> +  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
>>> +
>>> +  #
>>> +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem +
>>> + virtio-fs  #  INF
>>> + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>>> +  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>>> +  INF FatPkg/EnhancedFatDxe/Fat.inf
>>> +  INF
>>> +
>> MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i
>>> + nf  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
>>> +  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
>>> +
>>> +  #
>>> +  # Status Code Routing
>>> +  #
>>> +  INF
>>> +
>> MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportSt
>> atu
>>> + sCodeRouterRuntimeDxe.inf
>>> +
>>> +  #
>>> +  # Platform Driver
>>> +  #
>>> +  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
>>> +  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
>>> +  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
>>> +  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
>>> +
>>> +  #
>>> +  # UEFI application (Shell Embedded Boot Loader)  #  INF
>>> + ShellPkg/Application/Shell/Shell.inf
>>> +  INF
>>> +
>> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.
>> inf
>>> +  INF
>>> +
>> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand
>> .inf
>>> +  INF
>>> +
>> OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellComma
>> n
>>> + d.inf
>>> +
>>> +  #
>>> +  # Bds
>>> +  #
>>> +  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
>>> +  INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
>>> +  INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
>>> +  INF
>>> +
>> MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManager
>> Dxe
>>> + .inf  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>>> +  INF MdeModulePkg/Application/UiApp/UiApp.inf
>>> +  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
>> [SAMI] Qemu-FwCfg dependency? Also check at other places in the fdf and
>> fdf.inc file.
> Yeah, it's a tough work for me.
>
>>> +
>>> +  #
>>> +  # SCSI Bus and Disk Driver
>>> +  #
>>> +  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
>>> +  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
>>> +
>>> +  #
>>> +  # ACPI Support
>>> +  #
>>> +  INF
>> ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
>>> +!if $(ARCH) == AARCH64
>>> +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
>>> +  INF
>>>
>> +MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap
>> hics
>>> +ResourceTableDxe.inf
>>> +  INF ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
>>> +
>>> +  #
>>> +  # EBC support
>>> +  #
>>> +  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
>>> +!endif
>>> +
>>> +  #
>>> +  # PCI support
>>> +  #
>>> +  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
>>> +  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
>>> +  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
>>> +  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
>>> +  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
>>> +  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
>>> +
>>> +  #
>>> +  # TPM2 support
>>> +  #
>>> +!if $(TPM2_ENABLE) == TRUE
>>> +  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
>>> +!if $(TPM2_CONFIG_ENABLE) == TRUE
>>> +  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
>>> +!endif
>>> +!endif
>>> +
>>> +  #
>>> +  # TianoCore logo (splash screen)
>>> +  #
>>> +  INF MdeModulePkg/Logo/LogoDxe.inf
>>> +
>>> +  #
>>> +  # Ramdisk support
>>> +  #
>>> +  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
>>> +
>>> +
>>> +
>>> +
>>> +
>>> +
>>> +
>>> +
>>> +
>>> +
>>> +
>>> +
>> [SAMI] Remove empty lines.
> Oh, it's my bad.
>
> Thanks
> Jianyong
>
>>> +[FV.FVMAIN_COMPACT]
>>> +FvAlignment        = 16
>>> +ERASE_POLARITY     = 1
>>> +MEMORY_MAPPED      = TRUE
>>> +STICKY_WRITE       = TRUE
>>> +LOCK_CAP           = TRUE
>>> +LOCK_STATUS        = TRUE
>>> +WRITE_DISABLED_CAP = TRUE
>>> +WRITE_ENABLED_CAP  = TRUE
>>> +WRITE_STATUS       = TRUE
>>> +WRITE_LOCK_CAP     = TRUE
>>> +WRITE_LOCK_STATUS  = TRUE
>>> +READ_DISABLED_CAP  = TRUE
>>> +READ_ENABLED_CAP   = TRUE
>>> +READ_STATUS        = TRUE
>>> +READ_LOCK_CAP      = TRUE
>>> +READ_LOCK_STATUS   = TRUE
>>> +
>>> +  INF ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
>>> +  INF MdeModulePkg/Core/Pei/PeiMain.inf  INF
>>> + ArmPlatformPkg/PlatformPei/PlatformPeim.inf
>>> +  INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
>>> +  INF ArmPkg/Drivers/CpuPei/CpuPei.inf  INF
>>> + MdeModulePkg/Universal/PCD/Pei/Pcd.inf
>>> +  INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
>>> +  INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
>>> +
>>> +!if $(TPM2_ENABLE) == TRUE
>>> +  INF MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf
>>> +  INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
>>> +  INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
>>> +!endif
>>> +
>>> +  FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
>>> +    SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF
>> PROCESSING_REQUIRED = TRUE {
>>> +      SECTION FV_IMAGE = FVMAIN
>>> +    }
>>> +  }
>>> +
>>> +!include ArmVirtRules.fdf.inc
>>> diff --git a/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
>>> b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
>>> new file mode 100644
>>> index 000000000000..51041e889ef4
>>> --- /dev/null
>>> +++ b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
>>> @@ -0,0 +1,169 @@
>>> +#
>>> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>>> +#  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
>>> +#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
>>> +#
>>> +#  SPDX-License-Identifier: BSD-2-Clause-Patent #
>>> +
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +#
>>> +# FV Section
>>> +#
>>> +# [FV] section is used to define what components or modules are
>>> +placed within a flash # device file.  This section also defines order
>>> +the components and modules are positioned # within the image.  The
>>> +[FV] section consists of define statements, set statements and # module
>> statements.
>>> +#
>>>
>> +#########################################################
>> ############
>>> +###########
>>> +
>>> +[FV.FvMain]
>>> +FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
>>> +BlockSize          = 0x40
>>> +NumBlocks          = 0         # This FV gets compressed so make it just big
>> enough
>>> +FvAlignment        = 16        # FV alignment and FV attributes setting.
>>> +ERASE_POLARITY     = 1
>>> +MEMORY_MAPPED      = TRUE
>>> +STICKY_WRITE       = TRUE
>>> +LOCK_CAP           = TRUE
>>> +LOCK_STATUS        = TRUE
>>> +WRITE_DISABLED_CAP = TRUE
>>> +WRITE_ENABLED_CAP  = TRUE
>>> +WRITE_STATUS       = TRUE
>>> +WRITE_LOCK_CAP     = TRUE
>>> +WRITE_LOCK_STATUS  = TRUE
>>> +READ_DISABLED_CAP  = TRUE
>>> +READ_ENABLED_CAP   = TRUE
>>> +READ_STATUS        = TRUE
>>> +READ_LOCK_CAP      = TRUE
>>> +READ_LOCK_STATUS   = TRUE
>>> +
>>> +  INF MdeModulePkg/Core/Dxe/DxeMain.inf  INF
>>> + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
>>> +  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
>>> +  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
>>> +  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
>>> +
>>> +  #
>>> +  # PI DXE Drivers producing Architectural Protocols (EFI Services)
>>> +  #
>>> +  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
>>> +  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
>>> +  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
>>> +  INF
>> MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
>>> +  INF
>>>
>> +MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i
>> n
>>> +f
>>> +  INF
>>>
>> +MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
>>> +!if $(SECURE_BOOT_ENABLE) == TRUE
>>> +  INF
>>>
>> +SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf
>> i
>>> +gDxe.inf
>>> +!endif
>>> +  INF
>>>
>> +MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCou
>> nterRun
>>> +timeDxe.inf
>>> +  INF
>>>
>> +MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
>> Dxe.in
>>> +f
>>> +  INF
>> EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
>>> +  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
>>> +  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
>>> +
>>> +  #
>>> +  # Multiple Console IO support
>>> +  #
>>> +  INF
>>> +
>> MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
>>> +  INF
>>> + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
>>> +  INF
>>> +
>> MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleD
>> xe
>>> + .inf  INF
>> MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
>>> +  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
>>> +
>>> +  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
>>> +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
>>> +  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
>>> +
>>> +  #
>>> +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem +
>>> + virtio-fs  #  INF
>>> + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
>>> +  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>>> +  INF FatPkg/EnhancedFatDxe/Fat.inf
>>> +  INF
>>> +
>> MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i
>>> + nf  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
>>> +  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
>>> +
>>> +  #
>>> +  # Status Code Routing
>>> +  #
>>> +  INF
>>> +
>> MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportSt
>> atu
>>> + sCodeRouterRuntimeDxe.inf
>>> +
>>> +  #
>>> +  # Platform Driver
>>> +  #
>>> +  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
>>> +  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
>>> +  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
>>> +  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
>>> +
>>> +  #
>>> +  # UEFI application (Shell Embedded Boot Loader)  #  INF
>>> + ShellPkg/Application/Shell/Shell.inf
>>> +  INF
>>> +
>> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.
>> inf
>>> +  INF
>>> +
>> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand
>> .inf
>>> +  INF
>>> +
>> OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellComma
>> n
>>> + d.inf
>>> +
>>> +  #
>>> +  # Bds
>>> +  #
>>> +  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
>>> +  INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
>>> +  INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
>>> +  INF
>>> +
>> MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManager
>> Dxe
>>> + .inf  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>>> +  INF MdeModulePkg/Application/UiApp/UiApp.inf
>>> +  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
>>> +
>>> +  #
>>> +  # SCSI Bus and Disk Driver
>>> +  #
>>> +  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
>>> +  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
>>> +
>>> +  #
>>> +  # ACPI Support
>>> +  #
>>> +  INF
>> ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
>>> +!if $(ARCH) == AARCH64
>>> +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
>>> +  INF
>>>
>> +MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap
>> hics
>>> +ResourceTableDxe.inf
>>> +  INF ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
>>> +
>>> +  #
>>> +  # EBC support
>>> +  #
>>> +  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
>>> +!endif
>>> +
>>> +  #
>>> +  # PCI support
>>> +  #
>>> +  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
>>> +  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
>>> +  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
>>> +  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
>>> +  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
>>> +  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
>>> +
>>> +  #
>>> +  # TPM2 support
>>> +  #
>>> +!if $(TPM2_ENABLE) == TRUE
>>> +  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
>>> +!if $(TPM2_CONFIG_ENABLE) == TRUE
>>> +  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
>>> +!endif
>>> +!endif
>>> +
>>> +  #
>>> +  # TianoCore logo (splash screen)
>>> +  #
>>> +  INF MdeModulePkg/Logo/LogoDxe.inf
>>> +
>>> +  #
>>> +  # Ramdisk support
>>> +  #
>>> +  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf


[-- Attachment #2: 0001-ArmVirtPkg-Add-PCI-host-bridge-utility-lib-for-Kvmto.patch --]
[-- Type: text/plain, Size: 10091 bytes --]

From cc33217ae783ba88ab64672774d90a998cd5cea4 Mon Sep 17 00:00:00 2001
From: Sami Mujawar <sami.mujawar@arm.com>
Date: Tue, 20 Apr 2021 13:59:06 +0100
Subject: [PATCH 1/1] ArmVirtPkg: Add PCI host bridge utility lib for Kvmtool

The PCI host bridge utility lib is used to retrieve information
about the Root Bridges in a platform.
Therefore, add an instance of PciHostBridgeUtilityLib as this is
required to enable PCI support for Kvmtool firmware.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 .../KvmtoolPciHostBridgeUtilityLib.c               | 220 +++++++++++++++++++++
 .../KvmtoolPciHostBridgeUtilityLib.inf             |  39 ++++
 2 files changed, 259 insertions(+)
 create mode 100644 ArmVirtPkg/Library/KvmtoolPciHostBridgeUtilityLib/KvmtoolPciHostBridgeUtilityLib.c
 create mode 100644 ArmVirtPkg/Library/KvmtoolPciHostBridgeUtilityLib/KvmtoolPciHostBridgeUtilityLib.inf

diff --git a/ArmVirtPkg/Library/KvmtoolPciHostBridgeUtilityLib/KvmtoolPciHostBridgeUtilityLib.c b/ArmVirtPkg/Library/KvmtoolPciHostBridgeUtilityLib/KvmtoolPciHostBridgeUtilityLib.c
new file mode 100644
index 000000000000..ee3af07340fc
--- /dev/null
+++ b/ArmVirtPkg/Library/KvmtoolPciHostBridgeUtilityLib/KvmtoolPciHostBridgeUtilityLib.c
@@ -0,0 +1,220 @@
+/** @file
+  PCI Host Bridge utility functions for Kvmtool.
+
+  Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <IndustryStandard/Acpi10.h>
+#include <IndustryStandard/Pci.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PciHostBridgeLib.h>
+#include <Library/PciHostBridgeUtilityLib.h>
+#include <Library/PciLib.h>
+
+#pragma pack(1)
+
+/** A structure describing the ACPI and EFI device path for
+    the PCI Root Bridge device.
+**/
+typedef struct {
+  ACPI_HID_DEVICE_PATH     AcpiDevicePath;
+  EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
+} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
+
+#pragma pack ()
+
+/** An array of strings describing the ACPI address space type.
+**/
+GLOBAL_REMOVE_IF_UNREFERENCED
+STATIC CONST CHAR16 *mPciHostBridgeAcpiAddressSpaceTypeStr[] = {
+  L"Mem",
+  L"I/O",
+  L"Bus"
+};
+
+STATIC CONST EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath = {
+  {
+    // ACPI device path.
+    {
+      ACPI_DEVICE_PATH,
+      ACPI_DP,
+      {
+        (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)),
+        (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)
+      }
+    },
+    EISA_PNP_ID (0x0A03), // HID
+    0                     // UID
+  },
+
+  // End device path.
+  {
+    END_DEVICE_PATH_TYPE,
+    END_ENTIRE_DEVICE_PATH_SUBTYPE,
+    {
+      END_DEVICE_PATH_LENGTH,
+      0
+    }
+  }
+};
+
+STATIC PCI_ROOT_BRIDGE mRootBridge;
+
+/**
+  Utility function to return all the root bridge instances in an array.
+
+  @param [out] Count                  The number of root bridge instances.
+  @param [in]  Attributes             Initial attributes.
+  @param [in]  AllocAttributes        Allocation attributes.
+  @param [in]  DmaAbove4G             DMA above 4GB memory.
+  @param [in]  NoExtendedConfigSpace  No Extended Config Space.
+  @param [in]  BusMin                 Minimum Bus number, inclusive.
+  @param [in]  BusMax                 Maximum Bus number, inclusive.
+  @param [in]  Io                     IO aperture.
+  @param [in]  Mem                    MMIO aperture.
+  @param [in]  MemAbove4G             MMIO aperture above 4G.
+  @param [in]  PMem                   Prefetchable MMIO aperture.
+  @param [in]  PMemAbove4G            Prefetchable MMIO aperture above 4G.
+
+  @return                            All the root bridge instances in an array.
+**/
+PCI_ROOT_BRIDGE *
+EFIAPI
+PciHostBridgeUtilityGetRootBridges (
+  OUT UINTN                    *Count,
+  IN  UINT64                   Attributes,
+  IN  UINT64                   AllocationAttributes,
+  IN  BOOLEAN                  DmaAbove4G,
+  IN  BOOLEAN                  NoExtendedConfigSpace,
+  IN  UINTN                    BusMin,
+  IN  UINTN                    BusMax,
+  IN  PCI_ROOT_BRIDGE_APERTURE *Io,
+  IN  PCI_ROOT_BRIDGE_APERTURE *Mem,
+  IN  PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,
+  IN  PCI_ROOT_BRIDGE_APERTURE *PMem,
+  IN  PCI_ROOT_BRIDGE_APERTURE *PMemAbove4G
+  )
+{
+  if ((Count == NULL)       ||
+      (Io == NULL)          ||
+      (Mem == NULL)         ||
+      (MemAbove4G == NULL)  ||
+      (PMem == NULL)        ||
+      (PMemAbove4G == NULL)) {
+    return NULL;
+  }
+
+  *Count = 1;
+
+  mRootBridge.Segment               = 0;
+  mRootBridge.Supports              = Attributes;
+  mRootBridge.Attributes            = Attributes;
+
+  mRootBridge.DmaAbove4G            = DmaAbove4G;
+  mRootBridge.NoExtendedConfigSpace = NoExtendedConfigSpace;
+  mRootBridge.ResourceAssigned      = FALSE;
+
+  mRootBridge.AllocationAttributes  = AllocationAttributes;
+
+  mRootBridge.Bus.Base              = BusMin;
+  mRootBridge.Bus.Limit             = BusMax;
+  mRootBridge.Io.Base               = Io->Base;
+  mRootBridge.Io.Limit              = Io->Limit;
+  mRootBridge.Mem.Base              = Mem->Base;
+  mRootBridge.Mem.Limit             = Mem->Limit;
+  mRootBridge.MemAbove4G.Base       = MemAbove4G->Base;
+  mRootBridge.MemAbove4G.Limit      = MemAbove4G->Limit;
+  mRootBridge.PMem.Base             = PMem->Base;
+  mRootBridge.PMem.Limit            = PMem->Limit;
+  mRootBridge.PMemAbove4G.Base      = PMemAbove4G->Base;
+  mRootBridge.PMemAbove4G.Limit     = PMemAbove4G->Limit;
+
+  mRootBridge.DevicePath =
+    (EFI_DEVICE_PATH_PROTOCOL*)&mEfiPciRootBridgeDevicePath;
+
+  return &mRootBridge;
+}
+
+/**
+  Utility function to free root bridge instances array from
+  PciHostBridgeUtilityGetRootBridges().
+
+  @param[in] Bridges  The root bridge instances array.
+  @param[in] Count    The count of the array.
+**/
+VOID
+EFIAPI
+PciHostBridgeUtilityFreeRootBridges (
+  IN PCI_ROOT_BRIDGE *Bridges,
+  IN UINTN           Count
+  )
+{
+  // Nothing to do here.
+}
+
+/**
+  Utility function to inform the platform that the resource conflict happens.
+
+  @param[in] Configuration  Pointer to PCI I/O and PCI memory resource
+                            descriptors. The Configuration contains the
+                            resources for all the root bridges. The resource
+                            for each root bridge is terminated with END
+                            descriptor and an additional END is appended
+                            indicating the end of the entire resources. The
+                            resource descriptor field values follow the
+                            description in
+                            EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
+                            .SubmitResources().
+**/
+VOID
+EFIAPI
+PciHostBridgeUtilityResourceConflict (
+  IN VOID  *Configuration
+  )
+{
+  EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor;
+  UINTN                             RootBridgeIndex;
+  DEBUG ((DEBUG_ERROR, "PciHostBridge: Resource conflict happens!\n"));
+
+  RootBridgeIndex = 0;
+  Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR*)Configuration;
+  while (Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) {
+    DEBUG ((DEBUG_ERROR, "RootBridge[%d]:\n", RootBridgeIndex++));
+    for (; Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor++) {
+      ASSERT (Descriptor->ResType <
+              ARRAY_SIZE (mPciHostBridgeAcpiAddressSpaceTypeStr)
+              );
+      DEBUG ((
+        DEBUG_ERROR,
+        " %s: Length/Alignment = 0x%lx / 0x%lx\n",
+        mPciHostBridgeAcpiAddressSpaceTypeStr[Descriptor->ResType],
+        Descriptor->AddrLen,
+        Descriptor->AddrRangeMax
+        ));
+      if (Descriptor->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) {
+        DEBUG ((
+          DEBUG_ERROR,
+          "     Granularity/SpecificFlag = %ld / %02x%s\n",
+          Descriptor->AddrSpaceGranularity,
+          Descriptor->SpecificFlag,
+          ((Descriptor->SpecificFlag &
+            EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE
+            ) != 0) ? L" (Prefetchable)" : L""
+          ));
+      }
+    }
+    //
+    // Skip the END descriptor for root bridge
+    //
+    ASSERT (Descriptor->Desc == ACPI_END_TAG_DESCRIPTOR);
+    Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR*)(
+                   (EFI_ACPI_END_TAG_DESCRIPTOR*)Descriptor + 1
+                   );
+  }
+}
diff --git a/ArmVirtPkg/Library/KvmtoolPciHostBridgeUtilityLib/KvmtoolPciHostBridgeUtilityLib.inf b/ArmVirtPkg/Library/KvmtoolPciHostBridgeUtilityLib/KvmtoolPciHostBridgeUtilityLib.inf
new file mode 100644
index 000000000000..0e03fd6af8f0
--- /dev/null
+++ b/ArmVirtPkg/Library/KvmtoolPciHostBridgeUtilityLib/KvmtoolPciHostBridgeUtilityLib.inf
@@ -0,0 +1,39 @@
+## @file
+#  PciHostBridgeLib utility functions for Kvmtool.
+#
+#  Copyright (c) 2021, Arm Limited. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#
+##
+
+[Defines]
+  INF_VERSION                    = 0x0001001B
+  BASE_NAME                      = KvmtoolPciHostBridgeUtilityLib
+  FILE_GUID                      = 22A8844E-2AE7-4BF1-91FA-6EFDE3FE540C
+  MODULE_TYPE                    = DXE_DRIVER
+  VERSION_STRING                 = 1.0
+  LIBRARY_CLASS                  = PciHostBridgeUtilityLib
+
+#
+# The following information is for reference only and not required by the build
+# tools.
+#
+#  VALID_ARCHITECTURES           = AARCH64 ARM
+#
+
+[Sources]
+  KvmtoolPciHostBridgeUtilityLib.c
+
+[Packages]
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[LibraryClasses]
+  BaseMemoryLib
+  DebugLib
+  DevicePathLib
+  MemoryAllocationLib
+  PciLib
-- 
SAMI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}


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

* Re: [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family
  2021-05-29  7:43       ` Sami Mujawar
@ 2021-06-01  7:51         ` Jianyong Wu
  0 siblings, 0 replies; 30+ messages in thread
From: Jianyong Wu @ 2021-06-01  7:51 UTC (permalink / raw)
  To: Sami Mujawar, devel@edk2.groups.io, lersek@redhat.com,
	ardb+tianocore@kernel.org
  Cc: hao.a.wu@intel.com, Justin He, Leif Lindholm, nd

Hi Sami,

> -----Original Message-----
> From: Sami Mujawar <Sami.Mujawar@arm.com>
> Sent: Saturday, May 29, 2021 3:44 PM
> To: Jianyong Wu <Jianyong.Wu@arm.com>; devel@edk2.groups.io;
> lersek@redhat.com; ardb+tianocore@kernel.org
> Cc: hao.a.wu@intel.com; Justin He <Justin.He@arm.com>; Leif Lindholm
> <leif@nuviainc.com>; nd <nd@arm.com>
> Subject: Re: [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2
> family
> 
> Hi Jianyon,
> 
> Please find my response inline marked [SAMI].
> 
> Regards,
> 
> Sami Mujawar
> 
> On 27/05/2021 07:19 AM, Jianyong Wu wrote:
> > Hi Sami,
> >
> >> -----Original Message-----
> >> From: Sami Mujawar <Sami.Mujawar@arm.com>
> >> Sent: Wednesday, May 19, 2021 4:27 AM
> >> To: Jianyong Wu <Jianyong.Wu@arm.com>; devel@edk2.groups.io;
> >> lersek@redhat.com; ardb+tianocore@kernel.org
> >> Cc: hao.a.wu@intel.com; Justin He <Justin.He@arm.com>; Leif Lindholm
> >> <leif@nuviainc.com>; nd <nd@arm.com>
> >> Subject: Re: [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to
> >> edk2 family
> >>
> >> Hi Jianyon,
> >>
> >> Thank you for this patch.
> >>
> >> Please find my response inline marked [SAMI].
> >>
> >> Regards,
> >>
> >> Sami Mujawar
> >>
> >>
> >> On 17/05/2021 07:50 AM, Jianyong Wu wrote:
> >>> Cloud Hypervisor is kvm based VMM and is implemented in rust. Just
> >>> like other VMMs it need UEFI support to let ACPI work. That's why
> >>> Cloud Hypervisor is introduced here.
> >>>
> >>> Cc: Laszlo Ersek <lersek@redhat.com>
> >>> Cc: Leif Lindholm <leif@nuviainc.com>
> >>> Cc:
> >>> Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
> >>> ---
> >>>    ArmVirtPkg/ArmVirtCloudHv.dsc           | 455
> >> ++++++++++++++++++++++++
> >>>    ArmVirtPkg/ArmVirtCloudHv.fdf           | 292 +++++++++++++++
> >>>    ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc | 169 +++++++++
> >>>    3 files changed, 916 insertions(+)
> >>>    create mode 100644 ArmVirtPkg/ArmVirtCloudHv.dsc
> >>>    create mode 100644 ArmVirtPkg/ArmVirtCloudHv.fdf
> >>>    create mode 100644 ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> >>>
> >>> diff --git a/ArmVirtPkg/ArmVirtCloudHv.dsc
> >>> b/ArmVirtPkg/ArmVirtCloudHv.dsc new file mode 100644 index
> >>> 000000000000..bf1f8c5a75ae
> >>> --- /dev/null
> >>> +++ b/ArmVirtPkg/ArmVirtCloudHv.dsc
> >>> @@ -0,0 +1,455 @@
> >>> +#
> >>> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> >>> +#  Copyright (c) 2014, Linaro Limited. All rights reserved.
> >>> +#  Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
> >>> +#
> >>> +#  SPDX-License-Identifier: BSD-2-Clause-Patent # #
> >>> +
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +#
> >>> +# Defines Section - statements that will be processed to create a
> Makefile.
> >>> +#
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +[Defines]
> >>> +  PLATFORM_NAME                  = ArmVirtCloudHv
> >>> +  PLATFORM_GUID                  = DFFED32B-DFFE-D32B-DFFE-
> D32BDFFED32B
> >>> +  PLATFORM_VERSION               = 0.1
> >>> +  DSC_SPECIFICATION              = 0x00010005
> >>> +  OUTPUT_DIRECTORY               = Build/ArmVirtCloudHv-$(ARCH)
> >>> +  SUPPORTED_ARCHITECTURES        = AARCH64|ARM
> >>> +  BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
> >>> +  SKUID_IDENTIFIER               = DEFAULT
> >>> +  FLASH_DEFINITION               = ArmVirtPkg/ArmVirtCloudHv.fdf
> >>> +
> >>> +  #
> >>> +  # Defines for default states.  These can be changed on the command
> line.
> >>> +  # -D FLAG=VALUE
> >>> +  #
> >>> +  DEFINE TTY_TERMINAL            = FALSE
> >>> +  DEFINE SECURE_BOOT_ENABLE      = FALSE
> >>> +  DEFINE TPM2_ENABLE             = FALSE
> >>> +  DEFINE TPM2_CONFIG_ENABLE      = FALSE
> >>> +
> >>> +!include ArmVirtPkg/ArmVirt.dsc.inc
> >>> +
> >>> +[LibraryClasses.common]
> >>> +  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
> >>> +  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
> >>> +
> >>> +  # Virtio Support
> >>> +  VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
> >>> +
> >>> +
> >>
> VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDe
> >>> + viceLib.inf
> >>> +
> QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf
> >>> +
> >>> +
> >>
> QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3Li
> >> bNull
> >>> + .inf
> >>> +
> >>
> QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/
> >> Qe
> >>> + muFwCfgSimpleParserLib.inf
> >>> +
> >>
> QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/Generic
> >> Qemu
> >>> + LoadImageLib.inf
> >> [SAMI] Does Cloud Hypervisor support Qemu-FwCfg? If not, then are the
> >> above 4 libraries needed?
> > Hi Sami, I think CloudHv doesn't dependent on qemu-fwcfg, so I have tried
> to remove the dependencies. But I find it difficult to do that.
> > Some implicit codes depend on qemu-cfg that I can't do workaround. E.g.
> >
> > In OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
> > "
> >   Status = QemuFwCfgFindFile ("etc/extra-pci-roots", &FwCfgItem,
> &FwCfgSize);
> >    if (EFI_ERROR (Status) || FwCfgSize != sizeof ExtraRootBridges) {
> >      ExtraRootBridges = 0;
> >    } else {
> >      QemuFwCfgSelectItem (FwCfgItem);
> >      QemuFwCfgReadBytes (FwCfgSize, &ExtraRootBridges); "
> > I don't know how to do with it. So, I keep it here.
> > Maybe I need your help if these dependencies should be removed.
> [SAMI] I am working on a patch series that adds ACPI and PCI support for
> Kvmtool firmware. So, I may just have the patch you need. The patch is an
> instance of PciHostBridgeUtilityLib without the FwCfg and I think it should
> work for Choud Hypervisor too.
> If you can try the attached patch and let me know if it works; I will reword the
> patch so that it is common for both Kvmtool and Cloud Hypervisor and post it
> to the mailing list.
> Please let me know if you face any issues.
> [/SAMI]

I try your patch and it works! Now I can throw qemuFwCfg lib out of my patch.
I will rebase my patch on the common Pci lib after you rework on it.

Thanks
Jianyong Wu

> >>> +
> >>> +
> >>> +
> >>
> ArmPlatformLib|ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatform
> >>> + LibNull.inf
> >>> +
> >>> +  TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
> >>> +
> >>> +
> >>
> CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.
> >>> + inf  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
> >>> +
> >>> +
> >>
> PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/Pla
> >>> + tformBootManagerLib.inf
> >> [SAMI] The above instance of PlatformBootManagerLibhas a dependency
> >> on Qemu-FwCfg, right?
> >>> +
> >>> +
> >>
> PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBm
> >>> + PrintScLib.inf
> >>> +
> >>
> CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Custo
> >>> + mizedDisplayLib.inf
> >>> +
> >>
> FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBuffer
> >>> + BltLib.inf
> >>> +
> >>
> QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrder
> >> Lib.i
> >>> + nf
> >> [SAMI] Qemu-FwCfg dependency?
> > Sure
> >
> >>> +
> >>> + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerL
> >>> + FileExplorerLib|ib
> >>> + .inf
> >>> + PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPc
> >>> + PciPcdProducerLib|dP
> >>> + roducerLib.inf
> >>> +
> >>
> PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibP
> >>> + ci.inf
> >>> + PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHost
> >>> + PciHostBridgeLib|Br
> >>> + idgeLib.inf
> >>> + PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/Pc
> >>> + PciHostBridgeUtilityLib|iH
> >>> + ostBridgeUtilityLib.inf
> >>> +
> >>> +!if $(TPM2_ENABLE) == TRUE
> >>> +
> >>>
> >>
> +Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2Command
> >> Lib.inf
> >>> +
> >>>
> >>
> +Tcg2PhysicalPresenceLib|OvmfPkg/Library/Tcg2PhysicalPresenceLibQemu/
> >> D
> >>> +xeTcg2PhysicalPresenceLib.inf
> >> [SAMI] Is this supported by Cloud Hypervisor?
> > No, should be removed.
> >
> >>> +
> >>>
> >>
> +TpmMeasurementLib|SecurityPkg/Library/DxeTpmMeasurementLib/DxeT
> >> pmMeas
> >>> +urementLib.inf
> >>> +!else
> >>> +
> >>>
> >>
> +TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/T
> >> pmMeasu
> >>> +rementLibNull.inf
> >>> +!endif
> >>> +
> >>> +!include MdePkg/MdeLibs.dsc.inc
> >>> +
> >>> +[LibraryClasses.common.PEIM]
> >>> +
> >>>
> >>
> +ArmVirtMemInfoLib|ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHv
> >> Vir
> >>> +tMemInfoPeiLib.inf
> >>> +
> >>> +!if $(TPM2_ENABLE) == TRUE
> >>> +  BaseCryptLib|CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> >>> +
> >>>
> >>
> +ResetSystemLib|MdeModulePkg/Library/PeiResetSystemLib/PeiResetSyst
> >> emL
> >>> +ib.inf
> >>> +
> >>>
> >>
> +Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2DeviceLibD
> >> Tpm
> >>> +.inf
> >>> +!endif
> >>> +
> >>> +[LibraryClasses.common.DXE_DRIVER]
> >>> +
> >>>
> >>
> +ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/D
> >> xeRe
> >>> +portStatusCodeLib.inf
> >>> +
> >>> +!if $(TPM2_ENABLE) == TRUE
> >>> +
> >>>
> >>
> +Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg
> >> 2
> >>> +.inf
> >>> +!endif
> >>> +
> >>> +[LibraryClasses.common.UEFI_DRIVER]
> >>> +  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
> >>> +
> >>> +[BuildOptions]
> >>> +!include NetworkPkg/NetworkBuildOptions.dsc.inc
> >>> +
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +#
> >>> +# Pcd Section - list of all EDK II PCD Entries defined by this
> >>> +Platform #
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +
> >>> +[PcdsFeatureFlag.common]
> >>> +
> gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation|TRUE
> >>> +
> >>
> gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation|TRUE
> >>> +
> >>> +  ## If TRUE, Graphics Output Protocol will be installed on virtual
> >>> + handle
> >> created by ConsplitterDxe.
> >>> +  #  It could be set FALSE to save size.
> >>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
> >>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
> >>> +
> >>> +
> >> gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
> >>> +
> >>> +  gArmVirtTokenSpaceGuid.PcdTpm2SupportEnabled|$(TPM2_ENABLE)
> >>> +
> >>> +[PcdsFixedAtBuild.common]
> >>> +!if $(ARCH) == AARCH64
> >>> +  gArmTokenSpaceGuid.PcdVFPEnabled|1
> >>> +!endif
> >>> +
> >>> +  gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x4007c000
> >>> +
> >> gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvStoreReserved|0
> >>> +  gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
> >>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
> >>> +
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800
> >>> +
> >>> +  # Rsdp base address in Cloud Hypervisor
> >>> +
> >>
> gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiRsdpBaseAddress|0x40200000
> >>> +
> >>> +
> >>>
> >>
> +gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x40
> >> 0000
> >>> +0
> >>> +
> >>>
> >>
> +gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x400
> >> 00
> >>> +!if $(NETWORK_TLS_ENABLE) == TRUE
> >>> +  #
> >>> +  # The cumulative and individual VOLATILE variable size limits
> >>> +should be set
> >>> +  # high enough for accommodating several and/or large CA certificates.
> >>> +  #
> >>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x80000
> >>> +
> >>
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVolatileVariableSize|0x40000
> >>> +!endif
> >>> +
> >>> +  # Size of the region used by UEFI in permanent memory (Reserved
> >>> + 64MB)
> >>> +
> >>
> gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x040000
> >> 00
> >>> +
> >>> +  #
> >>> +  # ARM PrimeCell
> >>> +  #
> >>> +
> >>> +  ## PL011 - Serial Terminal
> >>> +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|38400
> >>> +
> >>> +  ## Default Terminal Type
> >>> +  ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM !if
> >>> +$(TTY_TERMINAL) == TRUE
> >>> +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
> >>> +  # Set terminal type to TtyTerm, the value encoded is
> >>> +EFI_TTY_TERM_GUID
> >>> +  gArmVirtTokenSpaceGuid.PcdTerminalTypeGuidBuffer|{0x80, 0x6d,
> >> 0x91,
> >>> +0x7d, 0xb1, 0x5b, 0x8c, 0x45, 0xa4, 0x8f, 0xe2, 0x5f, 0xdd, 0x51,
> >>> +0xef, 0x94} !else
> >>> +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|1
> >>> +!endif
> >>> +
> >>> +  # System Memory Base -- fixed at 0x4000_0000
> >>> +  gArmTokenSpaceGuid.PcdSystemMemoryBase|0x40000000
> >>> +
> >>> +  # initial location of the device tree blob passed by Cloud
> >>> + Hypervisor -- base of DRAM
> >>> +
> gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x40000000
> >>> +
> >>> +
> >>> +
> >>> +
> >>
> gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationC
> >> hange
> >>> + |FALSE
> >> gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{
> >>> + 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a,
> >>> + 0xb6, 0xf4, 0x66, 0x23, 0x31 }
> >>> +
> >>> +  #
> >>> +  # The maximum physical I/O addressability of the processor, set
> >>> + with  # BuildCpuHob().
> >>> +  #
> >>> +  gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|16
> >>> +
> >>> +  #
> >>> +  # Enable the non-executable DXE stack. (This gets set up by
> >>> + DxeIpl) #
> gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE
> >>> +
> >>> +!if $(SECURE_BOOT_ENABLE) == TRUE
> >>> +  # override the default values from SecurityPkg to ensure images
> >>> +from all sources are verified in secure boot
> >>> +
> >>>
> >>
> +gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x
> >> 0
> >>> +4
> >>> +
> >>>
> >>
> +gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0
> >> +x
> >>> +04
> >>> +
> >>>
> >>
> +gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPoli
> >> c
> >>> +y|0x04
> >>> +!endif
> >>> +
> >>> +  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|3
> >>> +  gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x20000
> >>> +
> >>> +[PcdsFixedAtBuild.AARCH64]
> >>> +  # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS
> >>> +entry point,
> >>> +  # if the entry point version is >= 3.0. AARCH64 OSes cannot
> >>> +assume the
> >>> +  # presence of the 32-bit entry point anyway (because many AARCH64
> >>> +systems
> >>> +  # don't have 32-bit addressable physical RAM), and the additional
> >>> +allocations
> >>> +  # below 4 GB needlessly fragment the memory map. So expose the
> >>> +64-bit entry
> >>> +  # point only, for entry point versions >= 3.0.
> >>> +
> >>
> gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosEntryPointProvideMethod|0
> >> x2
> >>> +
> >>> +[PcdsDynamicDefault.common]
> >>> +  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
> >>> +
> >>> +  ## If TRUE, OvmfPkg/AcpiPlatformDxe will not wait for PCI  #
> >>> + enumeration to complete before installing ACPI tables.
> >>> +
> >> gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE
> >>> +
> >>> +  # System Memory Size -- 1 MB initially, actual size will be
> >>> + fetched from DT
> >>> +  gArmTokenSpaceGuid.PcdSystemMemorySize|0x00100000
> >>> +
> >>> +
> >>
> gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable|TRUE
> >>> +
> >>> +  gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0
> >>> +  gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
> >>> +  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
> >>> +  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|0x0
> >>> +
> >>> +  #
> >>> +  # ARM General Interrupt Controller  #
> >>> +  gArmTokenSpaceGuid.PcdGicDistributorBase|0x0
> >>> +  gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x0
> >>> +  gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x0
> >>> +
> >>> +  ## PL031 RealTimeClock
> >>> +  gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x0
> >>> +
> >>> +  # set PcdPciExpressBaseAddress to MAX_UINT64, which signifies
> >>> + that this  # PCD and PcdPciDisableBusEnumeration above have not
> >>> + been assigned yet
> >>> +
> >>
> gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0xFFFFFFFFFFFFFF
> >> FF
> >>> +
> >>> +  gArmTokenSpaceGuid.PcdPciIoTranslation|0
> >>> +#  gArmTokenSpaceGuid.PcdPciIoTranslation|0x50000000
> >> [SAMI] Remove commented code.
> > Yeah
> >
> >>> +
> >>> +  #
> >>> +  # TPM2 support
> >>> +  #
> >>> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress|0x0
> >>> +!if $(TPM2_ENABLE) == TRUE
> >>> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid|{0x00, 0x00,
> >>> +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> >>> +0x00, 0x00, 0x00}
> >>> +  gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|0
> >>> +!endif
> >>> +
> >>> +[PcdsDynamicHii]
> >>> +
> >>>
> >>
> +gArmVirtTokenSpaceGuid.PcdForceNoAcpi|L"ForceNoAcpi"|gArmVirtVaria
> >> ble
> >>> +Guid|0x0|FALSE|NV,BS
> >>> +
> >>> +!if $(TPM2_CONFIG_ENABLE) == TRUE
> >>> +
> >>>
> >>
> +gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"T
> >> +C
> >>> +G2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS
> >>> +
> >>>
> >>
> +gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"
> >> |gTc
> >>> +g2ConfigFormSetGuid|0x8|3|NV,BS
> >>> +!endif
> >>> +
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +#
> >>> +# Components Section - list of all EDK II Modules needed by this
> >>> +Platform #
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +[Components.common]
> >>> +  #
> >>> +  # PEI Phase modules
> >>> +  #
> >>> +  ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
> >>> +  MdeModulePkg/Core/Pei/PeiMain.inf
> >>> +  MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
> >>> +    <LibraryClasses>
> >>> +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> >>> +  }
> >>> +  ArmPlatformPkg/PlatformPei/PlatformPeim.inf
> >>> +  ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
> >>> +  ArmPkg/Drivers/CpuPei/CpuPei.inf
> >>> +
> >>> +  MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
> >>> +
> >>> +!if $(TPM2_ENABLE) == TRUE
> >>> +  MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf {
> >>> +    <LibraryClasses>
> >>> +
> >>>
> >>
> +ResetSystemLib|ArmVirtPkg/Library/ArmVirtPsciResetSystemPeiLib/ArmVi
> >> r
> >>> +tPsciResetSystemPeiLib.inf
> >>> +  }
> >>> +  OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> >>> +  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf {
> >>> +    <LibraryClasses>
> >>> +
> >>
> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCrypto
> >> HashLib|R
> >> outerPei.inf
> >>> +
> >> NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> >>> +
> >>
> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.
> >> NULL|in
> >> f
> >>> +
> >>
> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.
> >> NULL|in
> >> f
> >>> +
> >>
> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.
> >> NULL|in
> >> f
> >>> +
> >>>
> +NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
> >>> +  }
> >>> +!endif
> >>> +
> >>> +  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
> >>> +    <LibraryClasses>
> >>> +
> >>> +
> >>
> NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDec
> >> ompre
> >>> + ssLib.inf
> >>> +  }
> >>> +
> >>> +  #
> >>> +  # DXE
> >>> +  #
> >>> +  MdeModulePkg/Core/Dxe/DxeMain.inf {
> >>> +    <LibraryClasses>
> >>> +
> >>
> NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32G
> >> uidedSectionExtractLib.inf
> >>> +
> >>> +
> DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.i
> >>> + DevicePathLib|nf
> >>> +  }
> >>> +  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
> >>> +    <LibraryClasses>
> >>> +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> >>> +  }
> >>> +
> >>> +  #
> >>> +  # Architectural Protocols
> >>> +  #
> >>> +  ArmPkg/Drivers/CpuDxe/CpuDxe.inf
> >>> +  MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> >>> +
> >>
> MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
> >>> +    <LibraryClasses>
> >>> +
> NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
> >>> +      # don't use unaligned CopyMem () on the UEFI varstore NOR
> >>> + flash
> >> region
> >>> +
> >> BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
> >>> +  }
> >>> +!if $(SECURE_BOOT_ENABLE) == TRUE
> >>> +  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
> >>> +    <LibraryClasses>
> >>> +
> >>> +NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificati
> >>> +NULL|on
> >>> +Lib.inf
> >>> +!if $(TPM2_ENABLE) == TRUE
> >>> +
> >>>
> >>
> +NULL|SecurityPkg/Library/DxeTpm2MeasureBootLib/DxeTpm2MeasureBo
> >> otLib.
> >>> +inf
> >>> +!endif
> >>> +  }
> >>> +
> >>>
> >>
> +SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf
> >> i
> >>> +gDxe.inf
> >>> +  OvmfPkg/EnrollDefaultKeys/EnrollDefaultKeys.inf
> >>> +!else
> >>> +  MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> >>> +!endif
> >>> +
> MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> >>> +
> >>>
> >>
> +MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i
> >> n
> >>> +f
> >>> +
> >>>
> >>
> +MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCou
> >> nterRun
> >>> +timeDxe.inf
> >>> +
> >>>
> >>
> +MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
> >> Dxe.in
> >>> +f
> >>> +
> >> EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
> {
> >>> +    <LibraryClasses>
> >>> +
> >>>
> >>
> +NULL|ArmVirtPkg/Library/ArmVirtPL031FdtClientLib/ArmVirtPL031FdtClie
> >> +NULL|n
> >>> +tLib.inf
> >>> +  }
> >>> +  EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> >>> +
> >>> +
> >> MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> >>> +
> MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> >>> +
> >>> +
> >>
> MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleD
> >> xe
> >>> + .inf  MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> >>> +  MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> >>> +
> >>> +  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> >>> +
> >>> +  ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> >>> +  ArmPkg/Drivers/TimerDxe/TimerDxe.inf {
> >>> +    <LibraryClasses>
> >>> +
> >>> +
> NULL|ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtCl
> >>> + NULL|ie
> >>> + ntLib.inf
> >>> +  }
> >>> +  MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> >>> +
> >>> +  #
> >>> +  # Status Code Routing
> >>> +  #
> >>> +
> >>> +
> >>
> MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportSt
> >> atu
> >>> + sCodeRouterRuntimeDxe.inf
> >>> +
> >>> +  #
> >>> +  # Platform Driver
> >>> +  #
> >>> +  ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> >>> +  ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> >>> +  ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> >>> +  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> >>> +  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> >>> +  OvmfPkg/VirtioNetDxe/VirtioNet.inf
> >>> +  OvmfPkg/VirtioRngDxe/VirtioRng.inf
> >>> +
> >>> +  #
> >>> +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem +
> >>> + virtio-fs  #  MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> >>> +  MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> >>> +
> >>> +
> >>
> MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i
> >>> + nf
> >>> +  FatPkg/EnhancedFatDxe/Fat.inf
> >>> +  MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> >>> +  OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> >>> +
> >>> +  #
> >>> +  # Bds
> >>> +  #
> >>> +  MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf {
> >>> +    <LibraryClasses>
> >>> +
> >> DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> >>> +      PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> >>> +  }
> >>> +  MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> >>> +  MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> >>> +
> >>> +
> >>
> MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManager
> >> Dxe
> >>> + .inf  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> >>> +  MdeModulePkg/Logo/LogoDxe.inf
> >>> +  MdeModulePkg/Application/UiApp/UiApp.inf {
> >>> +    <LibraryClasses>
> >>> +
> >>
> NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
> >>> +
> >> NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
> >>> +
> >>> +
> >>
> NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMainte
> >> nanc
> >>> + eManagerUiLib.inf
> >>> +  }
> >>> +  OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
> >> [SAMI] Qemu-FwCfg dependency?
> > Yeah
> >
> >>> +
> >>> +  #
> >>> +  # SCSI Bus and Disk Driver
> >>> +  #
> >>> +  MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> >>> +  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> >>> +
> >>> +  #
> >>> +  # PCI support
> >>> +  #
> >>> +  ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {
> >>> +    <LibraryClasses>
> >>> +
> >>> + NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.
> >>> + NULL|in
> >>> + f
> >>> +  }
> >>> +  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> >>> +  MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
> >>> +    <LibraryClasses>
> >>> +
> >>> + NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.
> >>> + NULL|in
> >>> + f
> >>> +  }
> >>> +  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> >>> +  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> >>> +  OvmfPkg/Virtio10Dxe/Virtio10.inf
> >>> +
> >>> +  #
> >>> +  # TPM2 support
> >>> +  #
> >>> +!if $(TPM2_ENABLE) == TRUE
> >>> +  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf {
> >>> +    <LibraryClasses>
> >>> +
> >>
> HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCrypto
> >> HashLib|R
> >> outerDxe.inf
> >>> +
> >>
> Tpm2DeviceLib|SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibR
> >> outerDxe.inf
> >>> +
> >>
> NULL|SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf
> >>> +
> >> NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf
> >>> +
> >>
> NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256.
> >> NULL|in
> >> f
> >>> +
> >>
> NULL|SecurityPkg/Library/HashInstanceLibSha384/HashInstanceLibSha384.
> >> NULL|in
> >> f
> >>> +
> >>
> NULL|SecurityPkg/Library/HashInstanceLibSha512/HashInstanceLibSha512.
> >> NULL|in
> >> f
> >>> +
> >>>
> +NULL|SecurityPkg/Library/HashInstanceLibSm3/HashInstanceLibSm3.inf
> >>> +  }
> >>> +!if $(TPM2_CONFIG_ENABLE) == TRUE
> >>> +  SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> >>> +!endif
> >>> +!endif
> >>> +
> >>> +  #
> >>> +  # ACPI Support
> >>> +  #
> >>> +  ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> >>> +[Components.AARCH64]
> >>> +
> >>>
> >>
> +MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap
> >> hics
> >>> +ResourceTableDxe.inf
> >>> +  ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf {
> >>> +    <LibraryClasses>
> >>> +
> >>>
> >>
> +NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.in
> >> +NULL|f
> >>> +  }
> >>> diff --git a/ArmVirtPkg/ArmVirtCloudHv.fdf
> >>> b/ArmVirtPkg/ArmVirtCloudHv.fdf new file mode 100644 index
> >>> 000000000000..3619a09ba8c5
> >>> --- /dev/null
> >>> +++ b/ArmVirtPkg/ArmVirtCloudHv.fdf
> >>> @@ -0,0 +1,292 @@
> >>> +#
> >>> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> >>> +#  Copyright (c) 2014, Linaro Limited. All rights reserved.
> >>> +#  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> >>> +#
> >>> +#  SPDX-License-Identifier: BSD-2-Clause-Patent #
> >>> +
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +#
> >>> +# FD Section
> >>> +# The [FD] Section is made up of the definition statements and a #
> >>> +description of what goes into  the Flash Device Image.  Each FD
> >>> +section # defines one flash "device" image.  A flash device image
> >>> +may be one of # the following: Removable media bootable image (like
> >>> +a boot floppy # image,) an Option ROM image (that would be "flashed"
> >>> +into an add-in # card,) a System "Flash"  image (that would be
> >>> +burned into a system's # flash) or an Update ("Capsule") image that
> >>> +will be used to update and # existing system flash.
> >>> +#
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +
> >>> +[Defines]
> >>> +!if $(FD_SIZE_IN_MB) == 2
> >>> +  DEFINE FVMAIN_COMPACT_SIZE  = 0x1ff000 !endif !if
> >>> +$(FD_SIZE_IN_MB) == 3
> >>> +  DEFINE FVMAIN_COMPACT_SIZE  = 0x2ff000 !endif
> >>> +
> >>> +[FD.CLOUDHV_EFI]
> >>> +BaseAddress   = 0x00000000|gArmTokenSpaceGuid.PcdFdBaseAddress
> #
> >> cloud-hypervisor assigns 0 - 0x8000000 for a BootROM
> >>> +Size          = $(FD_SIZE)|gArmTokenSpaceGuid.PcdFdSize         # The size
> in
> >> bytes of the FLASH Device
> >>> +ErasePolarity = 1
> >>> +
> >>> +# This one is tricky, it must be: BlockSize * NumBlocks = Size
> >>> +BlockSize     = 0x00001000
> >>> +NumBlocks     = $(FD_NUM_BLOCKS)
> >>> +
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +#
> >>> +# Following are lists of FD Region layout which correspond to the
> >>> +locations of different # images within the flash device.
> >>> +#
> >>> +# Regions must be defined in ascending order and may not overlap.
> >>> +#
> >>> +# A Layout Region start with a eight digit hex offset (leading "0x"
> >>> +required) followed by # the pipe "|" character, followed by the
> >>> +size of the region, also in hex with the leading # "0x" characters. Like:
> >>> +# Offset|Size
> >>> +# PcdOffsetCName|PcdSizeCName
> >>> +# RegionType <FV, DATA, or FILE>
> >>> +#
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +
> >>> +#
> >>> +# UEFI has trouble dealing with FVs that reside at physical address 0x0.
> >>> +# So instead, put a hardcoded 'jump to 0x1000' at offset 0x0, and
> >>> +put the # real FV at offset 0x1000 #
> >>> +0x00000000|0x00001000
> >>> +DATA = {
> >>> +!if $(ARCH) == AARCH64
> >>> +  0x00, 0x04, 0x00, 0x14   # 'b 0x1000' in AArch64 ASM
> >>> +!else
> >>> +  0xfe, 0x03, 0x00, 0xea   # 'b 0x1000' in AArch32 ASM
> >>> +!endif
> >>> +}
> >>> +
> >>> +0x00001000|$(FVMAIN_COMPACT_SIZE)
> >>>
> >>
> +gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
> >>> +FV = FVMAIN_COMPACT
> >>> +
> >>> +!include VarStore.fdf.inc
> >>> +
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +#
> >>> +# FV Section
> >>> +#
> >>> +# [FV] section is used to define what components or modules are
> >>> +placed within a flash # device file.  This section also defines
> >>> +order the components and modules are positioned # within the image.
> >>> +The [FV] section consists of define statements, set statements and
> >>> +# module
> >> statements.
> >>> +#
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +
> >>> +#!include ArmVirtCloudHvFvMain.fdf.inc
> >>> +
> >>> +
> >>> +
> >>> +[FV.FvMain]
> >>> +FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
> >>> +BlockSize          = 0x40
> >>> +NumBlocks          = 0         # This FV gets compressed so make it just big
> >> enough
> >>> +FvAlignment        = 16        # FV alignment and FV attributes setting.
> >>> +ERASE_POLARITY     = 1
> >>> +MEMORY_MAPPED      = TRUE
> >>> +STICKY_WRITE       = TRUE
> >>> +LOCK_CAP           = TRUE
> >>> +LOCK_STATUS        = TRUE
> >>> +WRITE_DISABLED_CAP = TRUE
> >>> +WRITE_ENABLED_CAP  = TRUE
> >>> +WRITE_STATUS       = TRUE
> >>> +WRITE_LOCK_CAP     = TRUE
> >>> +WRITE_LOCK_STATUS  = TRUE
> >>> +READ_DISABLED_CAP  = TRUE
> >>> +READ_ENABLED_CAP   = TRUE
> >>> +READ_STATUS        = TRUE
> >>> +READ_LOCK_CAP      = TRUE
> >>> +READ_LOCK_STATUS   = TRUE
> >>> +
> >>> +  INF MdeModulePkg/Core/Dxe/DxeMain.inf  INF
> >>> + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> >>> +  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> >>> +  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> >>> +  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> >>> +
> >>> +  #
> >>> +  # PI DXE Drivers producing Architectural Protocols (EFI Services)
> >>> + #  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf  INF
> >>> + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> >>> +  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> >>> +  INF
> >> MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> >>> +  INF
> >>>
> >>
> +MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i
> >> n
> >>> +f
> >>> +  INF
> >>>
> >>
> +MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
> >>> +!if $(SECURE_BOOT_ENABLE) == TRUE
> >>> +  INF
> >>>
> >>
> +SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf
> >> i
> >>> +gDxe.inf
> >>> +!endif
> >>> +  INF
> >>>
> >>
> +MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCou
> >> nterRun
> >>> +timeDxe.inf
> >>> +  INF
> >>>
> >>
> +MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
> >> Dxe.in
> >>> +f
> >>> +  INF
> >> EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
> >>> +  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> >>> +  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> >>> +
> >>> +  #
> >>> +  # Multiple Console IO support
> >>> +  #
> >>> +  INF
> >>> +
> >> MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> >>> +  INF
> >>> +
> MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> >>> +  INF
> >>> +
> >>
> MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleD
> >> xe
> >>> + .inf  INF
> >> MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> >>> +  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> >>> +
> >>> +  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> >>> +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
> >>> +  INF
> MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> >>> +
> >>> +  #
> >>> +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem +
> >>> + virtio-fs  #  INF
> >>> + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> >>> +  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> >>> +  INF FatPkg/EnhancedFatDxe/Fat.inf  INF
> >>> +
> >>
> MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i
> >>> + nf  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> >>> +  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> >>> +
> >>> +  #
> >>> +  # Status Code Routing
> >>> +  #
> >>> +  INF
> >>> +
> >>
> MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportSt
> >> atu
> >>> + sCodeRouterRuntimeDxe.inf
> >>> +
> >>> +  #
> >>> +  # Platform Driver
> >>> +  #
> >>> +  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> >>> +  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
> >>> +  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> >>> +  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
> >>> +
> >>> +  #
> >>> +  # UEFI application (Shell Embedded Boot Loader)  #  INF
> >>> + ShellPkg/Application/Shell/Shell.inf
> >>> +  INF
> >>> +
> >>
> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.
> >> inf
> >>> +  INF
> >>> +
> >>
> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand
> >> .inf
> >>> +  INF
> >>> +
> >>
> OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellComma
> >> n
> >>> + d.inf
> >>> +
> >>> +  #
> >>> +  # Bds
> >>> +  #
> >>> +  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
> >>> +  INF
> MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> >>> +  INF
> MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> >>> +  INF
> >>> +
> >>
> MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManager
> >> Dxe
> >>> + .inf  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> >>> +  INF MdeModulePkg/Application/UiApp/UiApp.inf
> >>> +  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
> >> [SAMI] Qemu-FwCfg dependency? Also check at other places in the fdf
> >> and fdf.inc file.
> > Yeah, it's a tough work for me.
> >
> >>> +
> >>> +  #
> >>> +  # SCSI Bus and Disk Driver
> >>> +  #
> >>> +  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> >>> +  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> >>> +
> >>> +  #
> >>> +  # ACPI Support
> >>> +  #
> >>> +  INF
> >> ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> >>> +!if $(ARCH) == AARCH64
> >>> +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> >>> +  INF
> >>>
> >>
> +MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap
> >> hics
> >>> +ResourceTableDxe.inf
> >>> +  INF
> ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> >>> +
> >>> +  #
> >>> +  # EBC support
> >>> +  #
> >>> +  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> >>> +!endif
> >>> +
> >>> +  #
> >>> +  # PCI support
> >>> +  #
> >>> +  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
> >>> +  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> >>> +  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
> >>> +  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> >>> +  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> >>> +  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
> >>> +
> >>> +  #
> >>> +  # TPM2 support
> >>> +  #
> >>> +!if $(TPM2_ENABLE) == TRUE
> >>> +  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> >>> +!if $(TPM2_CONFIG_ENABLE) == TRUE
> >>> +  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> >>> +!endif
> >>> +!endif
> >>> +
> >>> +  #
> >>> +  # TianoCore logo (splash screen)
> >>> +  #
> >>> +  INF MdeModulePkg/Logo/LogoDxe.inf
> >>> +
> >>> +  #
> >>> +  # Ramdisk support
> >>> +  #
> >>> +  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
> >>> +
> >>> +
> >>> +
> >>> +
> >>> +
> >>> +
> >>> +
> >>> +
> >>> +
> >>> +
> >>> +
> >>> +
> >> [SAMI] Remove empty lines.
> > Oh, it's my bad.
> >
> > Thanks
> > Jianyong
> >
> >>> +[FV.FVMAIN_COMPACT]
> >>> +FvAlignment        = 16
> >>> +ERASE_POLARITY     = 1
> >>> +MEMORY_MAPPED      = TRUE
> >>> +STICKY_WRITE       = TRUE
> >>> +LOCK_CAP           = TRUE
> >>> +LOCK_STATUS        = TRUE
> >>> +WRITE_DISABLED_CAP = TRUE
> >>> +WRITE_ENABLED_CAP  = TRUE
> >>> +WRITE_STATUS       = TRUE
> >>> +WRITE_LOCK_CAP     = TRUE
> >>> +WRITE_LOCK_STATUS  = TRUE
> >>> +READ_DISABLED_CAP  = TRUE
> >>> +READ_ENABLED_CAP   = TRUE
> >>> +READ_STATUS        = TRUE
> >>> +READ_LOCK_CAP      = TRUE
> >>> +READ_LOCK_STATUS   = TRUE
> >>> +
> >>> +  INF ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf
> >>> +  INF MdeModulePkg/Core/Pei/PeiMain.inf  INF
> >>> + ArmPlatformPkg/PlatformPei/PlatformPeim.inf
> >>> +  INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf
> >>> +  INF ArmPkg/Drivers/CpuPei/CpuPei.inf  INF
> >>> + MdeModulePkg/Universal/PCD/Pei/Pcd.inf
> >>> +  INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
> >>> +  INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
> >>> +
> >>> +!if $(TPM2_ENABLE) == TRUE
> >>> +  INF MdeModulePkg/Universal/ResetSystemPei/ResetSystemPei.inf
> >>> +  INF OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
> >>> +  INF SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
> >>> +!endif
> >>> +
> >>> +  FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
> >>> +    SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF
> >> PROCESSING_REQUIRED = TRUE {
> >>> +      SECTION FV_IMAGE = FVMAIN
> >>> +    }
> >>> +  }
> >>> +
> >>> +!include ArmVirtRules.fdf.inc
> >>> diff --git a/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> >>> b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> >>> new file mode 100644
> >>> index 000000000000..51041e889ef4
> >>> --- /dev/null
> >>> +++ b/ArmVirtPkg/ArmVirtCloudHvFvMain.fdf.inc
> >>> @@ -0,0 +1,169 @@
> >>> +#
> >>> +#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> >>> +#  Copyright (c) 2014-2016, Linaro Limited. All rights reserved.
> >>> +#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
> >>> +#
> >>> +#  SPDX-License-Identifier: BSD-2-Clause-Patent #
> >>> +
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +#
> >>> +# FV Section
> >>> +#
> >>> +# [FV] section is used to define what components or modules are
> >>> +placed within a flash # device file.  This section also defines
> >>> +order the components and modules are positioned # within the image.
> >>> +The [FV] section consists of define statements, set statements and
> >>> +# module
> >> statements.
> >>> +#
> >>>
> >>
> +#########################################################
> >> ############
> >>> +###########
> >>> +
> >>> +[FV.FvMain]
> >>> +FvNameGuid         = 2A88A00E-E267-C8BF-0E80-AE1BD504ED90
> >>> +BlockSize          = 0x40
> >>> +NumBlocks          = 0         # This FV gets compressed so make it just big
> >> enough
> >>> +FvAlignment        = 16        # FV alignment and FV attributes setting.
> >>> +ERASE_POLARITY     = 1
> >>> +MEMORY_MAPPED      = TRUE
> >>> +STICKY_WRITE       = TRUE
> >>> +LOCK_CAP           = TRUE
> >>> +LOCK_STATUS        = TRUE
> >>> +WRITE_DISABLED_CAP = TRUE
> >>> +WRITE_ENABLED_CAP  = TRUE
> >>> +WRITE_STATUS       = TRUE
> >>> +WRITE_LOCK_CAP     = TRUE
> >>> +WRITE_LOCK_STATUS  = TRUE
> >>> +READ_DISABLED_CAP  = TRUE
> >>> +READ_ENABLED_CAP   = TRUE
> >>> +READ_STATUS        = TRUE
> >>> +READ_LOCK_CAP      = TRUE
> >>> +READ_LOCK_STATUS   = TRUE
> >>> +
> >>> +  INF MdeModulePkg/Core/Dxe/DxeMain.inf  INF
> >>> + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> >>> +  INF ArmVirtPkg/VirtioFdtDxe/VirtioFdtDxe.inf
> >>> +  INF ArmVirtPkg/FdtClientDxe/FdtClientDxe.inf
> >>> +  INF ArmVirtPkg/HighMemDxe/HighMemDxe.inf
> >>> +
> >>> +  #
> >>> +  # PI DXE Drivers producing Architectural Protocols (EFI Services)
> >>> + #  INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf  INF
> >>> + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> >>> +  INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
> >>> +  INF
> >> MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
> >>> +  INF
> >>>
> >>
> +MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.i
> >> n
> >>> +f
> >>> +  INF
> >>>
> >>
> +MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
> >>> +!if $(SECURE_BOOT_ENABLE) == TRUE
> >>> +  INF
> >>>
> >>
> +SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConf
> >> i
> >>> +gDxe.inf
> >>> +!endif
> >>> +  INF
> >>>
> >>
> +MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCou
> >> nterRun
> >>> +timeDxe.inf
> >>> +  INF
> >>>
> >>
> +MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntime
> >> Dxe.in
> >>> +f
> >>> +  INF
> >> EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
> >>> +  INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
> >>> +  INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
> >>> +
> >>> +  #
> >>> +  # Multiple Console IO support
> >>> +  #
> >>> +  INF
> >>> +
> >> MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
> >>> +  INF
> >>> +
> MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
> >>> +  INF
> >>> +
> >>
> MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleD
> >> xe
> >>> + .inf  INF
> >> MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
> >>> +  INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
> >>> +
> >>> +  INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
> >>> +  INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
> >>> +  INF
> MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
> >>> +
> >>> +  #
> >>> +  # FAT filesystem + GPT/MBR partitioning + UDF filesystem +
> >>> + virtio-fs  #  INF
> >>> + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
> >>> +  INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
> >>> +  INF FatPkg/EnhancedFatDxe/Fat.inf  INF
> >>> +
> >>
> MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i
> >>> + nf  INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
> >>> +  INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf
> >>> +
> >>> +  #
> >>> +  # Status Code Routing
> >>> +  #
> >>> +  INF
> >>> +
> >>
> MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportSt
> >> atu
> >>> + sCodeRouterRuntimeDxe.inf
> >>> +
> >>> +  #
> >>> +  # Platform Driver
> >>> +  #
> >>> +  INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
> >>> +  INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
> >>> +  INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf
> >>> +  INF OvmfPkg/VirtioRngDxe/VirtioRng.inf
> >>> +
> >>> +  #
> >>> +  # UEFI application (Shell Embedded Boot Loader)  #  INF
> >>> + ShellPkg/Application/Shell/Shell.inf
> >>> +  INF
> >>> +
> >>
> ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.
> >> inf
> >>> +  INF
> >>> +
> >>
> ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand
> >> .inf
> >>> +  INF
> >>> +
> >>
> OvmfPkg/LinuxInitrdDynamicShellCommand/LinuxInitrdDynamicShellComma
> >> n
> >>> + d.inf
> >>> +
> >>> +  #
> >>> +  # Bds
> >>> +  #
> >>> +  INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
> >>> +  INF
> MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
> >>> +  INF
> MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
> >>> +  INF
> >>> +
> >>
> MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManager
> >> Dxe
> >>> + .inf  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> >>> +  INF MdeModulePkg/Application/UiApp/UiApp.inf
> >>> +  INF OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf
> >>> +
> >>> +  #
> >>> +  # SCSI Bus and Disk Driver
> >>> +  #
> >>> +  INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
> >>> +  INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
> >>> +
> >>> +  #
> >>> +  # ACPI Support
> >>> +  #
> >>> +  INF
> >> ArmVirtPkg/CloudHvPlatformHasAcpiDtDxe/CloudHvHasAcpiDtDxe.inf
> >>> +!if $(ARCH) == AARCH64
> >>> +  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
> >>> +  INF
> >>>
> >>
> +MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap
> >> hics
> >>> +ResourceTableDxe.inf
> >>> +  INF
> ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf
> >>> +
> >>> +  #
> >>> +  # EBC support
> >>> +  #
> >>> +  INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
> >>> +!endif
> >>> +
> >>> +  #
> >>> +  # PCI support
> >>> +  #
> >>> +  INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
> >>> +  INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> >>> +  INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
> >>> +  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
> >>> +  INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
> >>> +  INF OvmfPkg/Virtio10Dxe/Virtio10.inf
> >>> +
> >>> +  #
> >>> +  # TPM2 support
> >>> +  #
> >>> +!if $(TPM2_ENABLE) == TRUE
> >>> +  INF SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.inf
> >>> +!if $(TPM2_CONFIG_ENABLE) == TRUE
> >>> +  INF SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
> >>> +!endif
> >>> +!endif
> >>> +
> >>> +  #
> >>> +  # TianoCore logo (splash screen)
> >>> +  #
> >>> +  INF MdeModulePkg/Logo/LogoDxe.inf
> >>> +
> >>> +  #
> >>> +  # Ramdisk support
> >>> +  #
> >>> +  INF MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf


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

end of thread, other threads:[~2021-06-01  7:51 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-17  6:50 [PATCH v2 0/5] Enable Cloud Hypervisor support in edk2 Jianyong Wu
2021-05-17  6:50 ` [PATCH v2 1/5] ArmVirtPkg: Library: Memory initialization for Cloud Hypervisor Jianyong Wu
2021-05-18 20:20   ` Sami Mujawar
2021-05-27  2:18     ` Jianyong Wu
2021-05-19  6:07   ` [edk2-devel] " Laszlo Ersek
2021-05-19  6:11     ` Laszlo Ersek
2021-05-27  6:39       ` Jianyong Wu
2021-05-17  6:50 ` [PATCH v2 2/5] MdeMoudlePkg: introduce new PCD for Acpi/rsdp Jianyong Wu
2021-05-18 20:25   ` Sami Mujawar
2021-05-27  2:31     ` Jianyong Wu
2021-05-19  6:17   ` [edk2-devel] " Laszlo Ersek
2021-05-27  2:42     ` Jianyong Wu
2021-05-17  6:50 ` [PATCH v2 3/5] ArmVirtPkg: enable ACPI for cloud hypervisor Jianyong Wu
2021-05-18 20:26   ` Sami Mujawar
2021-05-27  2:57     ` Jianyong Wu
2021-05-19  6:25   ` [edk2-devel] " Laszlo Ersek
2021-05-27  3:18     ` Jianyong Wu
2021-05-17  6:50 ` [PATCH v2 4/5] ArmVirtPkg: Introduce Cloud Hypervisor to edk2 family Jianyong Wu
2021-05-18 20:26   ` Sami Mujawar
2021-05-27  6:19     ` Jianyong Wu
2021-05-29  7:43       ` Sami Mujawar
2021-06-01  7:51         ` Jianyong Wu
2021-05-19  6:36   ` [edk2-devel] " Laszlo Ersek
2021-05-27  6:23     ` Jianyong Wu
2021-05-17  6:50 ` [PATCH v2 5/5] Maintainers: update Maintainers file as new files/folders created Jianyong Wu
2021-05-18 20:26   ` Sami Mujawar
2021-05-19  6:55     ` Laszlo Ersek
2021-05-27  6:28       ` Jianyong Wu
2021-05-19  6:39   ` [edk2-devel] " Laszlo Ersek
2021-05-18 17:46 ` [edk2-devel] [PATCH v2 0/5] Enable Cloud Hypervisor support in edk2 Laszlo Ersek

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