Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #ifndef _PARISC_TLBFLUSH_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define _PARISC_TLBFLUSH_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) /* TLB flushing routines.... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <asm/mmu_context.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) extern void flush_tlb_all(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) extern void flush_tlb_all_local(void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define smp_flush_tlb_all()	flush_tlb_all()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) int __flush_tlb_range(unsigned long sid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	unsigned long start, unsigned long end);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define flush_tlb_range(vma, start, end) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	__flush_tlb_range((vma)->vm_mm->context, start, end)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define flush_tlb_kernel_range(start, end) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	__flush_tlb_range(0, start, end)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  * flush_tlb_mm()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)  * The code to switch to a new context is NOT valid for processes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)  * which play with the space id's.  Thus, we have to preserve the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)  * space and just flush the entire tlb.  However, the compilers,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)  * dynamic linker, etc, do not manipulate space id's, so there
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)  * could be a significant performance benefit in switching contexts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)  * and not flushing the whole tlb.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) static inline void flush_tlb_mm(struct mm_struct *mm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	BUG_ON(mm == &init_mm); /* Should never happen */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #if 1 || defined(CONFIG_SMP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	/* Except for very small threads, flushing the whole TLB is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	 * faster than using __flush_tlb_range.  The pdtlb and pitlb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	 * instructions are very slow because of the TLB broadcast.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	 * It might be faster to do local range flushes on all CPUs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	 * on PA 2.0 systems.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	flush_tlb_all();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	/* FIXME: currently broken, causing space id and protection ids
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	 * to go out of sync, resulting in faults on userspace accesses.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	 * This approach needs further investigation since running many
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	 * small applications (e.g., GCC testsuite) is faster on HP-UX.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	if (mm) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 		if (mm->context != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 			free_sid(mm->context);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 		mm->context = alloc_sid();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 		if (mm == current->active_mm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 			load_context(mm->context);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) static inline void flush_tlb_page(struct vm_area_struct *vma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	unsigned long addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	purge_tlb_entries(vma->vm_mm, addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #endif