diff mbox

[v3,2/5] powerpc/mm: refactor {create, remove}_section_mapping()

Message ID 1481831443-22761-3-git-send-email-arbab@linux.vnet.ibm.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Reza Arbab Dec. 15, 2016, 7:50 p.m. UTC
Change {create,remove}_section_mapping() to be wrappers around functions
prefixed with "hash__".

This is preparation for the addition of their "radix__" variants. No
functional change.

Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/book3s/64/hash.h |  5 +++++
 arch/powerpc/mm/hash_utils_64.c           |  4 ++--
 arch/powerpc/mm/pgtable-book3s64.c        | 18 ++++++++++++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)

Comments

Aneesh Kumar K.V Dec. 19, 2016, 9 a.m. UTC | #1
Reza Arbab <arbab@linux.vnet.ibm.com> writes:

> Change {create,remove}_section_mapping() to be wrappers around functions
> prefixed with "hash__".
>
> This is preparation for the addition of their "radix__" variants. No
> functional change.
>

I think this can go upstream now ? To fixup broken hotplug with radix ?

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

> Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
> ---
>  arch/powerpc/include/asm/book3s/64/hash.h |  5 +++++
>  arch/powerpc/mm/hash_utils_64.c           |  4 ++--
>  arch/powerpc/mm/pgtable-book3s64.c        | 18 ++++++++++++++++++
>  3 files changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/hash.h b/arch/powerpc/include/asm/book3s/64/hash.h
> index f61cad3..dd90574 100644
> --- a/arch/powerpc/include/asm/book3s/64/hash.h
> +++ b/arch/powerpc/include/asm/book3s/64/hash.h
> @@ -201,6 +201,11 @@ extern int __meminit hash__vmemmap_create_mapping(unsigned long start,
>  					      unsigned long phys);
>  extern void hash__vmemmap_remove_mapping(unsigned long start,
>  				     unsigned long page_size);
> +
> +#ifdef CONFIG_MEMORY_HOTPLUG
> +int hash__create_section_mapping(unsigned long start, unsigned long end);
> +int hash__remove_section_mapping(unsigned long start, unsigned long end);
> +#endif /* CONFIG_MEMORY_HOTPLUG */
>  #endif /* !__ASSEMBLY__ */
>  #endif /* __KERNEL__ */
>  #endif /* _ASM_POWERPC_BOOK3S_64_HASH_H */
> diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
> index b9a062f..96a4fb7 100644
> --- a/arch/powerpc/mm/hash_utils_64.c
> +++ b/arch/powerpc/mm/hash_utils_64.c
> @@ -743,7 +743,7 @@ static unsigned long __init htab_get_table_size(void)
>  }
>
>  #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),
>  				   pgprot_val(PAGE_KERNEL), mmu_linear_psize,
> @@ -757,7 +757,7 @@ int create_section_mapping(unsigned long start, unsigned long end)
>  	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,
>  				     mmu_kernel_ssize);
> diff --git a/arch/powerpc/mm/pgtable-book3s64.c b/arch/powerpc/mm/pgtable-book3s64.c
> index ebf9782..653ff6c 100644
> --- a/arch/powerpc/mm/pgtable-book3s64.c
> +++ b/arch/powerpc/mm/pgtable-book3s64.c
> @@ -126,3 +126,21 @@ void mmu_cleanup_all(void)
>  	else if (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 */
> -- 
> 1.8.3.1
Reza Arbab Dec. 19, 2016, 6 p.m. UTC | #2
On Mon, Dec 19, 2016 at 02:30:28PM +0530, Aneesh Kumar K.V wrote:
>Reza Arbab <arbab@linux.vnet.ibm.com> writes:
>> Change {create,remove}_section_mapping() to be wrappers around 
>> functions prefixed with "hash__".
>>
>> This is preparation for the addition of their "radix__" variants. No
>> functional change.
>>
>
>I think this can go upstream now ? To fixup broken hotplug with radix ?

Yes, this one might be worth separating as a fix for the BUG() on radix.
Balbir Singh Dec. 20, 2016, 5:26 a.m. UTC | #3
On 12/16/2016 06:50 AM, Reza Arbab wrote:
> Change {create,remove}_section_mapping() to be wrappers around functions
> prefixed with "hash__".
>
> This is preparation for the addition of their "radix__" variants. No
> functional change.
>
> Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>

Acked-by: Balbir Singh <bsingharora@gmail.com>
diff mbox

Patch

diff --git a/arch/powerpc/include/asm/book3s/64/hash.h b/arch/powerpc/include/asm/book3s/64/hash.h
index f61cad3..dd90574 100644
--- a/arch/powerpc/include/asm/book3s/64/hash.h
+++ b/arch/powerpc/include/asm/book3s/64/hash.h
@@ -201,6 +201,11 @@  extern int __meminit hash__vmemmap_create_mapping(unsigned long start,
 					      unsigned long phys);
 extern void hash__vmemmap_remove_mapping(unsigned long start,
 				     unsigned long page_size);
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+int hash__create_section_mapping(unsigned long start, unsigned long end);
+int hash__remove_section_mapping(unsigned long start, unsigned long end);
+#endif /* CONFIG_MEMORY_HOTPLUG */
 #endif /* !__ASSEMBLY__ */
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_BOOK3S_64_HASH_H */
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index b9a062f..96a4fb7 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -743,7 +743,7 @@  static unsigned long __init htab_get_table_size(void)
 }
 
 #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),
 				   pgprot_val(PAGE_KERNEL), mmu_linear_psize,
@@ -757,7 +757,7 @@  int create_section_mapping(unsigned long start, unsigned long end)
 	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,
 				     mmu_kernel_ssize);
diff --git a/arch/powerpc/mm/pgtable-book3s64.c b/arch/powerpc/mm/pgtable-book3s64.c
index ebf9782..653ff6c 100644
--- a/arch/powerpc/mm/pgtable-book3s64.c
+++ b/arch/powerpc/mm/pgtable-book3s64.c
@@ -126,3 +126,21 @@  void mmu_cleanup_all(void)
 	else if (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 */