Skip to content

Commit e735b98

Browse files
Zhenyu Yectmarinas
authored andcommitted
arm64: Add tlbi_user_level TLB invalidation helper
Add a level-hinted parameter to __tlbi_user, which only gets used if ARMv8.4-TTL gets detected. ARMv8.4-TTL provides the TTL field in tlbi instruction to indicate the level of translation table walk holding the leaf entry for the address that is being invalidated. This patch set the default level value of flush_tlb_range() to 0, which will be updated in future patches. And set the ttl value of flush_tlb_page_nosync() to 3 because it is only called to flush a single pte page. Signed-off-by: Zhenyu Ye <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent c10bc62 commit e735b98

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

arch/arm64/include/asm/tlbflush.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@
104104
__tlbi(op, arg); \
105105
} while(0)
106106

107+
#define __tlbi_user_level(op, arg, level) do { \
108+
if (arm64_kernel_unmapped_at_el0()) \
109+
__tlbi_level(op, (arg | USER_ASID_FLAG), level); \
110+
} while (0)
111+
107112
/*
108113
* TLB Invalidation
109114
* ================
@@ -205,8 +210,9 @@ static inline void flush_tlb_page_nosync(struct vm_area_struct *vma,
205210
unsigned long addr = __TLBI_VADDR(uaddr, ASID(vma->vm_mm));
206211

207212
dsb(ishst);
208-
__tlbi(vale1is, addr);
209-
__tlbi_user(vale1is, addr);
213+
/* This function is only called on a small page */
214+
__tlbi_level(vale1is, addr, 3);
215+
__tlbi_user_level(vale1is, addr, 3);
210216
}
211217

212218
static inline void flush_tlb_page(struct vm_area_struct *vma,
@@ -246,11 +252,11 @@ static inline void __flush_tlb_range(struct vm_area_struct *vma,
246252
dsb(ishst);
247253
for (addr = start; addr < end; addr += stride) {
248254
if (last_level) {
249-
__tlbi(vale1is, addr);
250-
__tlbi_user(vale1is, addr);
255+
__tlbi_level(vale1is, addr, 0);
256+
__tlbi_user_level(vale1is, addr, 0);
251257
} else {
252-
__tlbi(vae1is, addr);
253-
__tlbi_user(vae1is, addr);
258+
__tlbi_level(vae1is, addr, 0);
259+
__tlbi_user_level(vae1is, addr, 0);
254260
}
255261
}
256262
dsb(ish);

0 commit comments

Comments
 (0)