diff options
author | Anton Blanchard <anton@au1.ibm.com> | 2014-06-04 03:50:47 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-06-04 23:20:39 -0400 |
commit | a5d862576a64cb3e0c22dc9cc2170e4d750714f9 (patch) | |
tree | fcbe4063edf1c207af6bcde00506cb763d1db589 /arch/powerpc/platforms | |
parent | 223ca9d855ce32a4cc2d2b961e6e9d1fb36872ba (diff) |
powerpc: Allow ppc_md platform hook to override memory_block_size_bytes
The pseries platform code unconditionally overrides
memory_block_size_bytes regardless of the running platform.
Create a ppc_md hook that so each platform can choose to
do what it wants.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r-- | arch/powerpc/platforms/pseries/hotplug-memory.c | 17 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/pseries.h | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/setup.c | 3 |
3 files changed, 8 insertions, 14 deletions
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c index 7f75c94af822..7995135170a3 100644 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #include <asm/prom.h> | 21 | #include <asm/prom.h> |
22 | #include <asm/sparsemem.h> | 22 | #include <asm/sparsemem.h> |
23 | 23 | ||
24 | static unsigned long get_memblock_size(void) | 24 | unsigned long pseries_memory_block_size(void) |
25 | { | 25 | { |
26 | struct device_node *np; | 26 | struct device_node *np; |
27 | unsigned int memblock_size = MIN_MEMORY_BLOCK_SIZE; | 27 | unsigned int memblock_size = MIN_MEMORY_BLOCK_SIZE; |
@@ -64,17 +64,6 @@ static unsigned long get_memblock_size(void) | |||
64 | return memblock_size; | 64 | return memblock_size; |
65 | } | 65 | } |
66 | 66 | ||
67 | /* WARNING: This is going to override the generic definition whenever | ||
68 | * pseries is built-in regardless of what platform is active at boot | ||
69 | * time. This is fine for now as this is the only "option" and it | ||
70 | * should work everywhere. If not, we'll have to turn this into a | ||
71 | * ppc_md. callback | ||
72 | */ | ||
73 | unsigned long memory_block_size_bytes(void) | ||
74 | { | ||
75 | return get_memblock_size(); | ||
76 | } | ||
77 | |||
78 | #ifdef CONFIG_MEMORY_HOTREMOVE | 67 | #ifdef CONFIG_MEMORY_HOTREMOVE |
79 | static int pseries_remove_memory(u64 start, u64 size) | 68 | static int pseries_remove_memory(u64 start, u64 size) |
80 | { | 69 | { |
@@ -105,7 +94,7 @@ static int pseries_remove_memblock(unsigned long base, unsigned int memblock_siz | |||
105 | if (!pfn_valid(start_pfn)) | 94 | if (!pfn_valid(start_pfn)) |
106 | goto out; | 95 | goto out; |
107 | 96 | ||
108 | block_sz = memory_block_size_bytes(); | 97 | block_sz = pseries_memory_block_size(); |
109 | sections_per_block = block_sz / MIN_MEMORY_BLOCK_SIZE; | 98 | sections_per_block = block_sz / MIN_MEMORY_BLOCK_SIZE; |
110 | nid = memory_add_physaddr_to_nid(base); | 99 | nid = memory_add_physaddr_to_nid(base); |
111 | 100 | ||
@@ -201,7 +190,7 @@ static int pseries_update_drconf_memory(struct of_prop_reconfig *pr) | |||
201 | u32 *p; | 190 | u32 *p; |
202 | int i, rc = -EINVAL; | 191 | int i, rc = -EINVAL; |
203 | 192 | ||
204 | memblock_size = get_memblock_size(); | 193 | memblock_size = pseries_memory_block_size(); |
205 | if (!memblock_size) | 194 | if (!memblock_size) |
206 | return -EINVAL; | 195 | return -EINVAL; |
207 | 196 | ||
diff --git a/arch/powerpc/platforms/pseries/pseries.h b/arch/powerpc/platforms/pseries/pseries.h index 99219530ea4a..361add62abf1 100644 --- a/arch/powerpc/platforms/pseries/pseries.h +++ b/arch/powerpc/platforms/pseries/pseries.h | |||
@@ -64,4 +64,6 @@ extern int dlpar_detach_node(struct device_node *); | |||
64 | struct pci_host_bridge; | 64 | struct pci_host_bridge; |
65 | int pseries_root_bridge_prepare(struct pci_host_bridge *bridge); | 65 | int pseries_root_bridge_prepare(struct pci_host_bridge *bridge); |
66 | 66 | ||
67 | unsigned long pseries_memory_block_size(void); | ||
68 | |||
67 | #endif /* _PSERIES_PSERIES_H */ | 69 | #endif /* _PSERIES_PSERIES_H */ |
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 215c3c269617..adc21a0e3410 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -810,4 +810,7 @@ define_machine(pseries) { | |||
810 | #ifdef CONFIG_KEXEC | 810 | #ifdef CONFIG_KEXEC |
811 | .machine_kexec = pSeries_machine_kexec, | 811 | .machine_kexec = pSeries_machine_kexec, |
812 | #endif | 812 | #endif |
813 | #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE | ||
814 | .memory_block_size = pseries_memory_block_size, | ||
815 | #endif | ||
813 | }; | 816 | }; |