From: Megha Dey <megha.dey@linux.intel.com>
To: bhelgaas@google.com, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, marc.zyngier@arm.com, ashok.raj@intel.com,
jacob.jun.pan@linux.intel.com, megha.dey@intel.com,
Megha Dey <megha.dey@linux.intel.com>
Subject: [RFC V1 RESEND 1/6] PCI/MSI: New structures/macros for dynamic MSI-X allocation
Date: Fri, 21 Jun 2019 17:19:33 -0700 [thread overview]
Message-ID: <1561162778-12669-2-git-send-email-megha.dey@linux.intel.com> (raw)
In-Reply-To: <1561162778-12669-1-git-send-email-megha.dey@linux.intel.com>
This is a preparatory patch to introduce the dynamic allocation of
MSI-X vectors. In this patch, we add new structure members and macros
which will be consumed by the API that will dynamically allocate
MSI-X vectors.
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Megha Dey <megha.dey@linux.intel.com>
---
include/linux/device.h | 3 +++
include/linux/msi.h | 9 +++++++++
include/linux/pci.h | 6 ++++++
3 files changed, 18 insertions(+)
diff --git a/include/linux/device.h b/include/linux/device.h
index 848fc71..99d4951 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -967,6 +967,7 @@ struct dev_links_info {
* device.
* @dma_coherent: this particular device is dma coherent, even if the
* architecture supports non-coherent devices.
+ * @grp_first_desc: Pointer to the first msi_desc in every MSI-X group
*
* At the lowest level, every device in a Linux system is represented by an
* instance of struct device. The device structure contains the information
@@ -1062,6 +1063,8 @@ struct device {
defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)
bool dma_coherent:1;
#endif
+ /* For dynamic MSI-X allocation */
+ struct msi_desc *grp_first_desc;
};
static inline struct device *kobj_to_dev(struct kobject *kobj)
diff --git a/include/linux/msi.h b/include/linux/msi.h
index d48e919..91273cd 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -74,6 +74,7 @@ struct ti_sci_inta_msi_desc {
* @default_irq:[PCI MSI/X] The default pre-assigned non-MSI irq
* @mask_pos: [PCI MSI] Mask register position
* @mask_base: [PCI MSI-X] Mask register base address
+ * @group_id: [PCI MSI-X] group to which this descriptor belongs
* @platform: [platform] Platform device specific msi descriptor data
* @fsl_mc: [fsl-mc] FSL MC device specific msi descriptor data
* @inta: [INTA] TISCI based INTA specific msi descriptor data
@@ -107,6 +108,7 @@ struct msi_desc {
u8 mask_pos;
void __iomem *mask_base;
};
+ unsigned int group_id;
};
/*
@@ -131,6 +133,10 @@ struct msi_desc {
list_for_each_entry((desc), dev_to_msi_list((dev)), list)
#define for_each_msi_entry_safe(desc, tmp, dev) \
list_for_each_entry_safe((desc), (tmp), dev_to_msi_list((dev)), list)
+/* Iterate through MSI entries of device dev starting from a given desc */
+#define for_each_msi_entry_from(desc, dev) \
+ desc = (*dev).grp_first_desc; \
+ list_for_each_entry_from((desc), dev_to_msi_list((dev)), list) \
#ifdef CONFIG_IRQ_MSI_IOMMU
static inline const void *msi_desc_get_iommu_cookie(struct msi_desc *desc)
@@ -159,6 +165,9 @@ static inline void msi_desc_set_iommu_cookie(struct msi_desc *desc,
#define first_pci_msi_entry(pdev) first_msi_entry(&(pdev)->dev)
#define for_each_pci_msi_entry(desc, pdev) \
for_each_msi_entry((desc), &(pdev)->dev)
+/* Iterate through PCI-MSI entries of pdev starting from a given desc */
+#define for_each_pci_msi_entry_from(desc, pdev) \
+ for_each_msi_entry_from((desc), &(pdev)->dev)
struct pci_dev *msi_desc_to_pci_dev(struct msi_desc *desc);
void *msi_desc_to_pci_sysdata(struct msi_desc *desc);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index dd436da..b9a1d41 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -465,6 +465,12 @@ struct pci_dev {
char *driver_override; /* Driver name to force a match */
unsigned long priv_flags; /* Private flags for the PCI driver */
+ /* For dynamic MSI-X allocation */
+ unsigned int num_msix; /* Number of MSI-X vectors supported */
+ void __iomem *base; /* Holds base address of MSI-X table */
+ struct idr *grp_idr; /* IDR to assign group to MSI-X vecs */
+ unsigned long *entry; /* Bitmap to represent MSI-X entries */
+ bool one_shot; /* If true, oneshot MSI-X allocation */
};
static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
--
2.7.4
next prev parent reply other threads:[~2019-06-21 23:58 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-22 0:19 [RFC V1 RESEND 0/6] Introduce dynamic allocation/freeing of MSI-X vectors Megha Dey
2019-06-22 0:19 ` Megha Dey [this message]
2019-06-22 0:19 ` [RFC V1 RESEND 2/6] PCI/MSI: Dynamic allocation of MSI-X vectors by group Megha Dey
2019-06-29 7:59 ` Thomas Gleixner
2019-08-06 19:05 ` Megha Dey
2019-08-07 13:56 ` Thomas Gleixner
2019-08-07 14:18 ` Marc Zyngier
2019-08-11 7:20 ` Thomas Gleixner
2019-08-12 17:54 ` Megha Dey
2019-08-12 17:48 ` Megha Dey
2019-08-12 17:47 ` Megha Dey
2021-01-07 22:30 ` Jacob Keller
2019-06-22 0:19 ` [RFC V1 RESEND 3/6] x86: Introduce the dynamic teardown function Megha Dey
2019-06-29 8:01 ` Thomas Gleixner
2019-08-06 19:06 ` Megha Dey
2019-06-22 0:19 ` [RFC V1 RESEND 4/6] PCI/MSI: Introduce new structure to manage MSI-x entries Megha Dey
2019-06-22 0:19 ` [RFC V1 RESEND 5/6] PCI/MSI: Free MSI-X resources by group Megha Dey
2019-06-29 8:08 ` Thomas Gleixner
2019-08-06 19:09 ` Megha Dey
2019-08-11 7:18 ` Thomas Gleixner
2019-08-12 18:13 ` Megha Dey
2019-06-22 0:19 ` [RFC V1 RESEND 6/6] Documentation: PCI/MSI: Document dynamic MSI-X infrastructure Megha Dey
2019-08-02 0:24 ` [RFC V1 RESEND 0/6] Introduce dynamic allocation/freeing of MSI-X vectors Bjorn Helgaas
2019-08-06 19:12 ` Megha Dey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1561162778-12669-2-git-send-email-megha.dey@linux.intel.com \
--to=megha.dey@linux.intel.com \
--cc=ashok.raj@intel.com \
--cc=bhelgaas@google.com \
--cc=jacob.jun.pan@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=megha.dey@intel.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).