Commit 32b53c01 authored by Reza Arbab's avatar Reza Arbab Committed by Michael Ellerman

powerpc/mm: Fix memory hotplug BUG() on radix

Memory hotplug is leading to hash page table calls, even on radix:

  arch_add_memory
    create_section_mapping
      htab_bolt_mapping
        BUG_ON(!ppc_md.hpte_insert);

To fix, refactor {create,remove}_section_mapping() into hash__ and
radix__ variants. Leave the radix versions stubbed for now.
Reviewed-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: default avatarBalbir Singh <bsingharora@gmail.com>
Signed-off-by: default avatarReza Arbab <arbab@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 49def185
...@@ -201,6 +201,10 @@ extern int __meminit hash__vmemmap_create_mapping(unsigned long start, ...@@ -201,6 +201,10 @@ extern int __meminit hash__vmemmap_create_mapping(unsigned long start,
unsigned long phys); unsigned long phys);
extern void hash__vmemmap_remove_mapping(unsigned long start, extern void hash__vmemmap_remove_mapping(unsigned long start,
unsigned long page_size); unsigned long page_size);
int hash__create_section_mapping(unsigned long start, unsigned long end);
int hash__remove_section_mapping(unsigned long start, unsigned long end);
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_BOOK3S_64_HASH_H */ #endif /* _ASM_POWERPC_BOOK3S_64_HASH_H */
...@@ -747,7 +747,7 @@ static unsigned long __init htab_get_table_size(void) ...@@ -747,7 +747,7 @@ static unsigned long __init htab_get_table_size(void)
} }
#ifdef CONFIG_MEMORY_HOTPLUG #ifdef CONFIG_MEMORY_HOTPLUG
int create_section_mapping(unsigned long start, unsigned long end) int hash__create_section_mapping(unsigned long start, unsigned long end)
{ {
int rc = htab_bolt_mapping(start, end, __pa(start), int rc = htab_bolt_mapping(start, end, __pa(start),
pgprot_val(PAGE_KERNEL), mmu_linear_psize, pgprot_val(PAGE_KERNEL), mmu_linear_psize,
...@@ -761,7 +761,7 @@ int create_section_mapping(unsigned long start, unsigned long end) ...@@ -761,7 +761,7 @@ int create_section_mapping(unsigned long start, unsigned long end)
return rc; return rc;
} }
int remove_section_mapping(unsigned long start, unsigned long end) int hash__remove_section_mapping(unsigned long start, unsigned long end)
{ {
int rc = htab_remove_mapping(start, end, mmu_linear_psize, int rc = htab_remove_mapping(start, end, mmu_linear_psize,
mmu_kernel_ssize); mmu_kernel_ssize);
......
...@@ -126,3 +126,21 @@ void mmu_cleanup_all(void) ...@@ -126,3 +126,21 @@ void mmu_cleanup_all(void)
else if (mmu_hash_ops.hpte_clear_all) else if (mmu_hash_ops.hpte_clear_all)
mmu_hash_ops.hpte_clear_all(); mmu_hash_ops.hpte_clear_all();
} }
#ifdef CONFIG_MEMORY_HOTPLUG
int create_section_mapping(unsigned long start, unsigned long end)
{
if (radix_enabled())
return -ENODEV;
return hash__create_section_mapping(start, end);
}
int remove_section_mapping(unsigned long start, unsigned long end)
{
if (radix_enabled())
return -ENODEV;
return hash__remove_section_mapping(start, end);
}
#endif /* CONFIG_MEMORY_HOTPLUG */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment