mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-06 05:02:31 +00:00
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>
This commit is contained in:
parent
59f082e464
commit
27ddb68990
@ -1298,6 +1298,22 @@ const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(pci_irq_get_affinity);
|
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)
|
struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc)
|
||||||
{
|
{
|
||||||
return to_pci_dev(desc->dev);
|
return to_pci_dev(desc->dev);
|
||||||
|
@ -1323,6 +1323,7 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
|
|||||||
void pci_free_irq_vectors(struct pci_dev *dev);
|
void pci_free_irq_vectors(struct pci_dev *dev);
|
||||||
int pci_irq_vector(struct pci_dev *dev, unsigned int nr);
|
int pci_irq_vector(struct pci_dev *dev, unsigned int nr);
|
||||||
const struct cpumask *pci_irq_get_affinity(struct pci_dev *pdev, int vec);
|
const struct cpumask *pci_irq_get_affinity(struct pci_dev *pdev, int vec);
|
||||||
|
int pci_irq_get_node(struct pci_dev *pdev, int vec);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; }
|
static inline int pci_msi_vec_count(struct pci_dev *dev) { return -ENOSYS; }
|
||||||
@ -1370,6 +1371,11 @@ static inline const struct cpumask *pci_irq_get_affinity(struct pci_dev *pdev,
|
|||||||
{
|
{
|
||||||
return cpu_possible_mask;
|
return cpu_possible_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int pci_irq_get_node(struct pci_dev *pdev, int vec)
|
||||||
|
{
|
||||||
|
return first_online_node;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
Loading…
Reference in New Issue
Block a user