Commit 1865bc71 authored by Borislav Petkov's avatar Borislav Petkov

EDAC/amd64: Limit error injection functionality to supported hw

Families up to and including 0x16 allow access to the injection
hardware. Starting with family 0x17, access to those registers is
blocked by security policy.

Limit that only on the families which support it.
Suggested-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20201222180013.GD13463@zn.tnic
parent 61810096
...@@ -84,10 +84,10 @@ config EDAC_AMD64 ...@@ -84,10 +84,10 @@ config EDAC_AMD64
When EDAC_DEBUG is enabled, hardware error injection facilities When EDAC_DEBUG is enabled, hardware error injection facilities
through sysfs are available: through sysfs are available:
Recent Opterons (Family 10h and later) provide for Memory Error AMD CPUs up to and excluding family 0x17 provide for Memory
Injection into the ECC detection circuits. The amd64_edac module Error Injection into the ECC detection circuits. The amd64_edac
allows the operator/user to inject Uncorrectable and Correctable module allows the operator/user to inject Uncorrectable and
errors into DRAM. Correctable errors into DRAM.
When enabled, in each of the respective memory controller directories When enabled, in each of the respective memory controller directories
(/sys/devices/system/edac/mc/mcX), there are 3 input files: (/sys/devices/system/edac/mc/mcX), there are 3 input files:
......
...@@ -828,9 +828,11 @@ static umode_t inj_is_visible(struct kobject *kobj, struct attribute *attr, int ...@@ -828,9 +828,11 @@ static umode_t inj_is_visible(struct kobject *kobj, struct attribute *attr, int
struct mem_ctl_info *mci = container_of(dev, struct mem_ctl_info, dev); struct mem_ctl_info *mci = container_of(dev, struct mem_ctl_info, dev);
struct amd64_pvt *pvt = mci->pvt_info; struct amd64_pvt *pvt = mci->pvt_info;
if (pvt->fam < 0x10) /* Families which have that injection hw */
return 0; if (pvt->fam >= 0x10 && pvt->fam <= 0x16)
return attr->mode; return attr->mode;
return 0;
} }
static const struct attribute_group inj_group = { static const struct attribute_group inj_group = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment