From: Ian Jackson Date: Mon, 1 Sep 2008 09:34:37 +0000 (+0100) Subject: fix multiple pci-attach/pci-detach by removing meaningless irq_index X-Git-Tag: t.master-before-merge~100 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=990348aa4d6b55d2d2d1aa60b33385cb77c78052;p=qemu-xen-4.0-testing.git fix multiple pci-attach/pci-detach by removing meaningless irq_index 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 --- diff --git a/hw/pci.c b/hw/pci.c index 2637fb66..1de68fdd 100644 --- 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; diff --git a/hw/pci.h b/hw/pci.h index 17f43430..4adc4d74 100644 --- 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;