[PATCH] asm-generic: Add msi.h

Thomas Gleixner tglx at linutronix.de
Tue Nov 18 02:34:37 PST 2014

To support MSI irq domains we want a generic data structure for
allocation, but we need the option to provide an architecture specific
version of it. So instead of playing #ifdef games in linux/msi.h we
add a generic header file and let architectures decide whether to
include it or to provide their own implementation and provide the
required typedef.
I know that typedefs are not really nice, but in this case there are no
forward declarations required and it's the simplest solution.
Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
Cc: Jiang Liu <jiang.liu at linux.intel.com>
Cc: Tony Luck <tony.luck at intel.com>
Cc: linux-arm-kernel at lists.infradead.org
Cc: Bjorn Helgaas <bhelgaas at google.com>
Cc: Grant Likely <grant.likely at linaro.org>
Cc: Marc Zyngier <marc.zyngier at arm.com>
Cc: Yijing Wang <wangyijing at huawei.com>
Cc: Yingjoe Chen <yingjoe.chen at mediatek.com>
Cc: Borislav Petkov <bp at alien8.de>
Cc: Matthias Brugger <matthias.bgg at gmail.com>
Cc: Alexander Gordeev <agordeev at redhat.com>
Cc: Arnd Bergmann <arnd at arndb.de>

diff --git a/include/asm-generic/msi.h b/include/asm-generic/msi.h
new file mode 100644
index 000000000000..61c58d8878ce
--- /dev/null
+++ b/include/asm-generic/msi.h
@@ -0,0 +1,32 @@
+#ifndef __ASM_GENERIC_MSI_H
+#define __ASM_GENERIC_MSI_H
+#include <linux/types.h>
+struct msi_desc;
+ * struct msi_alloc_info - Default structure for MSI interrupt allocation.
+ * @desc:	Pointer to msi descriptor
+ * @hwirq:	Associated hw interrupt number in the domain
+ * @scratchpad:	Storage for implementation specific scratch data
+ *
+ * Architectures can provide their own implementation by not including
+ * asm-generic/msi.h into their arch specific header file.
+ */
+typedef struct msi_alloc_info {
+	struct msi_desc			*desc;
+	irq_hw_number_t			hwirq;
+	union {
+		unsigned long		ul;
+		void			*ptr;
+} msi_alloc_info_t;

More information about the linux-arm-kernel mailing list