Commit 1499934d authored by Dan Williams's avatar Dan Williams

acpi, nfit: support "map failed" dimms

Stop requiring dimms be successfully mapped into a
system-physical-address range. For provisioning and hardware remediation
purposes the kernel should account for failed devices in sysfs. If
possible it should still allow management commands to be sent to the
device.
Reported-by: default avatarToshi Kani <toshi.kani@hpe.com>
Tested-by: default avatarToshi Kani <toshi.kani@hpe.com>
Reported-by: default avatarLinda Knippers <linda.knippers@hpe.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent ac40b675
...@@ -738,28 +738,38 @@ static void nfit_mem_init_bdw(struct acpi_nfit_desc *acpi_desc, ...@@ -738,28 +738,38 @@ static void nfit_mem_init_bdw(struct acpi_nfit_desc *acpi_desc,
} }
} }
static int nfit_mem_dcr_init(struct acpi_nfit_desc *acpi_desc, static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc,
struct acpi_nfit_system_address *spa) struct acpi_nfit_system_address *spa)
{ {
struct nfit_mem *nfit_mem, *found; struct nfit_mem *nfit_mem, *found;
struct nfit_memdev *nfit_memdev; struct nfit_memdev *nfit_memdev;
int type = nfit_spa_type(spa); int type = spa ? nfit_spa_type(spa) : 0;
switch (type) { switch (type) {
case NFIT_SPA_DCR: case NFIT_SPA_DCR:
case NFIT_SPA_PM: case NFIT_SPA_PM:
break; break;
default: default:
if (spa)
return 0; return 0;
} }
/*
* This loop runs in two modes, when a dimm is mapped the loop
* adds memdev associations to an existing dimm, or creates a
* dimm. In the unmapped dimm case this loop sweeps for memdev
* instances with an invalid / zero range_index and adds those
* dimms without spa associations.
*/
list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) { list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) {
struct nfit_flush *nfit_flush; struct nfit_flush *nfit_flush;
struct nfit_dcr *nfit_dcr; struct nfit_dcr *nfit_dcr;
u32 device_handle; u32 device_handle;
u16 dcr; u16 dcr;
if (nfit_memdev->memdev->range_index != spa->range_index) if (spa && nfit_memdev->memdev->range_index != spa->range_index)
continue;
if (!spa && nfit_memdev->memdev->range_index)
continue; continue;
found = NULL; found = NULL;
dcr = nfit_memdev->memdev->region_index; dcr = nfit_memdev->memdev->region_index;
...@@ -844,14 +854,15 @@ static int nfit_mem_dcr_init(struct acpi_nfit_desc *acpi_desc, ...@@ -844,14 +854,15 @@ static int nfit_mem_dcr_init(struct acpi_nfit_desc *acpi_desc,
break; break;
} }
nfit_mem_init_bdw(acpi_desc, nfit_mem, spa); nfit_mem_init_bdw(acpi_desc, nfit_mem, spa);
} else { } else if (type == NFIT_SPA_PM) {
/* /*
* A single dimm may belong to multiple SPA-PM * A single dimm may belong to multiple SPA-PM
* ranges, record at least one in addition to * ranges, record at least one in addition to
* any SPA-DCR range. * any SPA-DCR range.
*/ */
nfit_mem->memdev_pmem = nfit_memdev->memdev; nfit_mem->memdev_pmem = nfit_memdev->memdev;
} } else
nfit_mem->memdev_dcr = nfit_memdev->memdev;
} }
return 0; return 0;
...@@ -875,6 +886,8 @@ static int nfit_mem_cmp(void *priv, struct list_head *_a, struct list_head *_b) ...@@ -875,6 +886,8 @@ static int nfit_mem_cmp(void *priv, struct list_head *_a, struct list_head *_b)
static int nfit_mem_init(struct acpi_nfit_desc *acpi_desc) static int nfit_mem_init(struct acpi_nfit_desc *acpi_desc)
{ {
struct nfit_spa *nfit_spa; struct nfit_spa *nfit_spa;
int rc;
/* /*
* For each SPA-DCR or SPA-PMEM address range find its * For each SPA-DCR or SPA-PMEM address range find its
...@@ -885,13 +898,20 @@ static int nfit_mem_init(struct acpi_nfit_desc *acpi_desc) ...@@ -885,13 +898,20 @@ static int nfit_mem_init(struct acpi_nfit_desc *acpi_desc)
* BDWs are optional. * BDWs are optional.
*/ */
list_for_each_entry(nfit_spa, &acpi_desc->spas, list) { list_for_each_entry(nfit_spa, &acpi_desc->spas, list) {
int rc; rc = __nfit_mem_init(acpi_desc, nfit_spa->spa);
rc = nfit_mem_dcr_init(acpi_desc, nfit_spa->spa);
if (rc) if (rc)
return rc; return rc;
} }
/*
* If a DIMM has failed to be mapped into SPA there will be no
* SPA entries above. Find and register all the unmapped DIMMs
* for reporting and recovery purposes.
*/
rc = __nfit_mem_init(acpi_desc, NULL);
if (rc)
return rc;
list_sort(NULL, &acpi_desc->dimms, nfit_mem_cmp); list_sort(NULL, &acpi_desc->dimms, nfit_mem_cmp);
return 0; return 0;
...@@ -1301,8 +1321,16 @@ static umode_t acpi_nfit_dimm_attr_visible(struct kobject *kobj, ...@@ -1301,8 +1321,16 @@ static umode_t acpi_nfit_dimm_attr_visible(struct kobject *kobj,
struct device *dev = container_of(kobj, struct device, kobj); struct device *dev = container_of(kobj, struct device, kobj);
struct nvdimm *nvdimm = to_nvdimm(dev); struct nvdimm *nvdimm = to_nvdimm(dev);
if (!to_nfit_dcr(dev)) if (!to_nfit_dcr(dev)) {
/* Without a dcr only the memdev attributes can be surfaced */
if (a == &dev_attr_handle.attr || a == &dev_attr_phys_id.attr
|| a == &dev_attr_flags.attr
|| a == &dev_attr_family.attr
|| a == &dev_attr_dsm_mask.attr)
return a->mode;
return 0; return 0;
}
if (a == &dev_attr_format1.attr && num_nvdimm_formats(nvdimm) <= 1) if (a == &dev_attr_format1.attr && num_nvdimm_formats(nvdimm) <= 1)
return 0; return 0;
return a->mode; return a->mode;
...@@ -1522,12 +1550,13 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc) ...@@ -1522,12 +1550,13 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc)
if ((mem_flags & ACPI_NFIT_MEM_FAILED_MASK) == 0) if ((mem_flags & ACPI_NFIT_MEM_FAILED_MASK) == 0)
continue; continue;
dev_info(acpi_desc->dev, "%s flags:%s%s%s%s\n", dev_info(acpi_desc->dev, "%s flags:%s%s%s%s%s\n",
nvdimm_name(nvdimm), nvdimm_name(nvdimm),
mem_flags & ACPI_NFIT_MEM_SAVE_FAILED ? " save_fail" : "", mem_flags & ACPI_NFIT_MEM_SAVE_FAILED ? " save_fail" : "",
mem_flags & ACPI_NFIT_MEM_RESTORE_FAILED ? " restore_fail":"", mem_flags & ACPI_NFIT_MEM_RESTORE_FAILED ? " restore_fail":"",
mem_flags & ACPI_NFIT_MEM_FLUSH_FAILED ? " flush_fail" : "", mem_flags & ACPI_NFIT_MEM_FLUSH_FAILED ? " flush_fail" : "",
mem_flags & ACPI_NFIT_MEM_NOT_ARMED ? " not_armed" : ""); mem_flags & ACPI_NFIT_MEM_NOT_ARMED ? " not_armed" : "",
mem_flags & ACPI_NFIT_MEM_MAP_FAILED ? " map_fail" : "");
} }
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#define ACPI_NFIT_MEM_FAILED_MASK (ACPI_NFIT_MEM_SAVE_FAILED \ #define ACPI_NFIT_MEM_FAILED_MASK (ACPI_NFIT_MEM_SAVE_FAILED \
| ACPI_NFIT_MEM_RESTORE_FAILED | ACPI_NFIT_MEM_FLUSH_FAILED \ | ACPI_NFIT_MEM_RESTORE_FAILED | ACPI_NFIT_MEM_FLUSH_FAILED \
| ACPI_NFIT_MEM_NOT_ARMED) | ACPI_NFIT_MEM_NOT_ARMED | ACPI_NFIT_MEM_MAP_FAILED)
enum nfit_uuids { enum nfit_uuids {
/* for simplicity alias the uuid index with the family id */ /* for simplicity alias the uuid index with the family id */
......
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