Skip to content

Commit 6bfbf57

Browse files
committed
arm64: tlb: Introduce __tlbi_sync_s1ish_{kernel,batch}() for TLB maintenance
Add __tlbi_sync_s1ish_kernel() similar to __tlbi_sync_s1ish() and use it for kernel TLB maintenance. Also use this function in flush_tlb_all() which is only used in relation to kernel mappings. Subsequent patches can differentiate between workarounds that apply to user only or both user and kernel. A subsequent patch will add mm_struct to __tlbi_sync_s1ish(). Since arch_tlbbatch_flush() is not specific to an mm, add a corresponding __tlbi_sync_s1ish_batch() helper. Acked-by: Mark Rutland <[email protected]> Cc: Will Deacon <[email protected]> Reviewed-by: Will Deacon <[email protected]> Signed-off-by: Catalin Marinas <[email protected]>
1 parent 1f318b9 commit 6bfbf57

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

arch/arm64/include/asm/tlbflush.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,18 @@ static inline void __tlbi_sync_s1ish(void)
191191
__repeat_tlbi_sync(vale1is, 0);
192192
}
193193

194+
static inline void __tlbi_sync_s1ish_batch(void)
195+
{
196+
dsb(ish);
197+
__repeat_tlbi_sync(vale1is, 0);
198+
}
199+
200+
static inline void __tlbi_sync_s1ish_kernel(void)
201+
{
202+
dsb(ish);
203+
__repeat_tlbi_sync(vale1is, 0);
204+
}
205+
194206
/*
195207
* Complete broadcast TLB maintenance issued by hyp code which invalidates
196208
* stage 1 translation information in any translation regime.
@@ -299,7 +311,7 @@ static inline void flush_tlb_all(void)
299311
{
300312
dsb(ishst);
301313
__tlbi(vmalle1is);
302-
__tlbi_sync_s1ish();
314+
__tlbi_sync_s1ish_kernel();
303315
isb();
304316
}
305317

@@ -385,7 +397,7 @@ static inline bool arch_tlbbatch_should_defer(struct mm_struct *mm)
385397
*/
386398
static inline void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch *batch)
387399
{
388-
__tlbi_sync_s1ish();
400+
__tlbi_sync_s1ish_batch();
389401
}
390402

391403
/*
@@ -568,7 +580,7 @@ static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end
568580
dsb(ishst);
569581
__flush_tlb_range_op(vaale1is, start, pages, stride, 0,
570582
TLBI_TTL_UNKNOWN, false, lpa2_is_enabled());
571-
__tlbi_sync_s1ish();
583+
__tlbi_sync_s1ish_kernel();
572584
isb();
573585
}
574586

@@ -582,7 +594,7 @@ static inline void __flush_tlb_kernel_pgtable(unsigned long kaddr)
582594

583595
dsb(ishst);
584596
__tlbi(vaae1is, addr);
585-
__tlbi_sync_s1ish();
597+
__tlbi_sync_s1ish_kernel();
586598
isb();
587599
}
588600

0 commit comments

Comments
 (0)