Re: [edk2-devel] [PATCH v3 04/35] OvmfPkg: Introduce XenPlatformPei

2019-07-05 Thread Laszlo Ersek
Hi Anthony,

On 07/04/19 16:42, Anthony PERARD wrote:
> Introduce XenPlatformPei, a copy of OvmfPkg/PlatformPei without some
> of QEMU specific initialization, Xen does not support QemuFwCfg.
> 
> This new module will be adjusted to accommodate Xen PVH.
> 
> fw_cfg dependents that have been removed, which are dynamically skipped
> when running PlatformPei on Xen:
> - GetFirstNonAddress(): controlling the 64-bit PCI MMIO aperture via the
> (experimental) "opt/ovmf/X-PciMmio64Mb" file
> - GetFirstNonAddress(): honoring the hotplug DIMM area
> ("etc/reserved-memory-end") in the placement of the 64-bit PCI MMIO
> aperture
> - NoexecDxeInitialization() is removed, so PcdPropertiesTableEnable and
> PcdSetNxForStack are left constant FALSE (not set dynamically from
> fw_cfg "opt/ovmf/PcdXxxx")
> - MaxCpuCountInitialization(), PublishPeiMemory(): the max CPU count is
> not taken from the QemuFwCfgItemSmpCpuCount fw_cfg key;
> PcdCpuMaxLogicalProcessorNumber is used intact and
> PcdCpuApInitTimeOutInMicroSeconds is never changed or used.
> - InitializeXenPlatform(), S3Verification(): S3 is assumed disabled (not
> consulting "etc/system-states" via QemuFwCfgS3Enabled()).
> - InstallFeatureControlCallback(): the feature control MSR is not set
> from "etc/msr_feature_control"
> (also removed FeatureControl.c as there is nothing been executed)
> 
> Also removed:
> - SMRAM/TSEG-related low mem size adjusting (PcdSmmSmramRequire is
> assumed FALSE) in PublishPeiMemory(),
> - QemuInitializeRam() entirely,
> 
> Xen related changes:
> - Have removed the module variable mXen, as it should be always true.
> - Have the platform PEI initialization fails if Xen has not been
>   detected.
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
> Signed-off-by: Anthony PERARD 
> Reviewed-by: Laszlo Ersek 
> ---
> 
> Notes:
> v3:
>   - fix coding style in new code
> (use DEBUG_xxx, add ASSERT before CpuDeadLoop)
>   - rebased, SPDX

In my v2 review at
,
point (2), I meant that you should please replace *all* EFI_D_xxx macros
with DEBUG_xxx macros, in new code.

By "new code" I didn't mean code that you wrote afresh, but simply
source code that appeared as new -- i.e., as an addition -- in the
patch. That is, all the EFI_D_xxx macros that you inherit from
PlatformPei by virtue of copying should be replaced as well.

This v3 patch continues to add 12 instances of EFI_D_xxx, by my count.
Please replace all of those, with DEBUG_xxx.

The rest of the updates in v3 are good, and sufficient.

Thanks
Laszlo

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43357): https://edk2.groups.io/g/devel/message/43357
Mute This Topic: https://groups.io/mt/32308571/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH v3 04/35] OvmfPkg: Introduce XenPlatformPei

2019-07-04 Thread Anthony PERARD
Introduce XenPlatformPei, a copy of OvmfPkg/PlatformPei without some
of QEMU specific initialization, Xen does not support QemuFwCfg.

This new module will be adjusted to accommodate Xen PVH.

fw_cfg dependents that have been removed, which are dynamically skipped
when running PlatformPei on Xen:
- GetFirstNonAddress(): controlling the 64-bit PCI MMIO aperture via the
(experimental) "opt/ovmf/X-PciMmio64Mb" file
- GetFirstNonAddress(): honoring the hotplug DIMM area
("etc/reserved-memory-end") in the placement of the 64-bit PCI MMIO
aperture
- NoexecDxeInitialization() is removed, so PcdPropertiesTableEnable and
PcdSetNxForStack are left constant FALSE (not set dynamically from
fw_cfg "opt/ovmf/PcdXxxx")
- MaxCpuCountInitialization(), PublishPeiMemory(): the max CPU count is
not taken from the QemuFwCfgItemSmpCpuCount fw_cfg key;
PcdCpuMaxLogicalProcessorNumber is used intact and
PcdCpuApInitTimeOutInMicroSeconds is never changed or used.
- InitializeXenPlatform(), S3Verification(): S3 is assumed disabled (not
consulting "etc/system-states" via QemuFwCfgS3Enabled()).
- InstallFeatureControlCallback(): the feature control MSR is not set
from "etc/msr_feature_control"
(also removed FeatureControl.c as there is nothing been executed)

Also removed:
- SMRAM/TSEG-related low mem size adjusting (PcdSmmSmramRequire is
assumed FALSE) in PublishPeiMemory(),
- QemuInitializeRam() entirely,

Xen related changes:
- Have removed the module variable mXen, as it should be always true.
- Have the platform PEI initialization fails if Xen has not been
  detected.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1689
Signed-off-by: Anthony PERARD 
Reviewed-by: Laszlo Ersek 
---

Notes:
v3:
  - fix coding style in new code
(use DEBUG_xxx, add ASSERT before CpuDeadLoop)
  - rebased, SPDX

 OvmfPkg/OvmfXen.dsc   |   2 +-
 OvmfPkg/OvmfXen.fdf   |   2 +-
 OvmfPkg/XenPlatformPei/XenPlatformPei.inf |  96 +
 OvmfPkg/XenPlatformPei/Cmos.h |  52 +++
 OvmfPkg/XenPlatformPei/Platform.h | 108 ++
 OvmfPkg/XenPlatformPei/Xen.h  |  39 ++
 OvmfPkg/XenPlatformPei/AmdSev.c   |  64 
 OvmfPkg/XenPlatformPei/ClearCache.c   | 112 ++
 OvmfPkg/XenPlatformPei/Cmos.c |  60 +++
 OvmfPkg/XenPlatformPei/Fv.c   |  76 
 OvmfPkg/XenPlatformPei/MemDetect.c| 421 
 OvmfPkg/XenPlatformPei/Platform.c | 444 ++
 OvmfPkg/XenPlatformPei/Xen.c  | 219 +++
 13 files changed, 1693 insertions(+), 2 deletions(-)
 create mode 100644 OvmfPkg/XenPlatformPei/XenPlatformPei.inf
 create mode 100644 OvmfPkg/XenPlatformPei/Cmos.h
 create mode 100644 OvmfPkg/XenPlatformPei/Platform.h
 create mode 100644 OvmfPkg/XenPlatformPei/Xen.h
 create mode 100644 OvmfPkg/XenPlatformPei/AmdSev.c
 create mode 100644 OvmfPkg/XenPlatformPei/ClearCache.c
 create mode 100644 OvmfPkg/XenPlatformPei/Cmos.c
 create mode 100644 OvmfPkg/XenPlatformPei/Fv.c
 create mode 100644 OvmfPkg/XenPlatformPei/MemDetect.c
 create mode 100644 OvmfPkg/XenPlatformPei/Platform.c
 create mode 100644 OvmfPkg/XenPlatformPei/Xen.c

diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index cab54da3e8..9f79d455fa 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -523,7 +523,7 @@ [Components]
   }

   MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf

 

-  OvmfPkg/PlatformPei/PlatformPei.inf

+  OvmfPkg/XenPlatformPei/XenPlatformPei.inf

   UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf

   UefiCpuPkg/CpuMpPei/CpuMpPei.inf

 

diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf
index 6fc8479aae..2ceff7baa2 100644
--- a/OvmfPkg/OvmfXen.fdf
+++ b/OvmfPkg/OvmfXen.fdf
@@ -152,7 +152,7 @@ [FV.PEIFV]
 INF  MdeModulePkg/Universal/PCD/Pei/Pcd.inf

 INF  
MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf

 INF  MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf

-INF  OvmfPkg/PlatformPei/PlatformPei.inf

+INF  OvmfPkg/XenPlatformPei/XenPlatformPei.inf

 INF  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf

 INF  UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf

 INF  UefiCpuPkg/CpuMpPei/CpuMpPei.inf

diff --git a/OvmfPkg/XenPlatformPei/XenPlatformPei.inf 
b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
new file mode 100644
index 00..d1265c365a
--- /dev/null
+++ b/OvmfPkg/XenPlatformPei/XenPlatformPei.inf
@@ -0,0 +1,96 @@
+## @file

+#  Platform PEI driver

+#

+#  This module provides platform specific function to detect boot mode.

+#  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.

+#  Copyright (c) 2019, Citrix Systems, Inc.

+#

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

+#

+##

+

+[Defines]

+  INF_VERSION= 0x00010005

+  BASE_NAME  = XenPlatformPei

+  FILE_GUID  = f112a6ee-993a-4f0b-8295-e52029d9b4ba

+  MODULE_TYPE= PEIM

+