Re: [edk2-devel][edk2-platforms][PATCH V3 1/1] MinPlatformPkg/AcpiTables: Add additional thread mapping in MADT

2022-08-08 Thread Oram, Isaac W
Pushed as d85e4251ce..306c2d1cef

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Oram, Isaac W
Sent: Monday, August 8, 2022 3:41 PM
To: Sinha, Ankit ; devel@edk2.groups.io
Cc: Desimone, Nathaniel L ; Dong, Eric 

Subject: Re: [edk2-devel][edk2-platforms][PATCH V3 1/1] 
MinPlatformPkg/AcpiTables: Add additional thread mapping in MADT

Reviewed-by: Isaac Oram 

-Original Message-
From: Sinha, Ankit 
Sent: Monday, August 8, 2022 2:05 PM
To: devel@edk2.groups.io
Cc: Oram, Isaac W ; Desimone, Nathaniel L 
; Dong, Eric 
Subject: [edk2-devel][edk2-platforms][PATCH V3 1/1] MinPlatformPkg/AcpiTables: 
Add additional thread mapping in MADT

Add mapping for all enabled and disabled threads in MADT

Cc: Isaac Oram 
Cc: Nate DeSimone 
Cc: Eric Dong 
Signed-off-by: Ankit Sinha 
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 49 
+++-
 1 file changed, 28 insertions(+), 21 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index e68b6070607f..5a282e7c18f2 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -243,46 +243,54 @@ SortCpuLocalApicInTable (
 }
   }
 
-  //
-  // 1. Sort TempCpuApicIdOrderTable,
-  //sort it by using ApicId from minimum to maximum (Socket0 to SocketN), 
and the BSP must in the fist location of the table.
-  //So, start sorting the table from the second element and total elements 
are mNumberOfCpus-1.
-  //
+  /*
+  1. Sort TempCpuApicIdOrderTable,
+Sort it by using ApicId from minimum to maximum (Socket0 to SocketN), 
and the BSP must be in the fist location of the table.
+
+  2. Sort and map all the enabled threads after BSP in 
+ CpuApicIdOrderTable
+
+  3. Threads that are not enabled are placed in the bottom of 
+ CpuApicIdOrderTable
+
+  4. Re-assign AcpiProcessorId for AcpiProcessorUid uses purpose.
+  */
+
   PerformQuickSort ((TempCpuApicIdOrderTable + 1), (mNumberOfCpus - 1), sizeof 
(EFI_CPU_ID_ORDER_MAP), (SORT_COMPARE) ApicIdCompareFunction);
 
-  //
-  // 2. Sort and map the primary threads to the front of the 
CpuApicIdOrderTable
-  //
   for (CurrProcessor = 0, Index = 0; Index < mNumberOfCpus; Index++) {
-if ((TempCpuApicIdOrderTable[Index].Thread) == 0) { // primary thread
+if ((TempCpuApicIdOrderTable[Index].Thread) == 0) {
   CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
   CurrProcessor++;
 }
   }
 
-  //
-  // 3. Sort and map the second threads to the middle of the 
CpuApicIdOrderTable
-  //
   for (Index = 0; Index < mNumberOfCpus; Index++) {
-if ((TempCpuApicIdOrderTable[Index].Thread) == 1) { //second thread
+if ((TempCpuApicIdOrderTable[Index].Thread) == 1) {
   CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
   CurrProcessor++;
 }
   }
 
-  //
-  // 4. Sort and map the not enabled threads to the bottom of the 
CpuApicIdOrderTable
-  //
   for (Index = 0; Index < mNumberOfCpus; Index++) {
-if (TempCpuApicIdOrderTable[Index].Flags == 0) { // not enabled
+if ((TempCpuApicIdOrderTable[Index].Thread) == 2) {
+  CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
+  CurrProcessor++;
+}
+  }
+
+  for (Index = 0; Index < mNumberOfCpus; Index++) {
+if ((TempCpuApicIdOrderTable[Index].Thread) == 3) {
+  CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
+  CurrProcessor++;
+}
+  }
+
+  for (Index = 0; Index < mNumberOfCpus; Index++) {
+if (TempCpuApicIdOrderTable[Index].Flags == 0) {
   CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
   CurrProcessor++;
 }
   }
 
-  //
-  // 5. Re-assign AcpiProcessorId for AcpiProcessorUid uses purpose.
-  //
   for (Socket = 0; Socket < FixedPcdGet32 (PcdMaxCpuSocketCount); Socket++) {
 for (CurrProcessor = 0, Index = 0; CurrProcessor < mNumberOfCpus; 
CurrProcessor++) {
   if (mCpuApicIdOrderTable[CurrProcessor].Flags && 
(mCpuApicIdOrderTable[CurrProcessor].SocketNum == Socket)) { @@ -292,7 +300,6 
@@ SortCpuLocalApicInTable (
 }
   }
 
-  //keep for debug purpose
   DEBUG ((DEBUG_INFO, "APIC ID Order Table ReOrdered\n"));
   DebugDisplayReOrderTable (mCpuApicIdOrderTable);
 
--
2.27.0.windows.1








-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92221): https://edk2.groups.io/g/devel/message/92221
Mute This Topic: https://groups.io/mt/92902463/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel][edk2-platforms][PATCH V3 1/1] MinPlatformPkg/AcpiTables: Add additional thread mapping in MADT

2022-08-08 Thread Oram, Isaac W
Reviewed-by: Isaac Oram 

-Original Message-
From: Sinha, Ankit  
Sent: Monday, August 8, 2022 2:05 PM
To: devel@edk2.groups.io
Cc: Oram, Isaac W ; Desimone, Nathaniel L 
; Dong, Eric 
Subject: [edk2-devel][edk2-platforms][PATCH V3 1/1] MinPlatformPkg/AcpiTables: 
Add additional thread mapping in MADT

Add mapping for all enabled and disabled threads in MADT

Cc: Isaac Oram 
Cc: Nate DeSimone 
Cc: Eric Dong 
Signed-off-by: Ankit Sinha 
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 49 
+++-
 1 file changed, 28 insertions(+), 21 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index e68b6070607f..5a282e7c18f2 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -243,46 +243,54 @@ SortCpuLocalApicInTable (
 }
   }
 
-  //
-  // 1. Sort TempCpuApicIdOrderTable,
-  //sort it by using ApicId from minimum to maximum (Socket0 to SocketN), 
and the BSP must in the fist location of the table.
-  //So, start sorting the table from the second element and total elements 
are mNumberOfCpus-1.
-  //
+  /*
+  1. Sort TempCpuApicIdOrderTable,
+Sort it by using ApicId from minimum to maximum (Socket0 to SocketN), 
and the BSP must be in the fist location of the table.
+
+  2. Sort and map all the enabled threads after BSP in 
+ CpuApicIdOrderTable
+
+  3. Threads that are not enabled are placed in the bottom of 
+ CpuApicIdOrderTable
+
+  4. Re-assign AcpiProcessorId for AcpiProcessorUid uses purpose.
+  */
+
   PerformQuickSort ((TempCpuApicIdOrderTable + 1), (mNumberOfCpus - 1), sizeof 
(EFI_CPU_ID_ORDER_MAP), (SORT_COMPARE) ApicIdCompareFunction);
 
-  //
-  // 2. Sort and map the primary threads to the front of the 
CpuApicIdOrderTable
-  //
   for (CurrProcessor = 0, Index = 0; Index < mNumberOfCpus; Index++) {
-if ((TempCpuApicIdOrderTable[Index].Thread) == 0) { // primary thread
+if ((TempCpuApicIdOrderTable[Index].Thread) == 0) {
   CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
   CurrProcessor++;
 }
   }
 
-  //
-  // 3. Sort and map the second threads to the middle of the 
CpuApicIdOrderTable
-  //
   for (Index = 0; Index < mNumberOfCpus; Index++) {
-if ((TempCpuApicIdOrderTable[Index].Thread) == 1) { //second thread
+if ((TempCpuApicIdOrderTable[Index].Thread) == 1) {
   CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
   CurrProcessor++;
 }
   }
 
-  //
-  // 4. Sort and map the not enabled threads to the bottom of the 
CpuApicIdOrderTable
-  //
   for (Index = 0; Index < mNumberOfCpus; Index++) {
-if (TempCpuApicIdOrderTable[Index].Flags == 0) { // not enabled
+if ((TempCpuApicIdOrderTable[Index].Thread) == 2) {
+  CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
+  CurrProcessor++;
+}
+  }
+
+  for (Index = 0; Index < mNumberOfCpus; Index++) {
+if ((TempCpuApicIdOrderTable[Index].Thread) == 3) {
+  CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
+  CurrProcessor++;
+}
+  }
+
+  for (Index = 0; Index < mNumberOfCpus; Index++) {
+if (TempCpuApicIdOrderTable[Index].Flags == 0) {
   CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
   CurrProcessor++;
 }
   }
 
-  //
-  // 5. Re-assign AcpiProcessorId for AcpiProcessorUid uses purpose.
-  //
   for (Socket = 0; Socket < FixedPcdGet32 (PcdMaxCpuSocketCount); Socket++) {
 for (CurrProcessor = 0, Index = 0; CurrProcessor < mNumberOfCpus; 
CurrProcessor++) {
   if (mCpuApicIdOrderTable[CurrProcessor].Flags && 
(mCpuApicIdOrderTable[CurrProcessor].SocketNum == Socket)) { @@ -292,7 +300,6 
@@ SortCpuLocalApicInTable (
 }
   }
 
-  //keep for debug purpose
   DEBUG ((DEBUG_INFO, "APIC ID Order Table ReOrdered\n"));
   DebugDisplayReOrderTable (mCpuApicIdOrderTable);
 
--
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92220): https://edk2.groups.io/g/devel/message/92220
Mute This Topic: https://groups.io/mt/92902463/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel][edk2-platforms][PATCH V3 1/1] MinPlatformPkg/AcpiTables: Add additional thread mapping in MADT

2022-08-08 Thread Sinha, Ankit
Add mapping for all enabled and disabled threads in MADT

Cc: Isaac Oram 
Cc: Nate DeSimone 
Cc: Eric Dong 
Signed-off-by: Ankit Sinha 
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 49 
+++-
 1 file changed, 28 insertions(+), 21 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index e68b6070607f..5a282e7c18f2 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -243,46 +243,54 @@ SortCpuLocalApicInTable (
 }
   }
 
-  //
-  // 1. Sort TempCpuApicIdOrderTable,
-  //sort it by using ApicId from minimum to maximum (Socket0 to SocketN), 
and the BSP must in the fist location of the table.
-  //So, start sorting the table from the second element and total elements 
are mNumberOfCpus-1.
-  //
+  /*
+  1. Sort TempCpuApicIdOrderTable,
+Sort it by using ApicId from minimum to maximum (Socket0 to SocketN), 
and the BSP must be in the fist location of the table.
+
+  2. Sort and map all the enabled threads after BSP in CpuApicIdOrderTable
+
+  3. Threads that are not enabled are placed in the bottom of 
CpuApicIdOrderTable
+
+  4. Re-assign AcpiProcessorId for AcpiProcessorUid uses purpose.
+  */
+
   PerformQuickSort ((TempCpuApicIdOrderTable + 1), (mNumberOfCpus - 1), sizeof 
(EFI_CPU_ID_ORDER_MAP), (SORT_COMPARE) ApicIdCompareFunction);
 
-  //
-  // 2. Sort and map the primary threads to the front of the 
CpuApicIdOrderTable
-  //
   for (CurrProcessor = 0, Index = 0; Index < mNumberOfCpus; Index++) {
-if ((TempCpuApicIdOrderTable[Index].Thread) == 0) { // primary thread
+if ((TempCpuApicIdOrderTable[Index].Thread) == 0) {
   CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
   CurrProcessor++;
 }
   }
 
-  //
-  // 3. Sort and map the second threads to the middle of the 
CpuApicIdOrderTable
-  //
   for (Index = 0; Index < mNumberOfCpus; Index++) {
-if ((TempCpuApicIdOrderTable[Index].Thread) == 1) { //second thread
+if ((TempCpuApicIdOrderTable[Index].Thread) == 1) {
   CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
   CurrProcessor++;
 }
   }
 
-  //
-  // 4. Sort and map the not enabled threads to the bottom of the 
CpuApicIdOrderTable
-  //
   for (Index = 0; Index < mNumberOfCpus; Index++) {
-if (TempCpuApicIdOrderTable[Index].Flags == 0) { // not enabled
+if ((TempCpuApicIdOrderTable[Index].Thread) == 2) {
+  CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
+  CurrProcessor++;
+}
+  }
+
+  for (Index = 0; Index < mNumberOfCpus; Index++) {
+if ((TempCpuApicIdOrderTable[Index].Thread) == 3) {
+  CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
+  CurrProcessor++;
+}
+  }
+
+  for (Index = 0; Index < mNumberOfCpus; Index++) {
+if (TempCpuApicIdOrderTable[Index].Flags == 0) {
   CopyMem ([CurrProcessor], 
[Index], sizeof (EFI_CPU_ID_ORDER_MAP));
   CurrProcessor++;
 }
   }
 
-  //
-  // 5. Re-assign AcpiProcessorId for AcpiProcessorUid uses purpose.
-  //
   for (Socket = 0; Socket < FixedPcdGet32 (PcdMaxCpuSocketCount); Socket++) {
 for (CurrProcessor = 0, Index = 0; CurrProcessor < mNumberOfCpus; 
CurrProcessor++) {
   if (mCpuApicIdOrderTable[CurrProcessor].Flags && 
(mCpuApicIdOrderTable[CurrProcessor].SocketNum == Socket)) {
@@ -292,7 +300,6 @@ SortCpuLocalApicInTable (
 }
   }
 
-  //keep for debug purpose
   DEBUG ((DEBUG_INFO, "APIC ID Order Table ReOrdered\n"));
   DebugDisplayReOrderTable (mCpuApicIdOrderTable);
 
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92218): https://edk2.groups.io/g/devel/message/92218
Mute This Topic: https://groups.io/mt/92902463/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-