]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmVirtPkg/QemuVirtMemInfoLib: remove 1:1 mapping of top of PA range
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 27 Nov 2018 14:25:42 +0000 (15:25 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 29 Nov 2018 17:52:54 +0000 (18:52 +0100)
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>
ArmVirtPkg/Library/QemuVirtMemInfoLib/AArch64/PhysAddrTop.S [deleted file]
ArmVirtPkg/Library/QemuVirtMemInfoLib/Arm/PhysAddrTop.S [deleted file]
ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.c
ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf
ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf

diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/AArch64/PhysAddrTop.S b/ArmVirtPkg/Library/QemuVirtMemInfoLib/AArch64/PhysAddrTop.S
deleted file mode 100644 (file)
index a1f6a19..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#\r
-#  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-#  Copyright (c) 2016-2017, Linaro Limited. All rights reserved.\r
-#\r
-#  This program and the accompanying materials\r
-#  are licensed and made available under the terms and conditions of the BSD License\r
-#  which accompanies this distribution.  The full text of the license may be found at\r
-#  http://opensource.org/licenses/bsd-license.php\r
-#\r
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#\r
-\r
-#include <AsmMacroIoLibV8.h>\r
-\r
-//EFI_PHYSICAL_ADDRESS\r
-//GetPhysAddrTop (\r
-//  VOID\r
-//  );\r
-ASM_FUNC(ArmGetPhysAddrTop)\r
-  mrs   x0, id_aa64mmfr0_el1\r
-  adr   x1, .LPARanges\r
-  and   x0, x0, #7\r
-  ldrb  w1, [x1, x0]\r
-  mov   x0, #1\r
-  lsl   x0, x0, x1\r
-  ret\r
-\r
-//\r
-// Bits 0..2 of the AA64MFR0_EL1 system register encode the size of the\r
-// physical address space support on this CPU:\r
-// 0 == 32 bits, 1 == 36 bits, etc etc\r
-// 6 and 7 are reserved\r
-//\r
-.LPARanges:\r
-  .byte 32, 36, 40, 42, 44, 48, -1, -1\r
-\r
-ASM_FUNCTION_REMOVE_IF_UNREFERENCED\r
diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/Arm/PhysAddrTop.S b/ArmVirtPkg/Library/QemuVirtMemInfoLib/Arm/PhysAddrTop.S
deleted file mode 100644 (file)
index 9cd8152..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#\r
-#  Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-#  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.\r
-#\r
-#  This program and the accompanying materials\r
-#  are licensed and made available under the terms and conditions of the BSD License\r
-#  which accompanies this distribution.  The full text of the license may be found at\r
-#  http://opensource.org/licenses/bsd-license.php\r
-#\r
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-#\r
-\r
-#include <AsmMacroIoLib.h>\r
-\r
-//EFI_PHYSICAL_ADDRESS\r
-//GetPhysAddrTop (\r
-//  VOID\r
-//  );\r
-ASM_FUNC(ArmGetPhysAddrTop)\r
-  mov   r0, #0x00000000\r
-  mov   r1, #0x10000\r
-  bx    lr\r
index 760bcc169cf44fb61fa9c406ec9ab30a3a957f72..0285a11b1d7701a568274cf72417bce0141fb61b 100644 (file)
 // Number of Virtual Memory Map Descriptors\r
 #define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS          5\r
 \r
 // Number of Virtual Memory Map Descriptors\r
 #define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS          5\r
 \r
-EFI_PHYSICAL_ADDRESS\r
-ArmGetPhysAddrTop (\r
-  VOID\r
-  );\r
-\r
 /**\r
   Return the Virtual Memory Map of your platform\r
 \r
 /**\r
   Return the Virtual Memory Map of your platform\r
 \r
@@ -45,7 +40,6 @@ ArmVirtGetMemoryMap (
   )\r
 {\r
   ARM_MEMORY_REGION_DESCRIPTOR  *VirtualMemoryTable;\r
   )\r
 {\r
   ARM_MEMORY_REGION_DESCRIPTOR  *VirtualMemoryTable;\r
-  UINT64                        TopOfMemory;\r
 \r
   ASSERT (VirtualMemoryMap != NULL);\r
 \r
 \r
   ASSERT (VirtualMemoryMap != NULL);\r
 \r
@@ -78,23 +72,14 @@ ArmVirtGetMemoryMap (
   VirtualMemoryTable[1].Length       = VirtualMemoryTable[0].PhysicalBase;\r
   VirtualMemoryTable[1].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;\r
 \r
   VirtualMemoryTable[1].Length       = VirtualMemoryTable[0].PhysicalBase;\r
   VirtualMemoryTable[1].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;\r
 \r
-  // Peripheral space after DRAM\r
-  TopOfMemory = MIN (1ULL << FixedPcdGet8 (PcdPrePiCpuMemorySize),\r
-                     ArmGetPhysAddrTop ());\r
-  VirtualMemoryTable[2].PhysicalBase = VirtualMemoryTable[0].Length + VirtualMemoryTable[1].Length;\r
-  VirtualMemoryTable[2].VirtualBase  = VirtualMemoryTable[2].PhysicalBase;\r
-  VirtualMemoryTable[2].Length       = TopOfMemory -\r
-                                       VirtualMemoryTable[2].PhysicalBase;\r
-  VirtualMemoryTable[2].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;\r
-\r
   // Remap the FD region as normal executable memory\r
   // Remap the FD region as normal executable memory\r
-  VirtualMemoryTable[3].PhysicalBase = PcdGet64 (PcdFdBaseAddress);\r
-  VirtualMemoryTable[3].VirtualBase  = VirtualMemoryTable[3].PhysicalBase;\r
-  VirtualMemoryTable[3].Length       = FixedPcdGet32 (PcdFdSize);\r
-  VirtualMemoryTable[3].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;\r
+  VirtualMemoryTable[2].PhysicalBase = PcdGet64 (PcdFdBaseAddress);\r
+  VirtualMemoryTable[2].VirtualBase  = VirtualMemoryTable[2].PhysicalBase;\r
+  VirtualMemoryTable[2].Length       = FixedPcdGet32 (PcdFdSize);\r
+  VirtualMemoryTable[2].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;\r
 \r
   // End of Table\r
 \r
   // End of Table\r
-  ZeroMem (&VirtualMemoryTable[4], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));\r
+  ZeroMem (&VirtualMemoryTable[3], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));\r
 \r
   *VirtualMemoryMap = VirtualMemoryTable;\r
 }\r
 \r
   *VirtualMemoryMap = VirtualMemoryTable;\r
 }\r
index c72a97f9e78ab11aebd32df59d223ff8d22541a0..5c5b841051adf9fbce9a7ab9a124b7f2219ba48d 100644 (file)
 [Sources]\r
   QemuVirtMemInfoLib.c\r
 \r
 [Sources]\r
   QemuVirtMemInfoLib.c\r
 \r
-[Sources.ARM]\r
-  Arm/PhysAddrTop.S\r
-\r
-[Sources.AARCH64]\r
-  AArch64/PhysAddrTop.S\r
-\r
 [Packages]\r
   ArmPkg/ArmPkg.dec\r
   ArmVirtPkg/ArmVirtPkg.dec\r
 [Packages]\r
   ArmPkg/ArmPkg.dec\r
   ArmVirtPkg/ArmVirtPkg.dec\r
@@ -51,4 +45,3 @@
 \r
 [FixedPcd]\r
   gArmTokenSpaceGuid.PcdFdSize\r
 \r
 [FixedPcd]\r
   gArmTokenSpaceGuid.PcdFdSize\r
-  gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize\r
index e4032d3efb53389119e522219c7e848a9d67440e..d12089760b2224cc98280f5a6427c6c9c7e82caa 100644 (file)
   QemuVirtMemInfoLib.c\r
   QemuVirtMemInfoPeiLibConstructor.c\r
 \r
   QemuVirtMemInfoLib.c\r
   QemuVirtMemInfoPeiLibConstructor.c\r
 \r
-[Sources.ARM]\r
-  Arm/PhysAddrTop.S\r
-\r
-[Sources.AARCH64]\r
-  AArch64/PhysAddrTop.S\r
-\r
 [Packages]\r
   ArmPkg/ArmPkg.dec\r
   ArmVirtPkg/ArmVirtPkg.dec\r
 [Packages]\r
   ArmPkg/ArmPkg.dec\r
   ArmVirtPkg/ArmVirtPkg.dec\r
@@ -55,4 +49,3 @@
 [FixedPcd]\r
   gArmTokenSpaceGuid.PcdFdSize\r
   gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress\r
 [FixedPcd]\r
   gArmTokenSpaceGuid.PcdFdSize\r
   gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress\r
-  gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize\r