public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 1/1] UefiCpuPkg/CpuCacheInfoLib: Add MpService dependency
@ 2021-02-02  0:41 Jason Lou
  2021-02-03  7:23 ` Ni, Ray
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Lou @ 2021-02-02  0:41 UTC (permalink / raw)
  To: devel; +Cc: Jason, Ray Ni, Eric Dong, Laszlo Ersek, Rahul Kumar

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3190

Add MpService dependency to enforce the executability of CpuCacheInfoLib.

Signed-off-by: Jason Lou <yun.lou@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
---
 UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c      | 7 +------
 UefiCpuPkg/Include/Library/CpuCacheInfoLib.h              | 2 --
 UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf | 2 +-
 UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf | 2 +-
 4 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
index d1f9830c91e7..d46fb0425851 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
@@ -346,8 +346,6 @@ CpuCacheInfoCollectCpuCacheInfoData (
   @retval         EFI_INVALID_PARAMETER   CpuCacheInfo is NULL while CpuCacheInfoCount contains the value
                                           greater than zero.
   @retval         EFI_UNSUPPORTED         Processor does not support CPUID_CACHE_PARAMS Leaf.
-  @retval         EFI_NOT_FOUND           EDKII_PEI_MP_SERVICES2_PPI or EFI_MP_SERVICES_PROTOCOL interface
-                                          is not found.
   @retval         EFI_OUT_OF_RESOURCES    Required resources could not be allocated.
   @retval         EFI_BUFFER_TOO_SMALL    CpuCacheInfoCount is too small to hold the response CpuCacheInfo
                                           array. CpuCacheInfoCount has been updated with the length needed
@@ -384,10 +382,7 @@ GetCpuCacheInfo (
   //
   // Initialize COLLECT_CPUID_CACHE_DATA_CONTEXT.MpServices.
   //
-  Status = CpuCacheInfoGetMpServices (&Context.MpServices);
-  if (EFI_ERROR(Status)) {
-    return Status;
-  }
+  CpuCacheInfoGetMpServices (&Context.MpServices);
 
   NumberOfProcessors = CpuCacheInfoGetNumberOfProcessors (Context.MpServices);
 
diff --git a/UefiCpuPkg/Include/Library/CpuCacheInfoLib.h b/UefiCpuPkg/Include/Library/CpuCacheInfoLib.h
index a23b8b12b5ee..a7f29b188775 100644
--- a/UefiCpuPkg/Include/Library/CpuCacheInfoLib.h
+++ b/UefiCpuPkg/Include/Library/CpuCacheInfoLib.h
@@ -59,8 +59,6 @@ typedef struct {
   @retval         EFI_INVALID_PARAMETER   CpuCacheInfo is NULL while CpuCacheInfoCount contains the value
                                           greater than zero.
   @retval         EFI_UNSUPPORTED         Processor does not support CPUID_CACHE_PARAMS Leaf.
-  @retval         EFI_NOT_FOUND           EDKII_PEI_MP_SERVICES2_PPI or EFI_MP_SERVICES_PROTOCOL interface
-                                          is not found.
   @retval         EFI_OUT_OF_RESOURCES    Required resources could not be allocated.
   @retval         EFI_BUFFER_TOO_SMALL    CpuCacheInfoCount is too small to hold the response CpuCacheInfo
                                           array. CpuCacheInfoCount has been updated with the length needed
diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf b/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf
index 1fd45380b871..c481080e49d8 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf
@@ -40,4 +40,4 @@ [Protocols]
 [Pcd]
 
 [Depex]
-  TRUE
+  gEfiMpServiceProtocolGuid
diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf b/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf
index c8aa33c95a8f..0c73015cac8b 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf
@@ -40,4 +40,4 @@ [Ppis]
 [Pcd]
 
 [Depex]
-  TRUE
+  gEdkiiPeiMpServices2PpiGuid
-- 
2.28.0.windows.1


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

* Re: [PATCH v2 1/1] UefiCpuPkg/CpuCacheInfoLib: Add MpService dependency
  2021-02-02  0:41 [PATCH v2 1/1] UefiCpuPkg/CpuCacheInfoLib: Add MpService dependency Jason Lou
@ 2021-02-03  7:23 ` Ni, Ray
  0 siblings, 0 replies; 2+ messages in thread
From: Ni, Ray @ 2021-02-03  7:23 UTC (permalink / raw)
  To: Lou, Yun, devel@edk2.groups.io; +Cc: Dong, Eric, Laszlo Ersek, Kumar, Rahul1

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Lou, Yun <yun.lou@intel.com>
> Sent: Tuesday, February 2, 2021 8:41 AM
> To: devel@edk2.groups.io
> Cc: Lou, Yun <yun.lou@intel.com>; Ni, Ray <ray.ni@intel.com>; Dong, Eric
> <eric.dong@intel.com>; Laszlo Ersek <lersek@redhat.com>; Kumar, Rahul1
> <rahul1.kumar@intel.com>
> Subject: [PATCH v2 1/1] UefiCpuPkg/CpuCacheInfoLib: Add MpService
> dependency
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3190
> 
> Add MpService dependency to enforce the executability of CpuCacheInfoLib.
> 
> Signed-off-by: Jason Lou <yun.lou@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> ---
>  UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c      | 7 +------
>  UefiCpuPkg/Include/Library/CpuCacheInfoLib.h              | 2 --
>  UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf | 2 +-
>  UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf | 2 +-
>  4 files changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
> b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
> index d1f9830c91e7..d46fb0425851 100644
> --- a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
> +++ b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
> @@ -346,8 +346,6 @@ CpuCacheInfoCollectCpuCacheInfoData (
>    @retval         EFI_INVALID_PARAMETER   CpuCacheInfo is NULL while
> CpuCacheInfoCount contains the value
> 
>                                            greater than zero.
> 
>    @retval         EFI_UNSUPPORTED         Processor does not support
> CPUID_CACHE_PARAMS Leaf.
> 
> -  @retval         EFI_NOT_FOUND           EDKII_PEI_MP_SERVICES2_PPI or
> EFI_MP_SERVICES_PROTOCOL interface
> 
> -                                          is not found.
> 
>    @retval         EFI_OUT_OF_RESOURCES    Required resources could not be
> allocated.
> 
>    @retval         EFI_BUFFER_TOO_SMALL    CpuCacheInfoCount is too small to
> hold the response CpuCacheInfo
> 
>                                            array. CpuCacheInfoCount has been updated with the
> length needed
> 
> @@ -384,10 +382,7 @@ GetCpuCacheInfo (
>    //
> 
>    // Initialize COLLECT_CPUID_CACHE_DATA_CONTEXT.MpServices.
> 
>    //
> 
> -  Status = CpuCacheInfoGetMpServices (&Context.MpServices);
> 
> -  if (EFI_ERROR(Status)) {
> 
> -    return Status;
> 
> -  }
> 
> +  CpuCacheInfoGetMpServices (&Context.MpServices);
> 
> 
> 
>    NumberOfProcessors = CpuCacheInfoGetNumberOfProcessors
> (Context.MpServices);
> 
> 
> 
> diff --git a/UefiCpuPkg/Include/Library/CpuCacheInfoLib.h
> b/UefiCpuPkg/Include/Library/CpuCacheInfoLib.h
> index a23b8b12b5ee..a7f29b188775 100644
> --- a/UefiCpuPkg/Include/Library/CpuCacheInfoLib.h
> +++ b/UefiCpuPkg/Include/Library/CpuCacheInfoLib.h
> @@ -59,8 +59,6 @@ typedef struct {
>    @retval         EFI_INVALID_PARAMETER   CpuCacheInfo is NULL while
> CpuCacheInfoCount contains the value
> 
>                                            greater than zero.
> 
>    @retval         EFI_UNSUPPORTED         Processor does not support
> CPUID_CACHE_PARAMS Leaf.
> 
> -  @retval         EFI_NOT_FOUND           EDKII_PEI_MP_SERVICES2_PPI or
> EFI_MP_SERVICES_PROTOCOL interface
> 
> -                                          is not found.
> 
>    @retval         EFI_OUT_OF_RESOURCES    Required resources could not be
> allocated.
> 
>    @retval         EFI_BUFFER_TOO_SMALL    CpuCacheInfoCount is too small to
> hold the response CpuCacheInfo
> 
>                                            array. CpuCacheInfoCount has been updated with the
> length needed
> 
> diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf
> b/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf
> index 1fd45380b871..c481080e49d8 100644
> --- a/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf
> +++ b/UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf
> @@ -40,4 +40,4 @@ [Protocols]
>  [Pcd]
> 
> 
> 
>  [Depex]
> 
> -  TRUE
> 
> +  gEfiMpServiceProtocolGuid
> 
> diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf
> b/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf
> index c8aa33c95a8f..0c73015cac8b 100644
> --- a/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf
> +++ b/UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf
> @@ -40,4 +40,4 @@ [Ppis]
>  [Pcd]
> 
> 
> 
>  [Depex]
> 
> -  TRUE
> 
> +  gEdkiiPeiMpServices2PpiGuid
> 
> --
> 2.28.0.windows.1


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

end of thread, other threads:[~2021-02-03  7:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-02  0:41 [PATCH v2 1/1] UefiCpuPkg/CpuCacheInfoLib: Add MpService dependency Jason Lou
2021-02-03  7:23 ` Ni, Ray

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