lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 23 Feb 2024 10:00:30 -0000
From: "tip-bot2 for Nipun Gupta" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Nipun Gupta <nipun.gupta@....com>, Thomas Gleixner <tglx@...utronix.de>,
 x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: irq/msi] genirq/msi: Export MSI allocation/free functions and
 provide a conveniance wrapper

The following commit has been merged into the irq/msi branch of tip:

Commit-ID:     ae4debc7fd82e4612a7f4460394b4fb8e95f6ed2
Gitweb:        https://git.kernel.org/tip/ae4debc7fd82e4612a7f4460394b4fb8e95f6ed2
Author:        Nipun Gupta <nipun.gupta@....com>
AuthorDate:    Fri, 23 Feb 2024 14:54:47 +05:30
Committer:     Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Fri, 23 Feb 2024 10:53:03 +01:00

genirq/msi: Export MSI allocation/free functions and provide a conveniance wrapper

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
interrupts rather than a range for simpler driver usage.

Signed-off-by: Nipun Gupta <nipun.gupta@....com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Link: https://lore.kernel.org/r/20240223092447.65564-2-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 26d07e2..765a655 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 f90952e..2024f89 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ