Received: by 10.213.65.68 with SMTP id h4csp1236117imn; Wed, 14 Mar 2018 13:51:26 -0700 (PDT) X-Google-Smtp-Source: AG47ELvDWf+RzWNcaPspKtyKwl8IhmH3atV6BHHHa4RqaBSmwbp5qWcKqr+yzUVb1BjdpCglzaCX X-Received: by 2002:a17:902:51a9:: with SMTP id y38-v6mr5485241plh.120.1521060686886; Wed, 14 Mar 2018 13:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521060686; cv=none; d=google.com; s=arc-20160816; b=nCCu046KiFXTHydGL32/r3TsnqjUigG9aPlJ3AFMuOFQXgzBwtK1af6hhb8Vw9TNLe qIVdu0UNuhxbG2jiw//8XDGQWDmYfuLVhW/R8QS7Khgzdmdjgez65UG926nQt0U8PNED OmfbhlrJkxtp98+A6Ouuw18+iL5xTvn/v+I+d/CLfZxa5REFVNP7aPKaxmcMukymu5W7 hgmP0ppawcAg3lanC479rmo7DVFG6NgEWBLD3iqI2oN1tiFOYCnUxOXRUO42z+qyb63L bYmxWPpzosuv7WypZt5J0QVqYl6BpfG2P6UfWj6z7iQEfgExjJ9ypHLkX/LlVT40HkDc obyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=zLSLnud3GiUGw0c/NQmMAxpAu10udqR3dM4YtkKhlcs=; b=LZonSTd2bz0iOwLDjBO3aFvNM5FNkDcq2bIZk5Um22C1JvEwBLQ2GO7snBj+Pfc3lz N/0nHWQOisHtJVYMxtpOXeXgjLE5XJkqpEukZbgczuKIr+bgSICW0+6qWmLnUpef7vaz Ap15loPfTJZx2ns7jrj2Rn5JxGLVl9LpVa9caoMK5wneHVkwiHtd2xarKw3e/T6ZL2Ry 5UF16O5kvAsYPWwl3MSQP4VbUju4ls5hYUcvocKE4npkNCPOwbdSFyPoOS6g2yUnwWyc VRl8AhECvf2kShiys56DAUorOYreEDoabvL4RPjt4avPdsk1kVsAiSXmaFifIZxVctg5 EJHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z19si2638516pfi.407.2018.03.14.13.51.12; Wed, 14 Mar 2018 13:51:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751886AbeCNUtJ (ORCPT + 99 others); Wed, 14 Mar 2018 16:49:09 -0400 Received: from terminus.zytor.com ([198.137.202.136]:45501 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751781AbeCNUtI (ORCPT ); Wed, 14 Mar 2018 16:49:08 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w2EKmt3H026633; Wed, 14 Mar 2018 13:48:55 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w2EKmt6x026629; Wed, 14 Mar 2018 13:48:55 -0700 Date: Wed, 14 Mar 2018 13:48:55 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Palmer Dabbelt Message-ID: Cc: palmer@sifive.com, mingo@kernel.org, will.deacon@arm.com, hpa@zytor.com, linux-kernel@vger.kernel.org, tglx@linutronix.de Reply-To: hpa@zytor.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, palmer@sifive.com, will.deacon@arm.com, mingo@kernel.org In-Reply-To: <20180307235731.22627-2-palmer@sifive.com> References: <20180307235731.22627-2-palmer@sifive.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/core] genirq: Add CONFIG_GENERIC_IRQ_MULTI_HANDLER Git-Commit-ID: caacdbf4aa567ab5e8de1a4070195c5d3e8f1340 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: caacdbf4aa567ab5e8de1a4070195c5d3e8f1340 Gitweb: https://git.kernel.org/tip/caacdbf4aa567ab5e8de1a4070195c5d3e8f1340 Author: Palmer Dabbelt AuthorDate: Wed, 7 Mar 2018 15:57:27 -0800 Committer: Thomas Gleixner 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 Signed-off-by: Thomas Gleixner Cc: jonas@southpole.se Cc: catalin.marinas@arm.com Cc: Will Deacon Cc: linux@armlinux.org.uk Cc: stefan.kristiansson@saunalahti.fi Cc: openrisc@lists.librecores.org Cc: shorne@gmail.com Cc: linux-riscv@lists.infradead.org Cc: linux-arm-kernel@lists.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