hw/intc: Handle software disabling of APIC correctly
PATCH v2 1/1 hw/intc: Handle software disabling of APIC correctly
When the local APIC is in a software disabled state, all local interrupt sources must be masked and all attempts to unmask them should be ignored. Currently, we don't do either. Fix this by handling it correctly in apic_mem_write().
Signed-off-by Jay Khandkar <[email protected]>
--- hw/intc/apic.c | 8 ++++++++ 1 file changed, 8 insertions(+)
hw/intc/apic.c +8 -0
@@ -793,6 +793,11 @@ static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val,break ;case 0x0f : s->spurious_vec = val &0x1ff ; +if (!(val &APIC_SPURIO_ENABLED )) { +for (int i =0 ; i <APIC_LVT_NB ; i++) { + s->lvt[i] |=APIC_LVT_MASKED ; + } + }apic_update_irq (s);break ; case 0x10 ... 0x17:
@@ -812,6 +817,9 @@ static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val, case 0x32 ... 0x37: {int n = index -0x32 ; +if (!(s->spurious_vec &APIC_SPURIO_ENABLED )) { + val |=APIC_LVT_MASKED ; + } s->lvt[n] = val;if (n ==APIC_LVT_TIMER ) {apic_timer_update (s,qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ));
Signature · 1 line
2.37.3
Quoted 39 lines · Jay Khandkar
When the local APIC is in a software disabled state, all local interrupt sources must be masked and all attempts to unmask them should be ignored. Currently, we don't do either. Fix this by handling it correctly in
apic_mem_write().Signed-off-by Jay Khandkar <[email protected]>--- hw/intc/apic.c | 8 ++++++++ 1 file changed, 8 insertions(+)hw/intc/apic.c +8
-0@@ -793,6 +793,11 @@ static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val,break ;case 0x0f : s->spurious_vec = val &0x1ff ; +if (!(val &APIC_SPURIO_ENABLED )) { +for (int i =0 ; i <APIC_LVT_NB ; i++) { + s->lvt[i] |=APIC_LVT_MASKED ; + } + }apic_update_irq (s);break ; case 0x10 ... 0x17:@@ -812,6 +817,9 @@ static void apic_mem_write(void *opaque, hwaddr addr, uint64_t val, case 0x32 ... 0x37: {int n = index -0x32 ; +if (!(s->spurious_vec &APIC_SPURIO_ENABLED )) { + val |=APIC_LVT_MASKED ; + } s->lvt[n] = val;if (n ==APIC_LVT_TIMER ) {apic_timer_update (s,qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ));Signature · 1 line
2.37.3
Ping...?