]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/CpuS3DataDxe: do not allocate useless register tables
authorLaszlo Ersek <lersek@redhat.com>
Tue, 19 Jan 2021 15:54:39 +0000 (16:54 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 20 Jan 2021 18:20:14 +0000 (18:20 +0000)
CpuS3DataDxe allocates the "RegisterTable" and "PreSmmInitRegisterTable"
arrays in ACPI_CPU_DATA just so every processor in the system can have its
own empty register table, matched by APIC ID. This has never been useful
in practice.

Given commit e992cc3f4859 ("UefiCpuPkg PiSmmCpuDxeSmm: Reduce SMRAM
consumption in CpuS3.c", 2021-01-11), simply leave both
"AcpiCpuData->RegisterTable" and "AcpiCpuData->PreSmmInitRegisterTable"
initialized to the zero address. This simplifies the driver, and saves
both normal RAM (boot services data type memory) and -- in PiSmmCpuDxeSmm
-- SMRAM.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3159
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Message-Id: <20210119155440.2262-4-lersek@redhat.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c

index 2be335d9190369c2d8183131018f1854f9b22936..078af36cfb41104adb1be6e2b2bacc4a335cacdd 100644 (file)
@@ -165,10 +165,6 @@ CpuS3DataInitialize (
   UINTN                      NumberOfCpus;\r
   UINTN                      NumberOfEnabledProcessors;\r
   VOID                       *Stack;\r
-  UINTN                      TableSize;\r
-  CPU_REGISTER_TABLE         *RegisterTable;\r
-  UINTN                      Index;\r
-  EFI_PROCESSOR_INFORMATION  ProcessorInfoBuffer;\r
   UINTN                      GdtSize;\r
   UINTN                      IdtSize;\r
   VOID                       *Gdt;\r
@@ -255,34 +251,6 @@ CpuS3DataInitialize (
     AcpiCpuData->PreSmmInitRegisterTable = OldAcpiCpuData->PreSmmInitRegisterTable;\r
     AcpiCpuData->ApLocation              = OldAcpiCpuData->ApLocation;\r
     CopyMem (&AcpiCpuData->CpuStatus, &OldAcpiCpuData->CpuStatus, sizeof (CPU_STATUS_INFORMATION));\r
-  } else {\r
-    //\r
-    // Allocate buffer for empty RegisterTable and PreSmmInitRegisterTable for all CPUs\r
-    //\r
-    TableSize = 2 * NumberOfCpus * sizeof (CPU_REGISTER_TABLE);\r
-    RegisterTable = (CPU_REGISTER_TABLE *)AllocateZeroPages (TableSize);\r
-    ASSERT (RegisterTable != NULL);\r
-\r
-    for (Index = 0; Index < NumberOfCpus; Index++) {\r
-      Status = MpServices->GetProcessorInfo (\r
-                           MpServices,\r
-                           Index,\r
-                           &ProcessorInfoBuffer\r
-                           );\r
-      ASSERT_EFI_ERROR (Status);\r
-\r
-      RegisterTable[Index].InitialApicId      = (UINT32)ProcessorInfoBuffer.ProcessorId;\r
-      RegisterTable[Index].TableLength        = 0;\r
-      RegisterTable[Index].AllocatedSize      = 0;\r
-      RegisterTable[Index].RegisterTableEntry = 0;\r
-\r
-      RegisterTable[NumberOfCpus + Index].InitialApicId      = (UINT32)ProcessorInfoBuffer.ProcessorId;\r
-      RegisterTable[NumberOfCpus + Index].TableLength        = 0;\r
-      RegisterTable[NumberOfCpus + Index].AllocatedSize      = 0;\r
-      RegisterTable[NumberOfCpus + Index].RegisterTableEntry = 0;\r
-    }\r
-    AcpiCpuData->RegisterTable           = (EFI_PHYSICAL_ADDRESS)(UINTN)RegisterTable;\r
-    AcpiCpuData->PreSmmInitRegisterTable = (EFI_PHYSICAL_ADDRESS)(UINTN)(RegisterTable + NumberOfCpus);\r
   }\r
 \r
   //\r