Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Introduce API for enabling & disabling L2 prefetch

Introduce new functions in struct bcache_ops to enable & disable L2
cache prefetching, and to retrieve the current state of L2 prefetching.
This will be used in later patches.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/11179/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Paul Burton and committed by
Ralf Baechle
37f2a174 c1a0e9bc

+27
+27
arch/mips/include/asm/bcache.h
··· 9 9 #ifndef _ASM_BCACHE_H 10 10 #define _ASM_BCACHE_H 11 11 12 + #include <linux/types.h> 12 13 13 14 /* Some R4000 / R4400 / R4600 / R5000 machines may have a non-dma-coherent, 14 15 chipset implemented caches. On machines with other CPUs the CPU does the ··· 19 18 void (*bc_disable)(void); 20 19 void (*bc_wback_inv)(unsigned long page, unsigned long size); 21 20 void (*bc_inv)(unsigned long page, unsigned long size); 21 + void (*bc_prefetch_enable)(void); 22 + void (*bc_prefetch_disable)(void); 23 + bool (*bc_prefetch_is_enabled)(void); 22 24 }; 23 25 24 26 extern void indy_sc_init(void); ··· 50 46 bcops->bc_inv(page, size); 51 47 } 52 48 49 + static inline void bc_prefetch_enable(void) 50 + { 51 + if (bcops->bc_prefetch_enable) 52 + bcops->bc_prefetch_enable(); 53 + } 54 + 55 + static inline void bc_prefetch_disable(void) 56 + { 57 + if (bcops->bc_prefetch_disable) 58 + bcops->bc_prefetch_disable(); 59 + } 60 + 61 + static inline bool bc_prefetch_is_enabled(void) 62 + { 63 + if (bcops->bc_prefetch_is_enabled) 64 + return bcops->bc_prefetch_is_enabled(); 65 + 66 + return false; 67 + } 68 + 53 69 #else /* !defined(CONFIG_BOARD_SCACHE) */ 54 70 55 71 /* Not R4000 / R4400 / R4600 / R5000. */ ··· 78 54 #define bc_disable() do { } while (0) 79 55 #define bc_wback_inv(page, size) do { } while (0) 80 56 #define bc_inv(page, size) do { } while (0) 57 + #define bc_prefetch_enable() do { } while (0) 58 + #define bc_prefetch_disable() do { } while (0) 59 + #define bc_prefetch_is_enabled() 0 81 60 82 61 #endif /* !defined(CONFIG_BOARD_SCACHE) */ 83 62