Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp317601rwn; Wed, 7 Sep 2022 17:28:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR4H7rqHWeVkKXKHyigcA51OGJXQEYovTlGgMexmTwaQQ+2RqGjDKKmPzY8CEPECCju64uos X-Received: by 2002:a63:5a46:0:b0:434:e36b:438f with SMTP id k6-20020a635a46000000b00434e36b438fmr5358482pgm.351.1662596891088; Wed, 07 Sep 2022 17:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662596891; cv=none; d=google.com; s=arc-20160816; b=eEQLPc1Ti28Y1tDWnsa0iZwlytbRyNpCKG/t13w7wvJ3+vI61DqiqmsLYpDTKjEzFf pieJl+SjvThS/0LdV7LLtDjXvsbcyw7SEdZYHzX7bSwaAjievFhHhDRLz4GU8wpAsEs/ /g4k1mBh/XbLekQ+lccRAaIL3K6YddBiPJShUIoTOqUWhufVxX0znI61Vhv53BrB/D+U Le94t5eRHvH7FphIFeALHACRj21jWUVcqCKB0lRMZJEIztHhGZgjWiOO8B42F3Fac0U+ 4TeEnTgw5QayCP+23BHrG51Hj+dQEWGv3OMr6G9dHmCMfHN4s/lSnW0nHRJQ378gRoYZ xHJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=LTOeCjfJotr02jcfDPAY5LmPRWFwiUZOmDbbyJyKBEc=; b=Et+jdD/s99dgEbCO6377UCuvOc/lTZRI6YsxOYyU/Doi+VWkg1cqYj0QwsckjE3eQ+ 8kBzcd0ksK/QirGJ/SqwEyQ17aE9auTQ0zWPrbuSuGkY7IroN4C5+3aUmT5QI1HEqXhL bURc7AbHWjYqI0ljBQX6TMEtWhU/XLUY9fWKVLrSF1hQLDrPudUtSiCA1AOpQ0EaYe+m seLMIUxx1ZVD6xzBvLmHk2OWpkiOz0mlB5WqRLhHHbE1fAh7vL6T6TUNFvGi6/IxasC3 svg2EeWltDlTEvx+89Qc3uxHJDecZfRa/mydN3wYv06Y979yfn+YwZdQJVlC7jUwvFW5 EtfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@atishpatra.org header.s=google header.b=nMgikIW2; 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 u16-20020a170902a61000b00176db576db9si1681066plq.275.2022.09.07.17.28.00; Wed, 07 Sep 2022 17:28:11 -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=@atishpatra.org header.s=google header.b=nMgikIW2; 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 S229567AbiIGXVH (ORCPT + 99 others); Wed, 7 Sep 2022 19:21:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229513AbiIGXVF (ORCPT ); Wed, 7 Sep 2022 19:21:05 -0400 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A909098A4A for ; Wed, 7 Sep 2022 16:21:04 -0700 (PDT) Received: by mail-io1-xd2c.google.com with SMTP id c4so12749454iof.3 for ; Wed, 07 Sep 2022 16:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atishpatra.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=LTOeCjfJotr02jcfDPAY5LmPRWFwiUZOmDbbyJyKBEc=; b=nMgikIW25jVPRgTNTsPE+uV3ApiAjiwGNFkTu5WfstH3jXuUCVYuepPCclOtQUowmJ BOyF5Jk3IqveRLG322GQ2NcPPrnmutuRdgR/JJke2RXJ9gwmhn2TXdAM1uv0RNtAh6DG VQCL8mkLCcXfd+1NYUDPBV7UNxRQ2D58wfg/A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=LTOeCjfJotr02jcfDPAY5LmPRWFwiUZOmDbbyJyKBEc=; b=cg5EfT2uxvP/+1A90YuQ5AP/8sdCRdFkaFVQ3cSy8VF+rzJy5izAhLdQSjWJitW4ZX ZGp+8t0+OqjrmiBdBZUhnHEM462Q9uWVHb92r9jiCPObxs5VKA6C/dcS728xJHkDw3NO crVYvXouDuijFKqV+vVvGoaH/Ux5SPmHp934NQ+RvdaeVi4l9KKog7uf8UrbfTkpGD59 B8wyBm+S3yk9J/YhTA81MJA4C1pNpO4fVQf9j8hu6cfVSFV97iikQZNYp43lAs3xBv9z mv6nxYHOMS81z6nZtRzYlDf089lY/cVCeSefDbSKv9AK64d96fbpFBLXNISB9wGv8nas +7+A== X-Gm-Message-State: ACgBeo3ivgMt+EN1SSQZK1KH41p2rkPendtTZ4qaR08uDCzBqG2W7J0c +U6vUwGKZDtJvdJ4LLYijSjg584XLTmp9O5liFnn X-Received: by 2002:a6b:c504:0:b0:68b:6802:2bfe with SMTP id v4-20020a6bc504000000b0068b68022bfemr2928712iof.22.1662592863904; Wed, 07 Sep 2022 16:21:03 -0700 (PDT) MIME-Version: 1.0 References: <20220903161309.32848-1-apatel@ventanamicro.com> <20220903161309.32848-3-apatel@ventanamicro.com> In-Reply-To: <20220903161309.32848-3-apatel@ventanamicro.com> From: Atish Patra Date: Wed, 7 Sep 2022 16:20:53 -0700 Message-ID: Subject: Re: [PATCH v9 2/7] irqchip/riscv-intc: Allow drivers to directly discover INTC hwnode To: Anup Patel Cc: Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Marc Zyngier , Daniel Lezcano , Alistair Francis , Anup Patel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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 On Sat, Sep 3, 2022 at 9:13 AM Anup Patel wrote: > > 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 > Reviewed-by: Atish Patra -- Regards, Atish