Skip to content

Commit 274d842

Browse files
BenjaminGrayNp1mpe
authored andcommitted
powerpc/tlb: Add local flush for page given mm_struct and psize
Adds a local TLB flush operation that works given an mm_struct, VA to flush, and page size representation. Most implementations mirror the surrounding code. The book3s/32/tlbflush.h implementation is left as a BUILD_BUG because it is more complicated and not required for anything as yet. This removes the need to create a vm_area_struct, which the temporary patching mm work does not need. Signed-off-by: Benjamin Gray <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d34471c commit 274d842

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

arch/powerpc/include/asm/book3s/32/tlbflush.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#ifndef _ASM_POWERPC_BOOK3S_32_TLBFLUSH_H
33
#define _ASM_POWERPC_BOOK3S_32_TLBFLUSH_H
44

5+
#include <linux/build_bug.h>
6+
57
#define MMU_NO_CONTEXT (0)
68
/*
79
* TLB flushing for "classic" hash-MMU 32-bit CPUs, 6xx, 7xx, 7xxx
@@ -74,6 +76,13 @@ static inline void local_flush_tlb_page(struct vm_area_struct *vma,
7476
{
7577
flush_tlb_page(vma, vmaddr);
7678
}
79+
80+
static inline void local_flush_tlb_page_psize(struct mm_struct *mm,
81+
unsigned long vmaddr, int psize)
82+
{
83+
BUILD_BUG();
84+
}
85+
7786
static inline void local_flush_tlb_mm(struct mm_struct *mm)
7887
{
7988
flush_tlb_mm(mm);

arch/powerpc/include/asm/book3s/64/tlbflush.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ static inline void local_flush_tlb_page(struct vm_area_struct *vma,
8686
radix__local_flush_tlb_page(vma, vmaddr);
8787
}
8888

89+
static inline void local_flush_tlb_page_psize(struct mm_struct *mm,
90+
unsigned long vmaddr, int psize)
91+
{
92+
if (radix_enabled())
93+
radix__local_flush_tlb_page_psize(mm, vmaddr, psize);
94+
}
95+
8996
static inline void tlb_flush(struct mmu_gather *tlb)
9097
{
9198
if (radix_enabled())

arch/powerpc/include/asm/nohash/tlbflush.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ static inline void local_flush_tlb_page(struct vm_area_struct *vma, unsigned lon
4545
asm volatile ("tlbie %0; sync" : : "r" (vmaddr) : "memory");
4646
}
4747

48+
static inline void local_flush_tlb_page_psize(struct mm_struct *mm,
49+
unsigned long vmaddr, int psize)
50+
{
51+
asm volatile ("tlbie %0; sync" : : "r" (vmaddr) : "memory");
52+
}
53+
4854
static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end)
4955
{
5056
start &= PAGE_MASK;
@@ -58,6 +64,7 @@ static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end
5864
extern void flush_tlb_kernel_range(unsigned long start, unsigned long end);
5965
extern void local_flush_tlb_mm(struct mm_struct *mm);
6066
extern void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
67+
void local_flush_tlb_page_psize(struct mm_struct *mm, unsigned long vmaddr, int psize);
6168

6269
extern void __local_flush_tlb_page(struct mm_struct *mm, unsigned long vmaddr,
6370
int tsize, int ind);

arch/powerpc/mm/nohash/tlb.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,14 @@ void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
184184
mmu_get_tsize(mmu_virtual_psize), 0);
185185
}
186186
EXPORT_SYMBOL(local_flush_tlb_page);
187+
188+
void local_flush_tlb_page_psize(struct mm_struct *mm,
189+
unsigned long vmaddr, int psize)
190+
{
191+
__local_flush_tlb_page(mm, vmaddr, mmu_get_tsize(psize), 0);
192+
}
193+
EXPORT_SYMBOL(local_flush_tlb_page_psize);
194+
187195
#endif
188196

189197
/*

0 commit comments

Comments
 (0)