From 73ac735be8f8d3f8e6e7ab02c34ad360b045452f Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 22 Feb 2024 11:54:05 +0100 Subject: [PATCH] MdeModulePkg/DxeIplPeim: fix PcdUse5LevelPageTable assert PcdUse5LevelPageTable documentation says: Indicates if 5-Level Paging will be enabled in long mode. 5-Level Paging will not be enabled when the PCD is TRUE but CPU doesn't support 5-Level Paging. So running in 4-level paging mode with PcdUse5LevelPageTable=TRUE is possible. The only invalid combination is 5-level paging being active with PcdUse5LevelPageTable=FALSE. Fix the ASSERT accordingly. Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek Acked-by: Ard Biesheuvel Message-Id: <20240222105407.75735-2-kraxel@redhat.com> Cc: Michael Roth Cc: Jiewen Yao Cc: Liming Gao Cc: Laszlo Ersek Cc: Tom Lendacky Cc: Paolo Bonzini Cc: Ard Biesheuvel Cc: Gerd Hoffmann Cc: Min Xu Cc: Erdem Aktas Cc: Oliver Steffen Cc: Ard Biesheuvel [lersek@redhat.com: turn the "Cc:" message headers from Gerd's on-list posting into "Cc:" tags in the commit message, in order to pacify "PatchCheck.py"] --- MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c index 980c2002d4..1d240e9596 100644 --- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c +++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c @@ -745,7 +745,9 @@ CreateIdentityMappingPageTables ( // Cr4.UintN = AsmReadCr4 (); Page5LevelSupport = (Cr4.Bits.LA57 != 0); - ASSERT (PcdGetBool (PcdUse5LevelPageTable) == Page5LevelSupport); + if (Page5LevelSupport) { + ASSERT (PcdGetBool (PcdUse5LevelPageTable)); + } } else { // // If cpu runs in 32bit protected mode PEI, Page table Level in DXE is decided by PCD and feature capability.