aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c66
-rw-r--r--arch/x86/mm/init_64.c14
2 files changed, 67 insertions, 13 deletions
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index bc8803664140..33867ec4a234 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -17,6 +17,54 @@
17#include <asm/pSeries_reconfig.h> 17#include <asm/pSeries_reconfig.h>
18#include <asm/sparsemem.h> 18#include <asm/sparsemem.h>
19 19
20static unsigned long get_memblock_size(void)
21{
22 struct device_node *np;
23 unsigned int memblock_size = 0;
24
25 np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
26 if (np) {
27 const unsigned long *size;
28
29 size = of_get_property(np, "ibm,lmb-size", NULL);
30 memblock_size = size ? *size : 0;
31
32 of_node_put(np);
33 } else {
34 unsigned int memzero_size = 0;
35 const unsigned int *regs;
36
37 np = of_find_node_by_path("/memory@0");
38 if (np) {
39 regs = of_get_property(np, "reg", NULL);
40 memzero_size = regs ? regs[3] : 0;
41 of_node_put(np);
42 }
43
44 if (memzero_size) {
45 /* We now know the size of memory@0, use this to find
46 * the first memoryblock and get its size.
47 */
48 char buf[64];
49
50 sprintf(buf, "/memory@%x", memzero_size);
51 np = of_find_node_by_path(buf);
52 if (np) {
53 regs = of_get_property(np, "reg", NULL);
54 memblock_size = regs ? regs[3] : 0;
55 of_node_put(np);
56 }
57 }
58 }
59
60 return memblock_size;
61}
62
63unsigned long memory_block_size_bytes(void)
64{
65 return get_memblock_size();
66}
67
20static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size) 68static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size)
21{ 69{
22 unsigned long start, start_pfn; 70 unsigned long start, start_pfn;
@@ -127,30 +175,22 @@ static int pseries_add_memory(struct device_node *np)
127 175
128static int pseries_drconf_memory(unsigned long *base, unsigned int action) 176static int pseries_drconf_memory(unsigned long *base, unsigned int action)
129{ 177{
130 struct device_node *np; 178 unsigned long memblock_size;
131 const unsigned long *lmb_size;
132 int rc; 179 int rc;
133 180
134 np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); 181 memblock_size = get_memblock_size();
135 if (!np) 182 if (!memblock_size)
136 return -EINVAL; 183 return -EINVAL;
137 184
138 lmb_size = of_get_property(np, "ibm,lmb-size", NULL);
139 if (!lmb_size) {
140 of_node_put(np);
141 return -EINVAL;
142 }
143
144 if (action == PSERIES_DRCONF_MEM_ADD) { 185 if (action == PSERIES_DRCONF_MEM_ADD) {
145 rc = memblock_add(*base, *lmb_size); 186 rc = memblock_add(*base, memblock_size);
146 rc = (rc < 0) ? -EINVAL : 0; 187 rc = (rc < 0) ? -EINVAL : 0;
147 } else if (action == PSERIES_DRCONF_MEM_REMOVE) { 188 } else if (action == PSERIES_DRCONF_MEM_REMOVE) {
148 rc = pseries_remove_memblock(*base, *lmb_size); 189 rc = pseries_remove_memblock(*base, memblock_size);
149 } else { 190 } else {
150 rc = -EINVAL; 191 rc = -EINVAL;
151 } 192 }
152 193
153 of_node_put(np);
154 return rc; 194 return rc;
155} 195}
156 196
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index a08a62cb136e..0aa34669ed3f 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -51,6 +51,7 @@
51#include <asm/numa.h> 51#include <asm/numa.h>
52#include <asm/cacheflush.h> 52#include <asm/cacheflush.h>
53#include <asm/init.h> 53#include <asm/init.h>
54#include <asm/uv/uv.h>
54 55
55static int __init parse_direct_gbpages_off(char *arg) 56static int __init parse_direct_gbpages_off(char *arg)
56{ 57{
@@ -898,6 +899,19 @@ const char *arch_vma_name(struct vm_area_struct *vma)
898 return NULL; 899 return NULL;
899} 900}
900 901
902#ifdef CONFIG_X86_UV
903#define MIN_MEMORY_BLOCK_SIZE (1 << SECTION_SIZE_BITS)
904
905unsigned long memory_block_size_bytes(void)
906{
907 if (is_uv_system()) {
908 printk(KERN_INFO "UV: memory block size 2GB\n");
909 return 2UL * 1024 * 1024 * 1024;
910 }
911 return MIN_MEMORY_BLOCK_SIZE;
912}
913#endif
914
901#ifdef CONFIG_SPARSEMEM_VMEMMAP 915#ifdef CONFIG_SPARSEMEM_VMEMMAP
902/* 916/*
903 * Initialise the sparsemem vmemmap using huge-pages at the PMD level. 917 * Initialise the sparsemem vmemmap using huge-pages at the PMD level.