Lines Matching refs:psdev
71 struct pcistub_device *psdev;
75 psdev = kzalloc(sizeof(*psdev), GFP_KERNEL);
76 if (!psdev)
79 psdev->dev = pci_dev_get(dev);
80 if (!psdev->dev) {
81 kfree(psdev);
85 kref_init(&psdev->kref);
86 spin_lock_init(&psdev->lock);
88 return psdev;
94 struct pcistub_device *psdev;
98 psdev = container_of(kref, struct pcistub_device, kref);
99 dev = psdev->dev;
143 kfree(psdev);
146 static inline void pcistub_device_get(struct pcistub_device *psdev)
148 kref_get(&psdev->kref);
151 static inline void pcistub_device_put(struct pcistub_device *psdev)
153 kref_put(&psdev->kref, pcistub_device_release);
159 struct pcistub_device *psdev;
161 list_for_each_entry(psdev, &pcistub_devices, dev_list) {
162 if (psdev->dev != NULL
163 && domain == pci_domain_nr(psdev->dev->bus)
164 && bus == psdev->dev->bus->number
165 && slot == PCI_SLOT(psdev->dev->devfn)
166 && func == PCI_FUNC(psdev->dev->devfn)) {
167 return psdev;
177 struct pcistub_device *psdev;
182 psdev = pcistub_device_find_locked(domain, bus, slot, func);
183 if (psdev)
184 pcistub_device_get(psdev);
187 return psdev;
191 struct pcistub_device *psdev)
196 pcistub_device_get(psdev);
198 spin_lock_irqsave(&psdev->lock, flags);
199 if (!psdev->pdev) {
200 psdev->pdev = pdev;
201 pci_dev = psdev->dev;
203 spin_unlock_irqrestore(&psdev->lock, flags);
206 pcistub_device_put(psdev);
215 struct pcistub_device *psdev;
221 psdev = pcistub_device_find_locked(domain, bus, slot, func);
222 if (psdev)
223 found_dev = pcistub_device_get_pci_dev(pdev, psdev);
232 struct pcistub_device *psdev;
238 list_for_each_entry(psdev, &pcistub_devices, dev_list) {
239 if (psdev->dev == dev) {
240 found_dev = pcistub_device_get_pci_dev(pdev, psdev);
262 struct pcistub_device *psdev, *found_psdev = NULL;
269 list_for_each_entry(psdev, &pcistub_devices, dev_list) {
270 if (psdev->dev == dev) {
271 found_psdev = psdev;
368 * here and then to call kfree(pci_get_drvdata(psdev->dev)).
453 struct pcistub_device *psdev;
460 psdev = container_of(seized_devices.next,
462 list_del(&psdev->dev_list);
466 err = pcistub_init_device(psdev->dev);
468 dev_err(&psdev->dev->dev,
470 kfree(psdev);
471 psdev = NULL;
476 if (psdev)
477 list_add_tail(&psdev->dev_list, &pcistub_devices);
520 struct pcistub_device *psdev;
524 psdev = pcistub_device_alloc(dev);
525 if (!psdev) {
536 err = pcistub_init_device(psdev->dev);
541 list_add(&psdev->dev_list, &pcistub_devices);
544 list_add(&psdev->dev_list, &seized_devices);
551 pcistub_device_put(psdev);
605 struct pcistub_device *psdev, *found_psdev = NULL;
614 list_for_each_entry(psdev, &pcistub_devices, dev_list) {
615 if (psdev->dev == dev) {
616 found_psdev = psdev;
663 static void kill_domain_by_device(struct pcistub_device *psdev)
669 BUG_ON(!psdev);
671 psdev->pdev->xdev->otherend_id);
676 dev_err(&psdev->dev->dev,
686 dev_err(&psdev->dev->dev,
696 static pci_ers_result_t common_process(struct pcistub_device *psdev,
702 struct xen_pcibk_device *pdev = psdev->pdev;
712 ret = xen_pcibk_get_pcifront_dev(psdev->dev, psdev->pdev,
715 dev_err(&psdev->dev->dev, "failed to get pcifront device\n");
720 dev_dbg(&psdev->dev->dev, "aer_op %x dom %x bus %x devfn %x\n",
751 dev_err(&psdev->dev->dev,
774 struct pcistub_device *psdev;
782 psdev = pcistub_device_find(pci_domain_nr(dev->bus),
787 if (!psdev || !psdev->pdev) {
792 if (!psdev->pdev->sh_info) {
795 kill_domain_by_device(psdev);
800 (unsigned long *)&psdev->pdev->sh_info->flags)) {
805 result = common_process(psdev, 1, XEN_PCI_OP_aer_slotreset, result);
811 kill_domain_by_device(psdev);
814 if (psdev)
815 pcistub_device_put(psdev);
831 struct pcistub_device *psdev;
839 psdev = pcistub_device_find(pci_domain_nr(dev->bus),
844 if (!psdev || !psdev->pdev) {
849 if (!psdev->pdev->sh_info) {
852 kill_domain_by_device(psdev);
857 (unsigned long *)&psdev->pdev->sh_info->flags)) {
862 result = common_process(psdev, 1, XEN_PCI_OP_aer_mmio, result);
868 kill_domain_by_device(psdev);
871 if (psdev)
872 pcistub_device_put(psdev);
888 struct pcistub_device *psdev;
896 psdev = pcistub_device_find(pci_domain_nr(dev->bus),
901 if (!psdev || !psdev->pdev) {
906 if (!psdev->pdev->sh_info) {
909 kill_domain_by_device(psdev);
915 (unsigned long *)&psdev->pdev->sh_info->flags)) {
917 kill_domain_by_device(psdev);
920 result = common_process(psdev, error, XEN_PCI_OP_aer_detected, result);
926 kill_domain_by_device(psdev);
929 if (psdev)
930 pcistub_device_put(psdev);
943 struct pcistub_device *psdev;
949 psdev = pcistub_device_find(pci_domain_nr(dev->bus),
954 if (!psdev || !psdev->pdev) {
959 if (!psdev->pdev->sh_info) {
962 kill_domain_by_device(psdev);
967 (unsigned long *)&psdev->pdev->sh_info->flags)) {
970 kill_domain_by_device(psdev);
973 common_process(psdev, 1, XEN_PCI_OP_aer_resume,
976 if (psdev)
977 pcistub_device_put(psdev);
1136 struct pcistub_device *psdev;
1143 psdev = pcistub_device_find(domain, bus, slot, func);
1144 if (!psdev) {
1148 dev = psdev->dev;
1168 if (psdev)
1169 pcistub_device_put(psdev);
1236 struct pcistub_device *psdev;
1242 list_for_each_entry(psdev, &pcistub_devices, dev_list) {
1245 if (!psdev->dev)
1247 dev_data = pci_get_drvdata(psdev->dev);
1253 pci_name(psdev->dev),
1266 struct pcistub_device *psdev;
1275 psdev = pcistub_device_find(domain, bus, slot, func);
1276 if (!psdev) {
1281 dev_data = pci_get_drvdata(psdev->dev);
1287 dev_dbg(&psdev->dev->dev, "%s fake irq handler: %d->%d\n",
1295 if (psdev)
1296 pcistub_device_put(psdev);
1372 struct pcistub_device *psdev;
1379 psdev = pcistub_device_find(domain, bus, slot, func);
1380 if (!psdev) {
1385 dev_data = pci_get_drvdata(psdev->dev);
1394 dev_warn(&psdev->dev->dev, "enabling permissive mode "
1396 dev_warn(&psdev->dev->dev,
1400 pcistub_device_put(psdev);
1409 struct pcistub_device *psdev;
1414 list_for_each_entry(psdev, &pcistub_devices, dev_list) {
1417 if (!psdev->dev)
1419 dev_data = pci_get_drvdata(psdev->dev);
1424 pci_name(psdev->dev));
1436 struct pcistub_device *psdev;
1443 psdev = pcistub_device_find(domain, bus, slot, func);
1444 if (!psdev) {
1449 dev_data = pci_get_drvdata(psdev->dev);
1457 pcistub_device_put(psdev);
1467 struct pcistub_device *psdev;
1473 list_for_each_entry(psdev, &pcistub_devices, dev_list) {
1476 if (!psdev->dev)
1478 dev_data = pci_get_drvdata(psdev->dev);
1483 pci_name(psdev->dev));
1627 struct pcistub_device *psdev = NULL;
1632 list_for_each_entry(psdev, &pcistub_devices, dev_list) {
1633 if (!psdev->pdev && psdev->dev != pdev
1634 && pci_physfn(psdev->dev) == pdev) {
1641 return psdev;
1658 struct pcistub_device *psdev = find_vfs(pdev);
1659 if (!psdev)
1661 device_release_driver(&psdev->dev->dev);