Skip to content

Commit a0e3745

Browse files
committed
libnvdimm/region: Introduce NDD_LABELING
The NDD_ALIASING flag is used to indicate where pmem capacity might alias with blk capacity and require labeling. It is also used to indicate whether the DIMM supports labeling. Separate this latter capability into its own flag so that the NDD_ALIASING flag is scoped to true aliased configurations. To my knowledge aliased configurations only exist in the ACPI spec, there are no known platforms that ship this support in production. This clarity allows namespace-capacity alignment constraints around interleave-ways to be relaxed. Cc: Vishal Verma <[email protected]> Cc: Oliver O'Halloran <[email protected]> Reviewed-by: Jeff Moyer <[email protected]> Reviewed-by: Aneesh Kumar K.V <[email protected]> Link: https://lore.kernel.org/r/158041477856.3889308.4212605617834097674.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams <[email protected]>
1 parent 6acd7d5 commit a0e3745

File tree

8 files changed

+19
-14
lines changed

8 files changed

+19
-14
lines changed

arch/powerpc/platforms/pseries/papr_scm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p)
328328
}
329329

330330
dimm_flags = 0;
331-
set_bit(NDD_ALIASING, &dimm_flags);
331+
set_bit(NDD_LABELING, &dimm_flags);
332332

333333
p->nvdimm = nvdimm_create(p->bus, p, NULL, dimm_flags,
334334
PAPR_SCM_DIMM_CMD_MASK, 0, NULL);

drivers/acpi/nfit/core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2026,8 +2026,10 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc)
20262026
continue;
20272027
}
20282028

2029-
if (nfit_mem->bdw && nfit_mem->memdev_pmem)
2029+
if (nfit_mem->bdw && nfit_mem->memdev_pmem) {
20302030
set_bit(NDD_ALIASING, &flags);
2031+
set_bit(NDD_LABELING, &flags);
2032+
}
20312033

20322034
/* collate flags across all memdevs for this dimm */
20332035
list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) {

drivers/nvdimm/dimm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static int nvdimm_probe(struct device *dev)
9999
if (ndd->ns_current >= 0) {
100100
rc = nd_label_reserve_dpa(ndd);
101101
if (rc == 0)
102-
nvdimm_set_aliasing(dev);
102+
nvdimm_set_labeling(dev);
103103
}
104104
nvdimm_bus_unlock(dev);
105105

drivers/nvdimm/dimm_devs.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ int nvdimm_check_config_data(struct device *dev)
3232

3333
if (!nvdimm->cmd_mask ||
3434
!test_bit(ND_CMD_GET_CONFIG_DATA, &nvdimm->cmd_mask)) {
35-
if (test_bit(NDD_ALIASING, &nvdimm->flags))
35+
if (test_bit(NDD_LABELING, &nvdimm->flags))
3636
return -ENXIO;
3737
else
3838
return -ENOTTY;
@@ -173,11 +173,11 @@ int nvdimm_set_config_data(struct nvdimm_drvdata *ndd, size_t offset,
173173
return rc;
174174
}
175175

176-
void nvdimm_set_aliasing(struct device *dev)
176+
void nvdimm_set_labeling(struct device *dev)
177177
{
178178
struct nvdimm *nvdimm = to_nvdimm(dev);
179179

180-
set_bit(NDD_ALIASING, &nvdimm->flags);
180+
set_bit(NDD_LABELING, &nvdimm->flags);
181181
}
182182

183183
void nvdimm_set_locked(struct device *dev)
@@ -312,8 +312,9 @@ static ssize_t flags_show(struct device *dev,
312312
{
313313
struct nvdimm *nvdimm = to_nvdimm(dev);
314314

315-
return sprintf(buf, "%s%s\n",
315+
return sprintf(buf, "%s%s%s\n",
316316
test_bit(NDD_ALIASING, &nvdimm->flags) ? "alias " : "",
317+
test_bit(NDD_LABELING, &nvdimm->flags) ? "label " : "",
317318
test_bit(NDD_LOCKED, &nvdimm->flags) ? "lock " : "");
318319
}
319320
static DEVICE_ATTR_RO(flags);

drivers/nvdimm/namespace_devs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2538,7 +2538,7 @@ static int init_active_labels(struct nd_region *nd_region)
25382538
if (!ndd) {
25392539
if (test_bit(NDD_LOCKED, &nvdimm->flags))
25402540
/* fail, label data may be unreadable */;
2541-
else if (test_bit(NDD_ALIASING, &nvdimm->flags))
2541+
else if (test_bit(NDD_LABELING, &nvdimm->flags))
25422542
/* fail, labels needed to disambiguate dpa */;
25432543
else
25442544
return 0;

drivers/nvdimm/nd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ int nvdimm_set_config_data(struct nvdimm_drvdata *ndd, size_t offset,
252252
void *buf, size_t len);
253253
long nvdimm_clear_poison(struct device *dev, phys_addr_t phys,
254254
unsigned int len);
255-
void nvdimm_set_aliasing(struct device *dev);
255+
void nvdimm_set_labeling(struct device *dev);
256256
void nvdimm_set_locked(struct device *dev);
257257
void nvdimm_clear_locked(struct device *dev);
258258
int nvdimm_security_setup_events(struct device *dev);

drivers/nvdimm/region_devs.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,16 +195,16 @@ EXPORT_SYMBOL_GPL(nd_blk_region_set_provider_data);
195195
int nd_region_to_nstype(struct nd_region *nd_region)
196196
{
197197
if (is_memory(&nd_region->dev)) {
198-
u16 i, alias;
198+
u16 i, label;
199199

200-
for (i = 0, alias = 0; i < nd_region->ndr_mappings; i++) {
200+
for (i = 0, label = 0; i < nd_region->ndr_mappings; i++) {
201201
struct nd_mapping *nd_mapping = &nd_region->mapping[i];
202202
struct nvdimm *nvdimm = nd_mapping->nvdimm;
203203

204-
if (test_bit(NDD_ALIASING, &nvdimm->flags))
205-
alias++;
204+
if (test_bit(NDD_LABELING, &nvdimm->flags))
205+
label++;
206206
}
207-
if (alias)
207+
if (label)
208208
return ND_DEVICE_NAMESPACE_PMEM;
209209
else
210210
return ND_DEVICE_NAMESPACE_IO;

include/linux/libnvdimm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ enum {
3737
NDD_WORK_PENDING = 4,
3838
/* ignore / filter NSLABEL_FLAG_LOCAL for this DIMM, i.e. no aliasing */
3939
NDD_NOBLK = 5,
40+
/* dimm supports namespace labels */
41+
NDD_LABELING = 6,
4042

4143
/* need to set a limit somewhere, but yes, this is likely overkill */
4244
ND_IOCTL_MAX_BUFLEN = SZ_4M,

0 commit comments

Comments
 (0)