Skip to content

Commit dffaac4

Browse files
Vladimir IsaevVVIsaev
authored andcommitted
ARC: Flush SCM when PTW uncached is configured
Page Table Walker (PTW) may be configured to use memory only. It requires each page pointer to be flushed before it can be used by hardware PTW. Since we have SCM (L2) now we need to flush it as well. Signed-off-by: Vladimir Isaev <isaev@synopsys.com>
1 parent 7e6cbb0 commit dffaac4

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

arch/arc/include/asm/cluster.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,5 +156,6 @@ static inline void arc_cln_write_reg(unsigned int reg, unsigned int data)
156156

157157
void arc_cluster_mumbojumbo(void);
158158
void arc_cluster_scm_enable(void);
159+
void arc_cluster_scm_flush_range(phys_addr_t low, phys_addr_t high);
159160

160161
#endif /* _ASM_ARC_CLUSTER_H */

arch/arc/mm/cache-arcv3.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ static struct cpuinfo_arc_cache {
1414
unsigned int sz_k, line_len, colors;
1515
} ic, dc, l2_info;
1616

17+
#define ARC_L2_CONFIGURED (l2_info.sz_k && l2_enable)
18+
1719
static int read_decode_cache_bcr_arcv3(int c, char *buf, int len)
1820
{
1921
struct cpuinfo_arc_cache *p_l2 = &l2_info;
@@ -103,7 +105,7 @@ void __ref arc_cache_init(void)
103105
{
104106
unsigned int __maybe_unused cpu = smp_processor_id();
105107

106-
if (cpu == 0 && l2_info.sz_k && l2_enable)
108+
if (cpu == 0 && ARC_L2_CONFIGURED)
107109
arc_cluster_scm_enable();
108110
}
109111

@@ -284,6 +286,8 @@ void ptw_flush(void *xp)
284286
#else
285287
write_aux_reg(ARC_REG_DC_IVDL, __pa(xp));
286288
#endif
289+
if (ARC_L2_CONFIGURED)
290+
arc_cluster_scm_flush_range(__pa(xp), __pa(xp));
287291
#endif
288292
}
289293

arch/arc/mm/cluster.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,18 @@ void arc_cluster_scm_enable()
4040

4141
arc_cln_write_reg(ARC_CLN_CACHE_STATUS, ARC_CLN_CACHE_STATUS_EN);
4242
}
43+
44+
void arc_cluster_scm_flush_range(phys_addr_t low, phys_addr_t high)
45+
{
46+
arc_cln_write_reg(ARC_CLN_CACHE_ADDR_LO0, (u32) low);
47+
arc_cln_write_reg(ARC_CLN_CACHE_ADDR_LO1, (u64) low >> 32);
48+
49+
arc_cln_write_reg(ARC_CLN_CACHE_ADDR_HI0, (u32) high);
50+
arc_cln_write_reg(ARC_CLN_CACHE_ADDR_HI1, (u64) high >> 32);
51+
52+
arc_cln_write_reg(ARC_CLN_CACHE_CMD, ARC_CLN_CACHE_CMD_OP_ADDR_CLN);
53+
54+
while (arc_cln_read_reg(ARC_CLN_CACHE_STATUS) &
55+
ARC_CLN_CACHE_STATUS_BUSY)
56+
;
57+
}

0 commit comments

Comments
 (0)