summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2019-01-02 08:06:15 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-01-17 20:20:32 -0800
commit81f1c81cf9521425b0d57cd94774d80ec4db0ef0 (patch)
tree8e6c18218cf005a44a112b6b04c5b315629a3f30
parent7d794116deacb595952ebd126cf9c05ea15b9b10 (diff)
downloadchrome-ec-81f1c81cf9521425b0d57cd94774d80ec4db0ef0.tar.gz
ish: balance all __in_isr calls
If we encountered an unregistered IRQ vector we would not decrement the __in_isr global properly which would cause the ISH to lock up. BRANCH=none BUG=b:121343650,b:112750896 TEST=With patch stack on arcada (ISH5) 'taskinfo' command works as expected. Change-Id: I3975356226d92a81bfd207d77bba42f3f8b30bb8 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1392416 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--core/minute-ia/irq_handler.h4
-rw-r--r--core/minute-ia/switch.S13
2 files changed, 9 insertions, 8 deletions
diff --git a/core/minute-ia/irq_handler.h b/core/minute-ia/irq_handler.h
index 843f9f5b10..b9cbc33ae0 100644
--- a/core/minute-ia/irq_handler.h
+++ b/core/minute-ia/irq_handler.h
@@ -46,7 +46,7 @@ struct irq_data {
".section .text._irq_"#irq"_handler\n" \
"_irq_"#irq"_handler:\n" \
"pusha\n" \
- "add $1, __in_isr\n" \
+ ASM_LOCK_PREFIX "addl $1, __in_isr\n" \
"call "#routine"\n" \
"push $0\n" \
"push $0\n" \
@@ -63,8 +63,8 @@ struct irq_data {
rstr_fpu_ctx \
"1:\n" \
"movl $"#vector ", (0xFEC00040)\n" \
- "sub $1, __in_isr\n" \
"movl $0x00, (0xFEE000B0)\n" \
+ ASM_LOCK_PREFIX "subl $1, __in_isr\n" \
"popa\n" \
"iret\n" \
);
diff --git a/core/minute-ia/switch.S b/core/minute-ia/switch.S
index 117b21b176..de76421a57 100644
--- a/core/minute-ia/switch.S
+++ b/core/minute-ia/switch.S
@@ -36,20 +36,21 @@ __task_start:
default_int_handler:
pusha
- add $1, __in_isr
+ ASM_LOCK_PREFIX addl $1, __in_isr
call unhandled_vector # Handle system interrupts and
# unregistered user interrupts
-
+ # unhandled_vector call loads eax with vector for comparison
cmpl $LAPIC_SPURIOUS_INT_VECTOR, %eax
je 1f # No EOI for LAPIC_SPURIOUS_INT_VECTOR
movl %eax, IOAPIC_EOI_REG # Indicate completion of servicing the
# interrupt to IOAPIC first
- sub $1, __in_isr
movl $0x00, LAPIC_EOI_REG # Indicate completion of servicing the
# interrupt to LAPIC next
1:
+ # Ensure we balance the __in_isr counter
+ ASM_LOCK_PREFIX subl $1, __in_isr
popa
iret
@@ -64,7 +65,7 @@ __switchto:
# Save current task
pusha
- addl $1, __in_isr
+ ASM_LOCK_PREFIX addl $1, __in_isr
# __schedule() copies 'resched' to %ecx and 'desched' to %edx before
# triggering ISH_TS_VECTOR
@@ -97,13 +98,13 @@ __switchto:
#endif
1:
- subl $1, __in_isr
# Indicate completion of servicing the interrupt to LAPIC.
# No IOAPIC EOI needed as this is SW triggered.
movl $0x00, LAPIC_EOI_REG
- # Restore general purpose registers.
+ # Decrement ISR counter and restore general purpose registers.
+ ASM_LOCK_PREFIX subl $1, __in_isr
popa
iret