[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1561162778-12669-7-git-send-email-megha.dey@linux.intel.com>
Date: Fri, 21 Jun 2019 17:19:38 -0700
From: Megha Dey <megha.dey@...ux.intel.com>
To: bhelgaas@...gle.com, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: tglx@...utronix.de, marc.zyngier@....com, ashok.raj@...el.com,
jacob.jun.pan@...ux.intel.com, megha.dey@...el.com,
Megha Dey <megha.dey@...ux.intel.com>
Subject: [RFC V1 RESEND 6/6] Documentation: PCI/MSI: Document dynamic MSI-X infrastructure
Add Documentation for the newly introduced dynamic allocation
and deallocation of MSI-X vectors.
Cc: Jacob Pan <jacob.jun.pan@...ux.intel.com>
Cc: Ashok Raj <ashok.raj@...el.com>
Signed-off-by: Megha Dey <megha.dey@...ux.intel.com>
---
Documentation/PCI/MSI-HOWTO.txt | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/Documentation/PCI/MSI-HOWTO.txt b/Documentation/PCI/MSI-HOWTO.txt
index 618e13d..5f6daf4 100644
--- a/Documentation/PCI/MSI-HOWTO.txt
+++ b/Documentation/PCI/MSI-HOWTO.txt
@@ -156,6 +156,44 @@ the driver can specify that only MSI or MSI-X is acceptable:
if (nvec < 0)
goto out_err;
+4.2.1 Dynamic MSI-X Allocation:
+
+The pci_alloc_irq_vectors() API is a one-shot method to allocate MSI resources
+i.e. they cannot be called multiple times. In order to allocate MSI-X vectors
+post probe phase, multiple times, use the following API:
+
+ int pci_alloc_irq_vectors_dyn(struct pci_dev *dev, unsigned int min_vecs,
+ unsigned int max_vecs, unsigned int flags, int *group_id);
+
+This API allocates up to max_vecs interrupt vectors for a PCI device. It returns
+the number of vectors allocated or a negative error. If the device has a
+requirement for a minimum number of vectors the driver can pass a min_vecs
+argument set to this limit, and the PCI core will return -ENOSPC if it can't
+meet the minimum number of vectors. This API is only to be used for MSI-X vectors.
+
+A group ID pointer is passed which gets populated by this function. A unique
+group_id will associated with all the MSI-X vectors allocated each time this
+function is called:
+
+ int group_id;
+ nvec = pci_alloc_irq_vectors_dyn(pdev, minvecs, maxvecs,
+ flags | PCI_IRQ_MSIX, &group_id);
+ if (nvec < 0)
+ goto out_err;
+
+To get the Linux IRQ numbers to pass to request_irq() and free_irq(), use the
+following function:
+
+ int pci_irq_vec_grp(struct pci_dev *dev, unsigned int nr, unsigned int group_id);
+
+In order to free the MSI-X resources associated with a particular group, use
+the following function:
+
+ int pci_free_irq_vectors_grp(struct pci_dev *dev, int group_id);
+
+For example, to delete the group allocated with the pci_alloc_irq_vectors_dyn(),
+ nvec = pci_free_irq_vectors_grp(pdev, group_id);
+
4.3 Legacy APIs
The following old APIs to enable and disable MSI or MSI-X interrupts should
--
2.7.4
Powered by blists - more mailing lists