ia64/xen-unstable

changeset 18423:7eefe6399bcd

ioemu: fix multiple pci-attach/pci-detach by removing the 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(). I made a test of
300 times of attach/detach and everything now works well.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Sep 01 10:48:09 2008 +0100 (2008-09-01)
parents 05c7efee10a1
children 7cb51e8484f6
files tools/ioemu/hw/pci.c tools/ioemu/vl.h
line diff
     1.1 --- a/tools/ioemu/hw/pci.c	Sat Aug 30 08:36:02 2008 +0100
     1.2 +++ b/tools/ioemu/hw/pci.c	Mon Sep 01 10:48:09 2008 +0100
     1.3 @@ -45,7 +45,6 @@ struct PCIBus {
     1.4  static void pci_update_mappings(PCIDevice *d);
     1.5  
     1.6  target_phys_addr_t pci_mem_base;
     1.7 -static int pci_irq_index;
     1.8  static PCIBus *first_bus;
     1.9  
    1.10  PCIBus *pci_register_bus(pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
    1.11 @@ -114,9 +113,6 @@ PCIDevice *pci_register_device(PCIBus *b
    1.12  {
    1.13      PCIDevice *pci_dev;
    1.14  
    1.15 -    if (pci_irq_index >= PCI_DEVICES_MAX)
    1.16 -        return NULL;
    1.17 -    
    1.18      if (devfn < 0) {
    1.19          for(devfn = bus->devfn_min ; devfn < 256; devfn += 8) {
    1.20              if ( !bus->devices[devfn] &&
    1.21 @@ -140,7 +136,6 @@ PCIDevice *pci_register_device(PCIBus *b
    1.22          config_write = pci_default_write_config;
    1.23      pci_dev->config_read = config_read;
    1.24      pci_dev->config_write = config_write;
    1.25 -    pci_dev->irq_index = pci_irq_index++;
    1.26      bus->devices[devfn] = pci_dev;
    1.27      return pci_dev;
    1.28  }
     2.1 --- a/tools/ioemu/vl.h	Sat Aug 30 08:36:02 2008 +0100
     2.2 +++ b/tools/ioemu/vl.h	Mon Sep 01 10:48:09 2008 +0100
     2.3 @@ -812,8 +812,6 @@ struct PCIDevice {
     2.4      /* do not access the following fields */
     2.5      PCIConfigReadFunc *config_read;
     2.6      PCIConfigWriteFunc *config_write;
     2.7 -    /* ??? This is a PC-specific hack, and should be removed.  */
     2.8 -    int irq_index;
     2.9  
    2.10      /* Current IRQ levels.  Used internally by the generic PCI code.  */
    2.11      int irq_state[4];