Received: by 2002:a05:6a10:5594:0:0:0:0 with SMTP id ee20csp544003pxb; Mon, 25 Apr 2022 16:06:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3PHKNnri2thI8IbWrjiJd07wZchzla7sRUoSWne0vRvballef2nKPHCZ+hMpWsjtLlWvO X-Received: by 2002:a63:79ce:0:b0:3a9:efa0:17d with SMTP id u197-20020a6379ce000000b003a9efa0017dmr17190373pgc.170.1650927989706; Mon, 25 Apr 2022 16:06:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650927989; cv=none; d=google.com; s=arc-20160816; b=kN4Kfs4T8bsrdbTDA/bEstaNLLU0KlszNI8ZXZYHo07iPCN4cYfESLceOGE7+u3JCQ +xUVAtLzPv7SbZropFJHAkiRqFzT6p4baVOhwGg+3ZtyaJumrzDOa8L7cT86388xcIKQ 3IP0nLIuayCmMhrN57cQ3qd/KTiLIT+pUpFZryWMOX4TfyjQl7U1DjbBBT30YRx1KM9X mvq3njQg8mDnRyDFKWSUUXyD/2Ed+7gNreSRf3KMdWZshQ+7J1npRcQk7lJ2fM9ePYca oAkKcVIrbpH9peyT760Xe4DvVmn2FMdnKctFUlPJc1e86WCgiPmdRdrbT9WAarHrGfPN XpBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=xY0GFM+BCfiJQY8oElKOTBq+jBzivOTHya4wKMoEjN0=; b=fJ/vg9ZAVwDmbDp4LoHUS6lF9LJYUGPknJhX+6wHgIQ56jJa/0kMOXsBL+YtU7+uhU kspJjC4SqVzJ38iGM0Zj28dUTKMgIHgMghjLj8NG8bi/F7v3TPMiKVeFHtNT3zTIvm3i tHy/lDbdiMXvl5Mu0BiVkOjPz+dXZb1StYdBI02K2HHQvHm5gtYxeJQ5VdBJIJNTgi3j fogMtoXhasPe6zu+ymVsjW+x/qaVR4TcalWZkV9EZPDr9SKSNbQn93uCKGQaEcjc42St KYiVjrgtrc9DVciovlqhDtJ7wnzB9cYz7Y2vQLCYeR9OkaO6g0AzWu0VAAznhv0/nUQ/ VULg== ARC-Authentication-Results: i=1; mx.google.com; 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 l22-20020a056a0016d600b0050a9644da4esi19660979pfc.335.2022.04.25.16.06.13; Mon, 25 Apr 2022 16:06:29 -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; 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 S238833AbiDYKYp convert rfc822-to-8bit (ORCPT + 99 others); Mon, 25 Apr 2022 06:24:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235072AbiDYKYf (ORCPT ); Mon, 25 Apr 2022 06:24:35 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7A7B583B2 for ; Mon, 25 Apr 2022 03:21:30 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nivqI-00049H-9V; Mon, 25 Apr 2022 12:21:18 +0200 Received: from [2a0a:edc0:0:900:1d::4e] (helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nivqH-0057yg-Ob; Mon, 25 Apr 2022 12:21:16 +0200 Received: from pza by lupine with local (Exim 4.94.2) (envelope-from ) id 1nivqF-0005uW-Hw; Mon, 25 Apr 2022 12:21:15 +0200 Message-ID: <1ec5ce3673dcdaa914e20ef2aae03f549d05ff9a.camel@pengutronix.de> Subject: Re: [PATCH v2 0/3] add fwnode support to reset subsystem From: Philipp Zabel To: =?ISO-8859-1?Q?Cl=E9ment_L=E9ger?= , Rob Herring Cc: Lizhi Hou , Sonal Santan , Frank Rowand , Lars Povlsen , Steen Hegelund , Microchip Linux Driver Support , Thomas Petazzoni , Alexandre Belloni , Allan Nielsen , "linux-kernel@vger.kernel.org" , devicetree@vger.kernel.org, Stefano Stabellini , Hans de Goede , Mark Brown Date: Mon, 25 Apr 2022 12:21:15 +0200 In-Reply-To: <20220408174841.34458529@fixe.home> References: <20220324141237.297207-1-clement.leger@bootlin.com> <20220405092434.6e424ed4@fixe.home> <20220405175120.23fc6b2a@fixe.home> <20220406094019.670a2956@fixe.home> <20220408174841.34458529@fixe.home> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 Hi Clément, On Fr, 2022-04-08 at 17:48 +0200, Clément Léger wrote: [...] > > > > > > I've told the Xilinx folks the same thing, but I would separate this > > > > > > into 2 parts. First is just h/w work in a DT based system. Second is > > > > > > creating a base tree an overlay can be applied to. The first part should > > > > > > be pretty straightforward. We already have PCI bus bindings. The only > > > > > > tricky part is getting address translation working from leaf device thru > > > > > > the PCI bus to host bus, but support for that should all be in place > > > > > > (given we support ISA buses off of PCI bus). The second part will > > > > > > require generating PCI DT nodes at runtime. That may be needed for both > > > > > > DT and ACPI systems as we don't always describe all the PCI hierarchy > > > > > > in DT. > > > > > > > > > > But then, if the driver generate the nodes, it will most probably > > > > > have to describe the nodes by hardcoding them right ? > > > > > > > > No, the kernel already maintains its own tree of devices. You just > > > > need to use that to generate the tree. That's really not much more > > > > than nodes with a 'reg' property encoding the device and function > > > > numbers. > > > > > > Just to clarified a point, my PCI device exposes multiple peripherals > > > behind one single PCI function. > > > > Right. I would expect your PCI device DT node to have a 'simple-bus' > > child node with all those peripherals. And maybe there's other nodes > > like fixed-clocks, etc. > > > > > To be sure I understood what you are suggesting, you propose to create > > > a DT node from the PCI driver that has been probed dynamically > > > matching this same PCI device with a 'reg' property. I also think > > > this would requires to generate some 'pci-ranges' to remap the > > > downstream devices that are described in the DTBO, finally, load the > > > overlay to be apply under this newly created node. Is that right ? > > > > Right. You'll need to take the BAR address(es) for the device and stick > > those into 'ranges' to translate offsets to BAR+offset. > > Hi Rob, > > I got something working (address translation, probing and so on) using > what you started. I switch to using changeset however, I'm not sure that > it make sense for property creation since the node has not yet been > added to the tree. Attaching the node with changeset however seems > to make sense. But I'm no expert here, so any advise is welcome. > > Based on what we said, I created a PCI driver which uses a builtin > overlay. In order to be able to apply the overlay on the correct PCI > node -the one on which the card was plugged) and thus be totally plug > and play, the 'target-path' property is patched using direct fdt > function and replaced the target with the PCI device node path. > I don't see any other way to do that before applying the overlay since > of_overlay_fdt_apply() takes a fdt blob as input. > > The driver also insert correct ranges into the PCI device in order to > translate the downstream node addresses to BAR addresses. It seems > reasonnable to assume that this depends on the driver and thus should > not be done by the PCI of core at all. > > Finally, the driver probes the newly added childs using > of_platform_populate(). With all of that, the address translation > and the probing works correctly and the platform devices are created. > There is still a few things to fix such as the following: > > [ 2830.324773] OF: overlay: WARNING: memory leak will occur if overlay > removed, property: /pci/pci@2,6/dev@0,0/compatible > > But it seems like this is something that works and would allow to > support various use cases. From what I see, it should also work on > other platforms. Major advantage of that over fwnode is that the > changes are pretty small and relatively contained. Could you show this off somewhere? From this I take that fwnode support in the reset subsystem is not of use to you anymore. I'll postpone taking your patches then, until they are needed. regards Philipp