x86/MCE: guard access to Intel/AMD-specific MCA MSRs

Add build-time checks for newly introduced INTEL/AMD config options when
calling vmce_{intel/amd}_{rdmsr/wrmsr}() routines.
This way a platform-specific code can be omitted in vmce code, if this
platform is disabled in config.

Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Sergiy Kibrik authored and Jan Beulich committed 2024-05-16 13:35:34 +02:00
1 parent a3ec23a940
commit 71b5eccbdd
1 file changed
+8
+8
View File
@@ -138,16 +138,20 @@ static int bank_mce_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
default:
switch ( boot_cpu_data.x86_vendor )
{
#ifdef CONFIG_INTEL
case X86_VENDOR_CENTAUR:
case X86_VENDOR_SHANGHAI:
case X86_VENDOR_INTEL:
ret = vmce_intel_rdmsr(v, msr, val);
break;
#endif
#ifdef CONFIG_AMD
case X86_VENDOR_AMD:
case X86_VENDOR_HYGON:
ret = vmce_amd_rdmsr(v, msr, val);
break;
#endif
default:
ret = 0;
@@ -271,14 +275,18 @@ static int bank_mce_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
default:
switch ( boot_cpu_data.x86_vendor )
{
#ifdef CONFIG_INTEL
case X86_VENDOR_INTEL:
ret = vmce_intel_wrmsr(v, msr, val);
break;
#endif
#ifdef CONFIG_AMD
case X86_VENDOR_AMD:
case X86_VENDOR_HYGON:
ret = vmce_amd_wrmsr(v, msr, val);
break;
#endif
default:
ret = 0;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.