From: "Min Xu" <min.m.xu@intel.com>
To: devel@edk2.groups.io
Cc: Min Xu <min.m.xu@intel.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Jordan Justen <jordan.l.justen@intel.com>,
Brijesh Singh <brijesh.singh@amd.com>,
Erdem Aktas <erdemaktas@google.com>,
James Bottomley <jejb@linux.ibm.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH V6 20/42] OvmfPkg/PlatformPei: Update hob functions PlatformInitLib
Date: Sat, 19 Feb 2022 19:56:33 +0800 [thread overview]
Message-ID: <e9c098c9e0b18ff78eaad24779365ca86a67c52a.1645261990.git.min.m.xu@intel.com> (raw)
In-Reply-To: <cover.1645261990.git.min.m.xu@intel.com>
RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429
Hob functions in OvmfPkg/PlatformPei are updated with the ones
in PlatformInitLib.
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
---
OvmfPkg/PlatformPei/MemDetect.c | 20 +++----
OvmfPkg/PlatformPei/Platform.c | 101 ++++----------------------------
OvmfPkg/PlatformPei/Platform.h | 31 ----------
3 files changed, 21 insertions(+), 131 deletions(-)
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
index d118dba2f214..d19a344d18b8 100644
--- a/OvmfPkg/PlatformPei/MemDetect.c
+++ b/OvmfPkg/PlatformPei/MemDetect.c
@@ -274,10 +274,10 @@ ScanOrAdd64BitE820Ram (
End = (E820Entry.BaseAddr + E820Entry.Length) &
~(UINT64)EFI_PAGE_MASK;
if (Base < End) {
- AddMemoryRangeHob (Base, End);
+ PlatformAddMemoryRangeHob (Base, End);
DEBUG ((
DEBUG_VERBOSE,
- "%a: AddMemoryRangeHob [0x%Lx, 0x%Lx)\n",
+ "%a: PlatformAddMemoryRangeHob [0x%Lx, 0x%Lx)\n",
__FUNCTION__,
Base,
End
@@ -743,8 +743,8 @@ QemuInitializeRamBelow1gb (
)
{
if (FeaturePcdGet (PcdSmmSmramRequire) && mQ35SmramAtDefaultSmbase) {
- AddMemoryRangeHob (0, SMM_DEFAULT_SMBASE);
- AddReservedMemoryBaseSizeHob (
+ PlatformAddMemoryRangeHob (0, SMM_DEFAULT_SMBASE);
+ PlatformAddReservedMemoryBaseSizeHob (
SMM_DEFAULT_SMBASE,
MCH_DEFAULT_SMBASE_SIZE,
TRUE /* Cacheable */
@@ -753,12 +753,12 @@ QemuInitializeRamBelow1gb (
SMM_DEFAULT_SMBASE + MCH_DEFAULT_SMBASE_SIZE < BASE_512KB + BASE_128KB,
"end of SMRAM at default SMBASE ends at, or exceeds, 640KB"
);
- AddMemoryRangeHob (
+ PlatformAddMemoryRangeHob (
SMM_DEFAULT_SMBASE + MCH_DEFAULT_SMBASE_SIZE,
BASE_512KB + BASE_128KB
);
} else {
- AddMemoryRangeHob (0, BASE_512KB + BASE_128KB);
+ PlatformAddMemoryRangeHob (0, BASE_512KB + BASE_128KB);
}
}
@@ -816,14 +816,14 @@ QemuInitializeRam (
UINT32 TsegSize;
TsegSize = mQ35TsegMbytes * SIZE_1MB;
- AddMemoryRangeHob (BASE_1MB, LowerMemorySize - TsegSize);
- AddReservedMemoryBaseSizeHob (
+ PlatformAddMemoryRangeHob (BASE_1MB, LowerMemorySize - TsegSize);
+ PlatformAddReservedMemoryBaseSizeHob (
LowerMemorySize - TsegSize,
TsegSize,
TRUE
);
} else {
- AddMemoryRangeHob (BASE_1MB, LowerMemorySize);
+ PlatformAddMemoryRangeHob (BASE_1MB, LowerMemorySize);
}
//
@@ -835,7 +835,7 @@ QemuInitializeRam (
if (EFI_ERROR (Status)) {
UpperMemorySize = GetSystemMemorySizeAbove4gb ();
if (UpperMemorySize != 0) {
- AddMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
+ PlatformAddMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
}
}
}
diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c
index 594891786440..62480c3c40e5 100644
--- a/OvmfPkg/PlatformPei/Platform.c
+++ b/OvmfPkg/PlatformPei/Platform.c
@@ -57,85 +57,6 @@ BOOLEAN mS3Supported = FALSE;
UINT32 mMaxCpuCount;
-VOID
-AddIoMemoryBaseSizeHob (
- EFI_PHYSICAL_ADDRESS MemoryBase,
- UINT64 MemorySize
- )
-{
- BuildResourceDescriptorHob (
- EFI_RESOURCE_MEMORY_MAPPED_IO,
- EFI_RESOURCE_ATTRIBUTE_PRESENT |
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
- EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_TESTED,
- MemoryBase,
- MemorySize
- );
-}
-
-VOID
-AddReservedMemoryBaseSizeHob (
- EFI_PHYSICAL_ADDRESS MemoryBase,
- UINT64 MemorySize,
- BOOLEAN Cacheable
- )
-{
- BuildResourceDescriptorHob (
- EFI_RESOURCE_MEMORY_RESERVED,
- EFI_RESOURCE_ATTRIBUTE_PRESENT |
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
- EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
- (Cacheable ?
- EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE :
- 0
- ) |
- EFI_RESOURCE_ATTRIBUTE_TESTED,
- MemoryBase,
- MemorySize
- );
-}
-
-VOID
-AddIoMemoryRangeHob (
- EFI_PHYSICAL_ADDRESS MemoryBase,
- EFI_PHYSICAL_ADDRESS MemoryLimit
- )
-{
- AddIoMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase));
-}
-
-VOID
-AddMemoryBaseSizeHob (
- EFI_PHYSICAL_ADDRESS MemoryBase,
- UINT64 MemorySize
- )
-{
- BuildResourceDescriptorHob (
- EFI_RESOURCE_SYSTEM_MEMORY,
- EFI_RESOURCE_ATTRIBUTE_PRESENT |
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
- EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
- EFI_RESOURCE_ATTRIBUTE_TESTED,
- MemoryBase,
- MemorySize
- );
-}
-
-VOID
-AddMemoryRangeHob (
- EFI_PHYSICAL_ADDRESS MemoryBase,
- EFI_PHYSICAL_ADDRESS MemoryLimit
- )
-{
- AddMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase));
-}
-
VOID
MemMapInitialization (
VOID
@@ -155,12 +76,12 @@ MemMapInitialization (
//
// Video memory + Legacy BIOS region
//
- AddIoMemoryRangeHob (0x0A0000, BASE_1MB);
+ PlatformAddIoMemoryRangeHob (0x0A0000, BASE_1MB);
if (mHostBridgeDevId == 0xffff /* microvm */) {
- AddIoMemoryBaseSizeHob (MICROVM_GED_MMIO_BASE, SIZE_4KB);
- AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB); /* ioapic #1 */
- AddIoMemoryBaseSizeHob (0xFEC10000, SIZE_4KB); /* ioapic #2 */
+ PlatformAddIoMemoryBaseSizeHob (MICROVM_GED_MMIO_BASE, SIZE_4KB);
+ PlatformAddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB); /* ioapic #1 */
+ PlatformAddIoMemoryBaseSizeHob (0xFEC10000, SIZE_4KB); /* ioapic #2 */
return;
}
@@ -194,20 +115,20 @@ MemMapInitialization (
// 0xFEE00000 LAPIC 1 MB
//
PciSize = 0xFC000000 - PciBase;
- AddIoMemoryBaseSizeHob (PciBase, PciSize);
+ PlatformAddIoMemoryBaseSizeHob (PciBase, PciSize);
PcdStatus = PcdSet64S (PcdPciMmio32Base, PciBase);
ASSERT_RETURN_ERROR (PcdStatus);
PcdStatus = PcdSet64S (PcdPciMmio32Size, PciSize);
ASSERT_RETURN_ERROR (PcdStatus);
- AddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB);
- AddIoMemoryBaseSizeHob (0xFED00000, SIZE_1KB);
+ PlatformAddIoMemoryBaseSizeHob (0xFEC00000, SIZE_4KB);
+ PlatformAddIoMemoryBaseSizeHob (0xFED00000, SIZE_1KB);
if (mHostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID) {
- AddIoMemoryBaseSizeHob (ICH9_ROOT_COMPLEX_BASE, SIZE_16KB);
+ PlatformAddIoMemoryBaseSizeHob (ICH9_ROOT_COMPLEX_BASE, SIZE_16KB);
//
// Note: there should be an
//
- // AddIoMemoryBaseSizeHob (PciExBarBase, SIZE_256MB);
+ // PlatformAddIoMemoryBaseSizeHob (PciExBarBase, SIZE_256MB);
//
// call below, just like the one above for RCBA. However, Linux insists
// that the MMCONFIG area be marked in the E820 or UEFI memory map as
@@ -225,7 +146,7 @@ MemMapInitialization (
// is most definitely not RAM; so, as an exception, cover it with
// uncacheable reserved memory right here.
//
- AddReservedMemoryBaseSizeHob (PciExBarBase, SIZE_256MB, FALSE);
+ PlatformAddReservedMemoryBaseSizeHob (PciExBarBase, SIZE_256MB, FALSE);
BuildMemoryAllocationHob (
PciExBarBase,
SIZE_256MB,
@@ -233,7 +154,7 @@ MemMapInitialization (
);
}
- AddIoMemoryBaseSizeHob (PcdGet32 (PcdCpuLocalApicBaseAddress), SIZE_1MB);
+ PlatformAddIoMemoryBaseSizeHob (PcdGet32 (PcdCpuLocalApicBaseAddress), SIZE_1MB);
//
// On Q35, the IO Port space is available for PCI resource allocations from
diff --git a/OvmfPkg/PlatformPei/Platform.h b/OvmfPkg/PlatformPei/Platform.h
index 24e4da4e1d93..f193ff736549 100644
--- a/OvmfPkg/PlatformPei/Platform.h
+++ b/OvmfPkg/PlatformPei/Platform.h
@@ -11,37 +11,6 @@
#include <IndustryStandard/E820.h>
-VOID
-AddIoMemoryBaseSizeHob (
- EFI_PHYSICAL_ADDRESS MemoryBase,
- UINT64 MemorySize
- );
-
-VOID
-AddIoMemoryRangeHob (
- EFI_PHYSICAL_ADDRESS MemoryBase,
- EFI_PHYSICAL_ADDRESS MemoryLimit
- );
-
-VOID
-AddMemoryBaseSizeHob (
- EFI_PHYSICAL_ADDRESS MemoryBase,
- UINT64 MemorySize
- );
-
-VOID
-AddMemoryRangeHob (
- EFI_PHYSICAL_ADDRESS MemoryBase,
- EFI_PHYSICAL_ADDRESS MemoryLimit
- );
-
-VOID
-AddReservedMemoryBaseSizeHob (
- EFI_PHYSICAL_ADDRESS MemoryBase,
- UINT64 MemorySize,
- BOOLEAN Cacheable
- );
-
VOID
AddressWidthInitialization (
VOID
--
2.29.2.windows.2
next prev parent reply other threads:[~2022-02-19 11:58 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-19 11:56 [PATCH V6 00/42] Enable Intel TDX in OvmfPkg (Config-A) Min Xu
2022-02-19 11:56 ` [PATCH V6 01/42] MdePkg: Add Tdx.h Min Xu
2022-02-23 1:56 ` Min Xu
2022-02-19 11:56 ` [PATCH V6 02/42] MdePkg: Introduce basic Tdx functions in BaseLib Min Xu
2022-02-23 1:57 ` Min Xu
2022-02-19 11:56 ` [PATCH V6 03/42] MdePkg: Add TdxLib to wrap Tdx operations Min Xu
2022-02-23 1:58 ` Min Xu
2022-02-19 11:56 ` [PATCH V6 04/42] UefiCpuPkg: Extend VmgExitLibNull to handle #VE exception Min Xu
2022-02-23 2:00 ` Min Xu
2022-02-19 11:56 ` [PATCH V6 05/42] OvmfPkg: Extend VmgExitLib " Min Xu
2022-02-19 11:56 ` [PATCH V6 06/42] UefiCpuPkg/CpuExceptionHandler: Add base support for the " Min Xu
2022-02-23 2:02 ` Min Xu
2022-02-19 11:56 ` [PATCH V6 07/42] MdePkg: Add helper functions for Tdx guest in BaseIoLibIntrinsic Min Xu
2022-02-19 11:56 ` [PATCH V6 08/42] MdePkg: Support mmio " Min Xu
2022-02-19 11:56 ` [PATCH V6 09/42] MdePkg: Support IoFifo " Min Xu
2022-02-19 11:56 ` [PATCH V6 10/42] MdePkg: Support IoRead/IoWrite " Min Xu
2022-02-19 11:56 ` [PATCH V6 11/42] UefiCpuPkg: Support TDX in BaseXApicX2ApicLib Min Xu
2022-02-19 11:56 ` [PATCH V6 12/42] MdePkg: Add macro to check SEV / TDX guest Min Xu
2022-02-19 11:56 ` [PATCH V6 13/42] UefiCpuPkg: Enable Tdx support in MpInitLib Min Xu
2022-02-19 11:56 ` [PATCH V6 14/42] OvmfPkg: Add IntelTdx.h in OvmfPkg/Include/IndustryStandard Min Xu
2022-02-19 11:56 ` [PATCH V6 15/42] OvmfPkg: Add TdxMailboxLib Min Xu
2022-02-19 11:56 ` [PATCH V6 16/42] MdePkg: Add EFI_RESOURCE_ATTRIBUTE_ENCRYPTED in PiHob.h Min Xu
2022-02-19 11:56 ` [PATCH V6 17/42] OvmfPkg: Create initial version of PlatformInitLib Min Xu
2022-02-19 11:56 ` [PATCH V6 18/42] OvmfPkg/PlatformPei: Update Cmos functions with PlatformInitLib Min Xu
2022-02-22 13:00 ` Gerd Hoffmann
2022-02-22 23:37 ` Min Xu
2022-02-19 11:56 ` [PATCH V6 19/42] OvmfPkg/PlatformInitLib: Add hob functions Min Xu
2022-02-19 11:56 ` Min Xu [this message]
2022-02-22 13:02 ` [PATCH V6 20/42] OvmfPkg/PlatformPei: Update hob functions PlatformInitLib Gerd Hoffmann
2022-02-22 23:38 ` Min Xu
2022-02-19 11:56 ` [PATCH V6 21/42] OvmfPkg/PlatformInitLib: Add memory functions Min Xu
2022-02-19 11:56 ` [PATCH V6 22/42] OvmfPkg/PlatformPei: Update memory functions with PlatformInitLib Min Xu
2022-02-19 11:56 ` [PATCH V6 23/42] OvmfPkg/PlatformInitLib: Add platform functions Min Xu
2022-02-19 11:56 ` [PATCH V6 25/42] OvmfPkg: Update PlatformInitLib to process Tdx hoblist Min Xu
2022-02-22 13:08 ` Gerd Hoffmann
2022-02-19 11:56 ` [PATCH V6 26/42] OvmfPkg: Add null instance of PlatformInitLib Min Xu
2022-02-22 13:10 ` Gerd Hoffmann
2022-02-23 0:34 ` Min Xu
2022-02-23 9:26 ` [edk2-devel] " Gerd Hoffmann
2022-02-19 11:56 ` [PATCH V6 27/42] OvmfPkg/Sec: Declare local variable as volatile in SecCoreStartupWithStack Min Xu
2022-02-23 9:44 ` Gerd Hoffmann
2022-02-19 11:56 ` [PATCH V6 28/42] OvmfPkg: Update Sec to support Tdx Min Xu
2022-02-23 9:49 ` Gerd Hoffmann
2022-02-19 11:56 ` [PATCH V6 29/42] OvmfPkg: Check Tdx in QemuFwCfgPei to avoid DMA operation Min Xu
2022-02-19 11:56 ` [PATCH V6 30/42] MdeModulePkg: EFER should not be changed in TDX Min Xu
2022-02-19 11:56 ` [PATCH V6 31/42] MdeModulePkg: Add PcdTdxSharedBitMask Min Xu
2022-02-19 11:56 ` [PATCH V6 32/42] UefiCpuPkg: Update AddressEncMask in CpuPageTable Min Xu
2022-02-19 11:56 ` [PATCH V6 33/42] OvmfPkg: Update PlatformInitLib for Tdx guest to publish ram regions Min Xu
2022-02-23 10:07 ` Gerd Hoffmann
2022-02-23 10:49 ` [edk2-devel] " Yao, Jiewen
2022-02-23 11:52 ` Gerd Hoffmann
2022-02-19 11:56 ` [PATCH V6 34/42] OvmfPkg: Update PlatformPei to support Tdx guest Min Xu
2022-02-23 10:13 ` Gerd Hoffmann
2022-02-24 0:49 ` Min Xu
2022-02-19 11:56 ` [PATCH V6 35/42] OvmfPkg: Update AcpiPlatformDxe to alter MADT table Min Xu
2022-02-19 11:56 ` [PATCH V6 36/42] OvmfPkg/BaseMemEncryptTdxLib: Add TDX helper library Min Xu
2022-02-19 11:56 ` [PATCH V6 37/42] OvmfPkg: Add TdxDxe driver Min Xu
2022-02-19 11:56 ` [PATCH V6 38/42] OvmfPkg/QemuFwCfgLib: Support Tdx in QemuFwCfgDxe Min Xu
2022-02-19 11:56 ` [PATCH V6 39/42] OvmfPkg: Update IoMmuDxe to support TDX Min Xu
2022-02-19 11:56 ` [PATCH V6 40/42] OvmfPkg: Rename XenTimerDxe to LocalApicTimerDxe Min Xu
[not found] ` <8e422d975ef8373efdf6eed332a44b59d7ffa38e.1645261990.git.min.m.xu@intel.com>
2022-02-22 13:04 ` [PATCH V6 24/42] OvmfPkg/PlatformPei: Update platform functions with PlatformInitLib Gerd Hoffmann
2022-02-22 23:39 ` Min Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e9c098c9e0b18ff78eaad24779365ca86a67c52a.1645261990.git.min.m.xu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox