Lines Matching refs:dev
24 static void xen_pcibk_control_isr(struct pci_dev *dev, int reset) in xen_pcibk_control_isr() argument
30 dev_data = pci_get_drvdata(dev); in xen_pcibk_control_isr()
35 if (dev->hdr_type != PCI_HEADER_TYPE_NORMAL) in xen_pcibk_control_isr()
53 dev_data->irq = dev->irq; in xen_pcibk_control_isr()
62 dev_dbg(&dev->dev, "%s: #%d %s %s%s %s-> %s\n", in xen_pcibk_control_isr()
65 pci_is_enabled(dev) ? "on" : "off", in xen_pcibk_control_isr()
66 dev->msi_enabled ? "MSI" : "", in xen_pcibk_control_isr()
67 dev->msix_enabled ? "MSI/X" : "", in xen_pcibk_control_isr()
76 if (dev->msi_enabled || dev->msix_enabled) in xen_pcibk_control_isr()
81 dev_data->irq_name, dev); in xen_pcibk_control_isr()
83 dev_err(&dev->dev, "%s: failed to install fake IRQ " \ in xen_pcibk_control_isr()
89 free_irq(dev_data->irq, dev); in xen_pcibk_control_isr()
95 dev_dbg(&dev->dev, "%s: #%d %s %s%s %s\n", in xen_pcibk_control_isr()
98 pci_is_enabled(dev) ? "on" : "off", in xen_pcibk_control_isr()
99 dev->msi_enabled ? "MSI" : "", in xen_pcibk_control_isr()
100 dev->msix_enabled ? "MSI/X" : "", in xen_pcibk_control_isr()
109 void xen_pcibk_reset_device(struct pci_dev *dev) in xen_pcibk_reset_device() argument
113 xen_pcibk_control_isr(dev, 1 /* reset device */); in xen_pcibk_reset_device()
116 if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) { in xen_pcibk_reset_device()
120 if (dev->msix_enabled) in xen_pcibk_reset_device()
121 pci_disable_msix(dev); in xen_pcibk_reset_device()
122 if (dev->msi_enabled) in xen_pcibk_reset_device()
123 pci_disable_msi(dev); in xen_pcibk_reset_device()
125 if (pci_is_enabled(dev)) in xen_pcibk_reset_device()
126 pci_disable_device(dev); in xen_pcibk_reset_device()
128 dev->is_busmaster = 0; in xen_pcibk_reset_device()
130 pci_read_config_word(dev, PCI_COMMAND, &cmd); in xen_pcibk_reset_device()
133 pci_write_config_word(dev, PCI_COMMAND, cmd); in xen_pcibk_reset_device()
135 dev->is_busmaster = 0; in xen_pcibk_reset_device()
143 struct pci_dev *dev, struct xen_pci_op *op) in xen_pcibk_enable_msi() argument
148 if (dev->msi_enabled) in xen_pcibk_enable_msi()
150 else if (dev->msix_enabled) in xen_pcibk_enable_msi()
153 status = pci_enable_msi(dev); in xen_pcibk_enable_msi()
156 dev_warn_ratelimited(&dev->dev, "error enabling MSI for guest %u: err %d\n", in xen_pcibk_enable_msi()
165 op->value = dev->irq ? xen_pirq_from_irq(dev->irq) : 0; in xen_pcibk_enable_msi()
167 dev_dbg(&dev->dev, "MSI: %d\n", op->value); in xen_pcibk_enable_msi()
169 dev_data = pci_get_drvdata(dev); in xen_pcibk_enable_msi()
178 struct pci_dev *dev, struct xen_pci_op *op) in xen_pcibk_disable_msi() argument
180 if (dev->msi_enabled) { in xen_pcibk_disable_msi()
183 pci_disable_msi(dev); in xen_pcibk_disable_msi()
185 dev_data = pci_get_drvdata(dev); in xen_pcibk_disable_msi()
189 op->value = dev->irq ? xen_pirq_from_irq(dev->irq) : 0; in xen_pcibk_disable_msi()
191 dev_dbg(&dev->dev, "MSI: %d\n", op->value); in xen_pcibk_disable_msi()
198 struct pci_dev *dev, struct xen_pci_op *op) in xen_pcibk_enable_msix() argument
205 dev_dbg(&dev->dev, "enable MSI-X\n"); in xen_pcibk_enable_msix()
210 if (dev->msix_enabled) in xen_pcibk_enable_msix()
218 pci_read_config_word(pci_physfn(dev), PCI_COMMAND, &cmd); in xen_pcibk_enable_msix()
219 if (dev->msi_enabled || !(cmd & PCI_COMMAND_MEMORY)) in xen_pcibk_enable_msix()
231 result = pci_enable_msix_exact(dev, entries, op->value); in xen_pcibk_enable_msix()
238 dev_dbg(&dev->dev, "MSI-X[%d]: %d\n", i, in xen_pcibk_enable_msix()
243 dev_warn_ratelimited(&dev->dev, "error enabling MSI-X for guest %u: err %d!\n", in xen_pcibk_enable_msix()
248 dev_data = pci_get_drvdata(dev); in xen_pcibk_enable_msix()
257 struct pci_dev *dev, struct xen_pci_op *op) in xen_pcibk_disable_msix() argument
259 if (dev->msix_enabled) { in xen_pcibk_disable_msix()
262 pci_disable_msix(dev); in xen_pcibk_disable_msix()
264 dev_data = pci_get_drvdata(dev); in xen_pcibk_disable_msix()
272 op->value = dev->irq ? xen_pirq_from_irq(dev->irq) : 0; in xen_pcibk_disable_msix()
274 dev_dbg(&dev->dev, "MSI-X: %d\n", op->value); in xen_pcibk_disable_msix()
323 struct pci_dev *dev; in xen_pcibk_do_one_op() local
333 dev = xen_pcibk_get_pci_dev(pdev, op->domain, op->bus, op->devfn); in xen_pcibk_do_one_op()
335 if (dev == NULL) in xen_pcibk_do_one_op()
338 dev_data = pci_get_drvdata(dev); in xen_pcibk_do_one_op()
343 op->err = xen_pcibk_config_read(dev, in xen_pcibk_do_one_op()
347 op->err = xen_pcibk_config_write(dev, in xen_pcibk_do_one_op()
352 op->err = xen_pcibk_enable_msi(pdev, dev, op); in xen_pcibk_do_one_op()
355 op->err = xen_pcibk_disable_msi(pdev, dev, op); in xen_pcibk_do_one_op()
359 op->err = xen_pcibk_enable_msix(pdev, dev, op); in xen_pcibk_do_one_op()
362 op->err = xen_pcibk_disable_msix(pdev, dev, op); in xen_pcibk_do_one_op()
370 if (!op->err && dev && dev_data) { in xen_pcibk_do_one_op()
373 xen_pcibk_control_isr(dev, 0 /* no reset */); in xen_pcibk_do_one_op()
427 struct pci_dev *dev = (struct pci_dev *)dev_id; in xen_pcibk_guest_interrupt() local
428 struct xen_pcibk_dev_data *dev_data = pci_get_drvdata(dev); in xen_pcibk_guest_interrupt()
434 dev_info(&dev->dev, "%s IRQ line is not shared " in xen_pcibk_guest_interrupt()