Skip to content

Commit 704dfe9

Browse files
chleroympe
authored andcommitted
powerpc: Rewrite FSL_BOOKE flush_cache_instruction() in C
Nothing prevents flush_cache_instruction() from being writen in C. Do it to improve readability and maintainability. This function is only use by low level callers, it is not intended to be used by module. Don't export it. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/f989eff8296800c427622c0985384148404e4f0b.1597384512.git.christophe.leroy@csgroup.eu
1 parent de39b19 commit 704dfe9

2 files changed

Lines changed: 16 additions & 22 deletions

File tree

‎arch/powerpc/kernel/misc_32.S‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -255,28 +255,6 @@ _ASM_NOKPROBE_SYMBOL(real_writeb)
255255

256256
#endif /* CONFIG_40x */
257257

258-
259-
/*
260-
* Flush instruction cache.
261-
*/
262-
#ifdef CONFIG_FSL_BOOKE
263-
_GLOBAL(flush_instruction_cache)
264-
#ifdef CONFIG_E200
265-
mfspr r3,SPRN_L1CSR0
266-
ori r3,r3,L1CSR0_CFI|L1CSR0_CLFC
267-
/* msync; isync recommended here */
268-
mtspr SPRN_L1CSR0,r3
269-
isync
270-
blr
271-
#endif
272-
mfspr r3,SPRN_L1CSR1
273-
ori r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR
274-
mtspr SPRN_L1CSR1,r3
275-
isync
276-
blr
277-
EXPORT_SYMBOL(flush_instruction_cache)
278-
#endif
279-
280258
/*
281259
* Copy a whole page. We use the dcbz instruction on the destination
282260
* to reduce memory traffic (it eliminates the unnecessary reads of

‎arch/powerpc/mm/nohash/fsl_booke.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,22 @@ unsigned long __init mmu_mapin_ram(unsigned long base, unsigned long top)
219219
return tlbcam_addrs[tlbcam_index - 1].limit - PAGE_OFFSET + 1;
220220
}
221221

222+
void flush_instruction_cache(void)
223+
{
224+
unsigned long tmp;
225+
226+
if (IS_ENABLED(CONFIG_E200)) {
227+
tmp = mfspr(SPRN_L1CSR0);
228+
tmp |= L1CSR0_CFI | L1CSR0_CLFC;
229+
mtspr(SPRN_L1CSR0, tmp);
230+
} else {
231+
tmp = mfspr(SPRN_L1CSR1);
232+
tmp |= L1CSR1_ICFI | L1CSR1_ICLFR;
233+
mtspr(SPRN_L1CSR1, tmp);
234+
}
235+
isync();
236+
}
237+
222238
/*
223239
* MMU_init_hw does the chip-specific initialization of the MMU hardware.
224240
*/

0 commit comments

Comments
 (0)