1 // SPDX-License-Identifier: GPL-2.0
3 * PCI Message Signaled Interrupt (MSI)
5 * Copyright (C) 2003-2004 Intel
6 * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
7 * Copyright (C) 2016 Christoph Hellwig.
10 #include <linux/export.h>
11 #include <linux/irq.h>
16 int pci_msi_enable = 1;
17 int pci_msi_ignore_mask;
20 * pci_msi_supported - check whether MSI may be enabled on a device
21 * @dev: pointer to the pci_dev data structure of MSI device function
22 * @nvec: how many MSIs have been requested?
24 * Look at global flags, the device itself, and its parent buses
25 * to determine if MSI/-X are supported for the device. If MSI/-X is
26 * supported return 1, else return 0.
28 static int pci_msi_supported(struct pci_dev *dev, int nvec)
32 /* MSI must be globally enabled and supported by the device */
36 if (!dev || dev->no_msi)
40 * You can't ask to have 0 or less MSIs configured.
42 * b) the list manipulation code assumes nvec >= 1.
48 * Any bridge which does NOT route MSI transactions from its
49 * secondary bus to its primary bus must set NO_MSI flag on
50 * the secondary pci_bus.
52 * The NO_MSI flag can either be set directly by:
53 * - arch-specific PCI host bus controller drivers (deprecated)
54 * - quirks for specific PCI bridges
56 * or indirectly by platform-specific PCI host bridge drivers by
57 * advertising the 'msi_domain' property, which results in
58 * the NO_MSI flag when no MSI domain is found for this bridge
61 for (bus = dev->bus; bus; bus = bus->parent)
62 if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI)
68 static void pcim_msi_release(void *pcidev)
70 struct pci_dev *dev = pcidev;
72 dev->is_msi_managed = false;
73 pci_free_irq_vectors(dev);
77 * Needs to be separate from pcim_release to prevent an ordering problem
78 * vs. msi_device_data_release() in the MSI core code.
80 static int pcim_setup_msi_release(struct pci_dev *dev)
84 if (!pci_is_managed(dev) || dev->is_msi_managed)
87 ret = devm_add_action(&dev->dev, pcim_msi_release, dev);
89 dev->is_msi_managed = true;
94 * Ordering vs. devres: msi device data has to be installed first so that
95 * pcim_msi_release() is invoked before it on device release.
97 static int pci_setup_msi_context(struct pci_dev *dev)
99 int ret = msi_setup_device_data(&dev->dev);
102 ret = pcim_setup_msi_release(dev);
107 * Helper functions for mask/unmask and MSI message handling
110 void pci_msi_update_mask(struct msi_desc *desc, u32 clear, u32 set)
112 raw_spinlock_t *lock = &to_pci_dev(desc->dev)->msi_lock;
115 if (!desc->pci.msi_attrib.can_mask)
118 raw_spin_lock_irqsave(lock, flags);
119 desc->pci.msi_mask &= ~clear;
120 desc->pci.msi_mask |= set;
121 pci_write_config_dword(msi_desc_to_pci_dev(desc), desc->pci.mask_pos,
123 raw_spin_unlock_irqrestore(lock, flags);
127 * pci_msi_mask_irq - Generic IRQ chip callback to mask PCI/MSI interrupts
128 * @data: pointer to irqdata associated to that interrupt
130 void pci_msi_mask_irq(struct irq_data *data)
132 struct msi_desc *desc = irq_data_get_msi_desc(data);
134 __pci_msi_mask_desc(desc, BIT(data->irq - desc->irq));
136 EXPORT_SYMBOL_GPL(pci_msi_mask_irq);
139 * pci_msi_unmask_irq - Generic IRQ chip callback to unmask PCI/MSI interrupts
140 * @data: pointer to irqdata associated to that interrupt
142 void pci_msi_unmask_irq(struct irq_data *data)
144 struct msi_desc *desc = irq_data_get_msi_desc(data);
146 __pci_msi_unmask_desc(desc, BIT(data->irq - desc->irq));
148 EXPORT_SYMBOL_GPL(pci_msi_unmask_irq);
150 void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
152 struct pci_dev *dev = msi_desc_to_pci_dev(entry);
154 BUG_ON(dev->current_state != PCI_D0);
156 if (entry->pci.msi_attrib.is_msix) {
157 void __iomem *base = pci_msix_desc_addr(entry);
159 if (WARN_ON_ONCE(entry->pci.msi_attrib.is_virtual))
162 msg->address_lo = readl(base + PCI_MSIX_ENTRY_LOWER_ADDR);
163 msg->address_hi = readl(base + PCI_MSIX_ENTRY_UPPER_ADDR);
164 msg->data = readl(base + PCI_MSIX_ENTRY_DATA);
166 int pos = dev->msi_cap;
169 pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_LO,
171 if (entry->pci.msi_attrib.is_64) {
172 pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_HI,
174 pci_read_config_word(dev, pos + PCI_MSI_DATA_64, &data);
177 pci_read_config_word(dev, pos + PCI_MSI_DATA_32, &data);
183 void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
185 struct pci_dev *dev = msi_desc_to_pci_dev(entry);
187 if (dev->current_state != PCI_D0 || pci_dev_is_disconnected(dev)) {
188 /* Don't touch the hardware now */
189 } else if (entry->pci.msi_attrib.is_msix) {
190 void __iomem *base = pci_msix_desc_addr(entry);
191 u32 ctrl = entry->pci.msix_ctrl;
192 bool unmasked = !(ctrl & PCI_MSIX_ENTRY_CTRL_MASKBIT);
194 if (entry->pci.msi_attrib.is_virtual)
198 * The specification mandates that the entry is masked
199 * when the message is modified:
201 * "If software changes the Address or Data value of an
202 * entry while the entry is unmasked, the result is
206 pci_msix_write_vector_ctrl(entry, ctrl | PCI_MSIX_ENTRY_CTRL_MASKBIT);
208 writel(msg->address_lo, base + PCI_MSIX_ENTRY_LOWER_ADDR);
209 writel(msg->address_hi, base + PCI_MSIX_ENTRY_UPPER_ADDR);
210 writel(msg->data, base + PCI_MSIX_ENTRY_DATA);
213 pci_msix_write_vector_ctrl(entry, ctrl);
215 /* Ensure that the writes are visible in the device */
216 readl(base + PCI_MSIX_ENTRY_DATA);
218 int pos = dev->msi_cap;
221 pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl);
222 msgctl &= ~PCI_MSI_FLAGS_QSIZE;
223 msgctl |= entry->pci.msi_attrib.multiple << 4;
224 pci_write_config_word(dev, pos + PCI_MSI_FLAGS, msgctl);
226 pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_LO,
228 if (entry->pci.msi_attrib.is_64) {
229 pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_HI,
231 pci_write_config_word(dev, pos + PCI_MSI_DATA_64,
234 pci_write_config_word(dev, pos + PCI_MSI_DATA_32,
237 /* Ensure that the writes are visible in the device */
238 pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl);
244 if (entry->write_msi_msg)
245 entry->write_msi_msg(entry, entry->write_msi_msg_data);
249 void pci_write_msi_msg(unsigned int irq, struct msi_msg *msg)
251 struct msi_desc *entry = irq_get_msi_desc(irq);
253 __pci_write_msi_msg(entry, msg);
255 EXPORT_SYMBOL_GPL(pci_write_msi_msg);
258 /* PCI/MSI specific functionality */
260 static void pci_intx_for_msi(struct pci_dev *dev, int enable)
262 if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
263 pci_intx(dev, enable);
266 static void pci_msi_set_enable(struct pci_dev *dev, int enable)
270 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
271 control &= ~PCI_MSI_FLAGS_ENABLE;
273 control |= PCI_MSI_FLAGS_ENABLE;
274 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control);
277 static int msi_setup_msi_desc(struct pci_dev *dev, int nvec,
278 struct irq_affinity_desc *masks)
280 struct msi_desc desc;
283 /* MSI Entry Initialization */
284 memset(&desc, 0, sizeof(desc));
286 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
287 /* Lies, damned lies, and MSIs */
288 if (dev->dev_flags & PCI_DEV_FLAGS_HAS_MSI_MASKING)
289 control |= PCI_MSI_FLAGS_MASKBIT;
290 /* Respect XEN's mask disabling */
291 if (pci_msi_ignore_mask)
292 control &= ~PCI_MSI_FLAGS_MASKBIT;
294 desc.nvec_used = nvec;
295 desc.pci.msi_attrib.is_64 = !!(control & PCI_MSI_FLAGS_64BIT);
296 desc.pci.msi_attrib.can_mask = !!(control & PCI_MSI_FLAGS_MASKBIT);
297 desc.pci.msi_attrib.default_irq = dev->irq;
298 desc.pci.msi_attrib.multi_cap = (control & PCI_MSI_FLAGS_QMASK) >> 1;
299 desc.pci.msi_attrib.multiple = ilog2(__roundup_pow_of_two(nvec));
300 desc.affinity = masks;
302 if (control & PCI_MSI_FLAGS_64BIT)
303 desc.pci.mask_pos = dev->msi_cap + PCI_MSI_MASK_64;
305 desc.pci.mask_pos = dev->msi_cap + PCI_MSI_MASK_32;
307 /* Save the initial mask status */
308 if (desc.pci.msi_attrib.can_mask)
309 pci_read_config_dword(dev, desc.pci.mask_pos, &desc.pci.msi_mask);
311 return msi_add_msi_desc(&dev->dev, &desc);
314 static int msi_verify_entries(struct pci_dev *dev)
316 struct msi_desc *entry;
318 if (!dev->no_64bit_msi)
321 msi_for_each_desc(entry, &dev->dev, MSI_DESC_ALL) {
322 if (entry->msg.address_hi) {
323 pci_err(dev, "arch assigned 64-bit MSI address %#x%08x but device only supports 32 bits\n",
324 entry->msg.address_hi, entry->msg.address_lo);
328 return !entry ? 0 : -EIO;
332 * msi_capability_init - configure device's MSI capability structure
333 * @dev: pointer to the pci_dev data structure of MSI device function
334 * @nvec: number of interrupts to allocate
335 * @affd: description of automatic IRQ affinity assignments (may be %NULL)
337 * Setup the MSI capability structure of the device with the requested
338 * number of interrupts. A return value of zero indicates the successful
339 * setup of an entry with the new MSI IRQ. A negative return value indicates
340 * an error, and a positive return value indicates the number of interrupts
341 * which could have been allocated.
343 static int msi_capability_init(struct pci_dev *dev, int nvec,
344 struct irq_affinity *affd)
346 struct irq_affinity_desc *masks = NULL;
347 struct msi_desc *entry;
350 /* Reject multi-MSI early on irq domain enabled architectures */
351 if (nvec > 1 && !pci_msi_domain_supports(dev, MSI_FLAG_MULTI_PCI_MSI, ALLOW_LEGACY))
355 * Disable MSI during setup in the hardware, but mark it enabled
356 * so that setup code can evaluate it.
358 pci_msi_set_enable(dev, 0);
359 dev->msi_enabled = 1;
362 masks = irq_create_affinity_masks(nvec, affd);
364 msi_lock_descs(&dev->dev);
365 ret = msi_setup_msi_desc(dev, nvec, masks);
369 /* All MSIs are unmasked by default; mask them all */
370 entry = msi_first_desc(&dev->dev, MSI_DESC_ALL);
371 pci_msi_mask(entry, msi_multi_mask(entry));
373 /* Configure MSI capability structure */
374 ret = pci_msi_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI);
378 ret = msi_verify_entries(dev);
382 /* Set MSI enabled bits */
383 pci_intx_for_msi(dev, 0);
384 pci_msi_set_enable(dev, 1);
386 pcibios_free_irq(dev);
387 dev->irq = entry->irq;
391 pci_msi_unmask(entry, msi_multi_mask(entry));
392 pci_free_msi_irqs(dev);
394 dev->msi_enabled = 0;
396 msi_unlock_descs(&dev->dev);
401 int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec,
402 struct irq_affinity *affd)
407 if (!pci_msi_supported(dev, minvec) || dev->current_state != PCI_D0)
410 /* Check whether driver already requested MSI-X IRQs */
411 if (dev->msix_enabled) {
412 pci_info(dev, "can't enable MSI (MSI-X already enabled)\n");
419 if (WARN_ON_ONCE(dev->msi_enabled))
422 nvec = pci_msi_vec_count(dev);
431 rc = pci_setup_msi_context(dev);
437 nvec = irq_calc_affinity_vectors(minvec, nvec, affd);
442 rc = msi_capability_init(dev, nvec, affd);
456 * pci_msi_vec_count - Return the number of MSI vectors a device can send
457 * @dev: device to report about
459 * This function returns the number of MSI vectors a device requested via
460 * Multiple Message Capable register. It returns a negative errno if the
461 * device is not capable sending MSI interrupts. Otherwise, the call succeeds
462 * and returns a power of two, up to a maximum of 2^5 (32), according to the
465 int pci_msi_vec_count(struct pci_dev *dev)
473 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &msgctl);
474 ret = 1 << ((msgctl & PCI_MSI_FLAGS_QMASK) >> 1);
478 EXPORT_SYMBOL(pci_msi_vec_count);
481 * Architecture override returns true when the PCI MSI message should be
482 * written by the generic restore function.
484 bool __weak arch_restore_msi_irqs(struct pci_dev *dev)
489 void __pci_restore_msi_state(struct pci_dev *dev)
491 struct msi_desc *entry;
494 if (!dev->msi_enabled)
497 entry = irq_get_msi_desc(dev->irq);
499 pci_intx_for_msi(dev, 0);
500 pci_msi_set_enable(dev, 0);
501 if (arch_restore_msi_irqs(dev))
502 __pci_write_msi_msg(entry, &entry->msg);
504 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
505 pci_msi_update_mask(entry, 0, 0);
506 control &= ~PCI_MSI_FLAGS_QSIZE;
507 control |= (entry->pci.msi_attrib.multiple << 4) | PCI_MSI_FLAGS_ENABLE;
508 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control);
511 void pci_msi_shutdown(struct pci_dev *dev)
513 struct msi_desc *desc;
515 if (!pci_msi_enable || !dev || !dev->msi_enabled)
518 pci_msi_set_enable(dev, 0);
519 pci_intx_for_msi(dev, 1);
520 dev->msi_enabled = 0;
522 /* Return the device with MSI unmasked as initial states */
523 desc = msi_first_desc(&dev->dev, MSI_DESC_ALL);
524 if (!WARN_ON_ONCE(!desc))
525 pci_msi_unmask(desc, msi_multi_mask(desc));
527 /* Restore dev->irq to its default pin-assertion IRQ */
528 dev->irq = desc->pci.msi_attrib.default_irq;
529 pcibios_alloc_irq(dev);
532 /* PCI/MSI-X specific functionality */
534 static void pci_msix_clear_and_set_ctrl(struct pci_dev *dev, u16 clear, u16 set)
538 pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &ctrl);
541 pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, ctrl);
544 static void __iomem *msix_map_region(struct pci_dev *dev,
545 unsigned int nr_entries)
547 resource_size_t phys_addr;
552 pci_read_config_dword(dev, dev->msix_cap + PCI_MSIX_TABLE,
554 bir = (u8)(table_offset & PCI_MSIX_TABLE_BIR);
555 flags = pci_resource_flags(dev, bir);
556 if (!flags || (flags & IORESOURCE_UNSET))
559 table_offset &= PCI_MSIX_TABLE_OFFSET;
560 phys_addr = pci_resource_start(dev, bir) + table_offset;
562 return ioremap(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
565 static int msix_setup_msi_descs(struct pci_dev *dev, void __iomem *base,
566 struct msix_entry *entries, int nvec,
567 struct irq_affinity_desc *masks)
569 int ret = 0, i, vec_count = pci_msix_vec_count(dev);
570 struct irq_affinity_desc *curmsk;
571 struct msi_desc desc;
574 memset(&desc, 0, sizeof(desc));
577 desc.pci.msi_attrib.is_msix = 1;
578 desc.pci.msi_attrib.is_64 = 1;
579 desc.pci.msi_attrib.default_irq = dev->irq;
580 desc.pci.mask_base = base;
582 for (i = 0, curmsk = masks; i < nvec; i++, curmsk++) {
583 desc.msi_index = entries ? entries[i].entry : i;
584 desc.affinity = masks ? curmsk : NULL;
585 desc.pci.msi_attrib.is_virtual = desc.msi_index >= vec_count;
586 desc.pci.msi_attrib.can_mask = !pci_msi_ignore_mask &&
587 !desc.pci.msi_attrib.is_virtual;
589 if (desc.pci.msi_attrib.can_mask) {
590 addr = pci_msix_desc_addr(&desc);
591 desc.pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
594 ret = msi_add_msi_desc(&dev->dev, &desc);
601 static void msix_update_entries(struct pci_dev *dev, struct msix_entry *entries)
603 struct msi_desc *desc;
606 msi_for_each_desc(desc, &dev->dev, MSI_DESC_ALL) {
607 entries->vector = desc->irq;
613 static void msix_mask_all(void __iomem *base, int tsize)
615 u32 ctrl = PCI_MSIX_ENTRY_CTRL_MASKBIT;
618 if (pci_msi_ignore_mask)
621 for (i = 0; i < tsize; i++, base += PCI_MSIX_ENTRY_SIZE)
622 writel(ctrl, base + PCI_MSIX_ENTRY_VECTOR_CTRL);
625 static int msix_setup_interrupts(struct pci_dev *dev, void __iomem *base,
626 struct msix_entry *entries, int nvec,
627 struct irq_affinity *affd)
629 struct irq_affinity_desc *masks = NULL;
633 masks = irq_create_affinity_masks(nvec, affd);
635 msi_lock_descs(&dev->dev);
636 ret = msix_setup_msi_descs(dev, base, entries, nvec, masks);
640 ret = pci_msi_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSIX);
644 /* Check if all MSI entries honor device restrictions */
645 ret = msi_verify_entries(dev);
649 msix_update_entries(dev, entries);
653 pci_free_msi_irqs(dev);
655 msi_unlock_descs(&dev->dev);
661 * msix_capability_init - configure device's MSI-X capability
662 * @dev: pointer to the pci_dev data structure of MSI-X device function
663 * @entries: pointer to an array of struct msix_entry entries
664 * @nvec: number of @entries
665 * @affd: Optional pointer to enable automatic affinity assignment
667 * Setup the MSI-X capability structure of device function with a
668 * single MSI-X IRQ. A return of zero indicates the successful setup of
669 * requested MSI-X entries with allocated IRQs or non-zero for otherwise.
671 static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries,
672 int nvec, struct irq_affinity *affd)
679 * Some devices require MSI-X to be enabled before the MSI-X
680 * registers can be accessed. Mask all the vectors to prevent
681 * interrupts coming in before they're fully set up.
683 pci_msix_clear_and_set_ctrl(dev, 0, PCI_MSIX_FLAGS_MASKALL |
684 PCI_MSIX_FLAGS_ENABLE);
686 /* Mark it enabled so setup functions can query it */
687 dev->msix_enabled = 1;
689 pci_read_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, &control);
690 /* Request & Map MSI-X table region */
691 tsize = msix_table_size(control);
692 base = msix_map_region(dev, tsize);
698 dev->msix_base = base;
700 ret = msix_setup_interrupts(dev, base, entries, nvec, affd);
705 pci_intx_for_msi(dev, 0);
708 * Ensure that all table entries are masked to prevent
709 * stale entries from firing in a crash kernel.
711 * Done late to deal with a broken Marvell NVME device
712 * which takes the MSI-X mask bits into account even
713 * when MSI-X is disabled, which prevents MSI delivery.
715 msix_mask_all(base, tsize);
716 pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL, 0);
718 pcibios_free_irq(dev);
722 dev->msix_enabled = 0;
723 pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL | PCI_MSIX_FLAGS_ENABLE, 0);
728 static bool pci_msix_validate_entries(struct msix_entry *entries, int nvec, int hwsize)
735 for (i = 0; i < nvec; i++) {
736 /* Entry within hardware limit? */
737 if (entries[i].entry >= hwsize)
740 /* Check for duplicate entries */
741 for (j = i + 1; j < nvec; j++) {
742 if (entries[i].entry == entries[j].entry)
749 int __pci_enable_msix_range(struct pci_dev *dev, struct msix_entry *entries, int minvec,
750 int maxvec, struct irq_affinity *affd, int flags)
752 int hwsize, rc, nvec = maxvec;
757 if (dev->msi_enabled) {
758 pci_info(dev, "can't enable MSI-X (MSI already enabled)\n");
762 if (WARN_ON_ONCE(dev->msix_enabled))
765 if (!pci_msi_supported(dev, nvec) || dev->current_state != PCI_D0)
768 hwsize = pci_msix_vec_count(dev);
772 if (!pci_msix_validate_entries(entries, nvec, hwsize))
775 /* PCI_IRQ_VIRTUAL is a horrible hack! */
776 if (nvec > hwsize && !(flags & PCI_IRQ_VIRTUAL))
782 rc = pci_setup_msi_context(dev);
788 nvec = irq_calc_affinity_vectors(minvec, nvec, affd);
793 rc = msix_capability_init(dev, entries, nvec, affd);
806 void __pci_restore_msix_state(struct pci_dev *dev)
808 struct msi_desc *entry;
811 if (!dev->msix_enabled)
814 /* route the table */
815 pci_intx_for_msi(dev, 0);
816 pci_msix_clear_and_set_ctrl(dev, 0,
817 PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL);
819 write_msg = arch_restore_msi_irqs(dev);
821 msi_lock_descs(&dev->dev);
822 msi_for_each_desc(entry, &dev->dev, MSI_DESC_ALL) {
824 __pci_write_msi_msg(entry, &entry->msg);
825 pci_msix_write_vector_ctrl(entry, entry->pci.msix_ctrl);
827 msi_unlock_descs(&dev->dev);
829 pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_MASKALL, 0);
832 void pci_msix_shutdown(struct pci_dev *dev)
834 struct msi_desc *desc;
836 if (!pci_msi_enable || !dev || !dev->msix_enabled)
839 if (pci_dev_is_disconnected(dev)) {
840 dev->msix_enabled = 0;
844 /* Return the device with MSI-X masked as initial states */
845 msi_for_each_desc(desc, &dev->dev, MSI_DESC_ALL)
848 pci_msix_clear_and_set_ctrl(dev, PCI_MSIX_FLAGS_ENABLE, 0);
849 pci_intx_for_msi(dev, 1);
850 dev->msix_enabled = 0;
851 pcibios_alloc_irq(dev);
854 /* Common interfaces */
856 void pci_free_msi_irqs(struct pci_dev *dev)
858 pci_msi_teardown_msi_irqs(dev);
860 if (dev->msix_base) {
861 iounmap(dev->msix_base);
862 dev->msix_base = NULL;
866 /* Misc. infrastructure */
868 struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc)
870 return to_pci_dev(desc->dev);
872 EXPORT_SYMBOL(msi_desc_to_pci_dev);
874 void pci_no_msi(void)