aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormike.travis@hpe.com <mike.travis@hpe.com>2018-05-24 16:17:12 -0400
committerIngo Molnar <mingo@kernel.org>2018-06-21 10:14:45 -0400
commitf642fb5864a6e3645edce6f85ffe7b44d5e9b990 (patch)
tree19a7f8246d6272e218d9c4565f273666ba6cd3d2
parentd6605b6bbee88b74150b14f5e83a6067f5e323d2 (diff)
x86/platform/UV: Add adjustable set memory block size function
Add a new function to "adjust" the current fixed UV memory block size of 2GB so it can be changed to a different physical boundary. This is out of necessity so arch dependent code can accommodate specific BIOS requirements which can align these new PMEM modules at less than the default boundaries. A "set order" type of function was used to insure that the memory block size will be a power of two value without requiring a validity check. 64GB was chosen as the upper limit for memory block size values to accommodate upcoming 4PB systems which have 6 more bits of physical address space (46 becoming 52). Signed-off-by: Mike Travis <mike.travis@hpe.com> Reviewed-by: Andrew Banman <andrew.banman@hpe.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Dimitri Sivanich <dimitri.sivanich@hpe.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russ Anderson <russ.anderson@hpe.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: dan.j.williams@intel.com Cc: jgross@suse.com Cc: kirill.shutemov@linux.intel.com Cc: mhocko@suse.com Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/lkml/20180524201711.609546602@stormcage.americas.sgi.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/mm/init_64.c20
-rw-r--r--include/linux/memory.h1
2 files changed, 17 insertions, 4 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 0a400606dea0..20d8bf5fbceb 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1350,16 +1350,28 @@ int kern_addr_valid(unsigned long addr)
1350/* Amount of ram needed to start using large blocks */ 1350/* Amount of ram needed to start using large blocks */
1351#define MEM_SIZE_FOR_LARGE_BLOCK (64UL << 30) 1351#define MEM_SIZE_FOR_LARGE_BLOCK (64UL << 30)
1352 1352
1353/* Adjustable memory block size */
1354static unsigned long set_memory_block_size;
1355int __init set_memory_block_size_order(unsigned int order)
1356{
1357 unsigned long size = 1UL << order;
1358
1359 if (size > MEM_SIZE_FOR_LARGE_BLOCK || size < MIN_MEMORY_BLOCK_SIZE)
1360 return -EINVAL;
1361
1362 set_memory_block_size = size;
1363 return 0;
1364}
1365
1353static unsigned long probe_memory_block_size(void) 1366static unsigned long probe_memory_block_size(void)
1354{ 1367{
1355 unsigned long boot_mem_end = max_pfn << PAGE_SHIFT; 1368 unsigned long boot_mem_end = max_pfn << PAGE_SHIFT;
1356 unsigned long bz; 1369 unsigned long bz;
1357 1370
1358 /* If this is UV system, always set 2G block size */ 1371 /* If memory block size has been set, then use it */
1359 if (is_uv_system()) { 1372 bz = set_memory_block_size;
1360 bz = MAX_BLOCK_SIZE; 1373 if (bz)
1361 goto done; 1374 goto done;
1362 }
1363 1375
1364 /* Use regular block if RAM is smaller than MEM_SIZE_FOR_LARGE_BLOCK */ 1376 /* Use regular block if RAM is smaller than MEM_SIZE_FOR_LARGE_BLOCK */
1365 if (boot_mem_end < MEM_SIZE_FOR_LARGE_BLOCK) { 1377 if (boot_mem_end < MEM_SIZE_FOR_LARGE_BLOCK) {
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 31ca3e28b0eb..a6ddefc60517 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -38,6 +38,7 @@ struct memory_block {
38 38
39int arch_get_memory_phys_device(unsigned long start_pfn); 39int arch_get_memory_phys_device(unsigned long start_pfn);
40unsigned long memory_block_size_bytes(void); 40unsigned long memory_block_size_bytes(void);
41int set_memory_block_size_order(unsigned int order);
41 42
42/* These states are exposed to userspace as text strings in sysfs */ 43/* These states are exposed to userspace as text strings in sysfs */
43#define MEM_ONLINE (1<<0) /* exposed to userspace */ 44#define MEM_ONLINE (1<<0) /* exposed to userspace */