From: Nipun Gupta <nipun.gupta@amd.com>
To: <gregkh@linuxfoundation.org>, <maz@kernel.org>,
<tglx@linutronix.de>, <jgg@ziepe.ca>,
<linux-kernel@vger.kernel.org>
Cc: <git@amd.com>, <harpreet.anand@amd.com>,
<pieter.jansen-van-vuuren@amd.com>, <nikhil.agarwal@amd.com>,
<michal.simek@amd.com>, <abhijit.gangurde@amd.com>,
<srivatsa@csail.mit.edu>, Nipun Gupta <nipun.gupta@amd.com>
Subject: [PATCH v8 2/2] add wrapper msi allocation API and export msi functions
Date: Fri, 23 Feb 2024 14:54:47 +0530 [thread overview]
Message-ID: <20240223092447.65564-2-nipun.gupta@amd.com> (raw)
In-Reply-To: <20240223092447.65564-1-nipun.gupta@amd.com>
MSI functions can be for allocation and free can be directly
used by the device drivers without any wrapper provided by
bus drivers. So export these MSI functions.
Also, add a wrapper API to allocate MSIs providing only the
number of IRQ's rather than range for simpler driver usage.
Signed-off-by: Nipun Gupta <nipun.gupta@amd.com>
---
include/linux/msi.h | 6 ++++++
kernel/irq/msi.c | 2 ++
2 files changed, 8 insertions(+)
diff --git a/include/linux/msi.h b/include/linux/msi.h
index 26d07e23052e..765a65581a66 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -676,6 +676,12 @@ int platform_device_msi_init_and_alloc_irqs(struct device *dev, unsigned int nve
void platform_device_msi_free_irqs_all(struct device *dev);
bool msi_device_has_isolated_msi(struct device *dev);
+
+static inline int msi_domain_alloc_irqs(struct device *dev, unsigned int domid, int nirqs)
+{
+ return msi_domain_alloc_irqs_range(dev, domid, 0, nirqs - 1);
+}
+
#else /* CONFIG_GENERIC_MSI_IRQ */
static inline bool msi_device_has_isolated_msi(struct device *dev)
{
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index f90952ebc494..2024f89baea4 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -1434,6 +1434,7 @@ int msi_domain_alloc_irqs_range(struct device *dev, unsigned int domid,
msi_unlock_descs(dev);
return ret;
}
+EXPORT_SYMBOL_GPL(msi_domain_alloc_irqs_range);
/**
* msi_domain_alloc_irqs_all_locked - Allocate all interrupts from a MSI interrupt domain
@@ -1680,6 +1681,7 @@ void msi_domain_free_irqs_range(struct device *dev, unsigned int domid,
msi_domain_free_irqs_range_locked(dev, domid, first, last);
msi_unlock_descs(dev);
}
+EXPORT_SYMBOL_GPL(msi_domain_free_irqs_all);
/**
* msi_domain_free_irqs_all_locked - Free all interrupts from a MSI interrupt domain
--
2.34.1
next prev parent reply other threads:[~2024-02-23 9:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-23 9:24 [PATCH v8 1/2] cdx: add MSI support for CDX bus Nipun Gupta
2024-02-23 9:24 ` Nipun Gupta [this message]
2024-02-23 9:53 ` [PATCH v8 2/2] add wrapper msi allocation API and export msi functions Thomas Gleixner
2024-02-23 10:00 ` [tip: irq/msi] genirq/msi: Export MSI allocation/free functions and provide a conveniance wrapper tip-bot2 for Nipun Gupta
2024-02-23 11:21 ` [PATCH v8 2/2] add wrapper msi allocation API and export msi functions Greg KH
[not found] ` <CH3PR12MB9193A635BC7952495469B2C5E8552@CH3PR12MB9193.namprd12.prod.outlook.com>
2024-02-23 12:39 ` Greg KH
2024-02-23 9:50 ` [PATCH v8 1/2] cdx: add MSI support for CDX bus Thomas Gleixner
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=20240223092447.65564-2-nipun.gupta@amd.com \
--to=nipun.gupta@amd.com \
--cc=abhijit.gangurde@amd.com \
--cc=git@amd.com \
--cc=gregkh@linuxfoundation.org \
--cc=harpreet.anand@amd.com \
--cc=jgg@ziepe.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=michal.simek@amd.com \
--cc=nikhil.agarwal@amd.com \
--cc=pieter.jansen-van-vuuren@amd.com \
--cc=srivatsa@csail.mit.edu \
--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