Skip to contentSkip to conversation

Generate PCI hotplug interrupt only if corespondent EN bit is set.

PATCH Applied Gleb Natapov 3 participants 3 messages Feb 12, 2009 – Feb 16, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Generate PCI hotplug interrupt only if corespondent EN bit is set.

---

 hw/acpi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
hw/acpi.c +4 -4
index 5eac1ad..2375f20 100644
@@ -724,27 +724,27 @@ void qemu_system_hot_add_init(void)
 static void enable_device(struct pci_status *p, struct gpe_regs *g, int slot)
 {
     g->sts |= 2;
-    g->en |= 2;
     p->up |= (1 << slot);
 }
 
 static void disable_device(struct pci_status *p, struct gpe_regs *g, int slot)
 {
     g->sts |= 2;
-    g->en |= 2;
     p->down |= (1 << slot);
 }
 
 void qemu_system_device_hot_add(int bus, int slot, int state)
 {
-    qemu_set_irq(pm_state->irq, 1);
     pci0_status.up = 0;
     pci0_status.down = 0;
     if (state)
         enable_device(&pci0_status, &gpe, slot);
     else
         disable_device(&pci0_status, &gpe, slot);
-    qemu_set_irq(pm_state->irq, 0);
+    if (gpe.en & 2) {
+        qemu_set_irq(pm_state->irq, 1);
+        qemu_set_irq(pm_state->irq, 0);
+    }
 }
 
 struct acpi_table_header
#1 lore raw
Quoted 2 lines · Gleb Natapov

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 46 lines

---

 hw/acpi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
hw/acpi.c +4 -4
index 5eac1ad..2375f20 100644
@@ -724,27 +724,27 @@ void qemu_system_hot_add_init(void)
 static void enable_device(struct pci_status *p, struct gpe_regs *g, int slot)
 {
     g->sts |= 2;
-    g->en |= 2;
     p->up |= (1 << slot);
 }
 
 static void disable_device(struct pci_status *p, struct gpe_regs *g, int slot)
 {
     g->sts |= 2;
-    g->en |= 2;
     p->down |= (1 << slot);
 }
 
 void qemu_system_device_hot_add(int bus, int slot, int state)
 {
-    qemu_set_irq(pm_state->irq, 1);
     pci0_status.up = 0;
     pci0_status.down = 0;
     if (state)
         enable_device(&pci0_status, &gpe, slot);
     else
         disable_device(&pci0_status, &gpe, slot);
-    qemu_set_irq(pm_state->irq, 0);
+    if (gpe.en & 2) {
+        qemu_set_irq(pm_state->irq, 1);
+        qemu_set_irq(pm_state->irq, 0);
+    }
 }
 
 struct acpi_table_header
#2 lore raw
In reply to Gleb Natapov

ACK

Quoted 44 lines · Gleb Natapov

---

 hw/acpi.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
hw/acpi.c +4 -4
index 5eac1ad..2375f20 100644
@@ -724,27 +724,27 @@ void qemu_system_hot_add_init(void)
 static void enable_device(struct pci_status *p, struct gpe_regs *g, int slot)
 {
     g->sts |= 2;
-    g->en |= 2;
     p->up |= (1 << slot);
 }
 
 static void disable_device(struct pci_status *p, struct gpe_regs *g, int slot)
 {
     g->sts |= 2;
-    g->en |= 2;
     p->down |= (1 << slot);
 }
 
 void qemu_system_device_hot_add(int bus, int slot, int state)
 {
-    qemu_set_irq(pm_state->irq, 1);
     pci0_status.up = 0;
     pci0_status.down = 0;
     if (state)
         enable_device(&pci0_status, &gpe, slot);
     else
         disable_device(&pci0_status, &gpe, slot);
-    qemu_set_irq(pm_state->irq, 0);
+    if (gpe.en & 2) {
+        qemu_set_irq(pm_state->irq, 1);
+        qemu_set_irq(pm_state->irq, 0);
+    }
 }
 
 struct acpi_table_header