Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2687762rdb; Wed, 4 Oct 2023 08:32:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH+WFTYgeD0O5WDogvuhGiLwUaPH4lDrPxNVYQhySIXT4sYYup757DxtyToAwPRyfOLSbQD X-Received: by 2002:a17:902:c3c1:b0:1c5:9d28:b2bb with SMTP id j1-20020a170902c3c100b001c59d28b2bbmr2637660plj.33.1696433578770; Wed, 04 Oct 2023 08:32:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696433578; cv=none; d=google.com; s=arc-20160816; b=h6tV4tycpYHe8vDA+zTUz8fU6bFeOaosJ7LvP1ORwxhYswgLnKp28NfPgJzi835u4U 0znygJ7igsoDMSknNSt5Acb1Al34AceWzn3OfVrwuwSWEqNg51yKyymGptybqYsJiJSH 2dTu0+XFKV4uJa1ns9whsS10S3U3gK9f0rRJ17lwvXRAvQSiRVpvoWrFsFXFTw30yVER UN28BOVVxa6Ld0VnW932FZNrXPj9mj/Dm5vVqgep12A8s/YLLN/kHNTgsqKvufJXeeN4 RHolR/YhwuY/ja3xTf/a9T4nJtrjPPJ1gq6pSep89+7mT4hMu9/SqvYeE3l9TSFB8D6P 8+lg== 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 :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature; bh=qUllfq5WNt8+GoyijiY3nJIsmWZU2xUZa7itJfb6WN0=; fh=Kc6k46jil/ng4zpcsEar2Yb+9UoXdDAU3nQBTD34k6s=; b=AVEbEtYZIcSZK2/D2s0ACuMlxXpAsAt1FP7VZcrad7qUlxXI130YNFkY00F5u+hNKY 3fYJyi8LgWi3T4JK4dMYOmCXIcf1cuwL4OVgkTKTSVqI9M4rEQhkcs01Bivr/OOPTPQ4 46MDWC342560WoPS53Ij/2BoQB9S2Le4CfCZuM+9KUKmg5TLZkVHkkR70l9qQilAgjlH UmQ46eoNYm5g50JdL5YYIa6dLLVvPxD0lQ/hwmJdml6+YId+Yt0nB7rkGSqd4L+8vQNG Sz1G0pbHSj4r0xI4EkZTXxg/CCxBdJuKYrMLaip7ngXmzY0M+aWS9VM4XELJ8YNPWJgy T/tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UlRUnRxR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z13-20020a170903018d00b001c6223663b2si4198098plg.339.2023.10.04.08.32.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 08:32:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UlRUnRxR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D40B8822CEE1; Wed, 4 Oct 2023 08:32:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233600AbjJDPc4 (ORCPT + 99 others); Wed, 4 Oct 2023 11:32:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233550AbjJDPcy (ORCPT ); Wed, 4 Oct 2023 11:32:54 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BCF7C6 for ; Wed, 4 Oct 2023 08:32:51 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEFEBC433C7; Wed, 4 Oct 2023 15:32:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696433570; bh=Na16UD/s1oSoqnUU7cLXvGvYgsS3in1QKmZWnqaLLM8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UlRUnRxR4Knt/zA1ssgoCg17S7pcXjBahn655ReiBJ/eLOS5x/vT0cNWB+zftQ7/2 yWHdSS4rhR4Y0oYGHmClcdBh+rL5reJPF0yPyFNod0LOv7pAnVYN4KuKVm7jIfjyeQ pDpDvD5yer+ZQ4AejEO6htlgMPAmFHk/BTrXNKrjScnABeZAjuh+SwuMxa/eQ/YDnh gT476gABsmUxf1Wf8BNSuBOjsDQ77L2uJuzR8Xc1TeJjZyJxiR2K0gndCzA8ioimm5 DI9yGP7EjGgXIdZaqDV2kfk/tk5FuRuzef7jQVHgaXiIW6U60lPqTU96T6EOEikSvm mLjqOI8PHOVaA== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qo3rk-0016Ui-GG; Wed, 04 Oct 2023 16:32:48 +0100 Date: Wed, 04 Oct 2023 16:32:47 +0100 Message-ID: <86cyxuo128.wl-maz@kernel.org> From: Marc Zyngier To: Anup Patel Cc: Dmitry Dunaev , dunaich@mail.ru, Thomas Gleixner , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH] irqchip/riscv-intc: Mark INTC nodes for secondary CPUs as initialized. In-Reply-To: References: <20230926102801.1591126-1-dunaev@tecon.ru> <86il7mofmm.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: apatel@ventanamicro.com, dunaev@tecon.ru, dunaich@mail.ru, tglx@linutronix.de, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 04 Oct 2023 08:32:58 -0700 (PDT) On Wed, 04 Oct 2023 15:59:33 +0100, Anup Patel wrote: >=20 > On Wed, Oct 4, 2023 at 3:48=E2=80=AFPM Marc Zyngier wrot= e: > > > > On Tue, 26 Sep 2023 11:36:31 +0100, > > Anup Patel wrote: > > > > > > On Tue, Sep 26, 2023 at 3:59=E2=80=AFPM Dmitry Dunaev wrote: > > > > > > > > The current Linux driver irq-riscv-intc initialize IRQ domain only = once, > > > > when init function called on primary hart. In other cases no IRQ do= main is > > > > created and no operation on interrupt-controller node is performed. > > > > This is cause of that no common Linux driver can use per-cpu interr= upts > > > > mapped to several CPUs because fwnode of secondary cores INTC is not > > > > marked as initialized. This device is always will be marked as defe= rred. > > > > For example the system with devicetree > > > > > > > > cpu0: cpu@0 { > > > > cpu0_intc: interrupt-controller { > > > > interrupt-controller; > > > > compatible =3D riscv,cpu-intc; > > > > }; > > > > }; > > > > > > > > cpu1: cpu@1 { > > > > cpu1_intc: interrupt-controller { > > > > interrupt-controller; > > > > compatible =3D riscv,cpu-intc; > > > > }; > > > > }; > > > > > > > > buserr { > > > > compatible =3D riscv,buserr; > > > > interrupts-extended =3D <&cpu0_intc 16 &cpu1_intc 16>; > > > > }; > > > > > > > > will always report 'buserr' node as deferred without calling any > > > > bus probe function. > > > > > > > > This patch will mark all secondary nodes passed to irq-riscv-intc > > > > driver init function as initialized to be able to act as correct > > > > IRQ phandle node. > > > > > > > > Signed-off-by: Dmitry Dunaev > > > > --- > > > > drivers/irqchip/irq-riscv-intc.c | 8 ++++++-- > > > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq= -riscv-intc.c > > > > index 4adeee1bc391..c01a4e8d4983 100644 > > > > --- a/drivers/irqchip/irq-riscv-intc.c > > > > +++ b/drivers/irqchip/irq-riscv-intc.c > > > > @@ -155,8 +155,10 @@ static int __init riscv_intc_init(struct devic= e_node *node, > > > > * for each INTC DT node. We only need to do INTC initializ= ation > > > > * for the INTC DT node belonging to boot CPU (or boot HART= ). > > > > */ > > > > - if (riscv_hartid_to_cpuid(hartid) !=3D smp_processor_id()) > > > > + if (riscv_hartid_to_cpuid(hartid) !=3D smp_processor_id()) { > > > > + fwnode_dev_initialized(of_node_to_fwnode(node), tru= e); > > > > > > There is already a patch on LKML to address this. > > > https://www.spinics.net/lists/kernel/msg4929886.html > > > > If this is a fix, why is it buried in a huge series and not brought > > forward as an independent fix that needs to be picked early? >=20 > Dmitry saw this issue in a totally different context which is not > reproducible with existing DTS files in kernel sources. I hope you're not suggesting that only the DTs that are present in the kernel tree are valid. Because as far as I'm concern, the DTs in the kernel tree are only some *examples*, and not a reference. I fully expect the vast majority of DTs to live *outside* of the kernel tree, provided by the firmware, and never upstreamed. Would you expect every PC vendor to upstream their ACPI tables? > This issue only manifests when some platform driver DT node > points to the per-HART INTC nodes. For example, RISC-V > irqchip device DT nodes point to per-HART INTC nodes. Is this configuration legal or not as per the DT binding? I don't see anything that suggests it isn't legal, and having per-CPU interrupts isn't exactly a new thing. > Currently, all RISC-V irqchip drivers (INTC and PLIC) are probed > early (not as platform drivers) so we don't see this issue with > existing irqchip drivers. You don't, but Dimitry does. Who wins? M. --=20 Without deviation from the norm, progress is not possible.