]> xenbits.xensource.com Git - qemu-xen-4.0-testing.git/commitdiff
fix multiple pci-attach/pci-detach by removing meaningless irq_index
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 1 Sep 2008 09:34:37 +0000 (10:34 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 3 Sep 2008 10:36:04 +0000 (11:36 +0100)
For HVM guest, we can't do pci-attach/pci-detach for >64 times due to
the meaningless checking in pci_register_device(). This patches
removes it.

With the patches, I [Dexuan] made a test of 300 times of attach/detach
and everything works well.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
(cherry picked from commit 990348aa4d6b55d2d2d1aa60b33385cb77c78052)

hw/pci.c
hw/pci.h

index 2637fb6671d2c54d049013563c5347c2902622d7..1de68fddd137c204b1806728bb9b60c614592378 100644 (file)
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -50,7 +50,6 @@ static void pci_update_mappings(PCIDevice *d);
 static void pci_set_irq(void *opaque, int irq_num, int level);
 
 target_phys_addr_t pci_mem_base;
-static int pci_irq_index;
 static PCIBus *first_bus;
 
 static int pcibus_load(QEMUFile *f, void *opaque, int version_id)
@@ -136,9 +135,6 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name,
 {
     PCIDevice *pci_dev;
 
-    if (pci_irq_index >= PCI_DEVICES_MAX)
-        return NULL;
-
     if (devfn < 0) {
         for(devfn = bus->devfn_min ; devfn < 256; devfn += 8) {
             if ( !bus->devices[devfn] &&
@@ -162,7 +158,6 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name,
         config_write = pci_default_write_config;
     pci_dev->config_read = config_read;
     pci_dev->config_write = config_write;
-    pci_dev->irq_index = pci_irq_index++;
     bus->devices[devfn] = pci_dev;
     pci_dev->irq = qemu_allocate_irqs(pci_set_irq, pci_dev, 4);
     return pci_dev;
index 17f43430b09d4985f6e5cedcb054ef299ed3db5c..4adc4d74923f7f4e7bdcf4f395170f66bb4f33cf 100644 (file)
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -55,8 +55,6 @@ struct PCIDevice {
     /* do not access the following fields */
     PCIConfigReadFunc *config_read;
     PCIConfigWriteFunc *config_write;
-    /* ??? This is a PC-specific hack, and should be removed.  */
-    int irq_index;
 
     /* IRQ objects for the INTA-INTD pins.  */
     qemu_irq *irq;