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]
Message-ID: <tip-caacdbf4aa567ab5e8de1a4070195c5d3e8f1340@git.kernel.org>
Date:   Wed, 14 Mar 2018 13:48:55 -0700
From:   tip-bot for Palmer Dabbelt <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     palmer@...ive.com, mingo@...nel.org, will.deacon@....com,
        hpa@...or.com, linux-kernel@...r.kernel.org, tglx@...utronix.de
Subject: [tip:irq/core] genirq: Add CONFIG_GENERIC_IRQ_MULTI_HANDLER

Commit-ID:  caacdbf4aa567ab5e8de1a4070195c5d3e8f1340
Gitweb:     https://git.kernel.org/tip/caacdbf4aa567ab5e8de1a4070195c5d3e8f1340
Author:     Palmer Dabbelt <palmer@...ive.com>
AuthorDate: Wed, 7 Mar 2018 15:57:27 -0800
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Wed, 14 Mar 2018 21:46:29 +0100

genirq: Add CONFIG_GENERIC_IRQ_MULTI_HANDLER

The arm multi irq handler registration mechanism has been copied into a
handful of architectures, including arm64 and openrisc. RISC-V needs the
same mechanism.

Instead of adding yet another copy for RISC-V copy the arm implementation
into the core code depending on a new Kconfig symbol:
CONFIG_GENERIC_MULTI_IRQ_HANDLER.

Subsequent patches will convert the various architectures.

Signed-off-by: Palmer Dabbelt <palmer@...ive.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: jonas@...thpole.se
Cc: catalin.marinas@....com
Cc: Will Deacon <will.deacon@....com>
Cc: linux@...linux.org.uk
Cc: stefan.kristiansson@...nalahti.fi
Cc: openrisc@...ts.librecores.org
Cc: shorne@...il.com
Cc: linux-riscv@...ts.infradead.org
Cc: linux-arm-kernel@...ts.infradead.org
Link: https://lkml.kernel.org/r/20180307235731.22627-2-palmer@sifive.com

---
 include/linux/irq.h | 18 ++++++++++++++++++
 kernel/irq/Kconfig  |  5 +++++
 kernel/irq/handle.c | 15 +++++++++++++++
 3 files changed, 38 insertions(+)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index 979eed1b2654..65916a305f3d 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -1165,4 +1165,22 @@ int __ipi_send_mask(struct irq_desc *desc, const struct cpumask *dest);
 int ipi_send_single(unsigned int virq, unsigned int cpu);
 int ipi_send_mask(unsigned int virq, const struct cpumask *dest);
 
+#ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER
+/*
+ * Registers a generic IRQ handling function as the top-level IRQ handler in
+ * the system, which is generally the first C code called from an assembly
+ * architecture-specific interrupt handler.
+ *
+ * Returns 0 on success, or -EBUSY if an IRQ handler has already been
+ * registered.
+ */
+int __init set_handle_irq(void (*handle_irq)(struct pt_regs *));
+
+/*
+ * Allows interrupt handlers to find the irqchip that's been registered as the
+ * top-level IRQ handler.
+ */
+extern void (*handle_arch_irq)(struct pt_regs *) __ro_after_init;
+#endif
+
 #endif /* _LINUX_IRQ_H */
diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig
index 6fc87ccda1d7..5f3e2baefca9 100644
--- a/kernel/irq/Kconfig
+++ b/kernel/irq/Kconfig
@@ -132,3 +132,8 @@ config GENERIC_IRQ_DEBUGFS
 	  If you don't know what to do here, say N.
 
 endmenu
+
+config GENERIC_IRQ_MULTI_HANDLER
+	bool
+	help
+	  Allow to specify the low level IRQ handler at run time.
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 79f987b942b8..3570c715c3e7 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -20,6 +20,10 @@
 
 #include "internals.h"
 
+#ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER
+void (*handle_arch_irq)(struct pt_regs *) __ro_after_init;
+#endif
+
 /**
  * handle_bad_irq - handle spurious and unhandled irqs
  * @desc:      description of the interrupt
@@ -207,3 +211,14 @@ irqreturn_t handle_irq_event(struct irq_desc *desc)
 	irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);
 	return ret;
 }
+
+#ifdef CONFIG_GENERIC_IRQ_MULTI_HANDLER
+int __init set_handle_irq(void (*handle_irq)(struct pt_regs *))
+{
+	if (handle_arch_irq)
+		return -EBUSY;
+
+	handle_arch_irq = handle_irq;
+	return 0;
+}
+#endif

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ