[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [rfc 3/4] ioemu: make __insert_to_pci_slot indempotent
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx> Index: ioemu-remote/hw/pass-through.c =================================================================== --- ioemu-remote.orig/hw/pass-through.c 2009-03-20 21:33:32.000000000 +1100 +++ ioemu-remote/hw/pass-through.c 2009-03-20 21:34:06.000000000 +1100 @@ -835,6 +835,16 @@ static int get_next_keyval(char **option return 0; } +static int pci_slot_match(int bus, int dev, int func, int slot) +{ + if (test_pci_slot(slot) == 1 && + dpci_infos.php_devs[slot].r_bus == bus && + dpci_infos.php_devs[slot].r_dev == dev && + dpci_infos.php_devs[slot].r_func == func ) + return 1; + return 0; +} + /* Insert a new pass-through device into a specific pci slot. * input dom:bus:dev.func@slot, chose free one if slot == AUTO_PHP_SLOT * return -2: requested slot not available @@ -851,6 +861,9 @@ static int __insert_to_pci_slot(int bus, { if ( !test_pci_slot(slot) && !pci_devfn_in_use(e_bus, slot << 3) ) goto found; + if ( pci_slot_match(bus, dev, func, slot) ) + /* The slot is already here, just return */ + return slot; return -2; } @@ -920,10 +933,7 @@ int bdf_to_slot(char *bdf_str) /* locate the virtual pci slot for this VTd device */ for ( i = 0; i < NR_PCI_DEV; i++ ) { - if ( dpci_infos.php_devs[i].valid && - dpci_infos.php_devs[i].r_bus == bus && - dpci_infos.php_devs[i].r_dev == dev && - dpci_infos.php_devs[i].r_func == func ) + if ( pci_slot_match(bus, dev, func, slot) ) return i; } -- -- Simon Horman VA Linux Systems Japan K.K., Sydney, Australia Satellite Office H: www.vergenet.net/~horms/ W: www.valinux.co.jp/en _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |