diff options
author | Dan Williams <dan.j.williams@intel.com> | 2015-11-11 19:46:33 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2015-11-12 12:21:18 -0500 |
commit | f7256dc0cdbc68903502997bde619f555a910f50 (patch) | |
tree | f419b12cd2c374efda2afd682f97a6bb2f9acbb0 /drivers/nvdimm/e820.c | |
parent | f42957967fb435aef6fc700fbbd9df89533b9a2e (diff) |
libnvdimm, e820: fix numa node for e820-type-12 pmem ranges
Rather than punt on the numa node for these e820 ranges try to find a
better answer with memory_add_physaddr_to_nid() when it is available.
Cc: <stable@vger.kernel.org>
Reported-by: Boaz Harrosh <boaz@plexistor.com>
Tested-by: Boaz Harrosh <boaz@plexistor.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/e820.c')
-rw-r--r-- | drivers/nvdimm/e820.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/nvdimm/e820.c b/drivers/nvdimm/e820.c index 8282db2ef99e..b0045a505dc8 100644 --- a/drivers/nvdimm/e820.c +++ b/drivers/nvdimm/e820.c | |||
@@ -3,6 +3,7 @@ | |||
3 | * Copyright (c) 2015, Intel Corporation. | 3 | * Copyright (c) 2015, Intel Corporation. |
4 | */ | 4 | */ |
5 | #include <linux/platform_device.h> | 5 | #include <linux/platform_device.h> |
6 | #include <linux/memory_hotplug.h> | ||
6 | #include <linux/libnvdimm.h> | 7 | #include <linux/libnvdimm.h> |
7 | #include <linux/module.h> | 8 | #include <linux/module.h> |
8 | 9 | ||
@@ -25,6 +26,18 @@ static int e820_pmem_remove(struct platform_device *pdev) | |||
25 | return 0; | 26 | return 0; |
26 | } | 27 | } |
27 | 28 | ||
29 | #ifdef CONFIG_MEMORY_HOTPLUG | ||
30 | static int e820_range_to_nid(resource_size_t addr) | ||
31 | { | ||
32 | return memory_add_physaddr_to_nid(addr); | ||
33 | } | ||
34 | #else | ||
35 | static int e820_range_to_nid(resource_size_t addr) | ||
36 | { | ||
37 | return NUMA_NO_NODE; | ||
38 | } | ||
39 | #endif | ||
40 | |||
28 | static int e820_pmem_probe(struct platform_device *pdev) | 41 | static int e820_pmem_probe(struct platform_device *pdev) |
29 | { | 42 | { |
30 | static struct nvdimm_bus_descriptor nd_desc; | 43 | static struct nvdimm_bus_descriptor nd_desc; |
@@ -48,7 +61,7 @@ static int e820_pmem_probe(struct platform_device *pdev) | |||
48 | memset(&ndr_desc, 0, sizeof(ndr_desc)); | 61 | memset(&ndr_desc, 0, sizeof(ndr_desc)); |
49 | ndr_desc.res = p; | 62 | ndr_desc.res = p; |
50 | ndr_desc.attr_groups = e820_pmem_region_attribute_groups; | 63 | ndr_desc.attr_groups = e820_pmem_region_attribute_groups; |
51 | ndr_desc.numa_node = NUMA_NO_NODE; | 64 | ndr_desc.numa_node = e820_range_to_nid(p->start); |
52 | set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags); | 65 | set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags); |
53 | if (!nvdimm_pmem_region_create(nvdimm_bus, &ndr_desc)) | 66 | if (!nvdimm_pmem_region_create(nvdimm_bus, &ndr_desc)) |
54 | goto err; | 67 | goto err; |