Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp2838509pxb; Sun, 20 Feb 2022 02:01:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhjGbVph613icOI/2q//3Dbdu4pDwCsBdDwF41kJMB0CVBBK3t6EbpLYqfF9sqajOQFSyE X-Received: by 2002:a05:6a00:1503:b0:4e1:d277:cca with SMTP id q3-20020a056a00150300b004e1d2770ccamr13848347pfu.4.1645351304021; Sun, 20 Feb 2022 02:01:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645351304; cv=none; d=google.com; s=arc-20160816; b=D5lk1DYqLj9T2Z0P2B8sWi9tCLhhNsma+xCBc9Wt0xsTVTIGDKvW73fH0RaIE8yjfv HGg33Gy4PamKZMU6BeAKFULpspnnqnaW1iJMcoDrQKmYIO6hVkbwsF1cKXJMk40tPEfM GZCPCOiPZDTvUd8xnx1mb5NJAbzIOBLfwfKjOvHAXftE//m1MEFxBiMJ2wqDVVy8kdSP lOEhPn8DLQrqqQHzy5lsrNX3O/iruJYII2/SHi+3eNFh6G2WE8aMuGpfWJA96nDsSG2Z TOU27+dDwUkrRb3jL2wUJsXTTnTG1asZQ7MhD7gxbr2aGTomzkkqkzKQwchdeB7+OZ9g VcVQ== 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=CWgup5+s0NpBdPrI8o/lvYeDK7LCK1AyJL6/Cnvbp+I=; b=wX3zvj9xVwWi4Opb1KJpmvUah+Mo2p/xiMwDtFrYjRQdJ7zRICu3vz8POMHEOpky99 KbTQVJThv3WCo1Ez5kNer26D06RLWzB+RGIcWdoqk4VMqk0qZY08JmuYnMe0SOKk19Fa UfVWcG8Zl1Hye8RYEKbc+QaVX6HifrpZFtYTwg3bV17hSMDEJkIVrFUkmfMl2TRo7pld vBDJnZ6V35LQ7OMh5ALktjSa8WugnFcD5X5fiiBKvNy+uE3PwqufpVls0KW4fqDqWbM1 vfhXalnO5zO4O2VNcbzQznUJQoxGJS+kNvwv4/LStsTgASmY2ASM6xFLvaYpsarPQF1e o1EQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=l1nnOk+u; 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 a22si11369402pgg.201.2022.02.20.02.01.30; Sun, 20 Feb 2022 02:01:44 -0800 (PST) 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=l1nnOk+u; 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 S230076AbiBTFK1 (ORCPT + 99 others); Sun, 20 Feb 2022 00:10:27 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:35190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbiBTFKY (ORCPT ); Sun, 20 Feb 2022 00:10:24 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51E8B517FA for ; Sat, 19 Feb 2022 21:10:04 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id j10-20020a17090a94ca00b001bc2a9596f6so418648pjw.5 for ; Sat, 19 Feb 2022 21:10:04 -0800 (PST) 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=CWgup5+s0NpBdPrI8o/lvYeDK7LCK1AyJL6/Cnvbp+I=; b=l1nnOk+uSVryT9WPWfV5mA4fmGwv/bvudzwwVf6f/zyOIwxGrONbb7hJ+jT+dGSKS8 wn2ir1HXwyKaD+iGQCJ3d5a0BovwIWOk+rkG5MZZ+dO+bHE7Anh9fyXWPMI1OsJHOpxW jEiZaFm/8xiLQFaguByff7tgndBncn5I/otEb948t/rlQdDBjXj+swBdQqWvKzxIU19w rvG6RLnFYKTdnOSxcJ3eST/31JEuvZXebQVd+CebqMBd4HfO1jHjAzLCT3lzrw4eWiSQ V+H+R9sJwkttDISJ7FQ3oSx46TTGhawhDjduixox5cuasNlq2m1eD/S7kmeh6BUs08Za 4JJQ== 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=CWgup5+s0NpBdPrI8o/lvYeDK7LCK1AyJL6/Cnvbp+I=; b=MDKZaANDpM+MPBoWYVQjcVqJoPK69emeE1k0HnsbJTbmXubOrGDybYYKT2bEowOiCa hQdZQnpST5o0V0JVp5X+6HG3oqBj+C+mpn+gvqPhjgfWQi+Bgec6iakTWmspJryToSeA 4Y6dmTwXKAY4mW9l08jQKsmd+DzEVodxfftlibf5to+cI6+UHMPQTH8fLttNqmrpHRTX ZmsHlsUnFOEsg9t/LLCW4Oio4QRINxBKGPrxDFMVk/+RdGIDVgyHqpjAhVIRuvOxDGHF H7tHkg5T2RCfAAPIETGnCQrSEcB61d/hggGHW/UAD6nGk7bZzyQLc+Ei6LLf+gnlwUcX HYzw== X-Gm-Message-State: AOAM5311PFcjOogZtlKjb2Mk5j8sLCZv7rrkk+QlHNAZSoMznyQ55An3 +JjUx00zLTWvm/CbMvEWKvItBw== X-Received: by 2002:a17:90a:5302:b0:1b9:ba0a:27e5 with SMTP id x2-20020a17090a530200b001b9ba0a27e5mr19589604pjh.91.1645333803853; Sat, 19 Feb 2022 21:10:03 -0800 (PST) Received: from localhost.localdomain ([122.162.118.38]) by smtp.gmail.com with ESMTPSA id 84sm7602730pfx.181.2022.02.19.21.09.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 21:10:03 -0800 (PST) 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 v3 2/6] irqchip/riscv-intc: Allow drivers to directly discover INTC hwnode Date: Sun, 20 Feb 2022 10:38:50 +0530 Message-Id: <20220220050854.743420-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220220050854.743420-1-apatel@ventanamicro.com> References: <20220220050854.743420-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 | 19 +++++++++++++++++++ drivers/irqchip/irq-riscv-intc.c | 7 +++++++ 3 files changed, 30 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..ead92432df8c 100644 --- a/arch/riscv/kernel/irq.c +++ b/arch/riscv/kernel/irq.c @@ -7,9 +7,28 @@ #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; +} +EXPORT_SYMBOL_GPL(riscv_set_intc_hwnode_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..fa24ecd01d39 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) ? intc_domain->fwnode : NULL; +} + static int __init riscv_intc_init(struct device_node *node, struct device_node *parent) { @@ -119,6 +124,8 @@ static int __init riscv_intc_init(struct device_node *node, return -ENXIO; } + riscv_set_intc_hwnode_fn(riscv_intc_hwnode); + rc = set_handle_irq(&riscv_intc_irq); if (rc) { pr_err("failed to set irq handler\n"); -- 2.25.1