From d3d29f2f5e53a877b51342c19a2a8369e5f45b27 Mon Sep 17 00:00:00 2001 From: Taylor Beebe <31827475+TaylorBeebe@users.noreply.github.com> Date: Tue, 8 Nov 2022 11:56:07 -0800 Subject: [PATCH] Don't Set Access Attributes of Runtime MMIO Ranges (#51) ## Description Passing in access attributes to SetMemorySpaceAttributes() will cause the existing attributes to be overwritten. The MMIO region should have the appropriate attributes applied during memory protection initialization and the attributes of the memory space descriptor are inaccurate. Don't pass in any CPU arch attributes so SetMemorySpaceAttributes() doesn't subsequently call gCpu->SetMemoryAttributes(). ## Breaking change? No ## How This Was Tested - Booting to the OS and running the paging audit app on Q35 ## Integration Instructions N/A --- PrmPkg/PrmConfigDxe/PrmConfigDxe.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PrmPkg/PrmConfigDxe/PrmConfigDxe.c b/PrmPkg/PrmConfigDxe/PrmConfigDxe.c index 550ee64b4c..2cfaf3b1b0 100644 --- a/PrmPkg/PrmConfigDxe/PrmConfigDxe.c +++ b/PrmPkg/PrmConfigDxe/PrmConfigDxe.c @@ -155,7 +155,11 @@ SetRuntimeMemoryRangeAttributes ( Status = gDS->SetMemorySpaceAttributes ( RuntimeMmioRanges->Range[Index].PhysicalBaseAddress, (UINT64)RuntimeMmioRanges->Range[Index].Length, - Descriptor.Attributes | EFI_MEMORY_RUNTIME + // MU_CHANGE START: The memory space descriptor access attributes are not accurate. Don't pass + // in access attributes so SetMemorySpaceAttributes() doesn't update them. + // Descriptor.Attributes | EFI_MEMORY_RUNTIME + EFI_MEMORY_RUNTIME + // MU_CHANGE END ); ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) {