csky: Fixup cpu speculative execution to IO area
[email protected]
maintainerPATCH 1/1 csky: Fixup cpu speculative execution to IO area
From: Guo Ren <[email protected]>
For the memory size ( > 512MB, < 1GB), the MSA setting is:
- SSEG0: PHY_START , PHY_START + 512MB
- SSEG1: PHY_START + 512MB, PHY_START + 1GB
But the real memory is no more than 1GB, there is a gap between the end size of memory and border of 1GB. CPU could speculatively execute to that gap and if the gap of the bus couldn't respond to the CPU request, then the crash will happen.
Now make the setting with:
- SSEG0: PHY_START , PHY_START + 512MB (no change)
- SSEG1: Disabled (We use highmem to use the memory of 512MB~1GB)
We also deprecated zhole_szie[] settings, it's only used by arm style CPUs. All memory gap should use Reserved setting of dts in csky system.
--- arch/csky/abiv1/inc/abi/entry.h | 5 +-- arch/csky/abiv2/inc/abi/entry.h | 7 ++-- arch/csky/kernel/head.S | 5 +++ arch/csky/kernel/setup.c | 63 ++++++++------------------------- arch/csky/kernel/smp.c | 3 ++ 5 files changed, 25 insertions(+), 58 deletions(-)
arch/csky/abiv1/inc/abi/entry.h +1 -4
@@ -172,10 +172,7 @@ addi r6, 0xe cpwcr r6, cpcr30 - lsri r6, 28 - addi r6, 2 - lsli r6, 28 - addi r6, 0xe + movi r6, 0 cpwcr r6, cpcr31 .endm
arch/csky/abiv2/inc/abi/entry.h +2 -5
@@ -290,11 +290,8 @@ addi r6, 0x1ce mtcr r6, cr<30, 15> /* Set MSA0 */ - lsri r6, 28 - addi r6, 2 - lsli r6, 28 - addi r6, 0x1ce - mtcr r6, cr<31, 15> /* Set MSA1 */ + movi r6, 0 + mtcr r6, cr<31, 15> /* Clr MSA1 *//* enable MMU */ mfcr r6, cr18
arch/csky/kernel/head.S +5 -0
@@ -21,6 +21,11 @@ END(_start) ENTRY(_start_smp_secondary) SETUP_MMU + /* copy msa1 from CPU0 */ + lrw r6, secondary_msa1 + ld.w r6, (r6, 0) + mtcr r6, cr<31, 15> + /* set stack point */ lrw r6, secondary_stack ld.w r6, (r6, 0)
arch/csky/kernel/setup.c +14 -49
94 lines not on this page · raw message
arch/csky/kernel/smp.c +3 -0
@@ -159,6 +159,8 @@ volatile unsigned int secondary_hint;volatile unsigned int secondary_ccr;volatile unsigned int secondary_stack; +unsigned long secondary_msa1; +int __cpu_up (unsigned int cpu,struct task_struct *tidle) {unsigned long mask =1 << cpu;
@@ -167,6 +169,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) (unsigned int )task_stack_page (tidle) +THREAD_SIZE -8 ; secondary_hint =mfcr ("cr31" ); secondary_ccr =mfcr ("cr18" ); + secondary_msa1 =read_mmu_msa1 ();/* * Because other CPUs are in reset status, we must flush data
Signature · 1 line
2.17.0