Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2474660rwp; Fri, 14 Jul 2023 06:49:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlEmEO2smv6gd35prGm5feApAA4rPEI7rhp8nZflHqgNh6S42tnKV81PoQ1F+vprjqxJVwuM X-Received: by 2002:a5d:6550:0:b0:316:f001:7c9c with SMTP id z16-20020a5d6550000000b00316f0017c9cmr1245251wrv.58.1689342563270; Fri, 14 Jul 2023 06:49:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689342563; cv=none; d=google.com; s=arc-20160816; b=y0Os4yMyAr7hfeHKNLaiq1QNThTz7By2Iwe+WkFaQQYDhU3W33pnyNcy+D3cKudRLQ l70/VSUe4cVjHliK9sqteBZz53wb8I4uJycD+IcTQbnRQUQuNywZbZe9hslG+Vv3ZBnc vsQJlJjZICNNPwQpDrHIIFkujAnFZwhD5kO6ckTrQgGkLd/AoHZ00KF0QPkZT60TqGQv pjLBz9neDwmHDpA/Xiswxu3jvpHVCT7m0JAS34y1k39z0zUEAg+t/IGH72sP4acKr+yp 1GOvswlLMpbt5a/o6y4hCH5sqMsH5EFadSeWhgXFHOM1t4mvLzdbmHVIAHXRm24ffUMz MQKQ== 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=qpAbeSM64u5GNaOvIhDI16TbCHqyT/fMmbdxB9LSOTw=; fh=YJT4xf437ZZWcnbGgVnq6qyJ0BLcDpfcrzzaWYtLiZ8=; b=jXSs5XN68KSQrQdZxkhlL9RglpLVdnsfngoQGAVtpQXmdWlRG6o+eKLyz49hSAVr0T ql4a9xaNdTnrm1564dS4NJQgEqf5ZqG0GMPj1/YbHUMWdZoA3zGdl7ffJKQ8KPFqBqia UR2Wybos1NBh9FTt0XEOiLwNSphtXm2Jzom20xcJYalclgBd8RHAIYDbKMzvBbHQzPVD UzZqQy3L1QLOw+PEmdLxHEJYJQ2mMY99Lidi6lpT5/ahlpWGu8Hb1/dxeMJosEwhMa7D +PcP9+yyFyCn3BSW3VnciCOP0DrH5ngrQZxYbfOPUst6ReE2n3wjSH7DtOiBeY8AX0LX V1JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Loi/16pf"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id md13-20020a170906ae8d00b0098dd9f4ed60si8458169ejb.848.2023.07.14.06.48.59; Fri, 14 Jul 2023 06:49:23 -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=@kernel.org header.s=k20201202 header.b="Loi/16pf"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235679AbjGNNfT (ORCPT + 99 others); Fri, 14 Jul 2023 09:35:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235219AbjGNNfS (ORCPT ); Fri, 14 Jul 2023 09:35:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E072C1991; Fri, 14 Jul 2023 06:35:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5CF5E61D21; Fri, 14 Jul 2023 13:35:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A81D4C433C7; Fri, 14 Jul 2023 13:35:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689341715; bh=LmNuxSDhR2xVlR/o8NTwfyzlHy/wLO/mPMqtHawGjwQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Loi/16pfanheWa+qvyOzRQD2Ww3aZH0SazgDvpO4Xu+BEjwUixhWJ87f6gM5vozGQ npReio+qWUrWpngEa4Mb2oGpLVdx6SgmWPQtsobjXEJc7aLylypC6YBGIB+6Ea9RiV FkGD/Jae6rigsdElpq6PbOBaH2qv+qAk1IR5NaurpPYO/50uUGxM7/VE5vf/LuOiFX G21zStG3Bq3+UY/ZFNBbU/ZtMODMUVto1aZSPO+wfcc26YicqYJ1bal61RwrW7m/zL T7yT6KhGIMJffVit3lqc7MZzK9sXAEJUJk4aErNEeA1z5mAuCtCiTn6DTD1lA1LBap kEklyJ90rvVHQ== 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 1qKIwz-00D7Bz-7Y; Fri, 14 Jul 2023 14:35:13 +0100 Date: Fri, 14 Jul 2023 14:35:12 +0100 Message-ID: <86cz0uvcof.wl-maz@kernel.org> From: Marc Zyngier To: Anup Patel Cc: Saravana Kannan , Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Atish Patra , Andrew Jones , Sunil V L , Conor Dooley , Anup Patel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v5 7/9] irqchip: Add RISC-V advanced PLIC driver In-Reply-To: References: <20230710094321.1378351-1-apatel@ventanamicro.com> <20230710094321.1378351-8-apatel@ventanamicro.com> <86jzv2vpdb.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/28.2 (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, saravanak@google.com, palmer@dabbelt.com, paul.walmsley@sifive.com, tglx@linutronix.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, atishp@atishpatra.org, ajones@ventanamicro.com, sunilvl@ventanamicro.com, conor@kernel.org, anup@brainfault.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.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,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 Fri, 14 Jul 2023 10:35:34 +0100, Anup Patel wrote: >=20 > On Fri, Jul 14, 2023 at 2:31=E2=80=AFPM Marc Zyngier wro= te: > > > > Anup, > > > > On Fri, 14 Jul 2023 00:56:22 +0100, > > Saravana Kannan wrote: > > > > > > On Mon, Jul 10, 2023 at 2:44=E2=80=AFAM Anup Patel wrote: > > > > > > > > The RISC-V advanced interrupt architecture (AIA) specification defi= nes > > > > a new interrupt controller for managing wired interrupts on a RISC-V > > > > platform. This new interrupt controller is referred to as advanced > > > > platform-level interrupt controller (APLIC) which can forward wired > > > > interrupts to CPUs (or HARTs) as local interrupts OR as message > > > > signaled interrupts. > > > > (For more details refer https://github.com/riscv/riscv-aia) > > > > > > > > This patch adds an irqchip driver for RISC-V APLIC found on RISC-V > > > > platforms. > > > > > > > > Signed-off-by: Anup Patel > > > > [...] > > > > > > +static int __init aplic_dt_init(struct device_node *node, > > > > + struct device_node *parent) > > > > +{ > > > > + /* > > > > + * The APLIC platform driver needs to be probed early > > > > + * so for device tree: > > > > + * > > > > + * 1) Set the FWNODE_FLAG_BEST_EFFORT flag in fwnode which > > > > + * provides a hint to the device driver core to probe the > > > > + * platform driver early. > > > > + * 2) Clear the OF_POPULATED flag in device_node because > > > > + * of_irq_init() sets it which prevents creation of > > > > + * platform device. > > > > + */ > > > > + node->fwnode.flags |=3D FWNODE_FLAG_BEST_EFFORT; > > > > > > Please stop spamming us with broken patches. Already told you this is > > > not an option. > > > > > > Nack. > > > > What puzzles me here is that *no other arch* requires this sort of > > hack. What is so special about the APLIC that it requires it? I see > > nothing in this patch that even hints at it, despite the "discussion" > > in the last round. > > > > The rules are simple: > > > > - either the APLIC is so fundamental to the system that it has to be > > initialised super early, much like the GIC on arm64, at which point > > it cannot be a platform device, and the story is pretty simple. > > > > - or it isn't that fundamental, and it can be probed as a platform > > device using the dependency infrastructure that is already used by > > multiple other interrupt controller drivers, without any need to > > mess with internal flags. Again, this should be simple enough. >=20 > APLIC manages all wired interrupts whereas IMSIC manages all > MSIs. Both APLIC and IMSIC are fundamental devices which need > to be probed super early. >=20 > Now APLIC has two modes of operations: > 1) Direct mode where there is no IMSIC in the system and APLIC > directly injects interrupt to CPUs > 2) MSI mode where IMSIC is present in the system and APLIC > converts wired interrupts into MSIs >=20 > The APLIC driver added by this patch is a common driver for > both above modes. Which it doesn't need to be. You are pointlessly making life difficult for yourself, and everyone else. The MSI bridge behaviour has *zero* reason to be the same driver as the main "I need it super early" driver. They may be called the same, but they *are* different things in the system. They can share code, but they are fundamentally a different thing in the system. And I guess this silly approach has other ramifications: the IMSIC is also some early driver when it really doesn't need to be. Who needs MSIs that early in the life of the system? I don't buy this for even a second. Frankly, this whole thing needs to be taken apart and rebuilt from the ground up. > For #2, APLIC needs to be a platform device to create a device > MSI domain using platform_msi_create_device_domain() which > is why the APLIC driver is a platform driver. You can't have your cake and eat it. If needed super early, and it cannot be a platform driver. End of the story. And to my earlier point: IMSIC and APLIC-as-MSI-bridge have no purpose being early drivers. They must be platform drivers, and only that. > > If these rules don't apply to your stuff, please explain what is so > > different. And I mean actually explain the issue. Which isn't telling > > us "it doesn't work without it". Because as things stand, there is no > > way I will even consider taking this ugly mix of probing methods. >=20 > Yes, I don't want this ugly FWNODE_FLAG_BEST_EFFORT hack > in this driver. And yet you are hammering it even when told this is wrong. > I tried several things but setting the FWNODE_FLAG_BEST_EFFORT > flag is the only thing which works right now. How about you take a step back and realise that the way you've architected your drivers makes little sense? I don't think you have tried *that*. Thanks, M. --=20 Without deviation from the norm, progress is not possible.