MIPS: switch BMIPS5000 to use r4k_wait_irqoff()
PATCH 1/1 MIPS: switch BMIPS5000 to use r4k_wait_irqoff()
BCM7425 CPU Interface Zephyr Processor, pages 5-309 and 5-310 BCM7428B0 CPU Interface Zephyr Processor, pages 5-337 and 5-338
WAIT instruction:
Thread enters wait state. No instructions are executed until an interrupt occurs. The processor's clocks are stopped if both threads are in idle mode.
Description:
Execution of this instruction puts the thread into wait state, an idle mode in which no instructions are fetched or executed. The thread remains in wait state until an interrupt occurs that is not masked by the interrupt mask field in the Status register. Then, if interrupts are enabled by the IE bit in the Status register, the interrupt is serviced. The ERET instruction returns to the instruction following the WAIT instruction. If interrupts are disabled, the processor resumes executing instructions with the next sequential instruction.
Programming notes:
The WAIT instruction should be executed while interrupts are disabled by the IE bit in the Status register. This avoids a potential timing hazard, which occurs if an interrupt is taken between testing the counter and executing the WAIT instruction. In this hazard case, the interrupt will have been completed before the WAIT instruction is executed, so the processor will remain indefinitely in wait state until the next interrupt.
--- arch/mips/kernel/idle.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/mips/kernel/idle.c +3 -2
@@ -160,7 +160,6 @@ void __init check_wait(void)case CPU_BMIPS3300 :case CPU_BMIPS4350 :case CPU_BMIPS4380 : -case CPU_BMIPS5000 :case CPU_CAVIUM_OCTEON :case CPU_CAVIUM_OCTEON_PLUS :case CPU_CAVIUM_OCTEON2 :
@@ -171,7 +170,9 @@ void __init check_wait(void)case CPU_XLP : cpu_wait = r4k_wait;break ; - +case CPU_BMIPS5000 : + cpu_wait = r4k_wait_irqoff; +break ;case CPU_RM7000 : cpu_wait = rm7k_wait_irqoff;break ;
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
Quoted 27 lines · Petri Gynther
BCM7425 CPU Interface Zephyr Processor, pages 5-309 and 5-310 BCM7428B0 CPU Interface Zephyr Processor, pages 5-337 and 5-338
WAIT instruction:
Thread enters wait state. No instructions are executed until an interrupt occurs. The processor's clocks are stopped if both threads are in idle mode.Description:
Execution of this instruction puts the thread into wait state, an idle mode in which no instructions are fetched or executed. The thread remains in wait state until an interrupt occurs that is not masked by the interrupt mask field in the Status register. Then, if interrupts are enabled by the IE bit in the Status register, the interrupt is serviced. The ERET instruction returns to the instruction following the WAIT instruction. If interrupts are disabled, the processor resumes executing instructions with the next sequential instruction.Programming notes:
The WAIT instruction should be executed while interrupts are disabled by the IE bit in the Status register. This avoids a potential timing hazard, which occurs if an interrupt is taken between testing the counter and executing the WAIT instruction. In this hazard case, the interrupt will have been completed before the WAIT instruction is executed, so the processor will remain indefinitely in wait state until the next interrupt.
Quoted 1 line
Signed-off-by Petri Gynther <[email protected]>
Quoted 28 lines
--- arch/mips/kernel/idle.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)arch/mips/kernel/idle.c +3
-2@@ -160,7 +160,6 @@ void __init check_wait(void)case CPU_BMIPS3300 :case CPU_BMIPS4350 :case CPU_BMIPS4380 : -case CPU_BMIPS5000 :case CPU_CAVIUM_OCTEON :case CPU_CAVIUM_OCTEON_PLUS :case CPU_CAVIUM_OCTEON2 :@@ -171,7 +170,9 @@ void __init check_wait(void)case CPU_XLP : cpu_wait = r4k_wait;break ; - +case CPU_BMIPS5000 : + cpu_wait = r4k_wait_irqoff; +break ;case CPU_RM7000 : cpu_wait = rm7k_wait_irqoff;break ;
Signature · 1 line
Florian
Quoted 28 lines · Florian Fainelli
Quoted 27 lines · Petri Gynther
BCM7425 CPU Interface Zephyr Processor, pages 5-309 and 5-310 BCM7428B0 CPU Interface Zephyr Processor, pages 5-337 and 5-338
WAIT instruction:
Thread enters wait state. No instructions are executed until an interrupt occurs. The processor's clocks are stopped if both threads are in idle mode.Description:
Execution of this instruction puts the thread into wait state, an idle mode in which no instructions are fetched or executed. The thread remains in wait state until an interrupt occurs that is not masked by the interrupt mask field in the Status register. Then, if interrupts are enabled by the IE bit in the Status register, the interrupt is serviced. The ERET instruction returns to the instruction following the WAIT instruction. If interrupts are disabled, the processor resumes executing instructions with the next sequential instruction.Programming notes:
The WAIT instruction should be executed while interrupts are disabled by the IE bit in the Status register. This avoids a potential timing hazard, which occurs if an interrupt is taken between testing the counter and executing the WAIT instruction. In this hazard case, the interrupt will have been completed before the WAIT instruction is executed, so the processor will remain indefinitely in wait state until the next interrupt.
Quoted 4 lines
Quoted 1 line
Signed-off-by Petri Gynther <[email protected]>Reviewed-by Florian Fainelli <[email protected]>
Thanks Florian.
We have been using this patch on our BMIPS5000 systems for a while now. No issues.
Quoted 32 lines
Quoted 18 lines
--- arch/mips/kernel/idle.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)arch/mips/kernel/idle.c +0
-1@@ -160,7 +160,6 @@ void __init check_wait(void)case CPU_BMIPS3300 :case CPU_BMIPS4350 :case CPU_BMIPS4380 : -case CPU_BMIPS5000 :case CPU_CAVIUM_OCTEON :case CPU_CAVIUM_OCTEON_PLUS :case CPU_CAVIUM_OCTEON2 :arch/mips/kernel/idle.c void __init check_wait(void) · line 178
Quoted 10 lines
arch/mips/kernel/idle.c +3
-1@@ -171,7 +170,9 @@ void __init check_wait(void)case CPU_XLP : cpu_wait = r4k_wait;break ; - +case CPU_BMIPS5000 : + cpu_wait = r4k_wait_irqoff; +break ;case CPU_RM7000 : cpu_wait = rm7k_wait_irqoff;break ;--
Florian
Quoted 18 lines · Petri Gynther
BCM7425 CPU Interface Zephyr Processor, pages 5-309 and 5-310 BCM7428B0 CPU Interface Zephyr Processor, pages 5-337 and 5-338
WAIT instruction:
Thread enters wait state. No instructions are executed until an interrupt occurs. The processor's clocks are stopped if both threads are in idle mode.Description:
Execution of this instruction puts the thread into wait state, an idle mode in which no instructions are fetched or executed. The thread remains in wait state until an interrupt occurs that is not masked by the interrupt mask field in the Status register. Then, if interrupts are enabled by the IE bit in the Status register, the interrupt is serviced. The ERET instruction returns to the instruction following the WAIT instruction. If interrupts are disabled, the processor resumes executing instructions with the next sequential instruction.
Quoted 8 lines
Programming notes:
The WAIT instruction should be executed while interrupts are disabled by the IE bit in the Status register. This avoids a potential timing hazard, which occurs if an interrupt is taken between testing the counter and executing the WAIT instruction. In this hazard case, the interrupt will have been completed before the WAIT instruction is executed, so the processor will remain indefinitely in wait state until the next interrupt.
Note that this is the opposite restriction than many older MIPS CPUs where it is undefined if an interrupt will restart execution of instructions if interrupts are disabled. So this might be a violation of the architecture specification. However I rather have it the BMIPS way than the other way ...
Ralf
Quoted 9 lines · Ralf Baechle
Quoted 8 lines
Programming notes:
The WAIT instruction should be executed while interrupts are disabled by the IE bit in the Status register. This avoids a potential timing hazard, which occurs if an interrupt is taken between testing the counter and executing the WAIT instruction. In this hazard case, the interrupt will have been completed before the WAIT instruction is executed, so the processor will remain indefinitely in wait state until the next interrupt.
Quoted 5 lines
Note that this is the opposite restriction than many older MIPS CPUs where it is undefined if an interrupt will restart execution of instructions if interrupts are disabled. So this might be a violation of the architecture specification. However I rather have it the BMIPS way than the other way ...
It's been implementation-dependent since MIPSr1 whether a non-enabled
interrupt breaks out of WAIT, so no architecture specification violation here.
Maciej
Quoted 15 lines · Maciej W. Rozycki
Quoted 9 lines
Quoted 8 lines
Programming notes:
The WAIT instruction should be executed while interrupts are disabled by the IE bit in the Status register. This avoids a potential timing hazard, which occurs if an interrupt is taken between testing the counter and executing the WAIT instruction. In this hazard case, the interrupt will have been completed before the WAIT instruction is executed, so the processor will remain indefinitely in wait state until the next interrupt.Quoted 5 lines
Note that this is the opposite restriction than many older MIPS CPUs where it is undefined if an interrupt will restart execution of instructions if interrupts are disabled. So this might be a violation of the architecture specification. However I rather have it the BMIPS way than the other way ...
Quoted 3 lines
It's been implementation-dependent since MIPSr1 whether a non-enabled
interrupt breaks out of WAIT, so no architecture specification violation here.
I probably should have clarified that in the commit message but alas too late, this commit is long upstream.
Ralf