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 _ALPHA_CACHEFLUSH_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define _ALPHA_CACHEFLUSH_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) /* Note that the following two definitions are _highly_ dependent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)    on the contexts in which they are used in the kernel.  I personally
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)    think it is criminal how loosely defined these macros are.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) /* We need to flush the kernel's icache after loading modules.  The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)    only other use of this macro is in load_aout_interp which is not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)    used on Alpha. 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)    Note that this definition should *not* be used for userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)    icache flushing.  While functional, it is _way_ overkill.  The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)    icache is tagged with ASNs and it suffices to allocate a new ASN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)    for the process.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #ifndef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define flush_icache_range(start, end)		imb()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define flush_icache_range(start, end)		smp_imb()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) extern void smp_imb(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /* We need to flush the userspace icache after setting breakpoints in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)    ptrace.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)    Instead of indiscriminately using imb, take advantage of the fact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)    that icache entries are tagged with the ASN and load a new mm context.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /* ??? Ought to use this in arch/alpha/kernel/signal.c too.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #ifndef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) extern void __load_new_mm_context(struct mm_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) flush_icache_user_page(struct vm_area_struct *vma, struct page *page,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 			unsigned long addr, int len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	if (vma->vm_flags & VM_EXEC) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 		struct mm_struct *mm = vma->vm_mm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 		if (current->active_mm == mm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 			__load_new_mm_context(mm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 			mm->context[smp_processor_id()] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #define flush_icache_user_page flush_icache_user_page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #else /* CONFIG_SMP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) extern void flush_icache_user_page(struct vm_area_struct *vma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 		struct page *page, unsigned long addr, int len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #define flush_icache_user_page flush_icache_user_page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #endif /* CONFIG_SMP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) /* This is used only in __do_fault and do_swap_page.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #define flush_icache_page(vma, page) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	flush_icache_user_page((vma), (page), 0, 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #include <asm-generic/cacheflush.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #endif /* _ALPHA_CACHEFLUSH_H */