Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKernel Build Daemon <kbuild@suse.de>2019-10-07 13:52:05 +0200
committerKernel Build Daemon <kbuild@suse.de>2019-10-07 13:52:05 +0200
commitd0d222c6cb2f1057d541a11bf046cccb23f7f5e5 (patch)
tree2d0d003bdfe8a327b648f1fb87f106ad3a86c8f5
parent9fe2cd1126831f4cda4edef28f60cdcf05e67396 (diff)
parent6b38ffcc62af1d2303e862e8798089121bbeefe4 (diff)
Merge branch 'users/jthumshirn/SLE15-SP1/for-next' into SLE15-SP1
-rw-r--r--arch/powerpc/mm/init_64.c17
-rw-r--r--drivers/nvdimm/pfn_devs.c2
-rw-r--r--include/linux/memremap.h3
3 files changed, 21 insertions, 1 deletions
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 45d53b01bb0b..3677b5a33fee 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -156,6 +156,21 @@ static __meminit void vmemmap_list_populate(unsigned long phys,
vmemmap_list = vmem_back;
}
+static bool altmap_cross_boundary(struct vmem_altmap *altmap, unsigned long start,
+ unsigned long page_size)
+{
+ unsigned long nr_pfn = page_size / sizeof(struct page);
+ unsigned long start_pfn = page_to_pfn((struct page *)start);
+
+ if ((start_pfn + nr_pfn) > altmap->end_pfn)
+ return true;
+
+ if (start_pfn < altmap->base_pfn)
+ return true;
+
+ return false;
+}
+
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
struct vmem_altmap *altmap)
{
@@ -178,7 +193,7 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
* fail due to alignment issues when using 16MB hugepages, so
* fall back to system memory if the altmap allocation fail.
*/
- if (altmap) {
+ if (altmap && !altmap_cross_boundary(altmap, start, page_size)) {
p = altmap_alloc_block_buf(page_size, altmap);
if (!p)
pr_debug("altmap block allocation failed, falling back to system memory");
diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
index c22462a277b6..2a4104d0a170 100644
--- a/drivers/nvdimm/pfn_devs.c
+++ b/drivers/nvdimm/pfn_devs.c
@@ -612,9 +612,11 @@ static int __nvdimm_setup_pfn(struct nd_pfn *nd_pfn, struct dev_pagemap *pgmap)
struct nd_namespace_common *ndns = nd_pfn->ndns;
struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev);
resource_size_t base = nsio->res.start + start_pad;
+ resource_size_t end = nsio->res.end - end_trunc;
struct vmem_altmap __altmap = {
.base_pfn = init_altmap_base(base),
.reserve = init_altmap_reserve(base),
+ .end_pfn = PHYS_PFN(end),
};
memcpy(res, &nsio->res, sizeof(*res));
diff --git a/include/linux/memremap.h b/include/linux/memremap.h
index 8b83e71354b4..970fd6c33b8c 100644
--- a/include/linux/memremap.h
+++ b/include/linux/memremap.h
@@ -22,6 +22,9 @@ struct vmem_altmap {
unsigned long free;
unsigned long align;
unsigned long alloc;
+#ifndef __GENKSYMS__
+ const unsigned long end_pfn;
+#endif
};
/*