[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1568338328-22458-8-git-send-email-megha.dey@linux.intel.com>
Date: Thu, 12 Sep 2019 18:32:08 -0700
From: Megha Dey <megha.dey@...ux.intel.com>
To: linux-kernel@...r.kernel.org, x86@...nel.org,
linux-pci@...r.kernel.org, maz@...nel.org, bhelgaas@...gle.com,
rafael@...nel.org, gregkh@...uxfoundation.org, tglx@...utronix.de,
hpa@...or.com, alex.williamson@...hat.com, jgg@...lanox.com
Cc: ashok.raj@...el.com, megha.dey@...el.com, jacob.jun.pan@...el.com,
Megha Dey <megha.dey@...ux.intel.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>,
Sanjay Kumar <sanjay.k.kumar@...el.com>
Subject: [RFC V1 7/7] ims: Add the set_desc callback
Add the set_desc callback to the ims domain ops.
The set_desc callback is used to find a unique hwirq number from a given
domain.
Each mdev can have a maximum of 2048 IMS interrupts.
Cc: Jacob Pan <jacob.jun.pan@...ux.intel.com>
Signed-off-by: Sanjay Kumar <sanjay.k.kumar@...el.com>
Signed-off-by: Megha Dey <megha.dey@...ux.intel.com>
---
arch/x86/kernel/apic/ims.c | 7 +++++++
drivers/base/ims-msi.c | 9 +++++++++
include/linux/msi.h | 1 +
3 files changed, 17 insertions(+)
diff --git a/arch/x86/kernel/apic/ims.c b/arch/x86/kernel/apic/ims.c
index a539666..7e36571 100644
--- a/arch/x86/kernel/apic/ims.c
+++ b/arch/x86/kernel/apic/ims.c
@@ -76,11 +76,18 @@ int dev_ims_prepare(struct irq_domain *domain, struct device *dev, int nvec,
}
EXPORT_SYMBOL_GPL(dev_ims_prepare);
+void dev_ims_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc)
+{
+ arg->msi_hwirq = dev_ims_calc_hwirq(desc);
+}
+EXPORT_SYMBOL_GPL(dev_ims_set_desc);
+
#ifdef CONFIG_IRQ_REMAP
static struct msi_domain_ops dev_ims_domain_ops = {
.get_hwirq = msi_get_hwirq,
.msi_prepare = dev_ims_prepare,
+ .set_desc = dev_ims_set_desc,
};
static struct irq_chip dev_ims_ir_controller = {
diff --git a/drivers/base/ims-msi.c b/drivers/base/ims-msi.c
index 3e579c9..48f3d24 100644
--- a/drivers/base/ims-msi.c
+++ b/drivers/base/ims-msi.c
@@ -22,6 +22,15 @@ struct dev_ims_priv_data {
static DEFINE_IDA(dev_ims_devid_ida);
+irq_hw_number_t dev_ims_calc_hwirq(struct msi_desc *desc)
+{
+ u32 devid;
+
+ devid = desc->dev_ims.priv->devid;
+
+ return (devid << (32 - DEVIMS_ID_SHIFT)) | desc->dev_ims.ims_index;
+}
+
u32 __dev_ims_desc_mask_irq(struct msi_desc *desc, u32 flag)
{
u32 mask_bits = desc->dev_ims.masked;
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 4543bbf..fe4678e 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -237,6 +237,7 @@ void dev_ims_teardown_irqs(struct device *dev);
void dev_ims_restore_irqs(struct device *dev);
int dev_ims_alloc_irqs(struct device *dev, int nvec, struct dev_ims_ops *ops);
void dev_ims_free_irqs(struct device *dev);
+irq_hw_number_t dev_ims_calc_hwirq(struct msi_desc *desc);
/*
* The arch hooks to setup up msi irqs. Those functions are
--
2.7.4
Powered by blists - more mailing lists