^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * License. See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 1994 - 2003, 06, 07 by Ralf Baechle (ralf@linux-mips.org)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (C) 2007 MIPS Technologies, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/fcntl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/linkage.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/syscalls.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/highmem.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/cacheflush.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/processor.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <asm/cpu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <asm/cpu-features.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <asm/setup.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /* Cache operations. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) void (*flush_cache_all)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) void (*__flush_cache_all)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) EXPORT_SYMBOL_GPL(__flush_cache_all);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) void (*flush_cache_mm)(struct mm_struct *mm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) void (*flush_cache_range)(struct vm_area_struct *vma, unsigned long start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) unsigned long end);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) unsigned long pfn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) void (*flush_icache_range)(unsigned long start, unsigned long end);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) EXPORT_SYMBOL_GPL(flush_icache_range);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) void (*local_flush_icache_range)(unsigned long start, unsigned long end);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) EXPORT_SYMBOL_GPL(local_flush_icache_range);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) void (*__flush_icache_user_range)(unsigned long start, unsigned long end);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) void (*__local_flush_icache_user_range)(unsigned long start, unsigned long end);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) EXPORT_SYMBOL_GPL(__local_flush_icache_user_range);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) void (*__flush_cache_vmap)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) void (*__flush_cache_vunmap)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) void (*__flush_kernel_vmap_range)(unsigned long vaddr, int size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) EXPORT_SYMBOL_GPL(__flush_kernel_vmap_range);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) /* MIPS specific cache operations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) void (*local_flush_data_cache_page)(void * addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) void (*flush_data_cache_page)(unsigned long addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) void (*flush_icache_all)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) EXPORT_SYMBOL_GPL(local_flush_data_cache_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) EXPORT_SYMBOL(flush_data_cache_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) EXPORT_SYMBOL(flush_icache_all);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #ifdef CONFIG_DMA_NONCOHERENT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) /* DMA cache operations. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) void (*_dma_cache_wback_inv)(unsigned long start, unsigned long size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) void (*_dma_cache_wback)(unsigned long start, unsigned long size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) void (*_dma_cache_inv)(unsigned long start, unsigned long size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #endif /* CONFIG_DMA_NONCOHERENT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) * We could optimize the case where the cache argument is not BCACHE but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * that seems very atypical use ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) SYSCALL_DEFINE3(cacheflush, unsigned long, addr, unsigned long, bytes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) unsigned int, cache)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) if (bytes == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) if (!access_ok((void __user *) addr, bytes))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) __flush_icache_user_range(addr, addr + bytes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) void __flush_dcache_page(struct page *page)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) struct address_space *mapping = page_mapping_file(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) unsigned long addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) if (mapping && !mapping_mapped(mapping)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) SetPageDcacheDirty(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * We could delay the flush for the !page_mapping case too. But that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * case is for exec env/arg pages and those are %99 certainly going to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) * get faulted into the tlb (and thus flushed) anyways.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) if (PageHighMem(page))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) addr = (unsigned long)kmap_atomic(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) addr = (unsigned long)page_address(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) flush_data_cache_page(addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) if (PageHighMem(page))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) kunmap_atomic((void *)addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) EXPORT_SYMBOL(__flush_dcache_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) void __flush_anon_page(struct page *page, unsigned long vmaddr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) unsigned long addr = (unsigned long) page_address(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) if (pages_do_alias(addr, vmaddr)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) if (page_mapcount(page) && !Page_dcache_dirty(page)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) void *kaddr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) kaddr = kmap_coherent(page, vmaddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) flush_data_cache_page((unsigned long)kaddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) kunmap_coherent();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) } else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) flush_data_cache_page(addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) EXPORT_SYMBOL(__flush_anon_page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) void __update_cache(unsigned long address, pte_t pte)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) struct page *page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) unsigned long pfn, addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) int exec = !pte_no_exec(pte) && !cpu_has_ic_fills_f_dc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) pfn = pte_pfn(pte);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) if (unlikely(!pfn_valid(pfn)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) page = pfn_to_page(pfn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) if (Page_dcache_dirty(page)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) if (PageHighMem(page))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) addr = (unsigned long)kmap_atomic(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) addr = (unsigned long)page_address(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) if (exec || pages_do_alias(addr, address & PAGE_MASK))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) flush_data_cache_page(addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) if (PageHighMem(page))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) kunmap_atomic((void *)addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) ClearPageDcacheDirty(page);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) unsigned long _page_cachable_default;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) EXPORT_SYMBOL(_page_cachable_default);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) static inline void setup_protection_map(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) if (cpu_has_rixi) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) protection_map[0] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) protection_map[1] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) protection_map[2] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) protection_map[3] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) protection_map[4] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) protection_map[5] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) protection_map[6] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) protection_map[7] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) protection_map[8] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) protection_map[9] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) protection_map[10] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE | _PAGE_NO_READ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) protection_map[11] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) protection_map[12] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) protection_map[13] = __pgprot(_page_cachable_default | _PAGE_PRESENT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) protection_map[14] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) protection_map[15] = __pgprot(_page_cachable_default | _PAGE_PRESENT | _PAGE_WRITE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) protection_map[0] = PAGE_NONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) protection_map[1] = PAGE_READONLY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) protection_map[2] = PAGE_COPY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) protection_map[3] = PAGE_COPY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) protection_map[4] = PAGE_READONLY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) protection_map[5] = PAGE_READONLY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) protection_map[6] = PAGE_COPY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) protection_map[7] = PAGE_COPY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) protection_map[8] = PAGE_NONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) protection_map[9] = PAGE_READONLY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) protection_map[10] = PAGE_SHARED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) protection_map[11] = PAGE_SHARED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) protection_map[12] = PAGE_READONLY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) protection_map[13] = PAGE_READONLY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) protection_map[14] = PAGE_SHARED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) protection_map[15] = PAGE_SHARED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) void cpu_cache_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) if (cpu_has_3k_cache) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) extern void __weak r3k_cache_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) r3k_cache_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) if (cpu_has_6k_cache) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) extern void __weak r6k_cache_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) r6k_cache_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) if (cpu_has_4k_cache) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) extern void __weak r4k_cache_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) r4k_cache_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) if (cpu_has_8k_cache) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) extern void __weak r8k_cache_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) r8k_cache_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) if (cpu_has_tx39_cache) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) extern void __weak tx39_cache_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) tx39_cache_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) if (cpu_has_octeon_cache) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) extern void __weak octeon_cache_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) octeon_cache_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) setup_protection_map();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) int __weak __uncached_access(struct file *file, unsigned long addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) if (file->f_flags & O_DSYNC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) return addr >= __pa(high_memory);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) }