]> www.infradead.org Git - users/jedix/linux-maple.git/commit
libnvdimm, nfit: handle unarmed dimms, mark namespaces read-only
authorDan Williams <dan.j.williams@intel.com>
Wed, 24 Jun 2015 00:08:34 +0000 (20:08 -0400)
committerDan Duval <dan.duval@oracle.com>
Tue, 11 Oct 2016 18:41:38 +0000 (14:41 -0400)
commit88051cd188c2a62622321148c0d430a745d728ac
tree610bd44ec2f0f9901a0eecb2ad8aa295476ad690
parent8819775376f5fe0f0eb59d96368fd5490a7313a5
libnvdimm, nfit: handle unarmed dimms, mark namespaces read-only

Orabug: 22913653

Upon detection of an unarmed dimm in a region, arrange for descendant
BTT, PMEM, or BLK instances to be read-only.  A dimm is primarily marked
"unarmed" via flags passed by platform firmware (NFIT).

The flags in the NFIT memory device sub-structure indicate the state of
the data on the nvdimm relative to its energy source or last "flush to
persistence".  For the most part there is nothing the driver can do but
advertise the state of these flags in sysfs and emit a message if
firmware indicates that the contents of the device may be corrupted.
However, for the case of ACPI_NFIT_MEM_ARMED, the driver can arrange for
the block devices incorporating that nvdimm to be marked read-only.
This is a safe default as the data is still available and new writes are
held off until the administrator either forces read-write mode, or the
energy source becomes armed.

A 'read_only' attribute is added to REGION devices to allow for
overriding the default read-only policy of all descendant block devices.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
(cherry picked from commit 581388209405902b56d055f644b4dd124a206112)
Signed-off-by: Dan Duval <dan.duval@oracle.com>
drivers/acpi/nfit.c
drivers/acpi/nfit.h
drivers/nvdimm/blk.c
drivers/nvdimm/btt.c
drivers/nvdimm/bus.c
drivers/nvdimm/nd.h
drivers/nvdimm/pmem.c
drivers/nvdimm/region_devs.c
include/linux/libnvdimm.h
tools/testing/nvdimm/test/nfit.c