1 // SPDX-License-Identifier: GPL-2.0 1 2 // Copyright (c) 2018, The Linux Foundation. A 3 4 #include <linux/spinlock.h> 5 #include <linux/export.h> 6 7 #include <asm/barrier.h> 8 #include <asm/krait-l2-accessors.h> 9 10 static DEFINE_RAW_SPINLOCK(krait_l2_lock); 11 12 void krait_set_l2_indirect_reg(u32 addr, u32 v 13 { 14 unsigned long flags; 15 16 raw_spin_lock_irqsave(&krait_l2_lock, 17 /* 18 * Select the L2 window by poking l2cp 19 * via l2cpdr. 20 */ 21 asm volatile ("mcr p15, 3, %0, c15, c0 22 isb(); 23 asm volatile ("mcr p15, 3, %0, c15, c0 24 isb(); 25 26 raw_spin_unlock_irqrestore(&krait_l2_l 27 } 28 EXPORT_SYMBOL(krait_set_l2_indirect_reg); 29 30 u32 krait_get_l2_indirect_reg(u32 addr) 31 { 32 u32 val; 33 unsigned long flags; 34 35 raw_spin_lock_irqsave(&krait_l2_lock, 36 /* 37 * Select the L2 window by poking l2cp 38 * via l2cpdr. 39 */ 40 asm volatile ("mcr p15, 3, %0, c15, c0 41 isb(); 42 asm volatile ("mrc p15, 3, %0, c15, c0 43 44 raw_spin_unlock_irqrestore(&krait_l2_l 45 46 return val; 47 } 48 EXPORT_SYMBOL(krait_get_l2_indirect_reg); 49
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.