Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm

Pull libnvdimm fixes from Dan Williams:
"A regression fix, new unit test infrastructure and a build fix:

- Regression fix addressing support for the new NVDIMM label storage
area access commands (_LSI, _LSR, and _LSW).

The Intel specific version of these commands communicated the
"Device Locked" status on the label-storage-information command.

However, these new commands (standardized in ACPI 6.2) communicate
the "Device Locked" status on the label-storage-read command, and
the driver was missing the indication.

Reading from locked persistent memory is similar to reading
unmapped PCI memory space, returns all 1's.

- Unit test infrastructure is added to regression test the "Device
Locked" detection failure.

- A build fix is included to allow the "of_pmem" driver to be built
as a module and translate an Open Firmware described device to its
local numa node"

* 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
MAINTAINERS: Add backup maintainers for libnvdimm and DAX
device-dax: allow MAP_SYNC to succeed
Revert "libnvdimm, of_pmem: workaround OF_NUMA=n build error"
libnvdimm, of_pmem: use dev_to_node() instead of of_node_to_nid()
tools/testing/nvdimm: enable labels for nfit_test.1 dimms
tools/testing/nvdimm: fix missing newline in nfit_test_dimm 'handle' attribute
tools/testing/nvdimm: support nfit_test_dimm attributes under nfit_test.1
tools/testing/nvdimm: allow custom error code injection
libnvdimm, dimm: handle EACCES failures from label reads

+96 -32
+15
MAINTAINERS
··· 4248 4248 4249 4249 DEVICE DIRECT ACCESS (DAX) 4250 4250 M: Dan Williams <dan.j.williams@intel.com> 4251 + M: Dave Jiang <dave.jiang@intel.com> 4252 + M: Ross Zwisler <ross.zwisler@linux.intel.com> 4253 + M: Vishal Verma <vishal.l.verma@intel.com> 4251 4254 L: linux-nvdimm@lists.01.org 4252 4255 S: Supported 4253 4256 F: drivers/dax/ ··· 8063 8060 8064 8061 LIBNVDIMM BLK: MMIO-APERTURE DRIVER 8065 8062 M: Ross Zwisler <ross.zwisler@linux.intel.com> 8063 + M: Dan Williams <dan.j.williams@intel.com> 8064 + M: Vishal Verma <vishal.l.verma@intel.com> 8065 + M: Dave Jiang <dave.jiang@intel.com> 8066 8066 L: linux-nvdimm@lists.01.org 8067 8067 Q: https://patchwork.kernel.org/project/linux-nvdimm/list/ 8068 8068 S: Supported ··· 8074 8068 8075 8069 LIBNVDIMM BTT: BLOCK TRANSLATION TABLE 8076 8070 M: Vishal Verma <vishal.l.verma@intel.com> 8071 + M: Dan Williams <dan.j.williams@intel.com> 8072 + M: Ross Zwisler <ross.zwisler@linux.intel.com> 8073 + M: Dave Jiang <dave.jiang@intel.com> 8077 8074 L: linux-nvdimm@lists.01.org 8078 8075 Q: https://patchwork.kernel.org/project/linux-nvdimm/list/ 8079 8076 S: Supported ··· 8084 8075 8085 8076 LIBNVDIMM PMEM: PERSISTENT MEMORY DRIVER 8086 8077 M: Ross Zwisler <ross.zwisler@linux.intel.com> 8078 + M: Dan Williams <dan.j.williams@intel.com> 8079 + M: Vishal Verma <vishal.l.verma@intel.com> 8080 + M: Dave Jiang <dave.jiang@intel.com> 8087 8081 L: linux-nvdimm@lists.01.org 8088 8082 Q: https://patchwork.kernel.org/project/linux-nvdimm/list/ 8089 8083 S: Supported ··· 8102 8090 8103 8091 LIBNVDIMM: NON-VOLATILE MEMORY DEVICE SUBSYSTEM 8104 8092 M: Dan Williams <dan.j.williams@intel.com> 8093 + M: Ross Zwisler <ross.zwisler@linux.intel.com> 8094 + M: Vishal Verma <vishal.l.verma@intel.com> 8095 + M: Dave Jiang <dave.jiang@intel.com> 8105 8096 L: linux-nvdimm@lists.01.org 8106 8097 Q: https://patchwork.kernel.org/project/linux-nvdimm/list/ 8107 8098 T: git git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git
+2
drivers/dax/device.c
··· 19 19 #include <linux/dax.h> 20 20 #include <linux/fs.h> 21 21 #include <linux/mm.h> 22 + #include <linux/mman.h> 22 23 #include "dax-private.h" 23 24 #include "dax.h" 24 25 ··· 541 540 .release = dax_release, 542 541 .get_unmapped_area = dax_get_unmapped_area, 543 542 .mmap = dax_mmap, 543 + .mmap_supported_flags = MAP_SYNC, 544 544 }; 545 545 546 546 static void dev_dax_release(struct device *dev)
+1 -2
drivers/nvdimm/Kconfig
··· 103 103 Select Y if unsure 104 104 105 105 config OF_PMEM 106 - # FIXME: make tristate once OF_NUMA dependency removed 107 - bool "Device-tree support for persistent memory regions" 106 + tristate "Device-tree support for persistent memory regions" 108 107 depends on OF 109 108 default LIBNVDIMM 110 109 help
+12 -10
drivers/nvdimm/dimm_devs.c
··· 88 88 int nvdimm_init_config_data(struct nvdimm_drvdata *ndd) 89 89 { 90 90 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(ndd->dev); 91 + int rc = validate_dimm(ndd), cmd_rc = 0; 91 92 struct nd_cmd_get_config_data_hdr *cmd; 92 93 struct nvdimm_bus_descriptor *nd_desc; 93 - int rc = validate_dimm(ndd); 94 94 u32 max_cmd_size, config_size; 95 95 size_t offset; 96 96 ··· 124 124 cmd->in_offset = offset; 125 125 rc = nd_desc->ndctl(nd_desc, to_nvdimm(ndd->dev), 126 126 ND_CMD_GET_CONFIG_DATA, cmd, 127 - cmd->in_length + sizeof(*cmd), NULL); 128 - if (rc || cmd->status) { 129 - rc = -ENXIO; 127 + cmd->in_length + sizeof(*cmd), &cmd_rc); 128 + if (rc < 0) 129 + break; 130 + if (cmd_rc < 0) { 131 + rc = cmd_rc; 130 132 break; 131 133 } 132 134 memcpy(ndd->data + offset, cmd->out_buf, cmd->in_length); ··· 142 140 int nvdimm_set_config_data(struct nvdimm_drvdata *ndd, size_t offset, 143 141 void *buf, size_t len) 144 142 { 145 - int rc = validate_dimm(ndd); 146 143 size_t max_cmd_size, buf_offset; 147 144 struct nd_cmd_set_config_hdr *cmd; 145 + int rc = validate_dimm(ndd), cmd_rc = 0; 148 146 struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(ndd->dev); 149 147 struct nvdimm_bus_descriptor *nd_desc = nvdimm_bus->nd_desc; 150 148 ··· 166 164 for (buf_offset = 0; len; len -= cmd->in_length, 167 165 buf_offset += cmd->in_length) { 168 166 size_t cmd_size; 169 - u32 *status; 170 167 171 168 cmd->in_offset = offset + buf_offset; 172 169 cmd->in_length = min(max_cmd_size, len); ··· 173 172 174 173 /* status is output in the last 4-bytes of the command buffer */ 175 174 cmd_size = sizeof(*cmd) + cmd->in_length + sizeof(u32); 176 - status = ((void *) cmd) + cmd_size - sizeof(u32); 177 175 178 176 rc = nd_desc->ndctl(nd_desc, to_nvdimm(ndd->dev), 179 - ND_CMD_SET_CONFIG_DATA, cmd, cmd_size, NULL); 180 - if (rc || *status) { 181 - rc = rc ? rc : -ENXIO; 177 + ND_CMD_SET_CONFIG_DATA, cmd, cmd_size, &cmd_rc); 178 + if (rc < 0) 179 + break; 180 + if (cmd_rc < 0) { 181 + rc = cmd_rc; 182 182 break; 183 183 } 184 184 }
+1 -1
drivers/nvdimm/of_pmem.c
··· 67 67 */ 68 68 memset(&ndr_desc, 0, sizeof(ndr_desc)); 69 69 ndr_desc.attr_groups = region_attr_groups; 70 - ndr_desc.numa_node = of_node_to_nid(np); 70 + ndr_desc.numa_node = dev_to_node(&pdev->dev); 71 71 ndr_desc.res = &pdev->resource[i]; 72 72 ndr_desc.of_node = np; 73 73 set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags);
+65 -19
tools/testing/nvdimm/test/nfit.c
··· 138 138 }; 139 139 140 140 static unsigned long dimm_fail_cmd_flags[NUM_DCR]; 141 + static int dimm_fail_cmd_code[NUM_DCR]; 141 142 142 143 struct nfit_test_fw { 143 144 enum intel_fw_update_state state; ··· 893 892 if (i >= ARRAY_SIZE(handle)) 894 893 return -ENXIO; 895 894 896 - if ((1 << func) & dimm_fail_cmd_flags[i]) 895 + if ((1 << func) & dimm_fail_cmd_flags[i]) { 896 + if (dimm_fail_cmd_code[i]) 897 + return dimm_fail_cmd_code[i]; 897 898 return -EIO; 899 + } 898 900 899 901 return i; 900 902 } ··· 1166 1162 1167 1163 static void put_dimms(void *data) 1168 1164 { 1169 - struct device **dimm_dev = data; 1165 + struct nfit_test *t = data; 1170 1166 int i; 1171 1167 1172 - for (i = 0; i < NUM_DCR; i++) 1173 - if (dimm_dev[i]) 1174 - device_unregister(dimm_dev[i]); 1168 + for (i = 0; i < t->num_dcr; i++) 1169 + if (t->dimm_dev[i]) 1170 + device_unregister(t->dimm_dev[i]); 1175 1171 } 1176 1172 1177 1173 static struct class *nfit_test_dimm; ··· 1180 1176 { 1181 1177 int dimm; 1182 1178 1183 - if (sscanf(dev_name(dev), "test_dimm%d", &dimm) != 1 1184 - || dimm >= NUM_DCR || dimm < 0) 1179 + if (sscanf(dev_name(dev), "test_dimm%d", &dimm) != 1) 1185 1180 return -ENXIO; 1186 1181 return dimm; 1187 1182 } 1188 - 1189 1183 1190 1184 static ssize_t handle_show(struct device *dev, struct device_attribute *attr, 1191 1185 char *buf) ··· 1193 1191 if (dimm < 0) 1194 1192 return dimm; 1195 1193 1196 - return sprintf(buf, "%#x", handle[dimm]); 1194 + return sprintf(buf, "%#x\n", handle[dimm]); 1197 1195 } 1198 1196 DEVICE_ATTR_RO(handle); 1199 1197 ··· 1227 1225 } 1228 1226 static DEVICE_ATTR_RW(fail_cmd); 1229 1227 1228 + static ssize_t fail_cmd_code_show(struct device *dev, struct device_attribute *attr, 1229 + char *buf) 1230 + { 1231 + int dimm = dimm_name_to_id(dev); 1232 + 1233 + if (dimm < 0) 1234 + return dimm; 1235 + 1236 + return sprintf(buf, "%d\n", dimm_fail_cmd_code[dimm]); 1237 + } 1238 + 1239 + static ssize_t fail_cmd_code_store(struct device *dev, struct device_attribute *attr, 1240 + const char *buf, size_t size) 1241 + { 1242 + int dimm = dimm_name_to_id(dev); 1243 + unsigned long val; 1244 + ssize_t rc; 1245 + 1246 + if (dimm < 0) 1247 + return dimm; 1248 + 1249 + rc = kstrtol(buf, 0, &val); 1250 + if (rc) 1251 + return rc; 1252 + 1253 + dimm_fail_cmd_code[dimm] = val; 1254 + return size; 1255 + } 1256 + static DEVICE_ATTR_RW(fail_cmd_code); 1257 + 1230 1258 static struct attribute *nfit_test_dimm_attributes[] = { 1231 1259 &dev_attr_fail_cmd.attr, 1260 + &dev_attr_fail_cmd_code.attr, 1232 1261 &dev_attr_handle.attr, 1233 1262 NULL, 1234 1263 }; ··· 1272 1239 &nfit_test_dimm_attribute_group, 1273 1240 NULL, 1274 1241 }; 1242 + 1243 + static int nfit_test_dimm_init(struct nfit_test *t) 1244 + { 1245 + int i; 1246 + 1247 + if (devm_add_action_or_reset(&t->pdev.dev, put_dimms, t)) 1248 + return -ENOMEM; 1249 + for (i = 0; i < t->num_dcr; i++) { 1250 + t->dimm_dev[i] = device_create_with_groups(nfit_test_dimm, 1251 + &t->pdev.dev, 0, NULL, 1252 + nfit_test_dimm_attribute_groups, 1253 + "test_dimm%d", i + t->dcr_idx); 1254 + if (!t->dimm_dev[i]) 1255 + return -ENOMEM; 1256 + } 1257 + return 0; 1258 + } 1275 1259 1276 1260 static void smart_init(struct nfit_test *t) 1277 1261 { ··· 1385 1335 if (!t->_fit) 1386 1336 return -ENOMEM; 1387 1337 1388 - if (devm_add_action_or_reset(&t->pdev.dev, put_dimms, t->dimm_dev)) 1338 + if (nfit_test_dimm_init(t)) 1389 1339 return -ENOMEM; 1390 - for (i = 0; i < NUM_DCR; i++) { 1391 - t->dimm_dev[i] = device_create_with_groups(nfit_test_dimm, 1392 - &t->pdev.dev, 0, NULL, 1393 - nfit_test_dimm_attribute_groups, 1394 - "test_dimm%d", i); 1395 - if (!t->dimm_dev[i]) 1396 - return -ENOMEM; 1397 - } 1398 - 1399 1340 smart_init(t); 1400 1341 return ars_state_init(&t->pdev.dev, &t->ars_state); 1401 1342 } ··· 1418 1377 if (!t->spa_set[1]) 1419 1378 return -ENOMEM; 1420 1379 1380 + if (nfit_test_dimm_init(t)) 1381 + return -ENOMEM; 1421 1382 smart_init(t); 1422 1383 return ars_state_init(&t->pdev.dev, &t->ars_state); 1423 1384 } ··· 2265 2222 set_bit(ND_CMD_ARS_STATUS, &acpi_desc->bus_cmd_force_en); 2266 2223 set_bit(ND_CMD_CLEAR_ERROR, &acpi_desc->bus_cmd_force_en); 2267 2224 set_bit(ND_INTEL_ENABLE_LSS_STATUS, &acpi_desc->dimm_cmd_force_en); 2225 + set_bit(ND_CMD_GET_CONFIG_SIZE, &acpi_desc->dimm_cmd_force_en); 2226 + set_bit(ND_CMD_GET_CONFIG_DATA, &acpi_desc->dimm_cmd_force_en); 2227 + set_bit(ND_CMD_SET_CONFIG_DATA, &acpi_desc->dimm_cmd_force_en); 2268 2228 } 2269 2229 2270 2230 static int nfit_test_blk_do_io(struct nd_blk_region *ndbr, resource_size_t dpa,