[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211126230525.076279841@linutronix.de>
Date: Sat, 27 Nov 2021 02:20:37 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Bjorn Helgaas <helgaas@...nel.org>, Marc Zygnier <maz@...nel.org>,
Alex Williamson <alex.williamson@...hat.com>,
Kevin Tian <kevin.tian@...el.com>,
Jason Gunthorpe <jgg@...dia.com>,
Megha Dey <megha.dey@...el.com>,
Ashok Raj <ashok.raj@...el.com>, linux-pci@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Santosh Shilimkar <ssantosh@...nel.org>,
iommu@...ts.linux-foundation.org, dmaengine@...r.kernel.org,
Stuart Yoder <stuyoder@...il.com>,
Laurentiu Tudor <laurentiu.tudor@....com>,
Nishanth Menon <nm@...com>, Tero Kristo <kristo@...nel.org>,
linux-arm-kernel@...ts.infradead.org, x86@...nel.org,
Vinod Koul <vkoul@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Will Deacon <will@...nel.org>, Sinan Kaya <okaya@...nel.org>
Subject: [patch 19/37] genirq/msi: Add msi_device_data::properties
Add a properties field which allows core code to store information for easy
retrieval in order to replace MSI descriptor fiddling.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
include/linux/msi.h | 17 +++++++++++++++++
kernel/irq/msi.c | 12 ++++++++++++
2 files changed, 29 insertions(+)
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -4,6 +4,7 @@
#include <linux/spinlock.h>
#include <linux/list.h>
+#include <linux/bits.h>
#include <asm/msi.h>
/* Dummy shadow structures if an architecture does not define them */
@@ -141,17 +142,33 @@ struct msi_desc {
/**
* msi_device_data - MSI per device data
* @lock: Spinlock to protect register access
+ * @properties: MSI properties which are interesting to drivers
* @attrs: Pointer to the sysfs attribute group
* @platform_data: Platform-MSI specific data
*/
struct msi_device_data {
raw_spinlock_t lock;
+ unsigned long properties;
const struct attribute_group **attrs;
struct platform_msi_priv_data *platform_data;
};
int msi_setup_device_data(struct device *dev);
+/* MSI device properties */
+#define MSI_PROP_PCI_MSI BIT(0)
+#define MSI_PROP_PCI_MSIX BIT(1)
+#define MSI_PROP_64BIT BIT(2)
+
+#ifdef CONFIG_GENERIC_MSI_IRQ
+bool msi_device_has_property(struct device *dev, unsigned long prop);
+#else
+static inline bool msi_device_has_property(struct device *dev, unsigned long prop)
+{
+ return false;
+}
+#endif
+
/* Helpers to hide struct msi_desc implementation details */
#define msi_desc_to_dev(desc) ((desc)->dev)
#define dev_to_msi_list(dev) (&(dev)->msi_list)
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -60,6 +60,18 @@ void free_msi_entry(struct msi_desc *ent
kfree(entry);
}
+/**
+ * msi_device_has_property - Check whether a device has a specific MSI property
+ * @dev: Pointer to the device which is queried
+ * @prop: Property to check for
+ */
+bool msi_device_has_property(struct device *dev, unsigned long prop)
+{
+ if (!dev->msi.data)
+ return false;
+ return !!(dev->msi.data->properties & prop);
+}
+
void __get_cached_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
{
*msg = entry->msg;
Powered by blists - more mailing lists