Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp1157436rwb; Sat, 3 Sep 2022 09:24:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Za5ASJhxdBwK1pNVc5OnE74LaSPyNoLy0jpg8FJeyspQYFpShxmQ/STngTf0LFYjavTzb X-Received: by 2002:a05:6a00:21c2:b0:52b:ff44:6680 with SMTP id t2-20020a056a0021c200b0052bff446680mr42191854pfj.57.1662222288851; Sat, 03 Sep 2022 09:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662222288; cv=none; d=google.com; s=arc-20160816; b=ZOSyp8fQx+JmM0VukB5dADRpxS9i5mpQmOuGSqK/o9B4RB0aT4bNokhQsFyl5GbEw2 /tCRVSqLUtf9652OUsfE5Rl2N76YiZRwbZDVRxVfhquQ+ZM/fI41cwugyF5AsXqJHSOe U3UykyEQwbs27bzEjt68yJQG80VPCZmVy9ukFTvJQBsW316BsbSF9lI8NeAQahczWm3o CLkVytthXNjdX9PEhAf5KOfsj0rBCk5NkCyndxxls5dUXejDQaG1Tea45wlbwGghhSuG j773FwtdeiUc5j4Sgcke5StICh2nWK/l3CXVhjp+exigaucjglQJJxK0JgOA9DWNMRqs ZHvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7gL51KGK8h2gYdKsAsi/esrqwK4Ga0hyaEGMAaUXEgw=; b=xiwViFvcKU6PHUDt36HYj7c+fo6v9DVTvGvB3Ea/VtrSXDiBwR9XbpetOrjChNqRn+ 4zY0U3fn+baoY7D0xzA9gGKGUdyjk8yNh8nKawex8oUveZWIbDSMlMgvnu7joI+mZl6u mqHq20qUeTytSZX1NLj1GoFlF1p0sVnX8kfpCI45fm1fK5Vu5K4GMEkji8YJHi3+/NSJ Rke/ypDe0OTrhHC9TWw6dVY3xBRXcJcdwQ/JsEtrd/FkOxBHtscGz1ZjRFVOx2Y7MpPu V3rEWyQeoxi5qmNzKcAqBfR2+JmIs14K1sl44bnWf3x8kt1k5ufvbCxd34GAH3mZytpl 0EwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=BEOI9F3w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020a17090a2b8900b002001fd09d80si1150192pjd.59.2022.09.03.09.24.37; Sat, 03 Sep 2022 09:24:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=BEOI9F3w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231446AbiICQNh (ORCPT + 99 others); Sat, 3 Sep 2022 12:13:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231430AbiICQNf (ORCPT ); Sat, 3 Sep 2022 12:13:35 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 999B457893 for ; Sat, 3 Sep 2022 09:13:34 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id 9so1476866plj.11 for ; Sat, 03 Sep 2022 09:13:34 -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:subject:date; bh=7gL51KGK8h2gYdKsAsi/esrqwK4Ga0hyaEGMAaUXEgw=; b=BEOI9F3wsSw246ziNkDpwao42FUp+S3CnxRzu9XoN2nYZeSWgn6MZsTQFAf408gsSi OLgBWXxMbhHfA2R593+yr1oMYoOm6mMYr8FFYclLc0QCesF37UANs1I3ZiAnw8DkRkm0 MVs39Sp6bLB+Ny/kqkAE4q5YVHsIz3/7zWaSfmrPGa9et1+1BJrb7H8mUhf5rsbez8Bn 4H53yuqQooWI7/LdzAxjvSq2AFuZGGfZTJusbltcSxPjdJJcMoGivQXYP+RJ6p1X8G/v eV3B1rsFgOam3InpBciC1Z1j+eRlb2wR1ajb5PWTXZUQaYxdUwFmYgZyQDavLsFVEo13 LG7Q== 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 :subject:date; bh=7gL51KGK8h2gYdKsAsi/esrqwK4Ga0hyaEGMAaUXEgw=; b=LgLzDrXDwKPJ7d3gwoOKe4XI7CUSJfq92BGiwPptTHAgeMGNdhOt+G0/SpeCSv+GXf AUBjol6X6qJ2PdSJm5oltE6g9vSOstshusvBrb7iWjgHuTMB55n/N+Agd5vVjb+04ZnV H1LHHjLSLuzfwLH5G6nJj0CsWl27lNypJSVaHxCkEpTuCsyInQ7viavjS12ajy0xMu7d MbYBYusqkTZ3Q2lUQApPf9stBDX2DcKu2U+8UH9cCvoS7GaQ/CMZP1sHNVCQBK2Jn/LR pHkyeqsLezIf2fgl3eGLlrgUmd9AWD5O2G9gkg3wEykvykdMRrkJPdafW8k9/DJmNWWp w+oA== X-Gm-Message-State: ACgBeo17Zvthzf6+/Tz8yHPCqWzunV1/AyjShiuyU+KmtjxSnS7R9AxY F8lhXhbVBzRlmH2zrFdwGU8/Cw== X-Received: by 2002:a17:90b:1812:b0:1fd:d509:93e5 with SMTP id lw18-20020a17090b181200b001fdd50993e5mr10910560pjb.25.1662221613905; Sat, 03 Sep 2022 09:13:33 -0700 (PDT) Received: from anup-ubuntu64-vm.. ([171.76.86.115]) by smtp.gmail.com with ESMTPSA id 4-20020a620504000000b00537b1aa9191sm4166738pff.178.2022.09.03.09.13.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Sep 2022 09:13:33 -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 v9 2/7] irqchip/riscv-intc: Allow drivers to directly discover INTC hwnode Date: Sat, 3 Sep 2022 21:43:04 +0530 Message-Id: <20220903161309.32848-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220903161309.32848-1-apatel@ventanamicro.com> References: <20220903161309.32848-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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