ArmVirtPkg/QemuVirtMemInfoLib: remove 1:1 mapping of top of PA range
Currently, we map DRAM as EFI_MEMORY_WB, and the remainder of the entire virtual address space is mapped with EFI_MEMORY_UC attributes, regardless of whether any devices actually reside there. Now that we are relaxing the address space limit to more than 40 bits, mapping all that address space actually takes up more space in page tables than we have so far made available as temporary RAM. So let's get rid of the mapping rather than increasing the available RAM, given that the mapping is not particularly useful anyway. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
@@ -21,11 +21,6 @@
|
||||
// Number of Virtual Memory Map Descriptors
|
||||
#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5
|
||||
|
||||
EFI_PHYSICAL_ADDRESS
|
||||
ArmGetPhysAddrTop (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Return the Virtual Memory Map of your platform
|
||||
|
||||
@@ -45,7 +40,6 @@ ArmVirtGetMemoryMap (
|
||||
)
|
||||
{
|
||||
ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
|
||||
UINT64 TopOfMemory;
|
||||
|
||||
ASSERT (VirtualMemoryMap != NULL);
|
||||
|
||||
@@ -78,23 +72,14 @@ ArmVirtGetMemoryMap (
|
||||
VirtualMemoryTable[1].Length = VirtualMemoryTable[0].PhysicalBase;
|
||||
VirtualMemoryTable[1].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
|
||||
|
||||
// Peripheral space after DRAM
|
||||
TopOfMemory = MIN (1ULL << FixedPcdGet8 (PcdPrePiCpuMemorySize),
|
||||
ArmGetPhysAddrTop ());
|
||||
VirtualMemoryTable[2].PhysicalBase = VirtualMemoryTable[0].Length + VirtualMemoryTable[1].Length;
|
||||
VirtualMemoryTable[2].VirtualBase = VirtualMemoryTable[2].PhysicalBase;
|
||||
VirtualMemoryTable[2].Length = TopOfMemory -
|
||||
VirtualMemoryTable[2].PhysicalBase;
|
||||
VirtualMemoryTable[2].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
|
||||
|
||||
// Remap the FD region as normal executable memory
|
||||
VirtualMemoryTable[3].PhysicalBase = PcdGet64 (PcdFdBaseAddress);
|
||||
VirtualMemoryTable[3].VirtualBase = VirtualMemoryTable[3].PhysicalBase;
|
||||
VirtualMemoryTable[3].Length = FixedPcdGet32 (PcdFdSize);
|
||||
VirtualMemoryTable[3].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
|
||||
VirtualMemoryTable[2].PhysicalBase = PcdGet64 (PcdFdBaseAddress);
|
||||
VirtualMemoryTable[2].VirtualBase = VirtualMemoryTable[2].PhysicalBase;
|
||||
VirtualMemoryTable[2].Length = FixedPcdGet32 (PcdFdSize);
|
||||
VirtualMemoryTable[2].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
|
||||
|
||||
// End of Table
|
||||
ZeroMem (&VirtualMemoryTable[4], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));
|
||||
ZeroMem (&VirtualMemoryTable[3], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));
|
||||
|
||||
*VirtualMemoryMap = VirtualMemoryTable;
|
||||
}
|
||||
|
Reference in New Issue
Block a user