diff -r 2eee03873667 -r 65e84fc54aa5 xen/drivers/passthrough/vtd/dmar.c --- a/xen/drivers/passthrough/vtd/dmar.c Thu Jan 21 21:06:50 2010 +0900 +++ b/xen/drivers/passthrough/vtd/dmar.c Thu Jan 21 20:58:12 2010 +0900 @@ -397,7 +397,42 @@ if ( ret ) xfree(dmaru); else - acpi_register_drhd_unit(dmaru); + { + u8 b, d, f; + int i, invalid_cnt = 0; + + for ( i = 0; i < dmaru->scope.devices_cnt; i++ ) + { + b = PCI_BUS(dmaru->scope.devices[i]); + d = PCI_SLOT(dmaru->scope.devices[i]); + f = PCI_FUNC(dmaru->scope.devices[i]); + + if ( pci_device_detect(b, d, f) == 0 ) + { + dprintk(XENLOG_WARNING VTDPREFIX, + " Non-existent device (%x:%x.%x) is reported " + "in DRHD's scope!\n", + b, d, f); + invalid_cnt++; + } + } + + if ( invalid_cnt ) + { + xfree(dmaru); + if ( invalid_cnt == dmaru->scope.devices_cnt ) + { + dprintk(XENLOG_WARNING VTDPREFIX, + " Ignore the DRHD due to " + "devices under its scope are not PCI discoverable!\n"); + } + else + ret = -EINVAL; + } + else + acpi_register_drhd_unit(dmaru); + } + return ret; }