Skip to contentSkip to conversation

ioapic: clear irq_eoi when updating the ioapic redirect table entry

PATCH Applied Li Qiang 3 participants 3 messages Jun 24, 2019 – Jun 25, 2019

lore
Share & tools
lore

Li Qiang

author
#0 lore raw

PATCH 1/1 ioapic: clear irq_eoi when updating the ioapic redirect table entry

irq_eoi is used to count the number of irq injected during eoi broadcast. It should be set to 0 when updating the ioapic's redirect table entry.

---
 hw/intc/ioapic.c | 1 +
 1 file changed, 1 insertion(+)
hw/intc/ioapic.c +1 -0
index 7074489fdf..db9e518602 100644
@@ -380,6 +380,7 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val,
                 /* restore RO bits */
                 s->ioredtbl[index] &= IOAPIC_RW_BITS;
                 s->ioredtbl[index] |= ro_bits;
+                s->irq_eoi[index] = 0;
                 ioapic_fix_edge_remote_irr(&s->ioredtbl[index]);
                 ioapic_service(s);
             }
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Li Qiang

irq_eoi is used to count the number of irq injected during eoi broadcast. It should be set to 0 when updating the ioapic's redirect table entry.

---
 hw/intc/ioapic.c | 1 +
 1 file changed, 1 insertion(+)
hw/intc/ioapic.c +0 -0
index 7074489fdf..db9e518602 100644

hw/intc/ioapic.c ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val, · line 383

Quoted 4 lines
hw/intc/ioapic.c +1 -0
@@ -380,6 +380,7 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val,
                 /* restore RO bits */
                 s->ioredtbl[index] &= IOAPIC_RW_BITS;
                 s->ioredtbl[index] |= ro_bits;
+                s->irq_eoi[index] = 0;

It'll be cleared for twice for each ioapic entry because it only supports 32bit write to these registers. Though it seems fine, e.g., when the guest only want to update the vector info we should still clear it:

Quoted 7 lines
hw/intc/ioapic.c +0 -0
                 ioapic_fix_edge_remote_irr(&s->ioredtbl[index]);
                 ioapic_service(s);
             }
Signature · 1 line
2.17.1

Regards,

Signature · 1 line
Peter Xu
#2 lore raw
In reply to Li Qiang
Quoted 16 lines · Li Qiang

irq_eoi is used to count the number of irq injected during eoi broadcast. It should be set to 0 when updating the ioapic's redirect table entry.

---
 hw/intc/ioapic.c | 1 +
 1 file changed, 1 insertion(+)
hw/intc/ioapic.c +0 -0
index 7074489fdf..db9e518602 100644

hw/intc/ioapic.c ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val, · line 386

Quoted 7 lines
hw/intc/ioapic.c +1 -0
@@ -380,6 +380,7 @@ ioapic_mem_write(void *opaque, hwaddr addr, uint64_t val,
                 /* restore RO bits */
                 s->ioredtbl[index] &= IOAPIC_RW_BITS;
                 s->ioredtbl[index] |= ro_bits;
+                s->irq_eoi[index] = 0;
                 ioapic_fix_edge_remote_irr(&s->ioredtbl[index]);
                 ioapic_service(s);
             }

Queued, thanks.

Paolo