Re: [edk2-devel] [edk2-platforms V2] MinPlatformPkg: Corret AcpiProcessorUid in MADT

2024-04-02 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

Thanks,
Chasel


> -Original Message-
> From: Tan, Dun 
> Sent: Sunday, March 31, 2024 11:00 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray ; Lou, Yun ; Chiu, Chasel
> ; Desimone, Nathaniel L
> ; Liming Gao ;
> Dong, Eric 
> Subject: [edk2-platforms V2] MinPlatformPkg: Corret AcpiProcessorUid in MADT
> 
> Change AcpiProcessorUid in CpuApicIdOrderTable to the index in MpService
> regardless of disabled core.
> 
> Let's take a simple example:
> There are 2 enabled cores and 1 disabled core.
>   APICID   Index in MpService
> 0x_0
> 0x_0010(disbaled)  1
> 0x_00402
> 
> With current implementation, the results of the x2apic structure entries in 
> MADT
> are:
> MADT Entry  APICID AcpiProcessorUid
> 0 0x_  0
> 1 0x_0040  1
> 
> The AcpiProcessorUid will be associated with the processor device defined in
> DSDT/SSDT. To make sure the x2apic structure entries in MADT can be mapped to
> the right processor devices in DSDT, the AcpiProcessorUid of the second x2apic
> structure entry in MADT should be kept as 2, which is the core index in
> MpService.
> 
> Signed-off-by: Dun Tan 
> Cc: Ray Ni 
> Cc: Jason Lou 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Liming Gao 
> Cc: Eric Dong 
> ---
>  Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> index 2a833ec99c..f6ea7454d3 100644
> --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> @@ -190,7 +190,7 @@ CreateCpuLocalApicInTable (
>//
>for (Socket = 0; Socket < FixedPcdGet32 (PcdMaxCpuSocketCount); Socket++) {
>  for (CurrProcessor = 0, Index = 0; CurrProcessor < mNumberOfCpus;
> CurrProcessor++) {
> -  if (CpuApicIdOrderTable[CurrProcessor].Flags &&
> (CpuApicIdOrderTable[CurrProcessor].SocketNum == Socket)) {
> +  if (CpuApicIdOrderTable[CurrProcessor].SocketNum == Socket) {
>  CpuApicIdOrderTable[CurrProcessor].AcpiProcessorUid =
> (CpuApicIdOrderTable[CurrProcessor].SocketNum << mNumOfBitShift) + Index;
>  Index++;
>}
> --
> 2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117326): https://edk2.groups.io/g/devel/message/117326
Mute This Topic: https://groups.io/mt/105259071/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 V2] MinPlatformPkg: Corret AcpiProcessorUid in MADT

2024-04-01 Thread Ni, Ray
Reviewed-by: Ray Ni 

Thanks,
Ray

From: Tan, Dun 
Sent: Monday, April 1, 2024 13:59
To: devel@edk2.groups.io 
Cc: Ni, Ray ; Lou, Yun ; Chiu, Chasel 
; Desimone, Nathaniel L 
; Liming Gao ; Dong, 
Eric 
Subject: [edk2-platforms V2] MinPlatformPkg: Corret AcpiProcessorUid in MADT

Change AcpiProcessorUid in CpuApicIdOrderTable to
the index in MpService regardless of disabled core.

Let's take a simple example:
There are 2 enabled cores and 1 disabled core.
  APICID   Index in MpService
0x_0
0x_0010(disbaled)  1
0x_00402

With current implementation, the results of the x2apic
structure entries in MADT are:
MADT Entry  APICID AcpiProcessorUid
0 0x_  0
1 0x_0040  1

The AcpiProcessorUid will be associated with the
processor device defined in DSDT/SSDT. To make sure
the x2apic structure entries in MADT can be mapped to
the right processor devices in DSDT, the AcpiProcessorUid
of the second x2apic structure entry in MADT should
be kept as 2, which is the core index in MpService.

Signed-off-by: Dun Tan 
Cc: Ray Ni 
Cc: Jason Lou 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Eric Dong 
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index 2a833ec99c..f6ea7454d3 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -190,7 +190,7 @@ CreateCpuLocalApicInTable (
   //
   for (Socket = 0; Socket < FixedPcdGet32 (PcdMaxCpuSocketCount); Socket++) {
 for (CurrProcessor = 0, Index = 0; CurrProcessor < mNumberOfCpus; 
CurrProcessor++) {
-  if (CpuApicIdOrderTable[CurrProcessor].Flags && 
(CpuApicIdOrderTable[CurrProcessor].SocketNum == Socket)) {
+  if (CpuApicIdOrderTable[CurrProcessor].SocketNum == Socket) {
 CpuApicIdOrderTable[CurrProcessor].AcpiProcessorUid = 
(CpuApicIdOrderTable[CurrProcessor].SocketNum << mNumOfBitShift) + Index;
 Index++;
   }
--
2.31.1.windows.1



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




[edk2-devel] [edk2-platforms V2] MinPlatformPkg: Corret AcpiProcessorUid in MADT

2024-03-31 Thread duntan
Change AcpiProcessorUid in CpuApicIdOrderTable to
the index in MpService regardless of disabled core.

Let's take a simple example:
There are 2 enabled cores and 1 disabled core.
  APICID   Index in MpService
0x_0
0x_0010(disbaled)  1
0x_00402

With current implementation, the results of the x2apic
structure entries in MADT are:
MADT Entry  APICID AcpiProcessorUid
0 0x_  0
1 0x_0040  1

The AcpiProcessorUid will be associated with the
processor device defined in DSDT/SSDT. To make sure
the x2apic structure entries in MADT can be mapped to
the right processor devices in DSDT, the AcpiProcessorUid
of the second x2apic structure entry in MADT should
be kept as 2, which is the core index in MpService.

Signed-off-by: Dun Tan 
Cc: Ray Ni 
Cc: Jason Lou 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Eric Dong 
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index 2a833ec99c..f6ea7454d3 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -190,7 +190,7 @@ CreateCpuLocalApicInTable (
   //
   for (Socket = 0; Socket < FixedPcdGet32 (PcdMaxCpuSocketCount); Socket++) {
 for (CurrProcessor = 0, Index = 0; CurrProcessor < mNumberOfCpus; 
CurrProcessor++) {
-  if (CpuApicIdOrderTable[CurrProcessor].Flags && 
(CpuApicIdOrderTable[CurrProcessor].SocketNum == Socket)) {
+  if (CpuApicIdOrderTable[CurrProcessor].SocketNum == Socket) {
 CpuApicIdOrderTable[CurrProcessor].AcpiProcessorUid = 
(CpuApicIdOrderTable[CurrProcessor].SocketNum << mNumOfBitShift) + Index;
 Index++;
   }
-- 
2.31.1.windows.1



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