Skip to content

Commit 77ce0e7

Browse files
GT119119KexyBiscuit
authored andcommitted
FROMLIST: LoongArch: Update the flush cache policy
fix when LoongArch s3 resume, Can't find image information Signed-off-by: Li Jun <[email protected]> Signed-off-by: Baoqi Zhang <[email protected]> Signed-off-by: Jianmin Lv <[email protected]> Signed-off-by: Biao Dong <[email protected]> Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Kexy Biscuit <[email protected]>
1 parent 9535c8f commit 77ce0e7

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

arch/loongarch/mm/cache.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,27 @@ static void flush_cache_leaf(unsigned int leaf)
6363
} while (--nr_nodes > 0);
6464
}
6565

66+
static void flush_cache_last_level(unsigned int leaf)
67+
{
68+
u64 addr;
69+
int i, j, nr_nodes;
70+
struct cache_desc *cdesc = current_cpu_data.cache_leaves + leaf;
71+
72+
nr_nodes = loongson_sysconf.nr_nodes;
73+
74+
addr = CSR_DMW1_BASE;
75+
iocsr_write32(0x1, 0x280);
76+
do {
77+
for (i = 0; i < (cdesc->ways * 3); i++) {
78+
for (j = 0; j < (cdesc->sets); j++) {
79+
*(volatile u32 *)addr;
80+
addr += cdesc->linesz;
81+
}
82+
}
83+
addr += 0x100000000000;
84+
} while (--nr_nodes > 0);
85+
}
86+
6687
asmlinkage __visible void __flush_cache_all(void)
6788
{
6889
int leaf;
@@ -71,7 +92,7 @@ asmlinkage __visible void __flush_cache_all(void)
7192

7293
leaf = cache_present - 1;
7394
if (cache_inclusive(cdesc + leaf)) {
74-
flush_cache_leaf(leaf);
95+
flush_cache_last_level(leaf);
7596
return;
7697
}
7798

0 commit comments

Comments
 (0)