• Home
  • Raw
  • Download

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 <asm/xen/pci.h>
41 int domain; member
54 struct xen_pcibk_device *pdev;/* non-NULL if struct pci_dev is in use */
73 dev_dbg(&dev->dev, "pcistub_device_alloc\n"); in pcistub_device_alloc()
79 psdev->dev = pci_dev_get(dev); in pcistub_device_alloc()
80 if (!psdev->dev) { in pcistub_device_alloc()
85 kref_init(&psdev->kref); in pcistub_device_alloc()
86 spin_lock_init(&psdev->lock); in pcistub_device_alloc()
99 dev = psdev->dev; in pcistub_device_release()
102 dev_dbg(&dev->dev, "pcistub_device_release\n"); in pcistub_device_release()
111 pci_load_and_free_saved_state(dev, &dev_data->pci_saved_state)) in pcistub_device_release()
112 dev_info(&dev->dev, "Could not reload PCI state\n"); in pcistub_device_release()
116 if (dev->msix_cap) { in pcistub_device_release()
118 .seg = pci_domain_nr(dev->bus), in pcistub_device_release()
119 .bus = dev->bus->number, in pcistub_device_release()
120 .devfn = dev->devfn in pcistub_device_release()
125 if (err && err != -ENOSYS) in pcistub_device_release()
126 dev_warn(&dev->dev, "MSI-X release failed (%d)\n", in pcistub_device_release()
136 /* Clean-up the device */ in pcistub_device_release()
148 kref_get(&psdev->kref); in pcistub_device_get()
153 kref_put(&psdev->kref, pcistub_device_release); in pcistub_device_put()
156 static struct pcistub_device *pcistub_device_find_locked(int domain, int bus, in pcistub_device_find_locked() argument
162 if (psdev->dev != NULL in pcistub_device_find_locked()
163 && domain == pci_domain_nr(psdev->dev->bus) in pcistub_device_find_locked()
164 && bus == psdev->dev->bus->number in pcistub_device_find_locked()
165 && slot == PCI_SLOT(psdev->dev->devfn) in pcistub_device_find_locked()
166 && func == PCI_FUNC(psdev->dev->devfn)) { in pcistub_device_find_locked()
174 static struct pcistub_device *pcistub_device_find(int domain, int bus, in pcistub_device_find() argument
182 psdev = pcistub_device_find_locked(domain, bus, slot, func); in pcistub_device_find()
198 spin_lock_irqsave(&psdev->lock, flags); in pcistub_device_get_pci_dev()
199 if (!psdev->pdev) { in pcistub_device_get_pci_dev()
200 psdev->pdev = pdev; in pcistub_device_get_pci_dev()
201 pci_dev = psdev->dev; in pcistub_device_get_pci_dev()
203 spin_unlock_irqrestore(&psdev->lock, flags); in pcistub_device_get_pci_dev()
212 int domain, int bus, in pcistub_get_pci_dev_by_slot() argument
221 psdev = pcistub_device_find_locked(domain, bus, slot, func); in pcistub_get_pci_dev_by_slot()
239 if (psdev->dev == dev) { in pcistub_get_pci_dev()
251 * - XenBus state has been reconfigure (pci unplug). See xen_pcibk_remove_device
252 * - XenBus state has been disconnected (guest shutdown). See xen_pcibk_xenbus_remove
253 * - 'echo BDF > unbind' on pciback module with no guest attached. See pcistub_remove
254 * - 'echo BDF > unbind' with a guest still using it. See pcistub_remove
270 if (psdev->dev == dev) { in pcistub_put_pci_dev()
285 * (so it's ready for the next domain) in pcistub_put_pci_dev()
287 device_lock_assert(&dev->dev); in pcistub_put_pci_dev()
291 ret = pci_load_saved_state(dev, dev_data->pci_saved_state); in pcistub_put_pci_dev()
300 dev_info(&dev->dev, "Could not reload PCI state\n"); in pcistub_put_pci_dev()
308 dev_data->allow_interrupt_control = 0; in pcistub_put_pci_dev()
312 spin_lock_irqsave(&found_psdev->lock, flags); in pcistub_put_pci_dev()
313 found_psdev->pdev = NULL; in pcistub_put_pci_dev()
314 spin_unlock_irqrestore(&found_psdev->lock, flags); in pcistub_put_pci_dev()
323 /* Match the specified device by domain, bus, slot, func and also if in pcistub_match_one()
326 for (; dev != NULL; dev = dev->bus->self) { in pcistub_match_one()
327 if (pci_domain_nr(dev->bus) == pdev_id->domain in pcistub_match_one()
328 && dev->bus->number == pdev_id->bus in pcistub_match_one()
329 && dev->devfn == pdev_id->devfn) in pcistub_match_one()
333 if (dev == dev->bus->self) in pcistub_match_one()
363 dev_dbg(&dev->dev, "initializing...\n"); in pcistub_init_device()
365 /* The PCI backend is not intended to be a module (or to work with in pcistub_init_device()
366 * removable PCI devices (yet). If it were, xen_pcibk_config_free() in pcistub_init_device()
368 * here and then to call kfree(pci_get_drvdata(psdev->dev)). in pcistub_init_device()
373 err = -ENOMEM; in pcistub_init_device()
382 sprintf(dev_data->irq_name, DRV_NAME "[%s]", pci_name(dev)); in pcistub_init_device()
384 dev_dbg(&dev->dev, "initializing config\n"); in pcistub_init_device()
391 /* HACK: Force device (& ACPI) to determine what IRQ it's on - we in pcistub_init_device()
393 * the pci device's true irq (and possibly its other resources) in pcistub_init_device()
398 dev_dbg(&dev->dev, "enabling device\n"); in pcistub_init_device()
403 if (dev->msix_cap) { in pcistub_init_device()
405 .seg = pci_domain_nr(dev->bus), in pcistub_init_device()
406 .bus = dev->bus->number, in pcistub_init_device()
407 .devfn = dev->devfn in pcistub_init_device()
411 if (err && err != -ENOSYS) in pcistub_init_device()
412 dev_err(&dev->dev, "MSI-X preparation failed (%d)\n", in pcistub_init_device()
417 dev_dbg(&dev->dev, "save state of device\n"); in pcistub_init_device()
419 dev_data->pci_saved_state = pci_store_saved_state(dev); in pcistub_init_device()
420 if (!dev_data->pci_saved_state) in pcistub_init_device()
421 dev_err(&dev->dev, "Could not store PCI conf saved state!\n"); in pcistub_init_device()
423 dev_dbg(&dev->dev, "resetting (FLR, D3, etc) the device\n"); in pcistub_init_device()
430 dev_dbg(&dev->dev, "reset device\n"); in pcistub_init_device()
462 list_del(&psdev->dev_list); in pcistub_init_devices_late()
466 err = pcistub_init_device(psdev->dev); in pcistub_init_devices_late()
468 dev_err(&psdev->dev->dev, in pcistub_init_devices_late()
477 list_add_tail(&psdev->dev_list, &pcistub_devices); in pcistub_init_devices_late()
488 int domain, int bus, unsigned int devfn) in pcistub_device_id_add_list() argument
497 if (pci_dev_id->domain == domain && pci_dev_id->bus == bus && in pcistub_device_id_add_list()
498 pci_dev_id->devfn == devfn) { in pcistub_device_id_add_list()
505 new->domain = domain; in pcistub_device_id_add_list()
506 new->bus = bus; in pcistub_device_id_add_list()
507 new->devfn = devfn; in pcistub_device_id_add_list()
508 list_add_tail(&new->slot_list, &pcistub_device_ids); in pcistub_device_id_add_list()
527 return -ENOMEM; in pcistub_seize()
536 err = pcistub_init_device(psdev->dev); in pcistub_seize()
541 list_add(&psdev->dev_list, &pcistub_devices); in pcistub_seize()
543 dev_dbg(&dev->dev, "deferring initialization\n"); in pcistub_seize()
544 list_add(&psdev->dev_list, &seized_devices); in pcistub_seize()
553 pcistub_device_id_add_list(pci_dev_id, pci_domain_nr(dev->bus), in pcistub_seize()
554 dev->bus->number, dev->devfn); in pcistub_seize()
566 dev_dbg(&dev->dev, "probing...\n"); in pcistub_probe()
570 if ((dev->driver_override && in pcistub_probe()
571 !strcmp(dev->driver_override, PCISTUB_DRIVER_NAME)) || in pcistub_probe()
574 if (dev->hdr_type != PCI_HEADER_TYPE_NORMAL in pcistub_probe()
575 && dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { in pcistub_probe()
576 dev_err(&dev->dev, "can't export pci devices that " in pcistub_probe()
579 err = -ENODEV; in pcistub_probe()
586 err = -ENOMEM; in pcistub_probe()
591 dev_info(&dev->dev, "seizing device\n"); in pcistub_probe()
595 err = -ENODEV; in pcistub_probe()
608 dev_dbg(&dev->dev, "removing\n"); in pcistub_remove()
615 if (psdev->dev == dev) { in pcistub_remove()
624 dev_dbg(&dev->dev, "found device to remove %s\n", in pcistub_remove()
625 found_psdev->pdev ? "- in-use" : ""); in pcistub_remove()
627 if (found_psdev->pdev) { in pcistub_remove()
630 dev_warn(&dev->dev, "****** removing device %s while still in-use by domain %d! ******\n", in pcistub_remove()
631 pci_name(found_psdev->dev), domid); in pcistub_remove()
632 dev_warn(&dev->dev, "****** driver domain may still access this device's i/o resources!\n"); in pcistub_remove()
633 dev_warn(&dev->dev, "****** shutdown driver domain before binding device\n"); in pcistub_remove()
634 dev_warn(&dev->dev, "****** to other drivers or domains\n"); in pcistub_remove()
638 xen_pcibk_release_pci_dev(found_psdev->pdev, in pcistub_remove()
639 found_psdev->dev, in pcistub_remove()
644 list_del(&found_psdev->dev_list); in pcistub_remove()
670 snprintf(nodename, PCI_NODENAME_MAX, "/local/domain/0/backend/pci/%d/0", in kill_domain_by_device()
671 psdev->pdev->xdev->otherend_id); in kill_domain_by_device()
676 dev_err(&psdev->dev->dev, in kill_domain_by_device()
684 if (err == -EAGAIN) in kill_domain_by_device()
686 dev_err(&psdev->dev->dev, in kill_domain_by_device()
702 struct xen_pcibk_device *pdev = psdev->pdev; in common_process()
703 struct xen_pci_sharedinfo *sh_info = pdev->sh_info; in common_process()
707 aer_op = &(sh_info->aer_op); in common_process()
708 aer_op->cmd = aer_cmd ; in common_process()
710 aer_op->err = state; in common_process()
712 ret = xen_pcibk_get_pcifront_dev(psdev->dev, psdev->pdev, in common_process()
713 &aer_op->domain, &aer_op->bus, &aer_op->devfn); in common_process()
715 dev_err(&psdev->dev->dev, "failed to get pcifront device\n"); in common_process()
720 dev_dbg(&psdev->dev->dev, "aer_op %x dom %x bus %x devfn %x\n", in common_process()
721 aer_cmd, aer_op->domain, aer_op->bus, aer_op->devfn); in common_process()
723 * this flag to judge whether we need to check pci-front give aer in common_process()
726 set_bit(_PCIB_op_pending, (unsigned long *)&pdev->flags); in common_process()
733 (unsigned long *)&sh_info->flags); in common_process()
735 notify_remote_via_irq(pdev->evtchn_irq); in common_process()
742 &sh_info->flags)), 300*HZ); in common_process()
745 if (!test_bit(_PDEVF_op_active, &pdev->flags)) in common_process()
750 (unsigned long *)&sh_info->flags)) { in common_process()
751 dev_err(&psdev->dev->dev, in common_process()
754 (unsigned long *)&sh_info->flags); in common_process()
755 aer_op->err = PCI_ERS_RESULT_NONE; in common_process()
759 clear_bit(_PCIB_op_pending, (unsigned long *)&pdev->flags); in common_process()
761 res = (pci_ers_result_t)aer_op->err; in common_process()
769 * @dev: pointer to PCI devices
778 dev_dbg(&dev->dev, "xen_pcibk_slot_reset(bus:%x,devfn:%x)\n", in xen_pcibk_slot_reset()
779 dev->bus->number, dev->devfn); in xen_pcibk_slot_reset()
782 psdev = pcistub_device_find(pci_domain_nr(dev->bus), in xen_pcibk_slot_reset()
783 dev->bus->number, in xen_pcibk_slot_reset()
784 PCI_SLOT(dev->devfn), in xen_pcibk_slot_reset()
785 PCI_FUNC(dev->devfn)); in xen_pcibk_slot_reset()
787 if (!psdev || !psdev->pdev) { in xen_pcibk_slot_reset()
788 dev_err(&dev->dev, "device is not found/assigned\n"); in xen_pcibk_slot_reset()
792 if (!psdev->pdev->sh_info) { in xen_pcibk_slot_reset()
793 dev_err(&dev->dev, "device is not connected or owned" in xen_pcibk_slot_reset()
800 (unsigned long *)&psdev->pdev->sh_info->flags)) { in xen_pcibk_slot_reset()
801 dev_err(&dev->dev, in xen_pcibk_slot_reset()
809 dev_dbg(&dev->dev, in xen_pcibk_slot_reset()
825 * @dev: pointer to PCI devices
835 dev_dbg(&dev->dev, "xen_pcibk_mmio_enabled(bus:%x,devfn:%x)\n", in xen_pcibk_mmio_enabled()
836 dev->bus->number, dev->devfn); in xen_pcibk_mmio_enabled()
839 psdev = pcistub_device_find(pci_domain_nr(dev->bus), in xen_pcibk_mmio_enabled()
840 dev->bus->number, in xen_pcibk_mmio_enabled()
841 PCI_SLOT(dev->devfn), in xen_pcibk_mmio_enabled()
842 PCI_FUNC(dev->devfn)); in xen_pcibk_mmio_enabled()
844 if (!psdev || !psdev->pdev) { in xen_pcibk_mmio_enabled()
845 dev_err(&dev->dev, "device is not found/assigned\n"); in xen_pcibk_mmio_enabled()
849 if (!psdev->pdev->sh_info) { in xen_pcibk_mmio_enabled()
850 dev_err(&dev->dev, "device is not connected or owned" in xen_pcibk_mmio_enabled()
857 (unsigned long *)&psdev->pdev->sh_info->flags)) { in xen_pcibk_mmio_enabled()
858 dev_err(&dev->dev, in xen_pcibk_mmio_enabled()
866 dev_dbg(&dev->dev, in xen_pcibk_mmio_enabled()
880 * @dev: pointer to PCI devices
881 * @error: the current PCI connection state
892 dev_dbg(&dev->dev, "xen_pcibk_error_detected(bus:%x,devfn:%x)\n", in xen_pcibk_error_detected()
893 dev->bus->number, dev->devfn); in xen_pcibk_error_detected()
896 psdev = pcistub_device_find(pci_domain_nr(dev->bus), in xen_pcibk_error_detected()
897 dev->bus->number, in xen_pcibk_error_detected()
898 PCI_SLOT(dev->devfn), in xen_pcibk_error_detected()
899 PCI_FUNC(dev->devfn)); in xen_pcibk_error_detected()
901 if (!psdev || !psdev->pdev) { in xen_pcibk_error_detected()
902 dev_err(&dev->dev, "device is not found/assigned\n"); in xen_pcibk_error_detected()
906 if (!psdev->pdev->sh_info) { in xen_pcibk_error_detected()
907 dev_err(&dev->dev, "device is not connected or owned" in xen_pcibk_error_detected()
915 (unsigned long *)&psdev->pdev->sh_info->flags)) { in xen_pcibk_error_detected()
916 dev_dbg(&dev->dev, "guest may have no aer driver, kill it\n"); in xen_pcibk_error_detected()
924 dev_dbg(&dev->dev, in xen_pcibk_error_detected()
938 * @dev: pointer to PCI devices
945 dev_dbg(&dev->dev, "xen_pcibk_error_resume(bus:%x,devfn:%x)\n", in xen_pcibk_error_resume()
946 dev->bus->number, dev->devfn); in xen_pcibk_error_resume()
949 psdev = pcistub_device_find(pci_domain_nr(dev->bus), in xen_pcibk_error_resume()
950 dev->bus->number, in xen_pcibk_error_resume()
951 PCI_SLOT(dev->devfn), in xen_pcibk_error_resume()
952 PCI_FUNC(dev->devfn)); in xen_pcibk_error_resume()
954 if (!psdev || !psdev->pdev) { in xen_pcibk_error_resume()
955 dev_err(&dev->dev, "device is not found/assigned\n"); in xen_pcibk_error_resume()
959 if (!psdev->pdev->sh_info) { in xen_pcibk_error_resume()
960 dev_err(&dev->dev, "device is not connected or owned" in xen_pcibk_error_resume()
967 (unsigned long *)&psdev->pdev->sh_info->flags)) { in xen_pcibk_error_resume()
968 dev_err(&dev->dev, in xen_pcibk_error_resume()
1005 static inline int str_to_slot(const char *buf, int *domain, int *bus, in str_to_slot() argument
1010 switch (sscanf(buf, " %x:%x:%x.%x %n", domain, bus, slot, func, in str_to_slot()
1013 *func = -1; in str_to_slot()
1014 sscanf(buf, " %x:%x:%x.* %n", domain, bus, slot, &parsed); in str_to_slot()
1017 *slot = *func = -1; in str_to_slot()
1018 sscanf(buf, " %x:%x:*.* %n", domain, bus, &parsed); in str_to_slot()
1024 /* try again without domain */ in str_to_slot()
1025 *domain = 0; in str_to_slot()
1028 *func = -1; in str_to_slot()
1032 *slot = *func = -1; in str_to_slot()
1039 return -EINVAL; in str_to_slot()
1042 static inline int str_to_quirk(const char *buf, int *domain, int *bus, int in str_to_quirk() argument
1047 sscanf(buf, " %x:%x:%x.%x-%x:%x:%x %n", domain, bus, slot, func, in str_to_quirk()
1052 /* try again without domain */ in str_to_quirk()
1053 *domain = 0; in str_to_quirk()
1054 sscanf(buf, " %x:%x.%x-%x:%x:%x %n", bus, slot, func, reg, size, in str_to_quirk()
1059 return -EINVAL; in str_to_quirk()
1062 static int pcistub_device_id_add(int domain, int bus, int slot, int func) in pcistub_device_id_add() argument
1069 rc = pcistub_device_id_add(domain, bus, slot, func); in pcistub_device_id_add()
1075 rc = pcistub_device_id_add(domain, bus, slot, func); in pcistub_device_id_add()
1082 !pci_domains_supported ? domain : in pcistub_device_id_add()
1084 domain < 0 || domain > 0xffff) in pcistub_device_id_add()
1088 return -EINVAL; in pcistub_device_id_add()
1092 return -ENOMEM; in pcistub_device_id_add()
1095 domain, bus, slot, func); in pcistub_device_id_add()
1097 pcistub_device_id_add_list(pci_dev_id, domain, bus, devfn); in pcistub_device_id_add()
1102 static int pcistub_device_id_remove(int domain, int bus, int slot, int func) in pcistub_device_id_remove() argument
1105 int err = -ENOENT; in pcistub_device_id_remove()
1111 if (pci_dev_id->domain == domain && pci_dev_id->bus == bus in pcistub_device_id_remove()
1112 && (slot < 0 || PCI_SLOT(pci_dev_id->devfn) == slot) in pcistub_device_id_remove()
1113 && (func < 0 || PCI_FUNC(pci_dev_id->devfn) == func)) { in pcistub_device_id_remove()
1117 list_del(&pci_dev_id->slot_list); in pcistub_device_id_remove()
1123 domain, bus, slot, func); in pcistub_device_id_remove()
1131 static int pcistub_reg_add(int domain, int bus, int slot, int func, in pcistub_reg_add() argument
1141 return -EINVAL; in pcistub_reg_add()
1143 psdev = pcistub_device_find(domain, bus, slot, func); in pcistub_reg_add()
1145 err = -ENODEV; in pcistub_reg_add()
1148 dev = psdev->dev; in pcistub_reg_add()
1152 err = -ENOMEM; in pcistub_reg_add()
1156 field->offset = reg; in pcistub_reg_add()
1157 field->size = size; in pcistub_reg_add()
1158 field->mask = mask; in pcistub_reg_add()
1159 field->init = NULL; in pcistub_reg_add()
1160 field->reset = NULL; in pcistub_reg_add()
1161 field->release = NULL; in pcistub_reg_add()
1162 field->clean = xen_pcibk_config_field_free; in pcistub_reg_add()
1176 int domain, bus, slot, func; in new_slot_store() local
1179 err = str_to_slot(buf, &domain, &bus, &slot, &func); in new_slot_store()
1183 err = pcistub_device_id_add(domain, bus, slot, func); in new_slot_store()
1195 int domain, bus, slot, func; in remove_slot_store() local
1198 err = str_to_slot(buf, &domain, &bus, &slot, &func); in remove_slot_store()
1202 err = pcistub_device_id_remove(domain, bus, slot, func); in remove_slot_store()
1222 count += scnprintf(buf + count, PAGE_SIZE - count, in slots_show()
1224 pci_dev_id->domain, pci_dev_id->bus, in slots_show()
1225 PCI_SLOT(pci_dev_id->devfn), in slots_show()
1226 PCI_FUNC(pci_dev_id->devfn)); in slots_show()
1245 if (!psdev->dev) in irq_handlers_show()
1247 dev_data = pci_get_drvdata(psdev->dev); in irq_handlers_show()
1251 scnprintf(buf + count, PAGE_SIZE - count, in irq_handlers_show()
1253 pci_name(psdev->dev), in irq_handlers_show()
1254 dev_data->isr_on ? "on" : "off", in irq_handlers_show()
1255 dev_data->ack_intr ? "ack" : "not ack", in irq_handlers_show()
1256 dev_data->handled); in irq_handlers_show()
1268 int domain, bus, slot, func; in irq_handler_state_store() local
1271 err = str_to_slot(buf, &domain, &bus, &slot, &func); in irq_handler_state_store()
1275 psdev = pcistub_device_find(domain, bus, slot, func); in irq_handler_state_store()
1277 err = -ENOENT; in irq_handler_state_store()
1281 dev_data = pci_get_drvdata(psdev->dev); in irq_handler_state_store()
1283 err = -ENOENT; in irq_handler_state_store()
1287 dev_dbg(&psdev->dev->dev, "%s fake irq handler: %d->%d\n", in irq_handler_state_store()
1288 dev_data->irq_name, dev_data->isr_on, in irq_handler_state_store()
1289 !dev_data->isr_on); in irq_handler_state_store()
1291 dev_data->isr_on = !(dev_data->isr_on); in irq_handler_state_store()
1292 if (dev_data->isr_on) in irq_handler_state_store()
1293 dev_data->ack_intr = 1; in irq_handler_state_store()
1306 int domain, bus, slot, func, reg, size, mask; in quirks_store() local
1309 err = str_to_quirk(buf, &domain, &bus, &slot, &func, &reg, &size, in quirks_store()
1314 err = pcistub_reg_add(domain, bus, slot, func, reg, size, mask); in quirks_store()
1336 count += scnprintf(buf + count, PAGE_SIZE - count, in quirks_show()
1338 quirk->pdev->bus->number, in quirks_show()
1339 PCI_SLOT(quirk->pdev->devfn), in quirks_show()
1340 PCI_FUNC(quirk->pdev->devfn), in quirks_show()
1341 quirk->devid.vendor, quirk->devid.device, in quirks_show()
1342 quirk->devid.subvendor, in quirks_show()
1343 quirk->devid.subdevice); in quirks_show()
1345 dev_data = pci_get_drvdata(quirk->pdev); in quirks_show()
1347 list_for_each_entry(cfg_entry, &dev_data->config_fields, list) { in quirks_show()
1348 field = cfg_entry->field; in quirks_show()
1352 count += scnprintf(buf + count, PAGE_SIZE - count, in quirks_show()
1354 cfg_entry->base_offset + in quirks_show()
1355 field->offset, field->size, in quirks_show()
1356 field->mask); in quirks_show()
1370 int domain, bus, slot, func; in permissive_store() local
1375 err = str_to_slot(buf, &domain, &bus, &slot, &func); in permissive_store()
1379 psdev = pcistub_device_find(domain, bus, slot, func); in permissive_store()
1381 err = -ENODEV; in permissive_store()
1385 dev_data = pci_get_drvdata(psdev->dev); in permissive_store()
1388 err = -ENXIO; in permissive_store()
1391 if (!dev_data->permissive) { in permissive_store()
1392 dev_data->permissive = 1; in permissive_store()
1394 dev_warn(&psdev->dev->dev, "enabling permissive mode " in permissive_store()
1396 dev_warn(&psdev->dev->dev, in permissive_store()
1417 if (!psdev->dev) in permissive_show()
1419 dev_data = pci_get_drvdata(psdev->dev); in permissive_show()
1420 if (!dev_data || !dev_data->permissive) in permissive_show()
1423 scnprintf(buf + count, PAGE_SIZE - count, "%s\n", in permissive_show()
1424 pci_name(psdev->dev)); in permissive_show()
1434 int domain, bus, slot, func; in allow_interrupt_control_store() local
1439 err = str_to_slot(buf, &domain, &bus, &slot, &func); in allow_interrupt_control_store()
1443 psdev = pcistub_device_find(domain, bus, slot, func); in allow_interrupt_control_store()
1445 err = -ENODEV; in allow_interrupt_control_store()
1449 dev_data = pci_get_drvdata(psdev->dev); in allow_interrupt_control_store()
1452 err = -ENXIO; in allow_interrupt_control_store()
1455 dev_data->allow_interrupt_control = 1; in allow_interrupt_control_store()
1476 if (!psdev->dev) in allow_interrupt_control_show()
1478 dev_data = pci_get_drvdata(psdev->dev); in allow_interrupt_control_show()
1479 if (!dev_data || !dev_data->allow_interrupt_control) in allow_interrupt_control_show()
1482 scnprintf(buf + count, PAGE_SIZE - count, "%s\n", in allow_interrupt_control_show()
1483 pci_name(psdev->dev)); in allow_interrupt_control_show()
1512 int domain, bus, slot, func; in pcistub_init() local
1521 &domain, &bus, &slot, &func, &parsed); in pcistub_init()
1524 func = -1; in pcistub_init()
1527 &domain, &bus, &slot, &parsed); in pcistub_init()
1530 slot = func = -1; in pcistub_init()
1533 &domain, &bus, &parsed); in pcistub_init()
1538 domain = 0; in pcistub_init()
1544 func = -1; in pcistub_init()
1550 slot = func = -1; in pcistub_init()
1561 err = pcistub_device_id_add(domain, bus, slot, func); in pcistub_init()
1569 /* If we're the first PCI Device Driver to register, we're the in pcistub_init()
1570 * first one to get offered PCI devices as they become in pcistub_init()
1610 return -EINVAL; in pcistub_init()
1618 * get a chance by being the first pci device
1633 if (!psdev->pdev && psdev->dev != pdev in find_vfs()
1634 && pci_physfn(psdev->dev) == pdev) { in find_vfs()
1654 if (!pdev->is_physfn) in pci_stub_notifier()
1661 device_release_driver(&psdev->dev->dev); in pci_stub_notifier()
1676 return -ENODEV; in xen_pcibk_init()
1713 MODULE_ALIAS("xen-backend:pci");