Lines Matching +full:pci +full:- +full:domain

2  * PCI Stub Driver - Grabs devices in backend to be exported later
17 #include <linux/pci.h>
22 #include <xen/pci.h>
42 int domain; member
55 struct xen_pcibk_device *pdev;/* non-NULL if struct pci_dev is in use */
74 dev_dbg(&dev->dev, "pcistub_device_alloc\n"); in pcistub_device_alloc()
80 psdev->dev = pci_dev_get(dev); in pcistub_device_alloc()
81 if (!psdev->dev) { in pcistub_device_alloc()
86 kref_init(&psdev->kref); in pcistub_device_alloc()
87 spin_lock_init(&psdev->lock); in pcistub_device_alloc()
100 dev = psdev->dev; in pcistub_device_release()
103 dev_dbg(&dev->dev, "pcistub_device_release\n"); in pcistub_device_release()
112 pci_load_and_free_saved_state(dev, &dev_data->pci_saved_state)) in pcistub_device_release()
113 dev_info(&dev->dev, "Could not reload PCI state\n"); in pcistub_device_release()
117 if (dev->msix_cap) { in pcistub_device_release()
119 .seg = pci_domain_nr(dev->bus), in pcistub_device_release()
120 .bus = dev->bus->number, in pcistub_device_release()
121 .devfn = dev->devfn in pcistub_device_release()
126 if (err && err != -ENOSYS) in pcistub_device_release()
127 dev_warn(&dev->dev, "MSI-X release failed (%d)\n", in pcistub_device_release()
137 /* Clean-up the device */ in pcistub_device_release()
149 kref_get(&psdev->kref); in pcistub_device_get()
154 kref_put(&psdev->kref, pcistub_device_release); in pcistub_device_put()
157 static struct pcistub_device *pcistub_device_find_locked(int domain, int bus, in pcistub_device_find_locked() argument
163 if (psdev->dev != NULL in pcistub_device_find_locked()
164 && domain == pci_domain_nr(psdev->dev->bus) in pcistub_device_find_locked()
165 && bus == psdev->dev->bus->number in pcistub_device_find_locked()
166 && slot == PCI_SLOT(psdev->dev->devfn) in pcistub_device_find_locked()
167 && func == PCI_FUNC(psdev->dev->devfn)) { in pcistub_device_find_locked()
175 static struct pcistub_device *pcistub_device_find(int domain, int bus, in pcistub_device_find() argument
183 psdev = pcistub_device_find_locked(domain, bus, slot, func); in pcistub_device_find()
197 spin_lock_irqsave(&psdev->lock, flags); in pcistub_device_get_pci_dev()
198 if (!psdev->pdev) { in pcistub_device_get_pci_dev()
199 psdev->pdev = pdev; in pcistub_device_get_pci_dev()
200 pci_dev = psdev->dev; in pcistub_device_get_pci_dev()
202 spin_unlock_irqrestore(&psdev->lock, flags); in pcistub_device_get_pci_dev()
211 int domain, int bus, in pcistub_get_pci_dev_by_slot() argument
220 psdev = pcistub_device_find_locked(domain, bus, slot, func); in pcistub_get_pci_dev_by_slot()
238 if (psdev->dev == dev) { in pcistub_get_pci_dev()
250 * - XenBus state has been reconfigure (pci unplug). See xen_pcibk_remove_device
251 * - XenBus state has been disconnected (guest shutdown). See xen_pcibk_xenbus_remove
252 * - 'echo BDF > unbind' on pciback module with no guest attached. See pcistub_remove
253 * - 'echo BDF > unbind' with a guest still using it. See pcistub_remove
269 if (psdev->dev == dev) { in pcistub_put_pci_dev()
284 * (so it's ready for the next domain) in pcistub_put_pci_dev()
286 device_lock_assert(&dev->dev); in pcistub_put_pci_dev()
290 ret = pci_load_saved_state(dev, dev_data->pci_saved_state); in pcistub_put_pci_dev()
299 dev_info(&dev->dev, "Could not reload PCI state\n"); in pcistub_put_pci_dev()
307 dev_data->allow_interrupt_control = 0; in pcistub_put_pci_dev()
311 spin_lock_irqsave(&found_psdev->lock, flags); in pcistub_put_pci_dev()
312 found_psdev->pdev = NULL; in pcistub_put_pci_dev()
313 spin_unlock_irqrestore(&found_psdev->lock, flags); in pcistub_put_pci_dev()
322 /* Match the specified device by domain, bus, slot, func and also if in pcistub_match_one()
325 for (; dev != NULL; dev = dev->bus->self) { in pcistub_match_one()
326 if (pci_domain_nr(dev->bus) == pdev_id->domain in pcistub_match_one()
327 && dev->bus->number == pdev_id->bus in pcistub_match_one()
328 && dev->devfn == pdev_id->devfn) in pcistub_match_one()
332 if (dev == dev->bus->self) in pcistub_match_one()
362 dev_dbg(&dev->dev, "initializing...\n"); in pcistub_init_device()
364 /* The PCI backend is not intended to be a module (or to work with in pcistub_init_device()
365 * removable PCI devices (yet). If it were, xen_pcibk_config_free() in pcistub_init_device()
367 * here and then to call kfree(pci_get_drvdata(psdev->dev)). in pcistub_init_device()
372 err = -ENOMEM; in pcistub_init_device()
381 sprintf(dev_data->irq_name, DRV_NAME "[%s]", pci_name(dev)); in pcistub_init_device()
383 dev_dbg(&dev->dev, "initializing config\n"); in pcistub_init_device()
390 /* HACK: Force device (& ACPI) to determine what IRQ it's on - we in pcistub_init_device()
392 * the pci device's true irq (and possibly its other resources) in pcistub_init_device()
397 dev_dbg(&dev->dev, "enabling device\n"); in pcistub_init_device()
402 if (dev->msix_cap) { in pcistub_init_device()
404 .seg = pci_domain_nr(dev->bus), in pcistub_init_device()
405 .bus = dev->bus->number, in pcistub_init_device()
406 .devfn = dev->devfn in pcistub_init_device()
410 if (err && err != -ENOSYS) in pcistub_init_device()
411 dev_err(&dev->dev, "MSI-X preparation failed (%d)\n", in pcistub_init_device()
416 dev_dbg(&dev->dev, "save state of device\n"); in pcistub_init_device()
418 dev_data->pci_saved_state = pci_store_saved_state(dev); in pcistub_init_device()
419 if (!dev_data->pci_saved_state) in pcistub_init_device()
420 dev_err(&dev->dev, "Could not store PCI conf saved state!\n"); in pcistub_init_device()
422 dev_dbg(&dev->dev, "resetting (FLR, D3, etc) the device\n"); in pcistub_init_device()
429 dev_dbg(&dev->dev, "reset device\n"); in pcistub_init_device()
461 list_del(&psdev->dev_list); in pcistub_init_devices_late()
465 err = pcistub_init_device(psdev->dev); in pcistub_init_devices_late()
467 dev_err(&psdev->dev->dev, in pcistub_init_devices_late()
476 list_add_tail(&psdev->dev_list, &pcistub_devices); in pcistub_init_devices_late()
487 int domain, int bus, unsigned int devfn) in pcistub_device_id_add_list() argument
496 if (pci_dev_id->domain == domain && pci_dev_id->bus == bus && in pcistub_device_id_add_list()
497 pci_dev_id->devfn == devfn) { in pcistub_device_id_add_list()
504 new->domain = domain; in pcistub_device_id_add_list()
505 new->bus = bus; in pcistub_device_id_add_list()
506 new->devfn = devfn; in pcistub_device_id_add_list()
507 list_add_tail(&new->slot_list, &pcistub_device_ids); in pcistub_device_id_add_list()
526 return -ENOMEM; in pcistub_seize()
535 err = pcistub_init_device(psdev->dev); in pcistub_seize()
540 list_add(&psdev->dev_list, &pcistub_devices); in pcistub_seize()
542 dev_dbg(&dev->dev, "deferring initialization\n"); in pcistub_seize()
543 list_add(&psdev->dev_list, &seized_devices); in pcistub_seize()
552 pcistub_device_id_add_list(pci_dev_id, pci_domain_nr(dev->bus), in pcistub_seize()
553 dev->bus->number, dev->devfn); in pcistub_seize()
565 dev_dbg(&dev->dev, "probing...\n"); in pcistub_probe()
569 if ((dev->driver_override && in pcistub_probe()
570 !strcmp(dev->driver_override, PCISTUB_DRIVER_NAME)) || in pcistub_probe()
573 if (dev->hdr_type != PCI_HEADER_TYPE_NORMAL in pcistub_probe()
574 && dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { in pcistub_probe()
575 dev_err(&dev->dev, "can't export pci devices that " in pcistub_probe()
578 err = -ENODEV; in pcistub_probe()
585 err = -ENOMEM; in pcistub_probe()
590 dev_info(&dev->dev, "seizing device\n"); in pcistub_probe()
594 err = -ENODEV; in pcistub_probe()
607 dev_dbg(&dev->dev, "removing\n"); in pcistub_remove()
614 if (psdev->dev == dev) { in pcistub_remove()
623 dev_dbg(&dev->dev, "found device to remove %s\n", in pcistub_remove()
624 found_psdev->pdev ? "- in-use" : ""); in pcistub_remove()
626 if (found_psdev->pdev) { in pcistub_remove()
629 dev_warn(&dev->dev, "****** removing device %s while still in-use by domain %d! ******\n", in pcistub_remove()
630 pci_name(found_psdev->dev), domid); in pcistub_remove()
631 dev_warn(&dev->dev, "****** driver domain may still access this device's i/o resources!\n"); in pcistub_remove()
632 dev_warn(&dev->dev, "****** shutdown driver domain before binding device\n"); in pcistub_remove()
633 dev_warn(&dev->dev, "****** to other drivers or domains\n"); in pcistub_remove()
637 xen_pcibk_release_pci_dev(found_psdev->pdev, in pcistub_remove()
638 found_psdev->dev, in pcistub_remove()
643 list_del(&found_psdev->dev_list); in pcistub_remove()
669 snprintf(nodename, PCI_NODENAME_MAX, "/local/domain/0/backend/pci/%d/0", in kill_domain_by_device()
670 psdev->pdev->xdev->otherend_id); in kill_domain_by_device()
675 dev_err(&psdev->dev->dev, in kill_domain_by_device()
683 if (err == -EAGAIN) in kill_domain_by_device()
685 dev_err(&psdev->dev->dev, in kill_domain_by_device()
701 struct xen_pcibk_device *pdev = psdev->pdev; in common_process()
702 struct xen_pci_sharedinfo *sh_info = pdev->sh_info; in common_process()
706 aer_op = &(sh_info->aer_op); in common_process()
707 aer_op->cmd = aer_cmd ; in common_process()
709 aer_op->err = state; in common_process()
711 ret = xen_pcibk_get_pcifront_dev(psdev->dev, psdev->pdev, in common_process()
712 &aer_op->domain, &aer_op->bus, &aer_op->devfn); in common_process()
714 dev_err(&psdev->dev->dev, "failed to get pcifront device\n"); in common_process()
719 dev_dbg(&psdev->dev->dev, "aer_op %x dom %x bus %x devfn %x\n", in common_process()
720 aer_cmd, aer_op->domain, aer_op->bus, aer_op->devfn); in common_process()
722 * this flag to judge whether we need to check pci-front give aer in common_process()
725 set_bit(_PCIB_op_pending, (unsigned long *)&pdev->flags); in common_process()
732 (unsigned long *)&sh_info->flags); in common_process()
734 notify_remote_via_irq(pdev->evtchn_irq); in common_process()
741 &sh_info->flags)), 300*HZ); in common_process()
744 if (!test_bit(_PDEVF_op_active, &pdev->flags)) in common_process()
749 (unsigned long *)&sh_info->flags)) { in common_process()
750 dev_err(&psdev->dev->dev, in common_process()
753 (unsigned long *)&sh_info->flags); in common_process()
754 aer_op->err = PCI_ERS_RESULT_NONE; in common_process()
758 clear_bit(_PCIB_op_pending, (unsigned long *)&pdev->flags); in common_process()
760 res = (pci_ers_result_t)aer_op->err; in common_process()
768 * @dev: pointer to PCI devices
777 dev_dbg(&dev->dev, "xen_pcibk_slot_reset(bus:%x,devfn:%x)\n", in xen_pcibk_slot_reset()
778 dev->bus->number, dev->devfn); in xen_pcibk_slot_reset()
781 psdev = pcistub_device_find(pci_domain_nr(dev->bus), in xen_pcibk_slot_reset()
782 dev->bus->number, in xen_pcibk_slot_reset()
783 PCI_SLOT(dev->devfn), in xen_pcibk_slot_reset()
784 PCI_FUNC(dev->devfn)); in xen_pcibk_slot_reset()
786 if (!psdev || !psdev->pdev) { in xen_pcibk_slot_reset()
787 dev_err(&dev->dev, "device is not found/assigned\n"); in xen_pcibk_slot_reset()
791 if (!psdev->pdev->sh_info) { in xen_pcibk_slot_reset()
792 dev_err(&dev->dev, "device is not connected or owned" in xen_pcibk_slot_reset()
799 (unsigned long *)&psdev->pdev->sh_info->flags)) { in xen_pcibk_slot_reset()
800 dev_err(&dev->dev, in xen_pcibk_slot_reset()
808 dev_dbg(&dev->dev, in xen_pcibk_slot_reset()
824 * @dev: pointer to PCI devices
834 dev_dbg(&dev->dev, "xen_pcibk_mmio_enabled(bus:%x,devfn:%x)\n", in xen_pcibk_mmio_enabled()
835 dev->bus->number, dev->devfn); in xen_pcibk_mmio_enabled()
838 psdev = pcistub_device_find(pci_domain_nr(dev->bus), in xen_pcibk_mmio_enabled()
839 dev->bus->number, in xen_pcibk_mmio_enabled()
840 PCI_SLOT(dev->devfn), in xen_pcibk_mmio_enabled()
841 PCI_FUNC(dev->devfn)); in xen_pcibk_mmio_enabled()
843 if (!psdev || !psdev->pdev) { in xen_pcibk_mmio_enabled()
844 dev_err(&dev->dev, "device is not found/assigned\n"); in xen_pcibk_mmio_enabled()
848 if (!psdev->pdev->sh_info) { in xen_pcibk_mmio_enabled()
849 dev_err(&dev->dev, "device is not connected or owned" in xen_pcibk_mmio_enabled()
856 (unsigned long *)&psdev->pdev->sh_info->flags)) { in xen_pcibk_mmio_enabled()
857 dev_err(&dev->dev, in xen_pcibk_mmio_enabled()
865 dev_dbg(&dev->dev, in xen_pcibk_mmio_enabled()
879 * @dev: pointer to PCI devices
880 * @error: the current PCI connection state
891 dev_dbg(&dev->dev, "xen_pcibk_error_detected(bus:%x,devfn:%x)\n", in xen_pcibk_error_detected()
892 dev->bus->number, dev->devfn); in xen_pcibk_error_detected()
895 psdev = pcistub_device_find(pci_domain_nr(dev->bus), in xen_pcibk_error_detected()
896 dev->bus->number, in xen_pcibk_error_detected()
897 PCI_SLOT(dev->devfn), in xen_pcibk_error_detected()
898 PCI_FUNC(dev->devfn)); in xen_pcibk_error_detected()
900 if (!psdev || !psdev->pdev) { in xen_pcibk_error_detected()
901 dev_err(&dev->dev, "device is not found/assigned\n"); in xen_pcibk_error_detected()
905 if (!psdev->pdev->sh_info) { in xen_pcibk_error_detected()
906 dev_err(&dev->dev, "device is not connected or owned" in xen_pcibk_error_detected()
914 (unsigned long *)&psdev->pdev->sh_info->flags)) { in xen_pcibk_error_detected()
915 dev_dbg(&dev->dev, "guest may have no aer driver, kill it\n"); in xen_pcibk_error_detected()
923 dev_dbg(&dev->dev, in xen_pcibk_error_detected()
937 * @dev: pointer to PCI devices
944 dev_dbg(&dev->dev, "xen_pcibk_error_resume(bus:%x,devfn:%x)\n", in xen_pcibk_error_resume()
945 dev->bus->number, dev->devfn); in xen_pcibk_error_resume()
948 psdev = pcistub_device_find(pci_domain_nr(dev->bus), in xen_pcibk_error_resume()
949 dev->bus->number, in xen_pcibk_error_resume()
950 PCI_SLOT(dev->devfn), in xen_pcibk_error_resume()
951 PCI_FUNC(dev->devfn)); in xen_pcibk_error_resume()
953 if (!psdev || !psdev->pdev) { in xen_pcibk_error_resume()
954 dev_err(&dev->dev, "device is not found/assigned\n"); in xen_pcibk_error_resume()
958 if (!psdev->pdev->sh_info) { in xen_pcibk_error_resume()
959 dev_err(&dev->dev, "device is not connected or owned" in xen_pcibk_error_resume()
966 (unsigned long *)&psdev->pdev->sh_info->flags)) { in xen_pcibk_error_resume()
967 dev_err(&dev->dev, in xen_pcibk_error_resume()
1004 static inline int str_to_slot(const char *buf, int *domain, int *bus, in str_to_slot() argument
1009 switch (sscanf(buf, " %x:%x:%x.%x %n", domain, bus, slot, func, in str_to_slot()
1012 *func = -1; in str_to_slot()
1013 sscanf(buf, " %x:%x:%x.* %n", domain, bus, slot, &parsed); in str_to_slot()
1016 *slot = *func = -1; in str_to_slot()
1017 sscanf(buf, " %x:%x:*.* %n", domain, bus, &parsed); in str_to_slot()
1023 /* try again without domain */ in str_to_slot()
1024 *domain = 0; in str_to_slot()
1027 *func = -1; in str_to_slot()
1031 *slot = *func = -1; in str_to_slot()
1038 return -EINVAL; in str_to_slot()
1041 static inline int str_to_quirk(const char *buf, int *domain, int *bus, int in str_to_quirk() argument
1046 sscanf(buf, " %x:%x:%x.%x-%x:%x:%x %n", domain, bus, slot, func, in str_to_quirk()
1051 /* try again without domain */ in str_to_quirk()
1052 *domain = 0; in str_to_quirk()
1053 sscanf(buf, " %x:%x.%x-%x:%x:%x %n", bus, slot, func, reg, size, in str_to_quirk()
1058 return -EINVAL; in str_to_quirk()
1061 static int pcistub_device_id_add(int domain, int bus, int slot, int func) in pcistub_device_id_add() argument
1068 rc = pcistub_device_id_add(domain, bus, slot, func); in pcistub_device_id_add()
1074 rc = pcistub_device_id_add(domain, bus, slot, func); in pcistub_device_id_add()
1081 !pci_domains_supported ? domain : in pcistub_device_id_add()
1083 domain < 0 || domain > 0xffff) in pcistub_device_id_add()
1087 return -EINVAL; in pcistub_device_id_add()
1091 return -ENOMEM; in pcistub_device_id_add()
1094 domain, bus, slot, func); in pcistub_device_id_add()
1096 pcistub_device_id_add_list(pci_dev_id, domain, bus, devfn); in pcistub_device_id_add()
1101 static int pcistub_device_id_remove(int domain, int bus, int slot, int func) in pcistub_device_id_remove() argument
1104 int err = -ENOENT; in pcistub_device_id_remove()
1110 if (pci_dev_id->domain == domain && pci_dev_id->bus == bus in pcistub_device_id_remove()
1111 && (slot < 0 || PCI_SLOT(pci_dev_id->devfn) == slot) in pcistub_device_id_remove()
1112 && (func < 0 || PCI_FUNC(pci_dev_id->devfn) == func)) { in pcistub_device_id_remove()
1116 list_del(&pci_dev_id->slot_list); in pcistub_device_id_remove()
1122 domain, bus, slot, func); in pcistub_device_id_remove()
1130 static int pcistub_reg_add(int domain, int bus, int slot, int func, in pcistub_reg_add() argument
1140 return -EINVAL; in pcistub_reg_add()
1142 psdev = pcistub_device_find(domain, bus, slot, func); in pcistub_reg_add()
1144 err = -ENODEV; in pcistub_reg_add()
1147 dev = psdev->dev; in pcistub_reg_add()
1151 err = -ENOMEM; in pcistub_reg_add()
1155 field->offset = reg; in pcistub_reg_add()
1156 field->size = size; in pcistub_reg_add()
1157 field->mask = mask; in pcistub_reg_add()
1158 field->init = NULL; in pcistub_reg_add()
1159 field->reset = NULL; in pcistub_reg_add()
1160 field->release = NULL; in pcistub_reg_add()
1161 field->clean = xen_pcibk_config_field_free; in pcistub_reg_add()
1175 int domain, bus, slot, func; in new_slot_store() local
1178 err = str_to_slot(buf, &domain, &bus, &slot, &func); in new_slot_store()
1182 err = pcistub_device_id_add(domain, bus, slot, func); in new_slot_store()
1194 int domain, bus, slot, func; in remove_slot_store() local
1197 err = str_to_slot(buf, &domain, &bus, &slot, &func); in remove_slot_store()
1201 err = pcistub_device_id_remove(domain, bus, slot, func); in remove_slot_store()
1221 count += scnprintf(buf + count, PAGE_SIZE - count, in slots_show()
1223 pci_dev_id->domain, pci_dev_id->bus, in slots_show()
1224 PCI_SLOT(pci_dev_id->devfn), in slots_show()
1225 PCI_FUNC(pci_dev_id->devfn)); in slots_show()
1244 if (!psdev->dev) in irq_handlers_show()
1246 dev_data = pci_get_drvdata(psdev->dev); in irq_handlers_show()
1250 scnprintf(buf + count, PAGE_SIZE - count, in irq_handlers_show()
1252 pci_name(psdev->dev), in irq_handlers_show()
1253 dev_data->isr_on ? "on" : "off", in irq_handlers_show()
1254 dev_data->ack_intr ? "ack" : "not ack", in irq_handlers_show()
1255 dev_data->handled); in irq_handlers_show()
1267 int domain, bus, slot, func; in irq_handler_state_store() local
1270 err = str_to_slot(buf, &domain, &bus, &slot, &func); in irq_handler_state_store()
1274 psdev = pcistub_device_find(domain, bus, slot, func); in irq_handler_state_store()
1276 err = -ENOENT; in irq_handler_state_store()
1280 dev_data = pci_get_drvdata(psdev->dev); in irq_handler_state_store()
1282 err = -ENOENT; in irq_handler_state_store()
1286 dev_dbg(&psdev->dev->dev, "%s fake irq handler: %d->%d\n", in irq_handler_state_store()
1287 dev_data->irq_name, dev_data->isr_on, in irq_handler_state_store()
1288 !dev_data->isr_on); in irq_handler_state_store()
1290 dev_data->isr_on = !(dev_data->isr_on); in irq_handler_state_store()
1291 if (dev_data->isr_on) in irq_handler_state_store()
1292 dev_data->ack_intr = 1; in irq_handler_state_store()
1305 int domain, bus, slot, func, reg, size, mask; in quirks_store() local
1308 err = str_to_quirk(buf, &domain, &bus, &slot, &func, &reg, &size, in quirks_store()
1313 err = pcistub_reg_add(domain, bus, slot, func, reg, size, mask); in quirks_store()
1335 count += scnprintf(buf + count, PAGE_SIZE - count, in quirks_show()
1337 quirk->pdev->bus->number, in quirks_show()
1338 PCI_SLOT(quirk->pdev->devfn), in quirks_show()
1339 PCI_FUNC(quirk->pdev->devfn), in quirks_show()
1340 quirk->devid.vendor, quirk->devid.device, in quirks_show()
1341 quirk->devid.subvendor, in quirks_show()
1342 quirk->devid.subdevice); in quirks_show()
1344 dev_data = pci_get_drvdata(quirk->pdev); in quirks_show()
1346 list_for_each_entry(cfg_entry, &dev_data->config_fields, list) { in quirks_show()
1347 field = cfg_entry->field; in quirks_show()
1351 count += scnprintf(buf + count, PAGE_SIZE - count, in quirks_show()
1353 cfg_entry->base_offset + in quirks_show()
1354 field->offset, field->size, in quirks_show()
1355 field->mask); in quirks_show()
1369 int domain, bus, slot, func; in permissive_store() local
1374 err = str_to_slot(buf, &domain, &bus, &slot, &func); in permissive_store()
1378 psdev = pcistub_device_find(domain, bus, slot, func); in permissive_store()
1380 err = -ENODEV; in permissive_store()
1384 dev_data = pci_get_drvdata(psdev->dev); in permissive_store()
1387 err = -ENXIO; in permissive_store()
1390 if (!dev_data->permissive) { in permissive_store()
1391 dev_data->permissive = 1; in permissive_store()
1393 dev_warn(&psdev->dev->dev, "enabling permissive mode " in permissive_store()
1395 dev_warn(&psdev->dev->dev, in permissive_store()
1416 if (!psdev->dev) in permissive_show()
1418 dev_data = pci_get_drvdata(psdev->dev); in permissive_show()
1419 if (!dev_data || !dev_data->permissive) in permissive_show()
1422 scnprintf(buf + count, PAGE_SIZE - count, "%s\n", in permissive_show()
1423 pci_name(psdev->dev)); in permissive_show()
1433 int domain, bus, slot, func; in allow_interrupt_control_store() local
1438 err = str_to_slot(buf, &domain, &bus, &slot, &func); in allow_interrupt_control_store()
1442 psdev = pcistub_device_find(domain, bus, slot, func); in allow_interrupt_control_store()
1444 err = -ENODEV; in allow_interrupt_control_store()
1448 dev_data = pci_get_drvdata(psdev->dev); in allow_interrupt_control_store()
1451 err = -ENXIO; in allow_interrupt_control_store()
1454 dev_data->allow_interrupt_control = 1; in allow_interrupt_control_store()
1475 if (!psdev->dev) in allow_interrupt_control_show()
1477 dev_data = pci_get_drvdata(psdev->dev); in allow_interrupt_control_show()
1478 if (!dev_data || !dev_data->allow_interrupt_control) in allow_interrupt_control_show()
1481 scnprintf(buf + count, PAGE_SIZE - count, "%s\n", in allow_interrupt_control_show()
1482 pci_name(psdev->dev)); in allow_interrupt_control_show()
1511 int domain, bus, slot, func; in pcistub_init() local
1520 &domain, &bus, &slot, &func, &parsed); in pcistub_init()
1523 func = -1; in pcistub_init()
1526 &domain, &bus, &slot, &parsed); in pcistub_init()
1529 slot = func = -1; in pcistub_init()
1532 &domain, &bus, &parsed); in pcistub_init()
1537 domain = 0; in pcistub_init()
1543 func = -1; in pcistub_init()
1549 slot = func = -1; in pcistub_init()
1560 err = pcistub_device_id_add(domain, bus, slot, func); in pcistub_init()
1568 /* If we're the first PCI Device Driver to register, we're the in pcistub_init()
1569 * first one to get offered PCI devices as they become in pcistub_init()
1609 return -EINVAL; in pcistub_init()
1617 * get a chance by being the first pci device
1632 if (!psdev->pdev && psdev->dev != pdev in find_vfs()
1633 && pci_physfn(psdev->dev) == pdev) { in find_vfs()
1653 if (!pdev->is_physfn) in pci_stub_notifier()
1660 device_release_driver(&psdev->dev->dev); in pci_stub_notifier()
1675 return -ENODEV; in xen_pcibk_init()
1712 MODULE_ALIAS("xen-backend:pci");