Skip to content

Commit

Permalink
EDAC/mce_amd: Do not load edac_mce_amd module on guests
Browse files Browse the repository at this point in the history
Hypervisors likely do not expose the SMCA feature to the guest and
loading this module leads to false warnings. This module should not be
loaded in guests to begin with, but people tend to do so, especially
when testing kernels in VMs. And then they complain about those false
warnings.

Do the practical thing and do not load this module when running as a
guest to avoid all that complaining.

 [ bp: Rewrite commit message. ]

Suggested-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
Tested-by: Kim Phillips <kim.phillips@amd.com>
Link: https://lkml.kernel.org/r/20210628172740.245689-1-Smita.KoralahalliChannabasappa@amd.com
  • Loading branch information
Smita Koralahalli authored and Borislav Petkov committed Aug 9, 2021
1 parent e1ca90b commit 767f4b6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/edac/mce_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,9 @@ static int __init mce_amd_init(void)
c->x86_vendor != X86_VENDOR_HYGON)
return -ENODEV;

if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
return -ENODEV;

if (boot_cpu_has(X86_FEATURE_SMCA)) {
xec_mask = 0x3f;
goto out;
Expand Down

0 comments on commit 767f4b6

Please sign in to comment.