From c10e5703fece76810cad7a5c27914b545def91ff Mon Sep 17 00:00:00 2001 From: Zhiguang Liu Date: Wed, 10 Jan 2024 13:39:42 +0800 Subject: UefiCpuPkg/CpuMpPei: Don't write CR3 in ConvertMemoryPageToNotPresent The purpose of writing CR3 in ConvertMemoryPageToNotPresent is just to flush TLB, because CR3 won't be changed in function ConvertMemoryPageToNotPresent. After ConvertMemoryPageToNotPresent, there is always a flush TLB function. Also, because ConvertMemoryPageToNotPresent in called in a loop, to improve performance, there is no need to flush TLB inside ConvertMemoryPageToNotPresent. Just flushing TLB after the loop is enough. Reviewed-by: Ray Ni Reviewed-by: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann Signed-off-by: Zhiguang Liu --- UefiCpuPkg/CpuMpPei/CpuPaging.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'UefiCpuPkg/CpuMpPei') diff --git a/UefiCpuPkg/CpuMpPei/CpuPaging.c b/UefiCpuPkg/CpuMpPei/CpuPaging.c index 15c7015fb8..b923d9b502 100644 --- a/UefiCpuPkg/CpuMpPei/CpuPaging.c +++ b/UefiCpuPkg/CpuMpPei/CpuPaging.c @@ -76,7 +76,8 @@ AllocatePageTableMemory ( /** This function modifies the page attributes for the memory region specified - by BaseAddress and Length to not present. + by BaseAddress and Length to not present. This function only change page + table, but not flush TLB. Caller have the responsbility to flush TLB. Caller should make sure BaseAddress and Length is at page boundary. @@ -167,7 +168,6 @@ ConvertMemoryPageToNotPresent ( } ASSERT_EFI_ERROR (Status); - AsmWriteCr3 (PageTable); return Status; } -- cgit v1.2.3