Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp5635000imw; Wed, 20 Jul 2022 09:21:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ucvVTT+CvP6XahFzbelyHwAhCNrROR+534P3ZSLDXEdLrxh0uMQIqzKwSP+rkefrgrPs9K X-Received: by 2002:a05:6830:2a0b:b0:60c:742e:a09d with SMTP id y11-20020a0568302a0b00b0060c742ea09dmr15807155otu.349.1658334092095; Wed, 20 Jul 2022 09:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658334092; cv=none; d=google.com; s=arc-20160816; b=QykgZL7eDMFSfgjV2qqdks/+F3po3llRXZdv59J9immrzHlsSbqo/JCD2XY1t27TPG NTCCUMH+SYDYIzY/ADQVpLRWyqZkwbYz9pxoR8GJhkYRKPyDYNNf7bpV7NVKnoNBWYYN a55grr7HFgcLEuowvxfrghnOhHFsZRoXx8auKzRNmY0HGeNE0GYJI22yppDDd0QbjZdt xhGO9hjmuhdNKLucslJ9C3LSTiKL8LP3LDhJUNYQ6x3M+3KrUDh/b3TcTwrTw8iBztI3 Jni5OXYk9PugiXMS0d1u5gy2onzXd6Mr8lGT52+5GmiL5kzPikYTo1V1pFDW9iwbVxHu s5Bw== 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=Cvifg+dUrg5blYQC2/27Ocl/6bFW1eBGFrtfNgNQvp0=; b=BJfGInvsx9NEV4MY3NGAYnDetbZYCFtfR0J8/uI6DwoCJ+HtJ+DIM4ZEdQHns2Ru4h N7kAZfgJB0+5vlfQG8ghuamZqJ/R/JFyausSJLJ2pa99kFV9djzWl+X9puLIRVn3i88O xpM1M+AJtkS4VxeYI1R00aWwPF6D7ajgIvJcnVyCncdphqQT79zgfyNWY1rt3WjIET2R p4LNCMGiED5VqdkXEkZQBGtkGurSf1ERDYV5BEpKP2y8Z+OBqdMwEJtcqRV/vYuZAmgE YZ1OVwKFEOwzDSEnb9hNO7lQqFez93UmTsiu5H+Mgo3WleHlvwe5HsArM6xenqTHxbpb IEEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=ez44H26Z; 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 cj28-20020a056830641c00b0061ca14b4bdesi9707826otb.327.2022.07.20.09.21.18; Wed, 20 Jul 2022 09:21:32 -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=ez44H26Z; 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 S241380AbiGTPYg (ORCPT + 99 others); Wed, 20 Jul 2022 11:24:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241381AbiGTPYc (ORCPT ); Wed, 20 Jul 2022 11:24:32 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6648B5F122 for ; Wed, 20 Jul 2022 08:24:31 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id gq7so1898152pjb.1 for ; Wed, 20 Jul 2022 08:24:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cvifg+dUrg5blYQC2/27Ocl/6bFW1eBGFrtfNgNQvp0=; b=ez44H26Z6ZXJtrViq/7KPDdv00nd3MOz2imTcq2j027qHbmsHQY33sDneoEf6uhFkH kiKyLvHU07Org/O0t7+p4hwtmYSo5PCX6KPjCR+A3QOAeRN3b1nfU06O7YYT2CDUoC/m w/xstYLc7e8Mdnz3mXcnWTGkQwW7F5BhSPh4EjF7LExFk0aeFB0WAYbH12XL/idL8gDF jgRLnX6Ys5PH6l1986t20AokALQxGgpEY05CK3vcqdluLr/lpYLGzxDEiNQctK7FykdC daZWDziyXmRRfDA3iqtMa83ezWaInskwUazk0hgiED0iNOIinqquzbwHvQg2dwD8IGu0 11Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cvifg+dUrg5blYQC2/27Ocl/6bFW1eBGFrtfNgNQvp0=; b=RBUnhz0ytHigLpOWycr9GDHGB59P5dPomT9TUAp2k0Ial5TIw7ceKOljMw07cFxm+Q Q/+8k4QI4aqi6V8s9cJHfcyxiO1g1Xd3r9Mj3sdhY+o+9J6ipsFnUb/22Qmwt8mNvq/f se5N6VoWC69CCSZsYIgekuoiMuG1Ef7aIEuzk/8ZjcGI+HHvwFWhx0Ti2RpZaaUQ708j T04NtxAFOAIZ0FXd64WrLcT5bTRo/g3SSI24XCwl51m0QF2768+ir6UVb+MutQTXg7cF AHbR11OCp2mB6jszCETfnpUeA5EwqCPuZ1bnGIJxuVZlj+WsklO25Tp0ssMqutheJeuw RE7Q== X-Gm-Message-State: AJIora9U6vEVYY5dpvG485wL1OQW5/pf78t879z9ODBiA80+qfYLih4a QceWMLMskrIRIMlpAVKfTsnMWQ== X-Received: by 2002:a17:90b:390a:b0:1f0:6a1a:9654 with SMTP id ob10-20020a17090b390a00b001f06a1a9654mr6030490pjb.90.1658330670804; Wed, 20 Jul 2022 08:24:30 -0700 (PDT) Received: from anup-ubuntu64-vm.. ([122.179.42.230]) by smtp.gmail.com with ESMTPSA id w15-20020a1709026f0f00b0016cf8f0bdd5sm6013031plk.108.2022.07.20.08.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 08:24:30 -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 v7 2/7] irqchip/riscv-intc: Allow drivers to directly discover INTC hwnode Date: Wed, 20 Jul 2022 20:53:43 +0530 Message-Id: <20220720152348.2889109-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220720152348.2889109-1-apatel@ventanamicro.com> References: <20220720152348.2889109-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 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 b65bd8878d4f..084793a57af8 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) { @@ -125,6 +130,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