diff options
author | Dan Williams <dan.j.williams@intel.com> | 2015-11-09 13:29:39 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2015-11-09 13:29:39 -0500 |
commit | 85ce230051c37dfb979385eb0244bf3655625ba6 (patch) | |
tree | 90abeab25f8c1ea4836b38279790b90f0c780ae3 /tools | |
parent | 538ea4aa44737127ce2b5c8511c7349d2abdcf9c (diff) | |
parent | 209851649dc4f7900a6bfe1de5e2640ab2c7d931 (diff) |
Merge branch 'for-4.4/hotplug' into libnvdimm-for-next
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/Build | 2 | ||||
-rw-r--r-- | tools/perf/util/perf_regs.c | 2 | ||||
-rw-r--r-- | tools/perf/util/perf_regs.h | 1 | ||||
-rw-r--r-- | tools/testing/nvdimm/test/nfit.c | 164 | ||||
-rw-r--r-- | tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c | 9 |
5 files changed, 175 insertions, 3 deletions
diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 349bc96ca1fe..e5f18a288b74 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build | |||
@@ -17,6 +17,7 @@ libperf-y += levenshtein.o | |||
17 | libperf-y += llvm-utils.o | 17 | libperf-y += llvm-utils.o |
18 | libperf-y += parse-options.o | 18 | libperf-y += parse-options.o |
19 | libperf-y += parse-events.o | 19 | libperf-y += parse-events.o |
20 | libperf-y += perf_regs.o | ||
20 | libperf-y += path.o | 21 | libperf-y += path.o |
21 | libperf-y += rbtree.o | 22 | libperf-y += rbtree.o |
22 | libperf-y += bitmap.o | 23 | libperf-y += bitmap.o |
@@ -103,7 +104,6 @@ libperf-$(CONFIG_LIBBABELTRACE) += data-convert-bt.o | |||
103 | 104 | ||
104 | libperf-y += scripting-engines/ | 105 | libperf-y += scripting-engines/ |
105 | 106 | ||
106 | libperf-$(CONFIG_PERF_REGS) += perf_regs.o | ||
107 | libperf-$(CONFIG_ZLIB) += zlib.o | 107 | libperf-$(CONFIG_ZLIB) += zlib.o |
108 | libperf-$(CONFIG_LZMA) += lzma.o | 108 | libperf-$(CONFIG_LZMA) += lzma.o |
109 | 109 | ||
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c index 885e8ac83997..6b8eb13e14e4 100644 --- a/tools/perf/util/perf_regs.c +++ b/tools/perf/util/perf_regs.c | |||
@@ -6,6 +6,7 @@ const struct sample_reg __weak sample_reg_masks[] = { | |||
6 | SMPL_REG_END | 6 | SMPL_REG_END |
7 | }; | 7 | }; |
8 | 8 | ||
9 | #ifdef HAVE_PERF_REGS_SUPPORT | ||
9 | int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) | 10 | int perf_reg_value(u64 *valp, struct regs_dump *regs, int id) |
10 | { | 11 | { |
11 | int i, idx = 0; | 12 | int i, idx = 0; |
@@ -29,3 +30,4 @@ out: | |||
29 | *valp = regs->cache_regs[id]; | 30 | *valp = regs->cache_regs[id]; |
30 | return 0; | 31 | return 0; |
31 | } | 32 | } |
33 | #endif | ||
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h index 2984dcc54d67..679d6e493962 100644 --- a/tools/perf/util/perf_regs.h +++ b/tools/perf/util/perf_regs.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __PERF_REGS_H | 2 | #define __PERF_REGS_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/compiler.h> | ||
5 | 6 | ||
6 | struct regs_dump; | 7 | struct regs_dump; |
7 | 8 | ||
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 | */ |
87 | enum { | 98 | enum { |
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 | ||
120 | struct nfit_test { | 132 | struct 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 | ||
143 | static struct nfit_test *to_nfit_test(struct device *dev) | 156 | static 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); |
diff --git a/tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c b/tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c index d1b647509596..6cae06117b55 100644 --- a/tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c +++ b/tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c | |||
@@ -25,10 +25,19 @@ | |||
25 | 25 | ||
26 | #define FIXUP_SECTION ".ex_fixup" | 26 | #define FIXUP_SECTION ".ex_fixup" |
27 | 27 | ||
28 | static inline unsigned long __fls(unsigned long x); | ||
29 | |||
28 | #include "word-at-a-time.h" | 30 | #include "word-at-a-time.h" |
29 | 31 | ||
30 | #include "utils.h" | 32 | #include "utils.h" |
31 | 33 | ||
34 | static inline unsigned long __fls(unsigned long x) | ||
35 | { | ||
36 | int lz; | ||
37 | |||
38 | asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (x)); | ||
39 | return sizeof(unsigned long) - 1 - lz; | ||
40 | } | ||
32 | 41 | ||
33 | static int page_size; | 42 | static int page_size; |
34 | static char *mem_region; | 43 | static char *mem_region; |