The only callers of flush_instruction_cache() are:
arch/powerpc/kernel/swsusp_booke.S: bl flush_instruction_cache
arch/powerpc/mm/nohash/40x.c: flush_instruction_cache();
arch/powerpc/mm/nohash/44x.c: flush_instruction_cache();
arch/powerpc/mm/nohash/fsl_booke.c: flush_instruction_cache();
arch/powerpc/platforms/44x/machine_check.c: flush_instruction_cache();
arch/powerpc/platforms/44x/machine_check.c: flush_instruction_cache();
This function is not used by book3s/32, drop it.
Signed-off-by: Christophe Leroy <redacted>
---
arch/powerpc/kernel/misc_32.S | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
Nothing prevent flush_cache_instruction() from behing writen in C.
Do it to improve readability and maintainability.
Signed-off-by: Christophe Leroy <redacted>
---
arch/powerpc/kernel/misc_32.S | 17 -----------------
arch/powerpc/mm/nohash/fsl_booke.c | 16 ++++++++++++++++
2 files changed, 16 insertions(+), 17 deletions(-)
@@ -219,6 +219,22 @@ unsigned long __init mmu_mapin_ram(unsigned long base, unsigned long top)returntlbcam_addrs[tlbcam_index-1].limit-PAGE_OFFSET+1;}+voidflush_instruction_cache(void)+{+unsignedlongtmp;++if(IS_ENABLED(CONFIG_E200)){+tmp=mfspr(SPRN_L1CSR0);+tmp|=L1CSR0_CFI|L1CSR0_CLFC;+mtspr(SPRN_L1CSR0,tmp);+}else{+tmp=mfspr(SPRN_L1CSR1);+tmp|=L1CSR1_ICFI|L1CSR1_ICLFR;+mtspr(SPRN_L1CSR1,tmp);+}+isync();+}+/**MMU_init_hwdoesthechip-specificinitializationoftheMMUhardware.*/
flush_instruction_cache() is never used on 8xx, remove it.
Signed-off-by: Christophe Leroy <redacted>
---
arch/powerpc/mm/nohash/8xx.c | 7 -------
1 file changed, 7 deletions(-)
flush_instruction_cache() is a mixup of each PPC32 sub-arch.
Untangle it by making one complete function for each sub-arch.
This makes it a lot more readable and maintainable.
Signed-off-by: Christophe Leroy <redacted>
---
arch/powerpc/kernel/misc_32.S | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
@@ -290,18 +289,11 @@ _GLOBAL(flush_instruction_cache) mfspr r3,SPRN_L1CSR1 ori r3,r3,L1CSR1_ICFI|L1CSR1_ICLFR mtspr SPRN_L1CSR1,r3-#elif defined(CONFIG_PPC_BOOK3S_601)- blr /* for 601, do nothing */-#else- /* 603/604 processor - use invalidate-all bit in HID0 */- mfspr r3,SPRN_HID0- ori r3,r3,HID0_ICFI- mtspr SPRN_HID0,r3 #endif /* CONFIG_4xx */ isync blr EXPORT_SYMBOL(flush_instruction_cache)-#endif /* CONFIG_PPC_8xx */+#endif /* CONFIG_PPC_8xx || CONFIG_PPC_BOOK3S_32 */
What about untangling this into entirely separate versions instead
of the ifdef mess? Also the export does not seem to be needed at all.
Ok, I see that you do that later, sorry.
In v2, I drop the untangling patch, because the series completely
dismantles flush_instruction_cache() so there is no need for an
ephemeral untanggled version of it.
Christophe