Skip to content

Commit 402bae5

Browse files
Toshi Kanidjbw
authored andcommitted
nfit: Clarify memory device state flags strings
ACPI 6.0 NFIT Memory Device State Flags in Table 5-129 defines NVDIMM status as follows. These bits indicate multiple info, such as failures, pending event, and capability. Bit [0] set to 1 to indicate that the previous SAVE to the Memory Device failed. Bit [1] set to 1 to indicate that the last RESTORE from the Memory Device failed. Bit [2] set to 1 to indicate that platform flush of data to Memory Device failed. As a result, the restored data content may be inconsistent even if SAVE and RESTORE do not indicate failure. Bit [3] set to 1 to indicate that the Memory Device is observed to be not armed prior to OSPM hand off. A Memory Device is considered armed if it is able to accept persistent writes. Bit [4] set to 1 to indicate that the Memory Device observed SMART and health events prior to OSPM handoff. /sys/bus/nd/devices/nmemX/nfit/flags shows this flags info. The output strings associated with the bits are "save", "restore", "smart", etc., which can be confusing as they may be interpreted as positive status, i.e. save succeeded. Change also the dev_info() message in acpi_nfit_register_dimms() to be consistent with the sysfs flags strings. Reported-by: Robert Elliott <[email protected]> Signed-off-by: Toshi Kani <[email protected]> [ross: rename 'not_arm' to 'not_armed'] Cc: Ross Zwisler <[email protected]> [djbw: defer adding bit5, HEALTH_ENABLED, for now] Signed-off-by: Dan Williams <[email protected]>
1 parent de4a196 commit 402bae5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/acpi/nfit.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -702,11 +702,11 @@ static ssize_t flags_show(struct device *dev,
702702
u16 flags = to_nfit_memdev(dev)->flags;
703703

704704
return sprintf(buf, "%s%s%s%s%s\n",
705-
flags & ACPI_NFIT_MEM_SAVE_FAILED ? "save " : "",
706-
flags & ACPI_NFIT_MEM_RESTORE_FAILED ? "restore " : "",
707-
flags & ACPI_NFIT_MEM_FLUSH_FAILED ? "flush " : "",
708-
flags & ACPI_NFIT_MEM_ARMED ? "arm " : "",
709-
flags & ACPI_NFIT_MEM_HEALTH_OBSERVED ? "smart " : "");
705+
flags & ACPI_NFIT_MEM_SAVE_FAILED ? "save_fail " : "",
706+
flags & ACPI_NFIT_MEM_RESTORE_FAILED ? "restore_fail " : "",
707+
flags & ACPI_NFIT_MEM_FLUSH_FAILED ? "flush_fail " : "",
708+
flags & ACPI_NFIT_MEM_ARMED ? "not_armed " : "",
709+
flags & ACPI_NFIT_MEM_HEALTH_OBSERVED ? "smart_event " : "");
710710
}
711711
static DEVICE_ATTR_RO(flags);
712712

@@ -849,12 +849,12 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc)
849849
if ((mem_flags & ACPI_NFIT_MEM_FAILED_MASK) == 0)
850850
continue;
851851

852-
dev_info(acpi_desc->dev, "%s: failed: %s%s%s%s\n",
852+
dev_info(acpi_desc->dev, "%s flags:%s%s%s%s\n",
853853
nvdimm_name(nvdimm),
854-
mem_flags & ACPI_NFIT_MEM_SAVE_FAILED ? "save " : "",
855-
mem_flags & ACPI_NFIT_MEM_RESTORE_FAILED ? "restore " : "",
856-
mem_flags & ACPI_NFIT_MEM_FLUSH_FAILED ? "flush " : "",
857-
mem_flags & ACPI_NFIT_MEM_ARMED ? "arm " : "");
854+
mem_flags & ACPI_NFIT_MEM_SAVE_FAILED ? " save_fail" : "",
855+
mem_flags & ACPI_NFIT_MEM_RESTORE_FAILED ? " restore_fail":"",
856+
mem_flags & ACPI_NFIT_MEM_FLUSH_FAILED ? " flush_fail" : "",
857+
mem_flags & ACPI_NFIT_MEM_ARMED ? " not_armed" : "");
858858

859859
}
860860

0 commit comments

Comments
 (0)