diff mbox series

[v10,4/9] powerpc/mm: Remove empty hash__ functions

Message ID 20221109045112.187069-5-bgray@linux.ibm.com (mailing list archive)
State Accepted
Commit baf1ed24b27db475b38f534953885d0425e2232d
Headers show
Series powerpc/code-patching: Use temporary mm for Radix MMU | expand

Commit Message

Benjamin Gray Nov. 9, 2022, 4:51 a.m. UTC
The empty hash__* functions are unnecessary. The empty definitions were
introduced when 64-bit Hash support was added, as the functions were
still used in generic code. These empty definitions were prefixed with
hash__ when Radix support was added, and new wrappers with the original
names were added that selected the Radix or Hash version based on
radix_enabled().

But the hash__ prefixed functions were not part of a public interface,
so there is no need to include them for compatibility with anything.
Generic code will use the non-prefixed wrappers, and Hash specific code
will know that there is no point in calling them (or even worse, call
them and expect them to do something).

Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
---
v10:	* New in v10 for consistency with new functions
---
 .../include/asm/book3s/64/tlbflush-hash.h     | 28 -------------------
 arch/powerpc/include/asm/book3s/64/tlbflush.h | 27 ++++++------------
 2 files changed, 9 insertions(+), 46 deletions(-)

Comments

Christophe Leroy Nov. 9, 2022, 6:16 a.m. UTC | #1
Le 09/11/2022 à 05:51, Benjamin Gray a écrit :
> The empty hash__* functions are unnecessary. The empty definitions were
> introduced when 64-bit Hash support was added, as the functions were
> still used in generic code. These empty definitions were prefixed with
> hash__ when Radix support was added, and new wrappers with the original
> names were added that selected the Radix or Hash version based on
> radix_enabled().
> 
> But the hash__ prefixed functions were not part of a public interface,
> so there is no need to include them for compatibility with anything.
> Generic code will use the non-prefixed wrappers, and Hash specific code
> will know that there is no point in calling them (or even worse, call
> them and expect them to do something).
> 
> Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>

> ---
> v10:	* New in v10 for consistency with new functions
> ---
>   .../include/asm/book3s/64/tlbflush-hash.h     | 28 -------------------
>   arch/powerpc/include/asm/book3s/64/tlbflush.h | 27 ++++++------------
>   2 files changed, 9 insertions(+), 46 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush-hash.h b/arch/powerpc/include/asm/book3s/64/tlbflush-hash.h
> index 3c89e625e620..38d31c2489d3 100644
> --- a/arch/powerpc/include/asm/book3s/64/tlbflush-hash.h
> +++ b/arch/powerpc/include/asm/book3s/64/tlbflush-hash.h
> @@ -58,13 +58,6 @@ void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize, int ssize,
>   void flush_hash_range(unsigned long number, int local);
>   void flush_hash_hugepage(unsigned long vsid, unsigned long addr, pmd_t *pmdp,
>   			 unsigned int psize, int ssize, unsigned long flags);
> -static inline void hash__local_flush_tlb_mm(struct mm_struct *mm)
> -{
> -}
> -
> -static inline void hash__flush_tlb_mm(struct mm_struct *mm)
> -{
> -}
>   
>   static inline void hash__local_flush_all_mm(struct mm_struct *mm)
>   {
> @@ -88,27 +81,6 @@ static inline void hash__flush_all_mm(struct mm_struct *mm)
>   	WARN_ON_ONCE(1);
>   }
>   
> -static inline void hash__local_flush_tlb_page(struct vm_area_struct *vma,
> -					  unsigned long vmaddr)
> -{
> -}
> -
> -static inline void hash__flush_tlb_page(struct vm_area_struct *vma,
> -				    unsigned long vmaddr)
> -{
> -}
> -
> -static inline void hash__flush_tlb_range(struct vm_area_struct *vma,
> -				     unsigned long start, unsigned long end)
> -{
> -}
> -
> -static inline void hash__flush_tlb_kernel_range(unsigned long start,
> -					    unsigned long end)
> -{
> -}
> -
> -
>   struct mmu_gather;
>   void hash__tlb_flush(struct mmu_gather *tlb);
>   
> diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush.h b/arch/powerpc/include/asm/book3s/64/tlbflush.h
> index 67655cd60545..2254a40f0564 100644
> --- a/arch/powerpc/include/asm/book3s/64/tlbflush.h
> +++ b/arch/powerpc/include/asm/book3s/64/tlbflush.h
> @@ -47,8 +47,7 @@ static inline void flush_pmd_tlb_range(struct vm_area_struct *vma,
>   				       unsigned long start, unsigned long end)
>   {
>   	if (radix_enabled())
> -		return radix__flush_pmd_tlb_range(vma, start, end);
> -	return hash__flush_tlb_range(vma, start, end);
> +		radix__flush_pmd_tlb_range(vma, start, end);
>   }
>   
>   #define __HAVE_ARCH_FLUSH_HUGETLB_TLB_RANGE
> @@ -57,39 +56,34 @@ static inline void flush_hugetlb_tlb_range(struct vm_area_struct *vma,
>   					   unsigned long end)
>   {
>   	if (radix_enabled())
> -		return radix__flush_hugetlb_tlb_range(vma, start, end);
> -	return hash__flush_tlb_range(vma, start, end);
> +		radix__flush_hugetlb_tlb_range(vma, start, end);
>   }
>   
>   static inline void flush_tlb_range(struct vm_area_struct *vma,
>   				   unsigned long start, unsigned long end)
>   {
>   	if (radix_enabled())
> -		return radix__flush_tlb_range(vma, start, end);
> -	return hash__flush_tlb_range(vma, start, end);
> +		radix__flush_tlb_range(vma, start, end);
>   }
>   
>   static inline void flush_tlb_kernel_range(unsigned long start,
>   					  unsigned long end)
>   {
>   	if (radix_enabled())
> -		return radix__flush_tlb_kernel_range(start, end);
> -	return hash__flush_tlb_kernel_range(start, end);
> +		radix__flush_tlb_kernel_range(start, end);
>   }
>   
>   static inline void local_flush_tlb_mm(struct mm_struct *mm)
>   {
>   	if (radix_enabled())
> -		return radix__local_flush_tlb_mm(mm);
> -	return hash__local_flush_tlb_mm(mm);
> +		radix__local_flush_tlb_mm(mm);
>   }
>   
>   static inline void local_flush_tlb_page(struct vm_area_struct *vma,
>   					unsigned long vmaddr)
>   {
>   	if (radix_enabled())
> -		return radix__local_flush_tlb_page(vma, vmaddr);
> -	return hash__local_flush_tlb_page(vma, vmaddr);
> +		radix__local_flush_tlb_page(vma, vmaddr);
>   }
>   
>   static inline void local_flush_all_mm(struct mm_struct *mm)
> @@ -102,24 +96,21 @@ static inline void local_flush_all_mm(struct mm_struct *mm)
>   static inline void tlb_flush(struct mmu_gather *tlb)
>   {
>   	if (radix_enabled())
> -		return radix__tlb_flush(tlb);
> -	return hash__tlb_flush(tlb);
> +		radix__tlb_flush(tlb);
>   }
>   
>   #ifdef CONFIG_SMP
>   static inline void flush_tlb_mm(struct mm_struct *mm)
>   {
>   	if (radix_enabled())
> -		return radix__flush_tlb_mm(mm);
> -	return hash__flush_tlb_mm(mm);
> +		radix__flush_tlb_mm(mm);
>   }
>   
>   static inline void flush_tlb_page(struct vm_area_struct *vma,
>   				  unsigned long vmaddr)
>   {
>   	if (radix_enabled())
> -		return radix__flush_tlb_page(vma, vmaddr);
> -	return hash__flush_tlb_page(vma, vmaddr);
> +		radix__flush_tlb_page(vma, vmaddr);
>   }
>   
>   static inline void flush_all_mm(struct mm_struct *mm)
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush-hash.h b/arch/powerpc/include/asm/book3s/64/tlbflush-hash.h
index 3c89e625e620..38d31c2489d3 100644
--- a/arch/powerpc/include/asm/book3s/64/tlbflush-hash.h
+++ b/arch/powerpc/include/asm/book3s/64/tlbflush-hash.h
@@ -58,13 +58,6 @@  void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize, int ssize,
 void flush_hash_range(unsigned long number, int local);
 void flush_hash_hugepage(unsigned long vsid, unsigned long addr, pmd_t *pmdp,
 			 unsigned int psize, int ssize, unsigned long flags);
-static inline void hash__local_flush_tlb_mm(struct mm_struct *mm)
-{
-}
-
-static inline void hash__flush_tlb_mm(struct mm_struct *mm)
-{
-}
 
 static inline void hash__local_flush_all_mm(struct mm_struct *mm)
 {
@@ -88,27 +81,6 @@  static inline void hash__flush_all_mm(struct mm_struct *mm)
 	WARN_ON_ONCE(1);
 }
 
-static inline void hash__local_flush_tlb_page(struct vm_area_struct *vma,
-					  unsigned long vmaddr)
-{
-}
-
-static inline void hash__flush_tlb_page(struct vm_area_struct *vma,
-				    unsigned long vmaddr)
-{
-}
-
-static inline void hash__flush_tlb_range(struct vm_area_struct *vma,
-				     unsigned long start, unsigned long end)
-{
-}
-
-static inline void hash__flush_tlb_kernel_range(unsigned long start,
-					    unsigned long end)
-{
-}
-
-
 struct mmu_gather;
 void hash__tlb_flush(struct mmu_gather *tlb);
 
diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush.h b/arch/powerpc/include/asm/book3s/64/tlbflush.h
index 67655cd60545..2254a40f0564 100644
--- a/arch/powerpc/include/asm/book3s/64/tlbflush.h
+++ b/arch/powerpc/include/asm/book3s/64/tlbflush.h
@@ -47,8 +47,7 @@  static inline void flush_pmd_tlb_range(struct vm_area_struct *vma,
 				       unsigned long start, unsigned long end)
 {
 	if (radix_enabled())
-		return radix__flush_pmd_tlb_range(vma, start, end);
-	return hash__flush_tlb_range(vma, start, end);
+		radix__flush_pmd_tlb_range(vma, start, end);
 }
 
 #define __HAVE_ARCH_FLUSH_HUGETLB_TLB_RANGE
@@ -57,39 +56,34 @@  static inline void flush_hugetlb_tlb_range(struct vm_area_struct *vma,
 					   unsigned long end)
 {
 	if (radix_enabled())
-		return radix__flush_hugetlb_tlb_range(vma, start, end);
-	return hash__flush_tlb_range(vma, start, end);
+		radix__flush_hugetlb_tlb_range(vma, start, end);
 }
 
 static inline void flush_tlb_range(struct vm_area_struct *vma,
 				   unsigned long start, unsigned long end)
 {
 	if (radix_enabled())
-		return radix__flush_tlb_range(vma, start, end);
-	return hash__flush_tlb_range(vma, start, end);
+		radix__flush_tlb_range(vma, start, end);
 }
 
 static inline void flush_tlb_kernel_range(unsigned long start,
 					  unsigned long end)
 {
 	if (radix_enabled())
-		return radix__flush_tlb_kernel_range(start, end);
-	return hash__flush_tlb_kernel_range(start, end);
+		radix__flush_tlb_kernel_range(start, end);
 }
 
 static inline void local_flush_tlb_mm(struct mm_struct *mm)
 {
 	if (radix_enabled())
-		return radix__local_flush_tlb_mm(mm);
-	return hash__local_flush_tlb_mm(mm);
+		radix__local_flush_tlb_mm(mm);
 }
 
 static inline void local_flush_tlb_page(struct vm_area_struct *vma,
 					unsigned long vmaddr)
 {
 	if (radix_enabled())
-		return radix__local_flush_tlb_page(vma, vmaddr);
-	return hash__local_flush_tlb_page(vma, vmaddr);
+		radix__local_flush_tlb_page(vma, vmaddr);
 }
 
 static inline void local_flush_all_mm(struct mm_struct *mm)
@@ -102,24 +96,21 @@  static inline void local_flush_all_mm(struct mm_struct *mm)
 static inline void tlb_flush(struct mmu_gather *tlb)
 {
 	if (radix_enabled())
-		return radix__tlb_flush(tlb);
-	return hash__tlb_flush(tlb);
+		radix__tlb_flush(tlb);
 }
 
 #ifdef CONFIG_SMP
 static inline void flush_tlb_mm(struct mm_struct *mm)
 {
 	if (radix_enabled())
-		return radix__flush_tlb_mm(mm);
-	return hash__flush_tlb_mm(mm);
+		radix__flush_tlb_mm(mm);
 }
 
 static inline void flush_tlb_page(struct vm_area_struct *vma,
 				  unsigned long vmaddr)
 {
 	if (radix_enabled())
-		return radix__flush_tlb_page(vma, vmaddr);
-	return hash__flush_tlb_page(vma, vmaddr);
+		radix__flush_tlb_page(vma, vmaddr);
 }
 
 static inline void flush_all_mm(struct mm_struct *mm)