diff options
author | Shaohua Li <shli@fb.com> | 2017-02-01 09:53:15 -0800 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-03-02 08:56:04 -0700 |
commit | 27ddb689909cd0bab30524a5f720ae3a3e55acac (patch) | |
tree | 97e6276308d60b3e5087f8de902ba77970dba48c /drivers/pci | |
parent | 59f082e464ae0533813d5a1c3149b22563da93d7 (diff) | |
download | linux-27ddb689909cd0bab30524a5f720ae3a3e55acac.tar.bz2 |
PCI: add an API to get node from vector
Next patch will use the API to get the node from vector for nvme device
Signed-off-by: Shaohua Li <shli@fb.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/msi.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 980eaf588281..d571bc330686 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -1298,6 +1298,22 @@ const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr) } EXPORT_SYMBOL(pci_irq_get_affinity); +/** + * pci_irq_get_node - return the numa node of a particular msi vector + * @pdev: PCI device to operate on + * @vec: device-relative interrupt vector index (0-based). + */ +int pci_irq_get_node(struct pci_dev *pdev, int vec) +{ + const struct cpumask *mask; + + mask = pci_irq_get_affinity(pdev, vec); + if (mask) + return local_memory_node(cpu_to_node(cpumask_first(mask))); + return dev_to_node(&pdev->dev); +} +EXPORT_SYMBOL(pci_irq_get_node); + struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc) { return to_pci_dev(desc->dev); |