public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Re: [edk2-devel] [PATCH] UefiCpuPkg/MpService: GetProcessorInfo returns 6-level topology
       [not found] <15A98DC5A007A952.7301@groups.io>
@ 2019-06-19  8:58 ` Ni, Ray
  2019-06-20  3:00   ` Dong, Eric
  0 siblings, 1 reply; 2+ messages in thread
From: Ni, Ray @ 2019-06-19  8:58 UTC (permalink / raw)
  To: devel@edk2.groups.io, Ni, Ray; +Cc: Dong, Eric

This change will be pushed to edk2-staging repo after it gets Reviewed-by.
The reason is the change requires a protocol interface change in PI spec.

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ni, Ray
> Sent: Wednesday, June 19, 2019 4:57 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>
> Subject: [edk2-devel] [PATCH] UefiCpuPkg/MpService: GetProcessorInfo
> returns 6-level topology
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ray Ni <ray.ni@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> ---
>  MdePkg/Include/Protocol/MpService.h  | 50
> +++++++++++++++++++++++++---  UefiCpuPkg/Library/MpInitLib/MpLib.c |
> 19 +++++++++++
>  2 files changed, 64 insertions(+), 5 deletions(-)
> 
> diff --git a/MdePkg/Include/Protocol/MpService.h
> b/MdePkg/Include/Protocol/MpService.h
> index 10e2405daf..aeab8b0790 100644
> --- a/MdePkg/Include/Protocol/MpService.h
> +++ b/MdePkg/Include/Protocol/MpService.h
> @@ -27,7 +27,7 @@
>    APs to help test system memory in parallel with other device initialization.
>    Diagnostics applications may also use this protocol for multi-processor.
> 
> -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>    @par Revision Reference:
> @@ -79,7 +79,7 @@ typedef struct _EFI_MP_SERVICES_PROTOCOL
> EFI_MP_SERVICES_PROTOCOL;  #define PROCESSOR_HEALTH_STATUS_BIT
> 0x00000004
> 
>  ///
> -/// Structure that describes the pyhiscal location of a logical CPU.
> +/// Structure that describes the physical location of a logical CPU.
>  ///
>  typedef struct {
>    ///
> @@ -96,6 +96,45 @@ typedef struct {
>    UINT32  Thread;
>  } EFI_CPU_PHYSICAL_LOCATION;
> 
> +#define CPU_V2_EXTENDED_TOPOLOGY     BIT24
> +
> +///
> +/// Structure that describes the v2 physical location of a logical CPU.
> +///
> +typedef struct {
> +  ///
> +  /// Zero-based physical package number that identifies the cartridge of the
> processor.
> +  ///
> +  UINT32  Package;
> +  ///
> +  /// Zero-based physical module number within package of the processor.
> +  ///
> +  UINT32  Module;
> +  ///
> +  /// Zero-based physical tile number within module of the processor.
> +  ///
> +  UINT32  Tile;
> +  ///
> +  /// Zero-based physical die number within tile of the processor.
> +  ///
> +  UINT32  Die;
> +  ///
> +  /// Zero-based physical core number within die of the processor.
> +  ///
> +  UINT32  Core;
> +  ///
> +  /// Zero-based logical thread number within core of the processor.
> +  ///
> +  UINT32  Thread;
> +} EFI_CPU_PHYSICAL_LOCATION2;
> +
> +///
> +/// Structure that describes extended processor information.
> +///
> +typedef union {
> +  EFI_CPU_PHYSICAL_LOCATION2  Location2; }
> +EXTENDED_PROCESSOR_INFORMATION;
> +
>  ///
>  /// Structure that describes information about a logical CPU.
>  ///
> @@ -106,7 +145,7 @@ typedef struct {
>    /// are used, and higher bits are reserved.  For IPF, the lower 16 bits
> contains
>    /// id/eid, and higher bits are reserved.
>    ///
> -  UINT64                     ProcessorId;
> +  UINT64                         ProcessorId;
>    ///
>    /// Flags indicating if the processor is BSP or AP, if the processor is enabled
>    /// or disabled, and if the processor is healthy. Bits 3..31 are reserved and
> @@ -125,13 +164,14 @@ typedef struct {
>    ///  1      1       1     Healthy Enabled BSP.
>    /// </pre>
>    ///
> -  UINT32                     StatusFlag;
> +  UINT32                         StatusFlag;
>    ///
>    /// The physical location of the processor, including the physical package
> number
>    /// that identifies the cartridge, the physical core number within package,
> and
>    /// logical thread number within core.
>    ///
> -  EFI_CPU_PHYSICAL_LOCATION  Location;
> +  EFI_CPU_PHYSICAL_LOCATION      Location;
> +  EXTENDED_PROCESSOR_INFORMATION ExtendedInformation;
>  } EFI_PROCESSOR_INFORMATION;
> 
>  /**
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 6f51bc4ebf..538d6536e2 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1774,10 +1774,17 @@ MpInitLibGetProcessorInfo (
>    CPU_MP_DATA            *CpuMpData;
>    UINTN                  CallerNumber;
>    CPU_INFO_IN_HOB        *CpuInfoInHob;
> +  UINTN                  OriginalProcessorNumber;
> 
>    CpuMpData = GetCpuMpData ();
>    CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData-
> >CpuInfoInHob;
> 
> +  //
> +  // Lower 24 bits contains the actual processor number.
> +  //
> +  OriginalProcessorNumber = ProcessorNumber;  ProcessorNumber &=
> BIT24
> + - 1;
> +
>    //
>    // Check whether caller processor is BSP
>    //
> @@ -1818,6 +1825,18 @@ MpInitLibGetProcessorInfo (
>      &ProcessorInfoBuffer->Location.Thread
>      );
> 
> +  if ((OriginalProcessorNumber & CPU_V2_EXTENDED_TOPOLOGY) != 0) {
> +    GetProcessorLocation2ByApicId (
> +      CpuInfoInHob[ProcessorNumber].ApicId,
> +      &ProcessorInfoBuffer->ExtendedInformation.Location2.Package,
> +      &ProcessorInfoBuffer->ExtendedInformation.Location2.Die,
> +      &ProcessorInfoBuffer->ExtendedInformation.Location2.Tile,
> +      &ProcessorInfoBuffer->ExtendedInformation.Location2.Module,
> +      &ProcessorInfoBuffer->ExtendedInformation.Location2.Core,
> +      &ProcessorInfoBuffer->ExtendedInformation.Location2.Thread
> +      );
> +  }
> +
>    if (HealthData != NULL) {
>      HealthData->Uint32 = CpuInfoInHob[ProcessorNumber].Health;
>    }
> --
> 2.21.0.windows.1
> 
> 
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [edk2-devel] [PATCH] UefiCpuPkg/MpService: GetProcessorInfo returns 6-level topology
  2019-06-19  8:58 ` [edk2-devel] [PATCH] UefiCpuPkg/MpService: GetProcessorInfo returns 6-level topology Ni, Ray
@ 2019-06-20  3:00   ` Dong, Eric
  0 siblings, 0 replies; 2+ messages in thread
From: Dong, Eric @ 2019-06-20  3:00 UTC (permalink / raw)
  To: Ni, Ray, devel@edk2.groups.io

Reviewed-by: Eric Dong <eric.dong@intel.com>

> -----Original Message-----
> From: Ni, Ray
> Sent: Wednesday, June 19, 2019 4:58 PM
> To: devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>
> Cc: Dong, Eric <eric.dong@intel.com>
> Subject: RE: [edk2-devel] [PATCH] UefiCpuPkg/MpService: GetProcessorInfo
> returns 6-level topology
> 
> This change will be pushed to edk2-staging repo after it gets Reviewed-by.
> The reason is the change requires a protocol interface change in PI spec.
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ni,
> Ray
> > Sent: Wednesday, June 19, 2019 4:57 PM
> > To: devel@edk2.groups.io
> > Cc: Dong, Eric <eric.dong@intel.com>
> > Subject: [edk2-devel] [PATCH] UefiCpuPkg/MpService: GetProcessorInfo
> > returns 6-level topology
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ray Ni <ray.ni@intel.com>
> > Cc: Eric Dong <eric.dong@intel.com>
> > ---
> >  MdePkg/Include/Protocol/MpService.h  | 50
> > +++++++++++++++++++++++++---  UefiCpuPkg/Library/MpInitLib/MpLib.c
> |
> > 19 +++++++++++
> >  2 files changed, 64 insertions(+), 5 deletions(-)
> >
> > diff --git a/MdePkg/Include/Protocol/MpService.h
> > b/MdePkg/Include/Protocol/MpService.h
> > index 10e2405daf..aeab8b0790 100644
> > --- a/MdePkg/Include/Protocol/MpService.h
> > +++ b/MdePkg/Include/Protocol/MpService.h
> > @@ -27,7 +27,7 @@
> >    APs to help test system memory in parallel with other device initialization.
> >    Diagnostics applications may also use this protocol for multi-processor.
> >
> > -Copyright (c) 2006 - 2017, Intel Corporation. All rights
> > reserved.<BR>
> > +Copyright (c) 2006 - 2019, Intel Corporation. All rights
> > +reserved.<BR>
> >  SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >    @par Revision Reference:
> > @@ -79,7 +79,7 @@ typedef struct _EFI_MP_SERVICES_PROTOCOL
> > EFI_MP_SERVICES_PROTOCOL;  #define PROCESSOR_HEALTH_STATUS_BIT
> > 0x00000004
> >
> >  ///
> > -/// Structure that describes the pyhiscal location of a logical CPU.
> > +/// Structure that describes the physical location of a logical CPU.
> >  ///
> >  typedef struct {
> >    ///
> > @@ -96,6 +96,45 @@ typedef struct {
> >    UINT32  Thread;
> >  } EFI_CPU_PHYSICAL_LOCATION;
> >
> > +#define CPU_V2_EXTENDED_TOPOLOGY     BIT24
> > +
> > +///
> > +/// Structure that describes the v2 physical location of a logical CPU.
> > +///
> > +typedef struct {
> > +  ///
> > +  /// Zero-based physical package number that identifies the
> > +cartridge of the
> > processor.
> > +  ///
> > +  UINT32  Package;
> > +  ///
> > +  /// Zero-based physical module number within package of the processor.
> > +  ///
> > +  UINT32  Module;
> > +  ///
> > +  /// Zero-based physical tile number within module of the processor.
> > +  ///
> > +  UINT32  Tile;
> > +  ///
> > +  /// Zero-based physical die number within tile of the processor.
> > +  ///
> > +  UINT32  Die;
> > +  ///
> > +  /// Zero-based physical core number within die of the processor.
> > +  ///
> > +  UINT32  Core;
> > +  ///
> > +  /// Zero-based logical thread number within core of the processor.
> > +  ///
> > +  UINT32  Thread;
> > +} EFI_CPU_PHYSICAL_LOCATION2;
> > +
> > +///
> > +/// Structure that describes extended processor information.
> > +///
> > +typedef union {
> > +  EFI_CPU_PHYSICAL_LOCATION2  Location2; }
> > +EXTENDED_PROCESSOR_INFORMATION;
> > +
> >  ///
> >  /// Structure that describes information about a logical CPU.
> >  ///
> > @@ -106,7 +145,7 @@ typedef struct {
> >    /// are used, and higher bits are reserved.  For IPF, the lower 16
> > bits contains
> >    /// id/eid, and higher bits are reserved.
> >    ///
> > -  UINT64                     ProcessorId;
> > +  UINT64                         ProcessorId;
> >    ///
> >    /// Flags indicating if the processor is BSP or AP, if the processor is
> enabled
> >    /// or disabled, and if the processor is healthy. Bits 3..31 are
> > reserved and @@ -125,13 +164,14 @@ typedef struct {
> >    ///  1      1       1     Healthy Enabled BSP.
> >    /// </pre>
> >    ///
> > -  UINT32                     StatusFlag;
> > +  UINT32                         StatusFlag;
> >    ///
> >    /// The physical location of the processor, including the physical
> > package number
> >    /// that identifies the cartridge, the physical core number within
> > package, and
> >    /// logical thread number within core.
> >    ///
> > -  EFI_CPU_PHYSICAL_LOCATION  Location;
> > +  EFI_CPU_PHYSICAL_LOCATION      Location;
> > +  EXTENDED_PROCESSOR_INFORMATION ExtendedInformation;
> >  } EFI_PROCESSOR_INFORMATION;
> >
> >  /**
> > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> > b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> > index 6f51bc4ebf..538d6536e2 100644
> > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> > @@ -1774,10 +1774,17 @@ MpInitLibGetProcessorInfo (
> >    CPU_MP_DATA            *CpuMpData;
> >    UINTN                  CallerNumber;
> >    CPU_INFO_IN_HOB        *CpuInfoInHob;
> > +  UINTN                  OriginalProcessorNumber;
> >
> >    CpuMpData = GetCpuMpData ();
> >    CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData-
> > >CpuInfoInHob;
> >
> > +  //
> > +  // Lower 24 bits contains the actual processor number.
> > +  //
> > +  OriginalProcessorNumber = ProcessorNumber;  ProcessorNumber &=
> > BIT24
> > + - 1;
> > +
> >    //
> >    // Check whether caller processor is BSP
> >    //
> > @@ -1818,6 +1825,18 @@ MpInitLibGetProcessorInfo (
> >      &ProcessorInfoBuffer->Location.Thread
> >      );
> >
> > +  if ((OriginalProcessorNumber & CPU_V2_EXTENDED_TOPOLOGY) != 0) {
> > +    GetProcessorLocation2ByApicId (
> > +      CpuInfoInHob[ProcessorNumber].ApicId,
> > +      &ProcessorInfoBuffer->ExtendedInformation.Location2.Package,
> > +      &ProcessorInfoBuffer->ExtendedInformation.Location2.Die,
> > +      &ProcessorInfoBuffer->ExtendedInformation.Location2.Tile,
> > +      &ProcessorInfoBuffer->ExtendedInformation.Location2.Module,
> > +      &ProcessorInfoBuffer->ExtendedInformation.Location2.Core,
> > +      &ProcessorInfoBuffer->ExtendedInformation.Location2.Thread
> > +      );
> > +  }
> > +
> >    if (HealthData != NULL) {
> >      HealthData->Uint32 = CpuInfoInHob[ProcessorNumber].Health;
> >    }
> > --
> > 2.21.0.windows.1
> >
> >
> > 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-20  3:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <15A98DC5A007A952.7301@groups.io>
2019-06-19  8:58 ` [edk2-devel] [PATCH] UefiCpuPkg/MpService: GetProcessorInfo returns 6-level topology Ni, Ray
2019-06-20  3:00   ` Dong, Eric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox