]> git.baikalelectronics.ru Git - kernel.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 Williams <dan.j.williams@intel.com>
Fri, 26 Jun 2015 15:23:38 +0000 (11:23 -0400)
commitc30f4938b87be25fc8ef6ff883c786e57b3e79db
tree2160b6616cf072396067ca654cd5231e139fc304
parent96afd21b9696d31ed6d2d7834dd0a5e308a83c4f
libnvdimm, nfit: handle unarmed dimms, mark namespaces read-only

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>
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