mm: fix exec activate_mm vs TLB shootdown and lazy tlb switching race
[linux/fpc-iii.git] / arch / cris / arch-v32 / mm / l2cache.c
blob4fef321d5606fd4837b4ebbc803bb05e82357f19
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/init.h>
3 #include <linux/kernel.h>
4 #include <linux/string.h>
5 #include <memmap.h>
6 #include <hwregs/reg_map.h>
7 #include <hwregs/reg_rdwr.h>
8 #include <hwregs/l2cache_defs.h>
9 #include <asm/io.h>
11 #define L2CACHE_SIZE 64
13 int __init l2cache_init(void)
15 reg_l2cache_rw_ctrl ctrl = {0};
16 reg_l2cache_rw_cfg cfg = {.en = regk_l2cache_yes};
18 ctrl.csize = L2CACHE_SIZE;
19 ctrl.cbase = L2CACHE_SIZE / 4 + (L2CACHE_SIZE % 4 ? 1 : 0);
20 REG_WR(l2cache, regi_l2cache, rw_ctrl, ctrl);
22 /* Flush the tag memory */
23 memset((void *)(MEM_INTMEM_START | MEM_NON_CACHEABLE), 0, 2*1024);
25 /* Enable the cache */
26 REG_WR(l2cache, regi_l2cache, rw_cfg, cfg);
28 return 0;