diff mbox series

[XEN,v1,5/7] x86/MCE: guard {intel/amd}_mcheck_init() calls

Message ID 0c7d28740db4d6581ebc81a158c970258e547959.1713860310.git.Sergiy_Kibrik@epam.com (mailing list archive)
State Superseded
Headers show
Series x86: make Intel/AMD vPMU & MCE support configurable | expand

Commit Message

Sergiy Kibrik April 23, 2024, 8:56 a.m. UTC
Guard calls to CPU-specific mcheck init routines in common MCE code
using new INTEL/AMD config options.

The purpose is not to build platform-specific mcheck code and calls to it,
if this platform is disabled in config.

Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
---
 xen/arch/x86/cpu/mcheck/mce.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Stefano Stabellini April 26, 2024, 11:12 p.m. UTC | #1
On Tue, 23 Apr 2024, Sergiy Kibrik wrote:
> Guard calls to CPU-specific mcheck init routines in common MCE code
> using new INTEL/AMD config options.
> 
> The purpose is not to build platform-specific mcheck code and calls to it,
> if this platform is disabled in config.
> 
> Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Jan Beulich April 29, 2024, 3:45 p.m. UTC | #2
On 23.04.2024 10:56, Sergiy Kibrik wrote:
> --- a/xen/arch/x86/cpu/mcheck/mce.c
> +++ b/xen/arch/x86/cpu/mcheck/mce.c
> @@ -761,7 +761,8 @@ void mcheck_init(struct cpuinfo_x86 *c, bool bsp)
>      {
>      case X86_VENDOR_AMD:
>      case X86_VENDOR_HYGON:
> -        inited = amd_mcheck_init(c, bsp);
> +        inited = IS_ENABLED(CONFIG_AMD) ? amd_mcheck_init(c, bsp) :
> +                                          mcheck_unset;
>          break;
>  
>      case X86_VENDOR_INTEL:
> @@ -769,7 +770,8 @@ void mcheck_init(struct cpuinfo_x86 *c, bool bsp)
>          {
>          case 6:
>          case 15:
> -            inited = intel_mcheck_init(c, bsp);
> +            inited = IS_ENABLED(CONFIG_INTEL) ? intel_mcheck_init(c, bsp) :
> +                                                mcheck_unset;
>              break;
>          }
>          break;

Same question as on an earlier patch: Why set a value different from
what "default:" below here does (really: keeps)? And why not arrange to
have that "default:" take care of what's build-disabled?

Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index 72dfaf28cb..42e84e76b7 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -761,7 +761,8 @@  void mcheck_init(struct cpuinfo_x86 *c, bool bsp)
     {
     case X86_VENDOR_AMD:
     case X86_VENDOR_HYGON:
-        inited = amd_mcheck_init(c, bsp);
+        inited = IS_ENABLED(CONFIG_AMD) ? amd_mcheck_init(c, bsp) :
+                                          mcheck_unset;
         break;
 
     case X86_VENDOR_INTEL:
@@ -769,7 +770,8 @@  void mcheck_init(struct cpuinfo_x86 *c, bool bsp)
         {
         case 6:
         case 15:
-            inited = intel_mcheck_init(c, bsp);
+            inited = IS_ENABLED(CONFIG_INTEL) ? intel_mcheck_init(c, bsp) :
+                                                mcheck_unset;
             break;
         }
         break;