* [Patch v2 0/2] Avoid AP calls PeiServices table. @ 2019-01-07 1:05 Eric Dong 2019-01-07 1:05 ` [Patch v2 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Enhance debug message Eric Dong 2019-01-07 1:05 ` [Patch 2/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService Eric Dong 0 siblings, 2 replies; 6+ messages in thread From: Eric Dong @ 2019-01-07 1:05 UTC (permalink / raw) To: edk2-devel AP should not use PeiServices. The patch serial fix one issue related to this. This serial also include one patch used to refine the debug message. Eric Dong (2): UefiCpuPkg/RegisterCpuFeaturesLib: Enhance debug message. UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService. .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 39 +++++++++----- .../DxeRegisterCpuFeaturesLib.c | 57 +++++++++++--------- .../PeiRegisterCpuFeaturesLib.c | 62 +++++++++------------- .../RegisterCpuFeaturesLib/RegisterCpuFeatures.h | 16 +++++- 4 files changed, 96 insertions(+), 78 deletions(-) -- 2.15.0.windows.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Patch v2 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Enhance debug message. 2019-01-07 1:05 [Patch v2 0/2] Avoid AP calls PeiServices table Eric Dong @ 2019-01-07 1:05 ` Eric Dong 2019-01-07 7:53 ` Ni, Ruiyu 2019-01-07 1:05 ` [Patch 2/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService Eric Dong 1 sibling, 1 reply; 6+ messages in thread From: Eric Dong @ 2019-01-07 1:05 UTC (permalink / raw) To: edk2-devel; +Cc: Ruiyu Ni Enhance debug message format to let them easy to read. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong <eric.dong@intel.com> --- .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c index 0a74d448c8..624ddee055 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c @@ -473,8 +473,9 @@ DumpRegisterTableOnProcessor ( case Msr: DEBUG (( DebugPrintErrorLevel, - "Processor: %d: MSR: %x, Bit Start: %d, Bit Length: %d, Value: %lx\r\n", + "Processor: %04d: Index %04d, MSR : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", ProcessorNumber, + FeatureIndex, RegisterTableEntry->Index, RegisterTableEntry->ValidBitStart, RegisterTableEntry->ValidBitLength, @@ -484,8 +485,9 @@ DumpRegisterTableOnProcessor ( case ControlRegister: DEBUG (( DebugPrintErrorLevel, - "Processor: %d: CR: %x, Bit Start: %d, Bit Length: %d, Value: %lx\r\n", + "Processor: %04d: Index %04d, CR : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", ProcessorNumber, + FeatureIndex, RegisterTableEntry->Index, RegisterTableEntry->ValidBitStart, RegisterTableEntry->ValidBitLength, @@ -495,8 +497,9 @@ DumpRegisterTableOnProcessor ( case MemoryMapped: DEBUG (( DebugPrintErrorLevel, - "Processor: %d: MMIO: %lx, Bit Start: %d, Bit Length: %d, Value: %lx\r\n", + "Processor: %04d: Index %04d, MMIO : %08lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", ProcessorNumber, + FeatureIndex, RegisterTableEntry->Index | LShiftU64 (RegisterTableEntry->HighIndex, 32), RegisterTableEntry->ValidBitStart, RegisterTableEntry->ValidBitLength, @@ -506,8 +509,9 @@ DumpRegisterTableOnProcessor ( case CacheControl: DEBUG (( DebugPrintErrorLevel, - "Processor: %d: CACHE: %x, Bit Start: %d, Bit Length: %d, Value: %lx\r\n", + "Processor: %04d: Index %04d, CACHE: %08lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", ProcessorNumber, + FeatureIndex, RegisterTableEntry->Index, RegisterTableEntry->ValidBitStart, RegisterTableEntry->ValidBitLength, @@ -517,8 +521,9 @@ DumpRegisterTableOnProcessor ( case Semaphore: DEBUG (( DebugPrintErrorLevel, - "Processor: %d: Semaphore: Scope Value: %s\r\n", + "Processor: %04d: Index %04d, SEMAP: %s\r\n", ProcessorNumber, + FeatureIndex, mDependTypeStr[MIN ((UINT32)RegisterTableEntry->Value, InvalidDepType)] )); break; @@ -833,7 +838,7 @@ ProgramProcessorRegister ( ApLocation->Thread; DEBUG (( DEBUG_INFO, - "Processor = %lu, Entry Index %lu, Type = %s!\n", + "Processor = %08lu, Index %08lu, Type = %s!\n", (UINT64)ThreadIndex, (UINT64)Index, mRegisterTypeStr[MIN ((REGISTER_TYPE)RegisterTableEntry->RegisterType, InvalidReg)] -- 2.15.0.windows.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Patch v2 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Enhance debug message. 2019-01-07 1:05 ` [Patch v2 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Enhance debug message Eric Dong @ 2019-01-07 7:53 ` Ni, Ruiyu 0 siblings, 0 replies; 6+ messages in thread From: Ni, Ruiyu @ 2019-01-07 7:53 UTC (permalink / raw) To: Eric Dong, edk2-devel On 1/7/2019 9:05 AM, Eric Dong wrote: > Enhance debug message format to let them easy to read. > > Cc: Ruiyu Ni <ruiyu.ni@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Eric Dong <eric.dong@intel.com> > --- > .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > index 0a74d448c8..624ddee055 100644 > --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c > @@ -473,8 +473,9 @@ DumpRegisterTableOnProcessor ( > case Msr: > DEBUG (( > DebugPrintErrorLevel, > - "Processor: %d: MSR: %x, Bit Start: %d, Bit Length: %d, Value: %lx\r\n", > + "Processor: %04d: Index %04d, MSR : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", > ProcessorNumber, > + FeatureIndex, > RegisterTableEntry->Index, > RegisterTableEntry->ValidBitStart, > RegisterTableEntry->ValidBitLength, > @@ -484,8 +485,9 @@ DumpRegisterTableOnProcessor ( > case ControlRegister: > DEBUG (( > DebugPrintErrorLevel, > - "Processor: %d: CR: %x, Bit Start: %d, Bit Length: %d, Value: %lx\r\n", > + "Processor: %04d: Index %04d, CR : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", > ProcessorNumber, > + FeatureIndex, > RegisterTableEntry->Index, > RegisterTableEntry->ValidBitStart, > RegisterTableEntry->ValidBitLength, > @@ -495,8 +497,9 @@ DumpRegisterTableOnProcessor ( > case MemoryMapped: > DEBUG (( > DebugPrintErrorLevel, > - "Processor: %d: MMIO: %lx, Bit Start: %d, Bit Length: %d, Value: %lx\r\n", > + "Processor: %04d: Index %04d, MMIO : %08lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", > ProcessorNumber, > + FeatureIndex, > RegisterTableEntry->Index | LShiftU64 (RegisterTableEntry->HighIndex, 32), > RegisterTableEntry->ValidBitStart, > RegisterTableEntry->ValidBitLength, > @@ -506,8 +509,9 @@ DumpRegisterTableOnProcessor ( > case CacheControl: > DEBUG (( > DebugPrintErrorLevel, > - "Processor: %d: CACHE: %x, Bit Start: %d, Bit Length: %d, Value: %lx\r\n", > + "Processor: %04d: Index %04d, CACHE: %08lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n", > ProcessorNumber, > + FeatureIndex, > RegisterTableEntry->Index, > RegisterTableEntry->ValidBitStart, > RegisterTableEntry->ValidBitLength, > @@ -517,8 +521,9 @@ DumpRegisterTableOnProcessor ( > case Semaphore: > DEBUG (( > DebugPrintErrorLevel, > - "Processor: %d: Semaphore: Scope Value: %s\r\n", > + "Processor: %04d: Index %04d, SEMAP: %s\r\n", > ProcessorNumber, > + FeatureIndex, > mDependTypeStr[MIN ((UINT32)RegisterTableEntry->Value, InvalidDepType)] > )); > break; > @@ -833,7 +838,7 @@ ProgramProcessorRegister ( > ApLocation->Thread; > DEBUG (( > DEBUG_INFO, > - "Processor = %lu, Entry Index %lu, Type = %s!\n", > + "Processor = %08lu, Index %08lu, Type = %s!\n", > (UINT64)ThreadIndex, > (UINT64)Index, > mRegisterTypeStr[MIN ((REGISTER_TYPE)RegisterTableEntry->RegisterType, InvalidReg)] > Reviewed-by: Ray Ni <ray.ni@intel.com> -- Thanks, Ray ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Patch 2/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService. 2019-01-07 1:05 [Patch v2 0/2] Avoid AP calls PeiServices table Eric Dong 2019-01-07 1:05 ` [Patch v2 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Enhance debug message Eric Dong @ 2019-01-07 1:05 ` Eric Dong [not found] ` <734D49CCEBEEF84792F5B80ED585239D5BFA53EB@SHSMSX103.ccr.corp.intel.com> 1 sibling, 1 reply; 6+ messages in thread From: Eric Dong @ 2019-01-07 1:05 UTC (permalink / raw) To: edk2-devel; +Cc: Ruiyu Ni, Laszlo Ersek V2: 1. Initialize CpuFeaturesData->MpService in CpuInitDataInitialize and make this function been called at the begin of the initialization. 2. let all other functions use CpuFeaturesData->MpService install of locate the protocol itself. V1: GetProcessorIndex function calls GetMpPpi to get the MP Ppi. Ap will calls GetProcessorIndex function which final let AP calls PeiService. This patch avoid GetProcessorIndex call PeiService. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1411 Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Eric Dong <eric.dong@intel.com> --- .../RegisterCpuFeaturesLib/CpuFeaturesInitialize.c | 22 +++++--- .../DxeRegisterCpuFeaturesLib.c | 57 +++++++++++--------- .../PeiRegisterCpuFeaturesLib.c | 62 +++++++++------------- .../RegisterCpuFeaturesLib/RegisterCpuFeatures.h | 16 +++++- 4 files changed, 85 insertions(+), 72 deletions(-) diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c index 624ddee055..5866e022f0 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c @@ -138,7 +138,7 @@ FillProcessorInfo ( **/ VOID CpuInitDataInitialize ( - IN UINTN NumberOfCpus + VOID ) { EFI_STATUS Status; @@ -157,12 +157,22 @@ CpuInitDataInitialize ( ACPI_CPU_DATA *AcpiCpuData; CPU_STATUS_INFORMATION *CpuStatus; UINT32 *ValidCoreCountPerPackage; + UINTN NumberOfCpus; + UINTN NumberOfEnabledProcessors; Core = 0; Package = 0; Thread = 0; CpuFeaturesData = GetCpuFeaturesData (); + + // + // Initialize CpuFeaturesData->MpService as early as possile, so later function can use it. + // + CpuFeaturesData->MpService = GetMpService (); + + GetNumberOfProcessor (&NumberOfCpus, &NumberOfEnabledProcessors); + CpuFeaturesData->InitOrder = AllocateZeroPool (sizeof (CPU_FEATURES_INIT_ORDER) * NumberOfCpus); ASSERT (CpuFeaturesData->InitOrder != NULL); @@ -409,7 +419,7 @@ CollectProcessorData ( CPU_FEATURES_DATA *CpuFeaturesData; CpuFeaturesData = (CPU_FEATURES_DATA *)Buffer; - ProcessorNumber = GetProcessorIndex (); + ProcessorNumber = GetProcessorIndex (CpuFeaturesData); CpuInfo = &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo; // // collect processor information @@ -1105,15 +1115,11 @@ CpuFeaturesDetect ( VOID ) { - UINTN NumberOfCpus; - UINTN NumberOfEnabledProcessors; CPU_FEATURES_DATA *CpuFeaturesData; CpuFeaturesData = GetCpuFeaturesData(); - GetNumberOfProcessor (&NumberOfCpus, &NumberOfEnabledProcessors); - - CpuInitDataInitialize (NumberOfCpus); + CpuInitDataInitialize (); // // Wakeup all APs for data collection. @@ -1125,6 +1131,6 @@ CpuFeaturesDetect ( // CollectProcessorData (CpuFeaturesData); - AnalysisProcessorFeatures (NumberOfCpus); + AnalysisProcessorFeatures (CpuFeaturesData->NumberOfCpus); } diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c index 926698dc95..2d2095e437 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c @@ -20,7 +20,6 @@ #include "RegisterCpuFeatures.h" CPU_FEATURES_DATA mCpuFeaturesData = {0}; -EFI_MP_SERVICES_PROTOCOL *mCpuFeaturesMpServices = NULL; /** Worker function to get CPU_FEATURES_DATA pointer. @@ -40,44 +39,44 @@ GetCpuFeaturesData ( @return Pointer to EFI_MP_SERVICES_PROTOCOL. **/ -EFI_MP_SERVICES_PROTOCOL * -GetMpProtocol ( +VOID * +GetMpService ( VOID ) { - EFI_STATUS Status; - - if (mCpuFeaturesMpServices == NULL) { - // - // Get MP Services Protocol - // - Status = gBS->LocateProtocol ( - &gEfiMpServiceProtocolGuid, - NULL, - (VOID **)&mCpuFeaturesMpServices - ); - ASSERT_EFI_ERROR (Status); - } + EFI_STATUS Status; + EFI_MP_SERVICES_PROTOCOL *MpServices; - ASSERT (mCpuFeaturesMpServices != NULL); - return mCpuFeaturesMpServices; + // + // Get MP Services Protocol + // + Status = gBS->LocateProtocol ( + &gEfiMpServiceProtocolGuid, + NULL, + (VOID **)&MpServices + ); + ASSERT_EFI_ERROR (Status); + + return MpServices; } /** Worker function to return processor index. + @param CpuFeaturesData Cpu Feature Data structure. + @return The processor index. **/ UINTN GetProcessorIndex ( - VOID + IN CPU_FEATURES_DATA *CpuFeaturesData ) { EFI_STATUS Status; UINTN ProcessorIndex; EFI_MP_SERVICES_PROTOCOL *MpServices; - MpServices = GetMpProtocol (); + MpServices = (EFI_MP_SERVICES_PROTOCOL *)CpuFeaturesData->MpService; Status = MpServices->WhoAmI(MpServices, &ProcessorIndex); ASSERT_EFI_ERROR (Status); return ProcessorIndex; @@ -101,8 +100,11 @@ GetProcessorInformation ( { EFI_STATUS Status; EFI_MP_SERVICES_PROTOCOL *MpServices; + CPU_FEATURES_DATA *CpuFeaturesData; + + CpuFeaturesData = GetCpuFeaturesData (); + MpServices = (EFI_MP_SERVICES_PROTOCOL *)CpuFeaturesData->MpService; - MpServices = GetMpProtocol (); Status = MpServices->GetProcessorInfo ( MpServices, ProcessorNumber, @@ -130,8 +132,8 @@ StartupAPsWorker ( CPU_FEATURES_DATA *CpuFeaturesData; CpuFeaturesData = GetCpuFeaturesData (); + MpServices = (EFI_MP_SERVICES_PROTOCOL *)CpuFeaturesData->MpService; - MpServices = GetMpProtocol (); // // Wakeup all APs // @@ -159,8 +161,11 @@ SwitchNewBsp ( { EFI_STATUS Status; EFI_MP_SERVICES_PROTOCOL *MpServices; + CPU_FEATURES_DATA *CpuFeaturesData; + + CpuFeaturesData = GetCpuFeaturesData (); + MpServices = (EFI_MP_SERVICES_PROTOCOL *)CpuFeaturesData->MpService; - MpServices = GetMpProtocol (); // // Wakeup all APs // @@ -190,8 +195,10 @@ GetNumberOfProcessor ( { EFI_STATUS Status; EFI_MP_SERVICES_PROTOCOL *MpServices; + CPU_FEATURES_DATA *CpuFeaturesData; - MpServices = GetMpProtocol (); + CpuFeaturesData = GetCpuFeaturesData (); + MpServices = (EFI_MP_SERVICES_PROTOCOL *)CpuFeaturesData->MpService; // // Get the number of CPUs @@ -225,7 +232,7 @@ CpuFeaturesInitialize ( CpuFeaturesData = GetCpuFeaturesData (); - OldBspNumber = GetProcessorIndex(); + OldBspNumber = GetProcessorIndex (CpuFeaturesData); CpuFeaturesData->BspNumber = OldBspNumber; Status = gBS->CreateEvent ( diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c index 0bb3dee8b6..41f4dd54e8 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/PeiRegisterCpuFeaturesLib.c @@ -72,8 +72,8 @@ GetCpuFeaturesData ( @return PEI PPI service pointer. **/ -EFI_PEI_MP_SERVICES_PPI * -GetMpPpi ( +VOID * +GetMpService ( VOID ) { @@ -96,20 +96,27 @@ GetMpPpi ( /** Worker function to return processor index. + @param CpuFeaturesData Cpu Feature Data structure. + @return The processor index. **/ UINTN GetProcessorIndex ( - VOID + IN CPU_FEATURES_DATA *CpuFeaturesData ) { EFI_STATUS Status; EFI_PEI_MP_SERVICES_PPI *CpuMpPpi; UINTN ProcessorIndex; - CpuMpPpi = GetMpPpi (); + CpuMpPpi = (EFI_PEI_MP_SERVICES_PPI *)CpuFeaturesData->MpService; - Status = CpuMpPpi->WhoAmI(GetPeiServicesTablePointer (), CpuMpPpi, &ProcessorIndex); + // + // For two reasons which use NULL for WhoAmI: + // 1. This function will be called by APs and AP should not use PeiServices Table + // 2. Check WhoAmI implementation, this parameter will not be used. + // + Status = CpuMpPpi->WhoAmI(NULL, CpuMpPpi, &ProcessorIndex); ASSERT_EFI_ERROR (Status); return ProcessorIndex; } @@ -132,8 +139,11 @@ GetProcessorInformation ( { EFI_PEI_MP_SERVICES_PPI *CpuMpPpi; EFI_STATUS Status; + CPU_FEATURES_DATA *CpuFeaturesData; + + CpuFeaturesData = GetCpuFeaturesData (); + CpuMpPpi = (EFI_PEI_MP_SERVICES_PPI *)CpuFeaturesData->MpService; - CpuMpPpi = GetMpPpi (); Status = CpuMpPpi->GetProcessorInfo ( GetPeiServicesTablePointer(), CpuMpPpi, @@ -162,17 +172,7 @@ StartupAPsWorker ( CPU_FEATURES_DATA *CpuFeaturesData; CpuFeaturesData = GetCpuFeaturesData (); - - // - // Get MP Services Protocol - // - Status = PeiServicesLocatePpi ( - &gEfiPeiMpServicesPpiGuid, - 0, - NULL, - (VOID **)&CpuMpPpi - ); - ASSERT_EFI_ERROR (Status); + CpuMpPpi = (EFI_PEI_MP_SERVICES_PPI *)CpuFeaturesData->MpService; // // Wakeup all APs for data collection. @@ -244,17 +244,10 @@ SwitchNewBsp ( { EFI_STATUS Status; EFI_PEI_MP_SERVICES_PPI *CpuMpPpi; + CPU_FEATURES_DATA *CpuFeaturesData; - // - // Get MP Services Protocol - // - Status = PeiServicesLocatePpi ( - &gEfiPeiMpServicesPpiGuid, - 0, - NULL, - (VOID **)&CpuMpPpi - ); - ASSERT_EFI_ERROR (Status); + CpuFeaturesData = GetCpuFeaturesData (); + CpuMpPpi = (EFI_PEI_MP_SERVICES_PPI *)CpuFeaturesData->MpService; // // Wakeup all APs for data collection. @@ -286,17 +279,10 @@ GetNumberOfProcessor ( { EFI_STATUS Status; EFI_PEI_MP_SERVICES_PPI *CpuMpPpi; + CPU_FEATURES_DATA *CpuFeaturesData; - // - // Get MP Services Protocol - // - Status = PeiServicesLocatePpi ( - &gEfiPeiMpServicesPpiGuid, - 0, - NULL, - (VOID **)&CpuMpPpi - ); - ASSERT_EFI_ERROR (Status); + CpuFeaturesData = GetCpuFeaturesData (); + CpuMpPpi = (EFI_PEI_MP_SERVICES_PPI *)CpuFeaturesData->MpService; // // Get the number of CPUs @@ -329,7 +315,7 @@ CpuFeaturesInitialize ( CpuFeaturesData = GetCpuFeaturesData (); - OldBspNumber = GetProcessorIndex(); + OldBspNumber = GetProcessorIndex (CpuFeaturesData); CpuFeaturesData->BspNumber = OldBspNumber; // diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h index cf3da84837..ac0a2f9cf4 100644 --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeatures.h @@ -85,6 +85,8 @@ typedef struct { UINTN BspNumber; PROGRAM_CPU_REGISTER_FLAGS CpuFlags; + + VOID *MpService; } CPU_FEATURES_DATA; #define CPU_FEATURE_ENTRY_FROM_LINK(a) \ @@ -108,11 +110,13 @@ GetCpuFeaturesData ( /** Worker function to return processor index. + @param CpuFeaturesData Cpu Feature Data structure. + @return The processor index. **/ UINTN GetProcessorIndex ( - VOID + IN CPU_FEATURES_DATA *CpuFeaturesData ); /** @@ -245,4 +249,14 @@ GetAcpiCpuData ( VOID ); +/** + Worker function to get MP service pointer. + + @return Mp service pointer. +**/ +VOID * +GetMpService ( + VOID + ); + #endif -- 2.15.0.windows.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <734D49CCEBEEF84792F5B80ED585239D5BFA53EB@SHSMSX103.ccr.corp.intel.com>]
* Re: [Patch 2/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService. [not found] ` <734D49CCEBEEF84792F5B80ED585239D5BFA53EB@SHSMSX103.ccr.corp.intel.com> @ 2019-01-07 19:17 ` Laszlo Ersek 2019-01-08 5:32 ` Dong, Eric 0 siblings, 1 reply; 6+ messages in thread From: Laszlo Ersek @ 2019-01-07 19:17 UTC (permalink / raw) To: Ni, Ray, Dong, Eric, edk2-devel@lists.01.org On 01/07/19 09:24, Ni, Ray wrote: > 1. > How about defining a union for MpService. > typedef union { > EFI_MP_SERVICES_PROTOCOL *Protocol; > EFI_PEI_MP_SERVICES_PPI *Ppi; > } MP_SERVICES; > So a new field as below can be added here: > > MP_SERVICES MpService; > > GetMpService() can be also changed to return MP_SERVICES; > > 2. Please update the copyright year to 2019. - I wasn't CC'd on the cover letter, and the patches themselves don't include any version numbers, so it's hard to tell what version this is. - Upon examining my list folder, in addition to my inbox, the cover letter seems to be "[edk2] [Patch v2 0/2] Avoid AP calls PeiServices table." -- at <https://lists.01.org/pipermail/edk2-devel/2019-January/034675.html>. That's incorrect; this is version 3 actually. V1 was at <https://lists.01.org/pipermail/edk2-devel/2018-December/034262.html>, and the actual v2 was at <https://lists.01.org/pipermail/edk2-devel/2018-December/034440.html>. - As I stated under v2, at <https://lists.01.org/pipermail/edk2-devel/2018-December/034493.html>, I'll defer to Ray on v3. Thanks, Laszlo ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Patch 2/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService. 2019-01-07 19:17 ` Laszlo Ersek @ 2019-01-08 5:32 ` Dong, Eric 0 siblings, 0 replies; 6+ messages in thread From: Dong, Eric @ 2019-01-08 5:32 UTC (permalink / raw) To: Laszlo Ersek, Ni, Ray, edk2-devel@lists.01.org Hi Laszlo, Thanks for your detail check, sorry for this mistake. I will send V4 changes and only Cc Ray. I based on do the minimal change rule to create v2 change, so some code may seems ugly. I based on do the clean code rule to create V3 change, so the change may seems big. Thanks, Eric > -----Original Message----- > From: Laszlo Ersek [mailto:lersek@redhat.com] > Sent: Tuesday, January 8, 2019 3:18 AM > To: Ni, Ray <ray.ni@intel.com>; Dong, Eric <eric.dong@intel.com>; edk2- > devel@lists.01.org > Subject: Re: [Patch 2/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls > PeiService. > > On 01/07/19 09:24, Ni, Ray wrote: > > 1. > > How about defining a union for MpService. > > typedef union { > > EFI_MP_SERVICES_PROTOCOL *Protocol; > > EFI_PEI_MP_SERVICES_PPI *Ppi; > > } MP_SERVICES; > > So a new field as below can be added here: > > > > MP_SERVICES MpService; > > > > GetMpService() can be also changed to return MP_SERVICES; > > > > 2. Please update the copyright year to 2019. > > - I wasn't CC'd on the cover letter, and the patches themselves don't include > any version numbers, so it's hard to tell what version this is. > > - Upon examining my list folder, in addition to my inbox, the cover letter > seems to be "[edk2] [Patch v2 0/2] Avoid AP calls PeiServices table." -- at > <https://lists.01.org/pipermail/edk2-devel/2019-January/034675.html>. > > That's incorrect; this is version 3 actually. V1 was at > <https://lists.01.org/pipermail/edk2-devel/2018-December/034262.html>, > and the actual v2 was at > <https://lists.01.org/pipermail/edk2-devel/2018-December/034440.html>. > > - As I stated under v2, at > <https://lists.01.org/pipermail/edk2-devel/2018-December/034493.html>, > I'll defer to Ray on v3. > > Thanks, > Laszlo ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-01-08 5:32 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-01-07 1:05 [Patch v2 0/2] Avoid AP calls PeiServices table Eric Dong 2019-01-07 1:05 ` [Patch v2 1/2] UefiCpuPkg/RegisterCpuFeaturesLib: Enhance debug message Eric Dong 2019-01-07 7:53 ` Ni, Ruiyu 2019-01-07 1:05 ` [Patch 2/2] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService Eric Dong [not found] ` <734D49CCEBEEF84792F5B80ED585239D5BFA53EB@SHSMSX103.ccr.corp.intel.com> 2019-01-07 19:17 ` Laszlo Ersek 2019-01-08 5:32 ` Dong, Eric
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox