Commit f7256dc0 authored by Dan Williams's avatar Dan Williams

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: default avatarBoaz Harrosh <boaz@plexistor.com>
Tested-by: default avatarBoaz Harrosh <boaz@plexistor.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent f4295796
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* Copyright (c) 2015, Intel Corporation. * Copyright (c) 2015, Intel Corporation.
*/ */
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/memory_hotplug.h>
#include <linux/libnvdimm.h> #include <linux/libnvdimm.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -25,6 +26,18 @@ static int e820_pmem_remove(struct platform_device *pdev) ...@@ -25,6 +26,18 @@ static int e820_pmem_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_MEMORY_HOTPLUG
static int e820_range_to_nid(resource_size_t addr)
{
return memory_add_physaddr_to_nid(addr);
}
#else
static int e820_range_to_nid(resource_size_t addr)
{
return NUMA_NO_NODE;
}
#endif
static int e820_pmem_probe(struct platform_device *pdev) static int e820_pmem_probe(struct platform_device *pdev)
{ {
static struct nvdimm_bus_descriptor nd_desc; static struct nvdimm_bus_descriptor nd_desc;
...@@ -48,7 +61,7 @@ static int e820_pmem_probe(struct platform_device *pdev) ...@@ -48,7 +61,7 @@ static int e820_pmem_probe(struct platform_device *pdev)
memset(&ndr_desc, 0, sizeof(ndr_desc)); memset(&ndr_desc, 0, sizeof(ndr_desc));
ndr_desc.res = p; ndr_desc.res = p;
ndr_desc.attr_groups = e820_pmem_region_attribute_groups; ndr_desc.attr_groups = e820_pmem_region_attribute_groups;
ndr_desc.numa_node = NUMA_NO_NODE; ndr_desc.numa_node = e820_range_to_nid(p->start);
set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags); set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags);
if (!nvdimm_pmem_region_create(nvdimm_bus, &ndr_desc)) if (!nvdimm_pmem_region_create(nvdimm_bus, &ndr_desc))
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment