From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8312C25B08 for ; Sat, 20 Aug 2022 06:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=09+RJOLysAgNDAjSFrjTZQjxHfLUiiel7jxXdN2lU5I=; b=CERnuP98qP4plH lv2qaUnWTqIcJH8f3G7OOovcVfvHHBs3jRmLRELmn/scvMHPpZfVRZDxbJQoB37GiJSRv14nzReo0 cYAlekackR3IMMRHzRNtGtQrZgIhG+nAW1/lDsVdDCdu8AOrEJoHwZ9Hfh2l4NOEwJTJXGxpbhFeg 8Tqr42LD7z1Xx6QCJ/GGd2cN+TRKDGNDDX6miZxZ4Q6l14iJ4z0TDkDGDGPefYMX6nKxaa4OEFI2c t4VqxRTRobCyKv4SiItgxYqumyVcrZ++Mi47CMuqRJ4K7UEu8qs5+r1j2LYq05fYblAVacJDS3U36 k87ySaKILp85JLwwIWcw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oPIOl-003uUl-E1; Sat, 20 Aug 2022 06:55:59 +0000 Received: from mail-oi1-x22d.google.com ([2607:f8b0:4864:20::22d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oPIOi-003uSN-Au for linux-riscv@lists.infradead.org; Sat, 20 Aug 2022 06:55:57 +0000 Received: by mail-oi1-x22d.google.com with SMTP id r10so1178538oie.1 for ; Fri, 19 Aug 2022 23:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=7gL51KGK8h2gYdKsAsi/esrqwK4Ga0hyaEGMAaUXEgw=; b=Sw04uJ3vbDVepAg/gWVJcWOV7MbzEmF8dKmsd/rb6F8inqTs1ofPx1MK09cu3sGCTc 0VvQSYC0ZBw+zM+SXSv1L1UObgmZzvYVFbPwoMaYQ42uWio23+ffNmsmi+dimTW8E6u5 8O4T4xGCd206w7/uqNwH9F5bwTQY2wNgBLDZZd9u9xxYKp7pElOD0PXM7AiAvTkAQccV HsMXix2vDP8/m0hM8ddQW0m0vEPms6xLU6j7mPJ0UsUkauth3dyKJ/fDctjj3G+QGcYv lgVblX5ZvzjUpFnGtjWBem/SXRb3s3wrn6p45TOr5X2AUVAdCLOYvqPSYxkWvbZjdx7f b5Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=7gL51KGK8h2gYdKsAsi/esrqwK4Ga0hyaEGMAaUXEgw=; b=0xGYA4Iua2u8/74tgGb0apaJBaGIgx++96dRD7tAaD69HJUMLXazLSzEq2rD8ekucn t488SI3rQ+0wRM/ylT44mkkBV684Bhzm9VV2/6hkzzNcYdRAF9p448uOrBw4antF5yoM WGmHEivkJ4y2mX4cqNzZJEBtNCPtt9vhxWvRXk78d1ZIoT3RO1V+/TEhTysc8Ogts5c+ AiBQKN1EHNUxYNkX5I0qObhovwT2tSVN7CCunWKY2FFJudXFJe0TWGwConGb3soExqTg r1MiYmRH1iRzWGMUJ7DKvVGSbrKsOzvXRlfTILMmvY0XGrY1QeVpNfgzFHJ95n7N0Ss6 +B7Q== X-Gm-Message-State: ACgBeo2vBHzagE/KDuwdviI5sv7VmEq9dqf7PFfWfYK6jSzYXzOdDP4R YXvYdUp5l5Zs+9dpu94mMKH3mw== X-Google-Smtp-Source: AA6agR5utbHM4pipxClH5gyEYq4cq0Nm0cG2E0loDJemIx24wNgpN5lXHXqEGa8/FgPkVBgRhwGxRA== X-Received: by 2002:aca:5e8b:0:b0:344:d1ef:2293 with SMTP id s133-20020aca5e8b000000b00344d1ef2293mr7608063oib.158.1660978554932; Fri, 19 Aug 2022 23:55:54 -0700 (PDT) Received: from anup-ubuntu64-vm.. ([171.76.82.68]) by smtp.gmail.com with ESMTPSA id h26-20020a9d641a000000b00636faf5e2d9sm1661098otl.39.2022.08.19.23.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 23:55:54 -0700 (PDT) From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Marc Zyngier , Daniel Lezcano Cc: Atish Patra , Alistair Francis , Anup Patel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel Subject: [PATCH v8 2/7] irqchip/riscv-intc: Allow drivers to directly discover INTC hwnode Date: Sat, 20 Aug 2022 12:24:41 +0530 Message-Id: <20220820065446.389788-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220820065446.389788-1-apatel@ventanamicro.com> References: <20220820065446.389788-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220819_235556_415450_B82D34DA X-CRM114-Status: GOOD ( 11.35 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Various RISC-V drivers (such as SBI IPI, SBI Timer, SBI PMU, and KVM RISC-V) don't have associated DT node but these drivers need standard per-CPU (local) interrupts defined by the RISC-V privileged specification. We add riscv_get_intc_hwnode() in arch/riscv which allows RISC-V drivers not having DT node to discover INTC hwnode which in-turn helps these drivers to map per-CPU (local) interrupts provided by the INTC driver. Signed-off-by: Anup Patel --- arch/riscv/include/asm/irq.h | 4 ++++ arch/riscv/kernel/irq.c | 18 ++++++++++++++++++ drivers/irqchip/irq-riscv-intc.c | 7 +++++++ 3 files changed, 29 insertions(+) diff --git a/arch/riscv/include/asm/irq.h b/arch/riscv/include/asm/irq.h index e4c435509983..43b9ebfbd943 100644 --- a/arch/riscv/include/asm/irq.h +++ b/arch/riscv/include/asm/irq.h @@ -12,6 +12,10 @@ #include +void riscv_set_intc_hwnode_fn(struct fwnode_handle *(*fn)(void)); + +struct fwnode_handle *riscv_get_intc_hwnode(void); + extern void __init init_IRQ(void); #endif /* _ASM_RISCV_IRQ_H */ diff --git a/arch/riscv/kernel/irq.c b/arch/riscv/kernel/irq.c index 7207fa08d78f..96d3171f0ca1 100644 --- a/arch/riscv/kernel/irq.c +++ b/arch/riscv/kernel/irq.c @@ -7,9 +7,27 @@ #include #include +#include +#include #include #include +static struct fwnode_handle *(*__get_intc_node)(void); + +void riscv_set_intc_hwnode_fn(struct fwnode_handle *(*fn)(void)) +{ + __get_intc_node = fn; +} + +struct fwnode_handle *riscv_get_intc_hwnode(void) +{ + if (__get_intc_node) + return __get_intc_node(); + + return NULL; +} +EXPORT_SYMBOL_GPL(riscv_get_intc_hwnode); + int arch_show_interrupts(struct seq_file *p, int prec) { show_ipi_stats(p, prec); diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq-riscv-intc.c index 499e5f81b3fe..9066467e99e4 100644 --- a/drivers/irqchip/irq-riscv-intc.c +++ b/drivers/irqchip/irq-riscv-intc.c @@ -92,6 +92,11 @@ static const struct irq_domain_ops riscv_intc_domain_ops = { .xlate = irq_domain_xlate_onecell, }; +static struct fwnode_handle *riscv_intc_hwnode(void) +{ + return intc_domain->fwnode; +} + static int __init riscv_intc_init(struct device_node *node, struct device_node *parent) { @@ -126,6 +131,8 @@ static int __init riscv_intc_init(struct device_node *node, return rc; } + riscv_set_intc_hwnode_fn(riscv_intc_hwnode); + cpuhp_setup_state(CPUHP_AP_IRQ_RISCV_STARTING, "irqchip/riscv/intc:starting", riscv_intc_cpu_starting, -- 2.34.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv