Skip to content

Commit f0a029f

Browse files
committed
EDAC/Intel: Do not load EDAC driver when running as a guest
There's little to no point in loading an EDAC driver running in a guest: 1) The CPU model reported by CPUID may not represent actual h/w 2) The hypervisor likely does not pass in access to memory controller devices 3) Hypervisors generally do not pass corrected error details to guests Add a check in each of the Intel EDAC drivers for X86_FEATURE_HYPERVISOR and simply return -ENODEV in the init routine. Acked-by: Borislav Petkov <[email protected]> Signed-off-by: Tony Luck <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ad774bd commit f0a029f

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

drivers/edac/i10nm_base.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,9 @@ static int __init i10nm_init(void)
414414
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
415415
return -EBUSY;
416416

417+
if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
418+
return -ENODEV;
419+
417420
id = x86_match_cpu(i10nm_cpuids);
418421
if (!id)
419422
return -ENODEV;

drivers/edac/pnd2_edac.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,9 @@ static int __init pnd2_init(void)
15541554
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
15551555
return -EBUSY;
15561556

1557+
if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
1558+
return -ENODEV;
1559+
15571560
id = x86_match_cpu(pnd2_cpuids);
15581561
if (!id)
15591562
return -ENODEV;

drivers/edac/sb_edac.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3510,6 +3510,9 @@ static int __init sbridge_init(void)
35103510
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
35113511
return -EBUSY;
35123512

3513+
if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
3514+
return -ENODEV;
3515+
35133516
id = x86_match_cpu(sbridge_cpuids);
35143517
if (!id)
35153518
return -ENODEV;

drivers/edac/skx_base.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,9 @@ static int __init skx_init(void)
656656
if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))
657657
return -EBUSY;
658658

659+
if (cpu_feature_enabled(X86_FEATURE_HYPERVISOR))
660+
return -ENODEV;
661+
659662
id = x86_match_cpu(skx_cpuids);
660663
if (!id)
661664
return -ENODEV;

0 commit comments

Comments
 (0)