Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 340e01248478ba8b78a6d4d1809b1eff > files > 187

kvm-83-270.el5_11.src.rpm

From 0b33c7e1373e370e4cb6ef0e9cfcf95879eac934 Mon Sep 17 00:00:00 2001
From: Gleb Natapov <gleb@redhat.com>
Date: Thu, 12 Feb 2009 09:57:11 +0200
Subject: [PATCH 5/5] PCI hotplug SCI fix

Generate interrupt only if corespondent EN bit is set.

commit a1efe3d681ccd3ae75870b9bd639ae8ee2625e7e

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Acked-by: Glauber Costa <glommer@redhat.com>
Bugzilla: 485291
---
 qemu/hw/acpi.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c
index 2d2e3a4..c512fc5 100644
--- a/qemu/hw/acpi.c
+++ b/qemu/hw/acpi.c
@@ -814,25 +814,26 @@ void qemu_system_cpu_hot_add(int cpu, int state)
 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 pcibus, 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);
+    }
 }
-- 
1.6.1