Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9094819rwp; Wed, 19 Jul 2023 22:35:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlFGdIcnuS+xUJ6MkblZvSsL42suGIQU3QHmh75DvqjLKVEiWGt/QTgYVyIo8CH2DQtJHO9W X-Received: by 2002:a05:6871:10e:b0:1ba:63b2:899d with SMTP id y14-20020a056871010e00b001ba63b2899dmr758899oab.32.1689831301037; Wed, 19 Jul 2023 22:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689831301; cv=none; d=google.com; s=arc-20160816; b=XbsxCkR3TNkItEbIM7QmZ5etuKgKyuorQyse80J/lm0f86dich9C6S53zkA2W9WFkh Yxv0mThX90px0trlrH73Ft1EBDFoitMF1CRyuircT+tdZllsCwIg9J7jHYAorZHk3Kt6 41qU0F82zHTFf2G9ZCVBbwCwMp9Hak2Il6BxUSXAlDQk15sRPSGP48/EUW9bLDWubYH7 oVicFNnJa84PeBxL85emiUdUAUtMn8/vzJnJNdEvhDO//hGg588G5wdzzEWMAo6kk/cb KaOVcWo+0/UlklR1h7FiF/jUY5ceCcez1VPNks/eCnzXYX0xcqfGs9RfHiYJkhuqGmxQ JjCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=/wbrMMQ8KV+niCaXh6uJjaEC3/Z2Le24zOgdMFKpH7A=; fh=FuhKM5rnI1hZ/uwtLPuSZzSTEtlysFm7z2f855piMSw=; b=uMr5Ayi9VSauMftNKFai6x0buB8qQFDjbjLELwpLsREmUxUNoNvkDolkR9J5LqKZ2C 0/vKfFd2fFHU9GQnh9mz+aNmRUS+rIbb7fLi6KgZSxQx4xOJhzPbCHtoPFS6Wj57EmvM Z6vXoQ5dB2wIYd0UUzhPcdFUUk0bjGgIt0h5A8aIp1nvQO0p2vnvhGfNLK5JyVkXSaJw D1eI5BtJ6I2669/oFtOPTCDWqKifHrKQJPZp0c9h055Tec4yOEQPTnJoSQvUCMHW9O+X DcPeElfm74ru8YYqtHBd04AhWPbPehzKAuYs9i/3J8JIvuO2J5nlrx8LyB96YJwEhPvx 7D8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="E/Zr9Jc6"; 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 e6-20020a63d946000000b0055c79555b90si101495pgj.333.2023.07.19.22.34.46; Wed, 19 Jul 2023 22:35:00 -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="E/Zr9Jc6"; 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 S229540AbjGTFV2 (ORCPT + 99 others); Thu, 20 Jul 2023 01:21:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjGTFV1 (ORCPT ); Thu, 20 Jul 2023 01:21:27 -0400 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D529F110 for ; Wed, 19 Jul 2023 22:21:25 -0700 (PDT) Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-76714caf466so44824385a.1 for ; Wed, 19 Jul 2023 22:21:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689830485; x=1690435285; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=/wbrMMQ8KV+niCaXh6uJjaEC3/Z2Le24zOgdMFKpH7A=; b=E/Zr9Jc6xEoShH0RQk2rvrcWAkbs2qJx8iGl9hbMHK7GaotEkfJngBuGG9PbGp8wVl wxoOpW7hEK/Uqmvksp1lfkKE6jtuimBAy9kR4ZHGFnhdoiM5QQIV6xIM6zB0uZ6A7Lr3 /kljX445kk9wmORbSRIkspJM2rskoX8+4nF8q+xNmo3dsDPuIDvAjwsFKphO4I61OWpu CsF0hFAK2KiX9pWO+ZVlaPeEWYAuZZXG95Fb7mxBqnbAnisVFCRiWr9CWV7EGYYFvi9u tIkfz5kwp+4BU5MuqY2Z8YpqxuBhAjXPRhRzb02vogAW0IW/cwIUKT2YEXRRvjq16EE+ sEBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689830485; x=1690435285; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/wbrMMQ8KV+niCaXh6uJjaEC3/Z2Le24zOgdMFKpH7A=; b=ROTf4GeRLL3sZ4bu4ZuZH8qXK2VOdmZ2ZGMpNFaOsqxe+OrbFjK4VUzObcYnk+8ORt HFTIyJy1T0M8wN36CXLk9kIy0DzQa/wmNvh7xdqmn/zUBODgJHTxqaM/JdiGzpTsgBM+ CtWBAmkYVFIhZMeEYawoJL9ys3MJWSC5mhhf2WRuXeBSFsuynwuVq2YG21V18CHtaMKa 7u50IadC+xUK/KYLU2Put+Ogis520JmHgDW3XbD2Ffddjntkt4AlpBxYWIP1nk94otW3 sPFNgKAAZP8bj6QK2n7yU4aFCM9aW0VVftQWtfA9EvYHL7bcrJx1aNNCbzAt5uTBb/Rx l4XA== X-Gm-Message-State: ABy/qLYGapdbtXA68q8j9dshp/uJlMuTFTwBPGKOTC/FQ4BIq8EMyOnD IbJVohcfcA2YNiVT5F4WMd1fcduXarnoEdmX3wQCfFUhy9tJYlt2 X-Received: by 2002:a05:620a:6407:b0:760:69ca:7a1a with SMTP id pz7-20020a05620a640700b0076069ca7a1amr20891834qkn.1.1689830484880; Wed, 19 Jul 2023 22:21:24 -0700 (PDT) MIME-Version: 1.0 References: <20230719113542.2293295-1-apatel@ventanamicro.com> <20230719113542.2293295-4-apatel@ventanamicro.com> In-Reply-To: From: Anup Patel Date: Thu, 20 Jul 2023 10:51:13 +0530 Message-ID: Subject: Re: [PATCH v6 03/14] drivers: irqchip/riscv-intc: Mark all INTC nodes as initialized To: Saravana Kannan Cc: Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Frank Rowand , Conor Dooley , Atish Patra , Andrew Jones , Sunil V L , Anup Patel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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_BLOCKED, 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 Thu, Jul 20, 2023 at 3:45=E2=80=AFAM Saravana Kannan wrote: > > On Wed, Jul 19, 2023 at 4:36=E2=80=AFAM Anup Patel wrote: > > > > The RISC-V INTC local interrupts are per-HART (or per-CPU) so > > we create INTC IRQ domain only for the INTC node belonging to > > the boot HART. This means only the boot HART INTC node will be > > marked as initialized and other INTC nodes won't be marked which > > results downstream interrupt controllers (such as IMSIC and APLIC > > direct-mode) not being probed due to missing device suppliers. > > > > To address this issue, we mark all INTC node for which we don't > > create IRQ domain as initialized. > > > > Signed-off-by: Anup Patel > > --- > > drivers/irqchip/irq-riscv-intc.c | 10 +++++++++- > > 1 file changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq-ris= cv-intc.c > > index 65f4a2afb381..4e2704bc25fb 100644 > > --- a/drivers/irqchip/irq-riscv-intc.c > > +++ b/drivers/irqchip/irq-riscv-intc.c > > @@ -155,8 +155,16 @@ static int __init riscv_intc_init(struct device_no= de *node, > > * for each INTC DT node. We only need to do INTC initializatio= n > > * 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()) { > > + /* > > + * The INTC nodes of each CPU are suppliers for downstr= eam > > + * interrupt controllers (such as IMSIC and APLIC direc= t-mode) > > + * so we should mark an INTC node as initialized if we = are > > + * not creating IRQ domain for it. > > + */ > > I'm a bit confused by this. If those non-boot CPUs INTC doesn't have > an IRQ domain, why are the downstream interrupt controllers listing > these non-boot CPU INTCs as an upstream interrupt controller? Downstream interrupt controllers (such as PLIC, APLIC direct-mode, or IMSIC) use "interrupts-extended" DT property to associate their MMIO resources with target CPU. For example: If we have 4 CPUs then PLIC will typically have 2 PLIC MMIO contexts for each CPU where one context is for M-mode and another context is for S-mode. In this case, there are total 8 PLIC MMIO contexts and the arrangement of these MMIO resources is platform specific so "interrupts-extended" DT property is used by PLIC driver to discover the arrangement of PLIC MMIO contexts and their mapping to target CPU. Similar to the above example, the APLIC direct-mode has per-CPU IDC MMIO registers and "interrupts-extended" DT property is used to discover arrangement of these IDC MMIO registers and their mapping to the target CPU. > > This is more of a question of the existing behavior that this patch, > but this patch highlights the existing oddity. > > -Saravana > > > + fwnode_dev_initialized(of_fwnode_handle(node), true); > > return 0; > > + } > > > > return riscv_intc_init_common(of_node_to_fwnode(node)); > > } > > -- > > 2.34.1 > > Regards, Anup