diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2022-07-09 19:29:34 +1000 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2022-07-09 19:29:34 +1000 |
commit | 7e74dabc3daf0c217cb5e8e849a8f6c02927950f (patch) | |
tree | 8620e5d95e732952473eeb764aee17693e4458bd /arch/powerpc/mm/mem.c | |
parent | 54c15ec3b738c6086f2be001dae962ec412640e5 (diff) | |
parent | 887502826549caa7e4215fd9e628f48f14c0825a (diff) | |
download | linux-7e74dabc3daf0c217cb5e8e849a8f6c02927950f.tar.gz linux-7e74dabc3daf0c217cb5e8e849a8f6c02927950f.tar.bz2 linux-7e74dabc3daf0c217cb5e8e849a8f6c02927950f.zip |
Merge branch 'fixes' into next
Merge our fixes branch. In particular this brings in commit
986481618023 ("powerpc/book3e: Fix PUD allocation size in
map_kernel_page()") which fixes a build failure in next, because commit
2db2008e6363 ("powerpc/64e: Rewrite p4d_populate() as a static inline
function") depends on it.
Diffstat (limited to 'arch/powerpc/mm/mem.c')
-rw-r--r-- | arch/powerpc/mm/mem.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 2cf6748755e1..7b0d286bf9ba 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c @@ -106,6 +106,37 @@ void __ref arch_remove_linear_mapping(u64 start, u64 size) vm_unmap_aliases(); } +/* + * After memory hotplug the variables max_pfn, max_low_pfn and high_memory need + * updating. + */ +static void update_end_of_memory_vars(u64 start, u64 size) +{ + unsigned long end_pfn = PFN_UP(start + size); + + if (end_pfn > max_pfn) { + max_pfn = end_pfn; + max_low_pfn = end_pfn; + high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1; + } +} + +int __ref add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, + struct mhp_params *params) +{ + int ret; + + ret = __add_pages(nid, start_pfn, nr_pages, params); + if (ret) + return ret; + + /* update max_pfn, max_low_pfn and high_memory */ + update_end_of_memory_vars(start_pfn << PAGE_SHIFT, + nr_pages << PAGE_SHIFT); + + return ret; +} + int __ref arch_add_memory(int nid, u64 start, u64 size, struct mhp_params *params) { @@ -116,7 +147,7 @@ int __ref arch_add_memory(int nid, u64 start, u64 size, rc = arch_create_linear_mapping(nid, start, size, params); if (rc) return rc; - rc = __add_pages(nid, start_pfn, nr_pages, params); + rc = add_pages(nid, start_pfn, nr_pages, params); if (rc) arch_remove_linear_mapping(start, size); return rc; |