diff options
author | Dan Williams <dan.j.williams@intel.com> | 2017-05-04 17:01:24 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2017-05-04 17:01:24 -0400 |
commit | 8f078b38dd382710884ce7abd31a1935c440e6f8 (patch) | |
tree | bec3467c1f513663801d7fb62a9c56bea2fe52b6 /drivers | |
parent | 565851c972b50612f3a4542e26879ffb3e906fc2 (diff) |
libnvdimm: convert NDD_ flags to use bitops, introduce NDD_LOCKED
This is a preparation patch for handling locked nvdimm label regions, a
new concept as introduced by the latest DSM document on pmem.io [1]. A
future patch will leverage nvdimm_set_locked() at DIMM probe time to
flag regions that can not be enabled. There should be no functional
difference resulting from this change.
[1]: http://pmem.io/documents/NVDIMM_DSM_Interface_Example-V1.3.pdf
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/nfit/core.c | 4 | ||||
-rw-r--r-- | drivers/nvdimm/dimm_devs.c | 11 | ||||
-rw-r--r-- | drivers/nvdimm/namespace_devs.c | 2 | ||||
-rw-r--r-- | drivers/nvdimm/nd.h | 1 | ||||
-rw-r--r-- | drivers/nvdimm/region_devs.c | 4 |
5 files changed, 15 insertions, 7 deletions
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index ced95a79c1a1..a26c2297c1ed 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c | |||
@@ -1512,7 +1512,7 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc) | |||
1512 | } | 1512 | } |
1513 | 1513 | ||
1514 | if (nfit_mem->bdw && nfit_mem->memdev_pmem) | 1514 | if (nfit_mem->bdw && nfit_mem->memdev_pmem) |
1515 | flags |= NDD_ALIASING; | 1515 | set_bit(NDD_ALIASING, &flags); |
1516 | 1516 | ||
1517 | /* collate flags across all memdevs for this dimm */ | 1517 | /* collate flags across all memdevs for this dimm */ |
1518 | list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) { | 1518 | list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) { |
@@ -1527,7 +1527,7 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc) | |||
1527 | 1527 | ||
1528 | mem_flags = __to_nfit_memdev(nfit_mem)->flags; | 1528 | mem_flags = __to_nfit_memdev(nfit_mem)->flags; |
1529 | if (mem_flags & ACPI_NFIT_MEM_NOT_ARMED) | 1529 | if (mem_flags & ACPI_NFIT_MEM_NOT_ARMED) |
1530 | flags |= NDD_UNARMED; | 1530 | set_bit(NDD_UNARMED, &flags); |
1531 | 1531 | ||
1532 | rc = acpi_nfit_add_dimm(acpi_desc, nfit_mem, device_handle); | 1532 | rc = acpi_nfit_add_dimm(acpi_desc, nfit_mem, device_handle); |
1533 | if (rc) | 1533 | if (rc) |
diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c index 8b721321be5b..7d1a3dbc7d5d 100644 --- a/drivers/nvdimm/dimm_devs.c +++ b/drivers/nvdimm/dimm_devs.c | |||
@@ -34,7 +34,7 @@ int nvdimm_check_config_data(struct device *dev) | |||
34 | 34 | ||
35 | if (!nvdimm->cmd_mask || | 35 | if (!nvdimm->cmd_mask || |
36 | !test_bit(ND_CMD_GET_CONFIG_DATA, &nvdimm->cmd_mask)) { | 36 | !test_bit(ND_CMD_GET_CONFIG_DATA, &nvdimm->cmd_mask)) { |
37 | if (nvdimm->flags & NDD_ALIASING) | 37 | if (test_bit(NDD_ALIASING, &nvdimm->flags)) |
38 | return -ENXIO; | 38 | return -ENXIO; |
39 | else | 39 | else |
40 | return -ENOTTY; | 40 | return -ENOTTY; |
@@ -188,7 +188,14 @@ void nvdimm_set_aliasing(struct device *dev) | |||
188 | { | 188 | { |
189 | struct nvdimm *nvdimm = to_nvdimm(dev); | 189 | struct nvdimm *nvdimm = to_nvdimm(dev); |
190 | 190 | ||
191 | nvdimm->flags |= NDD_ALIASING; | 191 | set_bit(NDD_ALIASING, &nvdimm->flags); |
192 | } | ||
193 | |||
194 | void nvdimm_set_locked(struct device *dev) | ||
195 | { | ||
196 | struct nvdimm *nvdimm = to_nvdimm(dev); | ||
197 | |||
198 | set_bit(NDD_LOCKED, &nvdimm->flags); | ||
192 | } | 199 | } |
193 | 200 | ||
194 | static void nvdimm_release(struct device *dev) | 201 | static void nvdimm_release(struct device *dev) |
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c index 1b481a5fb966..2f2d8afc684a 100644 --- a/drivers/nvdimm/namespace_devs.c +++ b/drivers/nvdimm/namespace_devs.c | |||
@@ -2240,7 +2240,7 @@ static int init_active_labels(struct nd_region *nd_region) | |||
2240 | * being activated if it aliases DPA. | 2240 | * being activated if it aliases DPA. |
2241 | */ | 2241 | */ |
2242 | if (!ndd) { | 2242 | if (!ndd) { |
2243 | if ((nvdimm->flags & NDD_ALIASING) == 0) | 2243 | if (!test_bit(NDD_ALIASING, &nvdimm->flags)) |
2244 | return 0; | 2244 | return 0; |
2245 | dev_dbg(&nd_region->dev, "%s: is disabled, failing probe\n", | 2245 | dev_dbg(&nd_region->dev, "%s: is disabled, failing probe\n", |
2246 | dev_name(&nd_mapping->nvdimm->dev)); | 2246 | dev_name(&nd_mapping->nvdimm->dev)); |
diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h index c3b33cf655fb..77d032192bf7 100644 --- a/drivers/nvdimm/nd.h +++ b/drivers/nvdimm/nd.h | |||
@@ -240,6 +240,7 @@ int nvdimm_set_config_data(struct nvdimm_drvdata *ndd, size_t offset, | |||
240 | long nvdimm_clear_poison(struct device *dev, phys_addr_t phys, | 240 | long nvdimm_clear_poison(struct device *dev, phys_addr_t phys, |
241 | unsigned int len); | 241 | unsigned int len); |
242 | void nvdimm_set_aliasing(struct device *dev); | 242 | void nvdimm_set_aliasing(struct device *dev); |
243 | void nvdimm_set_locked(struct device *dev); | ||
243 | struct nd_btt *to_nd_btt(struct device *dev); | 244 | struct nd_btt *to_nd_btt(struct device *dev); |
244 | 245 | ||
245 | struct nd_gen_sb { | 246 | struct nd_gen_sb { |
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index 07756b2e1cd5..b550edf2571f 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c | |||
@@ -222,7 +222,7 @@ int nd_region_to_nstype(struct nd_region *nd_region) | |||
222 | struct nd_mapping *nd_mapping = &nd_region->mapping[i]; | 222 | struct nd_mapping *nd_mapping = &nd_region->mapping[i]; |
223 | struct nvdimm *nvdimm = nd_mapping->nvdimm; | 223 | struct nvdimm *nvdimm = nd_mapping->nvdimm; |
224 | 224 | ||
225 | if (nvdimm->flags & NDD_ALIASING) | 225 | if (test_bit(NDD_ALIASING, &nvdimm->flags)) |
226 | alias++; | 226 | alias++; |
227 | } | 227 | } |
228 | if (alias) | 228 | if (alias) |
@@ -881,7 +881,7 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus, | |||
881 | return NULL; | 881 | return NULL; |
882 | } | 882 | } |
883 | 883 | ||
884 | if (nvdimm->flags & NDD_UNARMED) | 884 | if (test_bit(NDD_UNARMED, &nvdimm->flags)) |
885 | ro = 1; | 885 | ro = 1; |
886 | } | 886 | } |
887 | 887 | ||