aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-10 15:07:22 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-10 15:07:22 -0500
commit264015f8a83fefc62c5125d761fbbadf924e520c (patch)
tree6a0602761abb3d866471861a7128a5177a855fd0 /tools
parentd55fc37856244c929965c190c8e9dcb49e2c07aa (diff)
parentab27a8d04b32b6ee8c30c14c4afd1058e8addc82 (diff)
Merge tag 'libnvdimm-for-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm updates from Dan Williams: "Outside of the new ACPI-NFIT hot-add support this pull request is more notable for what it does not contain, than what it does. There were a handful of development topics this cycle, dax get_user_pages, dax fsync, and raw block dax, that need more more iteration and will wait for 4.5. The patches to make devm and the pmem driver NUMA aware have been in -next for several weeks. The hot-add support has not, but is contained to the NFIT driver and is passing unit tests. The coredump support is straightforward and was looked over by Jeff. All of it has received a 0day build success notification across 107 configs. Summary: - Add support for the ACPI 6.0 NFIT hot add mechanism to process updates of the NFIT at runtime. - Teach the coredump implementation how to filter out DAX mappings. - Introduce NUMA hints for allocations made by the pmem driver, and as a side effect all devm allocations now hint their NUMA node by default" * tag 'libnvdimm-for-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: coredump: add DAX filtering for FDPIC ELF coredumps coredump: add DAX filtering for ELF coredumps acpi: nfit: Add support for hot-add nfit: in acpi_nfit_init, break on a 0-length table pmem, memremap: convert to numa aware allocations devm_memremap_pages: use numa_mem_id devm: make allocations numa aware by default devm_memremap: convert to return ERR_PTR devm_memunmap: use devres_release() pmem: kill memremap_pmem() x86, mm: quiet arch_add_memory()
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/nvdimm/test/nfit.c164
1 files changed, 162 insertions, 2 deletions
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
index 021e6f97f33e..dce346aa94ea 100644
--- a/tools/testing/nvdimm/test/nfit.c
+++ b/tools/testing/nvdimm/test/nfit.c
@@ -17,8 +17,10 @@
17#include <linux/vmalloc.h> 17#include <linux/vmalloc.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/mutex.h>
20#include <linux/ndctl.h> 21#include <linux/ndctl.h>
21#include <linux/sizes.h> 22#include <linux/sizes.h>
23#include <linux/list.h>
22#include <linux/slab.h> 24#include <linux/slab.h>
23#include <nfit.h> 25#include <nfit.h>
24#include <nd.h> 26#include <nd.h>
@@ -44,6 +46,15 @@
44 * +------+ | blk5.0 | pm1.0 | 3 region5 46 * +------+ | blk5.0 | pm1.0 | 3 region5
45 * +-------------------------+----------+-+-------+ 47 * +-------------------------+----------+-+-------+
46 * 48 *
49 * +--+---+
50 * | cpu1 |
51 * +--+---+ (Hotplug DIMM)
52 * | +----------------------------------------------+
53 * +--+---+ | blk6.0/pm7.0 | 4 region6/7
54 * | imc0 +--+----------------------------------------------+
55 * +------+
56 *
57 *
47 * *) In this layout we have four dimms and two memory controllers in one 58 * *) In this layout we have four dimms and two memory controllers in one
48 * socket. Each unique interface (BLK or PMEM) to DPA space 59 * socket. Each unique interface (BLK or PMEM) to DPA space
49 * is identified by a region device with a dynamically assigned id. 60 * is identified by a region device with a dynamically assigned id.
@@ -85,8 +96,8 @@
85 * reference an NVDIMM. 96 * reference an NVDIMM.
86 */ 97 */
87enum { 98enum {
88 NUM_PM = 2, 99 NUM_PM = 3,
89 NUM_DCR = 4, 100 NUM_DCR = 5,
90 NUM_BDW = NUM_DCR, 101 NUM_BDW = NUM_DCR,
91 NUM_SPA = NUM_PM + NUM_DCR + NUM_BDW, 102 NUM_SPA = NUM_PM + NUM_DCR + NUM_BDW,
92 NUM_MEM = NUM_DCR + NUM_BDW + 2 /* spa0 iset */ + 4 /* spa1 iset */, 103 NUM_MEM = NUM_DCR + NUM_BDW + 2 /* spa0 iset */ + 4 /* spa1 iset */,
@@ -115,6 +126,7 @@ static u32 handle[NUM_DCR] = {
115 [1] = NFIT_DIMM_HANDLE(0, 0, 0, 0, 1), 126 [1] = NFIT_DIMM_HANDLE(0, 0, 0, 0, 1),
116 [2] = NFIT_DIMM_HANDLE(0, 0, 1, 0, 0), 127 [2] = NFIT_DIMM_HANDLE(0, 0, 1, 0, 0),
117 [3] = NFIT_DIMM_HANDLE(0, 0, 1, 0, 1), 128 [3] = NFIT_DIMM_HANDLE(0, 0, 1, 0, 1),
129 [4] = NFIT_DIMM_HANDLE(0, 1, 0, 0, 0),
118}; 130};
119 131
120struct nfit_test { 132struct nfit_test {
@@ -138,6 +150,7 @@ struct nfit_test {
138 dma_addr_t *dcr_dma; 150 dma_addr_t *dcr_dma;
139 int (*alloc)(struct nfit_test *t); 151 int (*alloc)(struct nfit_test *t);
140 void (*setup)(struct nfit_test *t); 152 void (*setup)(struct nfit_test *t);
153 int setup_hotplug;
141}; 154};
142 155
143static struct nfit_test *to_nfit_test(struct device *dev) 156static struct nfit_test *to_nfit_test(struct device *dev)
@@ -428,6 +441,10 @@ static int nfit_test0_alloc(struct nfit_test *t)
428 if (!t->spa_set[1]) 441 if (!t->spa_set[1])
429 return -ENOMEM; 442 return -ENOMEM;
430 443
444 t->spa_set[2] = test_alloc_coherent(t, SPA0_SIZE, &t->spa_set_dma[2]);
445 if (!t->spa_set[2])
446 return -ENOMEM;
447
431 for (i = 0; i < NUM_DCR; i++) { 448 for (i = 0; i < NUM_DCR; i++) {
432 t->dimm[i] = test_alloc(t, DIMM_SIZE, &t->dimm_dma[i]); 449 t->dimm[i] = test_alloc(t, DIMM_SIZE, &t->dimm_dma[i]);
433 if (!t->dimm[i]) 450 if (!t->dimm[i])
@@ -950,6 +967,126 @@ static void nfit_test0_setup(struct nfit_test *t)
950 flush->hint_count = 1; 967 flush->hint_count = 1;
951 flush->hint_address[0] = t->flush_dma[3]; 968 flush->hint_address[0] = t->flush_dma[3];
952 969
970 if (t->setup_hotplug) {
971 offset = offset + sizeof(struct acpi_nfit_flush_address) * 4;
972 /* dcr-descriptor4 */
973 dcr = nfit_buf + offset;
974 dcr->header.type = ACPI_NFIT_TYPE_CONTROL_REGION;
975 dcr->header.length = sizeof(struct acpi_nfit_control_region);
976 dcr->region_index = 4+1;
977 dcr->vendor_id = 0xabcd;
978 dcr->device_id = 0;
979 dcr->revision_id = 1;
980 dcr->serial_number = ~handle[4];
981 dcr->windows = 1;
982 dcr->window_size = DCR_SIZE;
983 dcr->command_offset = 0;
984 dcr->command_size = 8;
985 dcr->status_offset = 8;
986 dcr->status_size = 4;
987
988 offset = offset + sizeof(struct acpi_nfit_control_region);
989 /* bdw4 (spa/dcr4, dimm4) */
990 bdw = nfit_buf + offset;
991 bdw->header.type = ACPI_NFIT_TYPE_DATA_REGION;
992 bdw->header.length = sizeof(struct acpi_nfit_data_region);
993 bdw->region_index = 4+1;
994 bdw->windows = 1;
995 bdw->offset = 0;
996 bdw->size = BDW_SIZE;
997 bdw->capacity = DIMM_SIZE;
998 bdw->start_address = 0;
999
1000 offset = offset + sizeof(struct acpi_nfit_data_region);
1001 /* spa10 (dcr4) dimm4 */
1002 spa = nfit_buf + offset;
1003 spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS;
1004 spa->header.length = sizeof(*spa);
1005 memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_DCR), 16);
1006 spa->range_index = 10+1;
1007 spa->address = t->dcr_dma[4];
1008 spa->length = DCR_SIZE;
1009
1010 /*
1011 * spa11 (single-dimm interleave for hotplug, note storage
1012 * does not actually alias the related block-data-window
1013 * regions)
1014 */
1015 spa = nfit_buf + offset + sizeof(*spa);
1016 spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS;
1017 spa->header.length = sizeof(*spa);
1018 memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_PM), 16);
1019 spa->range_index = 11+1;
1020 spa->address = t->spa_set_dma[2];
1021 spa->length = SPA0_SIZE;
1022
1023 /* spa12 (bdw for dcr4) dimm4 */
1024 spa = nfit_buf + offset + sizeof(*spa) * 2;
1025 spa->header.type = ACPI_NFIT_TYPE_SYSTEM_ADDRESS;
1026 spa->header.length = sizeof(*spa);
1027 memcpy(spa->range_guid, to_nfit_uuid(NFIT_SPA_BDW), 16);
1028 spa->range_index = 12+1;
1029 spa->address = t->dimm_dma[4];
1030 spa->length = DIMM_SIZE;
1031
1032 offset = offset + sizeof(*spa) * 3;
1033 /* mem-region14 (spa/dcr4, dimm4) */
1034 memdev = nfit_buf + offset;
1035 memdev->header.type = ACPI_NFIT_TYPE_MEMORY_MAP;
1036 memdev->header.length = sizeof(*memdev);
1037 memdev->device_handle = handle[4];
1038 memdev->physical_id = 4;
1039 memdev->region_id = 0;
1040 memdev->range_index = 10+1;
1041 memdev->region_index = 4+1;
1042 memdev->region_size = 0;
1043 memdev->region_offset = 0;
1044 memdev->address = 0;
1045 memdev->interleave_index = 0;
1046 memdev->interleave_ways = 1;
1047
1048 /* mem-region15 (spa0, dimm4) */
1049 memdev = nfit_buf + offset +
1050 sizeof(struct acpi_nfit_memory_map);
1051 memdev->header.type = ACPI_NFIT_TYPE_MEMORY_MAP;
1052 memdev->header.length = sizeof(*memdev);
1053 memdev->device_handle = handle[4];
1054 memdev->physical_id = 4;
1055 memdev->region_id = 0;
1056 memdev->range_index = 11+1;
1057 memdev->region_index = 4+1;
1058 memdev->region_size = SPA0_SIZE;
1059 memdev->region_offset = t->spa_set_dma[2];
1060 memdev->address = 0;
1061 memdev->interleave_index = 0;
1062 memdev->interleave_ways = 1;
1063
1064 /* mem-region16 (spa/dcr4, dimm4) */
1065 memdev = nfit_buf + offset +
1066 sizeof(struct acpi_nfit_memory_map) * 2;
1067 memdev->header.type = ACPI_NFIT_TYPE_MEMORY_MAP;
1068 memdev->header.length = sizeof(*memdev);
1069 memdev->device_handle = handle[4];
1070 memdev->physical_id = 4;
1071 memdev->region_id = 0;
1072 memdev->range_index = 12+1;
1073 memdev->region_index = 4+1;
1074 memdev->region_size = 0;
1075 memdev->region_offset = 0;
1076 memdev->address = 0;
1077 memdev->interleave_index = 0;
1078 memdev->interleave_ways = 1;
1079
1080 offset = offset + sizeof(struct acpi_nfit_memory_map) * 3;
1081 /* flush3 (dimm4) */
1082 flush = nfit_buf + offset;
1083 flush->header.type = ACPI_NFIT_TYPE_FLUSH_ADDRESS;
1084 flush->header.length = sizeof(struct acpi_nfit_flush_address);
1085 flush->device_handle = handle[4];
1086 flush->hint_count = 1;
1087 flush->hint_address[0] = t->flush_dma[4];
1088 }
1089
953 acpi_desc = &t->acpi_desc; 1090 acpi_desc = &t->acpi_desc;
954 set_bit(ND_CMD_GET_CONFIG_SIZE, &acpi_desc->dimm_dsm_force_en); 1091 set_bit(ND_CMD_GET_CONFIG_SIZE, &acpi_desc->dimm_dsm_force_en);
955 set_bit(ND_CMD_GET_CONFIG_DATA, &acpi_desc->dimm_dsm_force_en); 1092 set_bit(ND_CMD_GET_CONFIG_DATA, &acpi_desc->dimm_dsm_force_en);
@@ -1108,6 +1245,29 @@ static int nfit_test_probe(struct platform_device *pdev)
1108 if (!acpi_desc->nvdimm_bus) 1245 if (!acpi_desc->nvdimm_bus)
1109 return -ENXIO; 1246 return -ENXIO;
1110 1247
1248 INIT_LIST_HEAD(&acpi_desc->spa_maps);
1249 INIT_LIST_HEAD(&acpi_desc->spas);
1250 INIT_LIST_HEAD(&acpi_desc->dcrs);
1251 INIT_LIST_HEAD(&acpi_desc->bdws);
1252 INIT_LIST_HEAD(&acpi_desc->idts);
1253 INIT_LIST_HEAD(&acpi_desc->flushes);
1254 INIT_LIST_HEAD(&acpi_desc->memdevs);
1255 INIT_LIST_HEAD(&acpi_desc->dimms);
1256 mutex_init(&acpi_desc->spa_map_mutex);
1257 mutex_init(&acpi_desc->init_mutex);
1258
1259 rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_size);
1260 if (rc) {
1261 nvdimm_bus_unregister(acpi_desc->nvdimm_bus);
1262 return rc;
1263 }
1264
1265 if (nfit_test->setup != nfit_test0_setup)
1266 return 0;
1267
1268 nfit_test->setup_hotplug = 1;
1269 nfit_test->setup(nfit_test);
1270
1111 rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_size); 1271 rc = acpi_nfit_init(acpi_desc, nfit_test->nfit_size);
1112 if (rc) { 1272 if (rc) {
1113 nvdimm_bus_unregister(acpi_desc->nvdimm_bus); 1273 nvdimm_bus_unregister(acpi_desc->nvdimm_bus);