From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5C68C432C2 for ; Wed, 25 Sep 2019 15:30:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C188F205F4 for ; Wed, 25 Sep 2019 15:30:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728068AbfIYPaP (ORCPT ); Wed, 25 Sep 2019 11:30:15 -0400 Received: from mx2.suse.de ([195.135.220.15]:57058 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727381AbfIYPaP (ORCPT ); Wed, 25 Sep 2019 11:30:15 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 86EB3ACA5; Wed, 25 Sep 2019 15:30:12 +0000 (UTC) Message-ID: <43fb5fe1de317d65a4edf592f88ea150c6e3b8cc.camel@suse.de> Subject: Re: [PATCH 00/11] of: Fix DMA configuration for non-DT masters From: Nicolas Saenz Julienne To: Robin Murphy , Rob Herring Cc: devicetree@vger.kernel.org, Matthias Brugger , linux-arm-msm , linux-wireless , "linux-kernel@vger.kernel.org" , dri-devel , etnaviv@lists.freedesktop.org, linux-tegra@vger.kernel.org, Florian Fainelli , Stefan Wahren , james.quinlan@broadcom.com, linux-pci@vger.kernel.org, "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , xen-devel@lists.xenproject.org, Dan Williams , freedreno , Frank Rowand , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Linux Media Mailing List Date: Wed, 25 Sep 2019 17:30:10 +0200 In-Reply-To: References: <20190924181244.7159-1-nsaenzjulienne@suse.de> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-Jc6/4bVbm9VDLL08SmH3" User-Agent: Evolution 3.32.4 MIME-Version: 1.0 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org --=-Jc6/4bVbm9VDLL08SmH3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2019-09-25 at 16:09 +0100, Robin Murphy wrote: > On 25/09/2019 15:52, Nicolas Saenz Julienne wrote: > > On Tue, 2019-09-24 at 16:59 -0500, Rob Herring wrote: > > > On Tue, Sep 24, 2019 at 1:12 PM Nicolas Saenz Julienne > > > wrote: > > > > Hi All, > > > > this series tries to address one of the issues blocking us from > > > > upstreaming Broadcom's STB PCIe controller[1]. Namely, the fact tha= t > > > > devices not represented in DT which sit behind a PCI bus fail to ge= t the > > > > bus' DMA addressing constraints. > > > >=20 > > > > This is due to the fact that of_dma_configure() assumes it's receiv= ing a > > > > DT node representing the device being configured, as opposed to the= PCIe > > > > bridge node we currently pass. This causes the code to directly jum= p > > > > into PCI's parent node when checking for 'dma-ranges' and misses > > > > whatever was set there. > > > >=20 > > > > To address this I create a new API in OF - inspired from Robin Murp= hys > > > > original proposal[2] - which accepts a bus DT node as it's input in > > > > order to configure a device's DMA constraints. The changes go deep = into > > > > of/address.c's implementation, as a device being having a DT node > > > > assumption was pretty strong. > > > >=20 > > > > On top of this work, I also cleaned up of_dma_configure() removing = its > > > > redundant arguments and creating an alternative function for the sp= ecial > > > > cases > > > > not applicable to either the above case or the default usage. > > > >=20 > > > > IMO the resulting functions are more explicit. They will probably > > > > surface some hacky usages that can be properly fixed as I show with= the > > > > DT fixes on the Layerscape platform. > > > >=20 > > > > This was also tested on a Raspberry Pi 4 with a custom PCIe driver = and > > > > on a Seattle AMD board. > > >=20 > > > Humm, I've been working on this issue too. Looks similar though yours > > > has a lot more churn and there's some other bugs I've found. > >=20 > > That's good news, and yes now that I see it, some stuff on my series is > > overly > > complicated. Specially around of_translate_*(). > >=20 > > On top of that, you removed in of_dma_get_range(): > >=20 > > - /* > > - * At least empty ranges has to be defined for parent node if > > - * DMA is supported > > - */ > > - if (!ranges) > > - break; > >=20 > > Which I assumed was bound to the standard and makes things easier. > >=20 > > > Can you test out this branch[1]. I don't have any h/w needing this, > > > but wrote a unittest and tested with modified QEMU. > >=20 > > I reviewed everything, I did find a minor issue, see the patch attached= . >=20 > WRT that patch, the original intent of "force_dma" was purely to=20 > consider a device DMA-capable regardless of the presence of=20 > "dma-ranges". Expecting of_dma_configure() to do anything for a non-OF= =20 > device has always been bogus - magic paravirt devices which appear out= =20 > of nowhere and expect to be treated as genuine DMA masters are a=20 > separate problem that we haven't really approached yet. I agree it's clearly abusing the function. I have no problem with the behav= iour change if it's OK with you. Robin, have you looked into supporting multiple dma-ranges? It's the next t= hing we need for BCM STB's PCIe. I'll have a go at it myself if nothing is in th= e works already. Regards, Nicolas --=-Jc6/4bVbm9VDLL08SmH3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEErOkkGDHCg2EbPcGjlfZmHno8x/4FAl2LiAIACgkQlfZmHno8 x/7J7Af+NrtcYkM0WphLDC8n2KXI1Rofej10z7b8lAcPZvn586CNcayUtga34+e3 jMIOwHl9qzzFJrgAT9FoyDjkcJ0gfVWKSzQYB798pTOVEND7LdUsHH0ZNqNqf4YM yRmNNvCpZi+i83aeetAQjPoMUeDjKU0dMCX7oEzfvlrmxi4YRx59jcOfIbaqr2Hg SGipuOc97V/so7VcwvypG9xeYU/zTeZ0wFoQzT7X4OdEUp4uBAgHoeou4kez1gSy 27EmZX8DU3l7YbWTM5SBP13uDcQ0I2y25cjjy55r4gBm+zQYdGCuh3oHbdOvyws/ xjAYrC9sFk3+VCjuPTn9CTbfyDqZ8A== =9rW4 -----END PGP SIGNATURE----- --=-Jc6/4bVbm9VDLL08SmH3-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Saenz Julienne Subject: Re: [PATCH 00/11] of: Fix DMA configuration for non-DT masters Date: Wed, 25 Sep 2019 17:30:10 +0200 Message-ID: <43fb5fe1de317d65a4edf592f88ea150c6e3b8cc.camel@suse.de> References: <20190924181244.7159-1-nsaenzjulienne@suse.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-Jc6/4bVbm9VDLL08SmH3" Return-path: In-Reply-To: Sender: linux-wireless-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Robin Murphy , Rob Herring Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Matthias Brugger , linux-arm-msm , linux-wireless , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , dri-devel , etnaviv-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Florian Fainelli , Stefan Wahren , james.quinlan-dY08KVG/lbpWk0Htik3J/w@public.gmane.org, linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , xen-devel-GuqFBffKawtpuQazS67q72D2FQJk+8+b@public.gmane.org, Dan Williams , freedreno , Frank Rowand , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" List-Id: linux-tegra@vger.kernel.org --=-Jc6/4bVbm9VDLL08SmH3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2019-09-25 at 16:09 +0100, Robin Murphy wrote: > On 25/09/2019 15:52, Nicolas Saenz Julienne wrote: > > On Tue, 2019-09-24 at 16:59 -0500, Rob Herring wrote: > > > On Tue, Sep 24, 2019 at 1:12 PM Nicolas Saenz Julienne > > > wrote: > > > > Hi All, > > > > this series tries to address one of the issues blocking us from > > > > upstreaming Broadcom's STB PCIe controller[1]. Namely, the fact tha= t > > > > devices not represented in DT which sit behind a PCI bus fail to ge= t the > > > > bus' DMA addressing constraints. > > > >=20 > > > > This is due to the fact that of_dma_configure() assumes it's receiv= ing a > > > > DT node representing the device being configured, as opposed to the= PCIe > > > > bridge node we currently pass. This causes the code to directly jum= p > > > > into PCI's parent node when checking for 'dma-ranges' and misses > > > > whatever was set there. > > > >=20 > > > > To address this I create a new API in OF - inspired from Robin Murp= hys > > > > original proposal[2] - which accepts a bus DT node as it's input in > > > > order to configure a device's DMA constraints. The changes go deep = into > > > > of/address.c's implementation, as a device being having a DT node > > > > assumption was pretty strong. > > > >=20 > > > > On top of this work, I also cleaned up of_dma_configure() removing = its > > > > redundant arguments and creating an alternative function for the sp= ecial > > > > cases > > > > not applicable to either the above case or the default usage. > > > >=20 > > > > IMO the resulting functions are more explicit. They will probably > > > > surface some hacky usages that can be properly fixed as I show with= the > > > > DT fixes on the Layerscape platform. > > > >=20 > > > > This was also tested on a Raspberry Pi 4 with a custom PCIe driver = and > > > > on a Seattle AMD board. > > >=20 > > > Humm, I've been working on this issue too. Looks similar though yours > > > has a lot more churn and there's some other bugs I've found. > >=20 > > That's good news, and yes now that I see it, some stuff on my series is > > overly > > complicated. Specially around of_translate_*(). > >=20 > > On top of that, you removed in of_dma_get_range(): > >=20 > > - /* > > - * At least empty ranges has to be defined for parent node if > > - * DMA is supported > > - */ > > - if (!ranges) > > - break; > >=20 > > Which I assumed was bound to the standard and makes things easier. > >=20 > > > Can you test out this branch[1]. I don't have any h/w needing this, > > > but wrote a unittest and tested with modified QEMU. > >=20 > > I reviewed everything, I did find a minor issue, see the patch attached= . >=20 > WRT that patch, the original intent of "force_dma" was purely to=20 > consider a device DMA-capable regardless of the presence of=20 > "dma-ranges". Expecting of_dma_configure() to do anything for a non-OF= =20 > device has always been bogus - magic paravirt devices which appear out= =20 > of nowhere and expect to be treated as genuine DMA masters are a=20 > separate problem that we haven't really approached yet. I agree it's clearly abusing the function. I have no problem with the behav= iour change if it's OK with you. Robin, have you looked into supporting multiple dma-ranges? It's the next t= hing we need for BCM STB's PCIe. I'll have a go at it myself if nothing is in th= e works already. Regards, Nicolas --=-Jc6/4bVbm9VDLL08SmH3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEErOkkGDHCg2EbPcGjlfZmHno8x/4FAl2LiAIACgkQlfZmHno8 x/7J7Af+NrtcYkM0WphLDC8n2KXI1Rofej10z7b8lAcPZvn586CNcayUtga34+e3 jMIOwHl9qzzFJrgAT9FoyDjkcJ0gfVWKSzQYB798pTOVEND7LdUsHH0ZNqNqf4YM yRmNNvCpZi+i83aeetAQjPoMUeDjKU0dMCX7oEzfvlrmxi4YRx59jcOfIbaqr2Hg SGipuOc97V/so7VcwvypG9xeYU/zTeZ0wFoQzT7X4OdEUp4uBAgHoeou4kez1gSy 27EmZX8DU3l7YbWTM5SBP13uDcQ0I2y25cjjy55r4gBm+zQYdGCuh3oHbdOvyws/ xjAYrC9sFk3+VCjuPTn9CTbfyDqZ8A== =9rW4 -----END PGP SIGNATURE----- --=-Jc6/4bVbm9VDLL08SmH3-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DCD9CC432C2 for ; Wed, 25 Sep 2019 15:30:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B1D8221D7F for ; Wed, 25 Sep 2019 15:30:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kAzS6+Av" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B1D8221D7F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:References:In-Reply-To:Date:To:From:Subject:Message-ID:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Pt1Ma5qEK4R+dOYFhZDbrY2bI5Q/NcH1tYbhDD3cWkE=; b=kAzS6+AvvRZEnRoI1NgrHCSmA 2EFoQ3jZyBnVQ3FCxAzCDV6W7m711TZU11aDL2c7ArJPhg6qymP9/25T9UP8sqgW/1IpXMffxH0zA 17xG0OHpmkLV2oK+YcsNSrq9u1fhUKnO/+oNnwfJfP3VibOzDRRfV8Azv/EmwqoRXqkRBUklrjWzl pETtt3TQfqoCKZn19buAbUYFrYV7oHNO0Orzobzkhe1pdIlUP5JzzmRRETS32ic6qKHLBO/qs13nP QgcEDeP0Opy8V69IClHdH7Ph1I0fKf+my9cQfi2/bTkF3pJSvRZp5n7Z6soV6B5xoAtmSCceIG4Rw KXxi5s6hw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iD9FE-0006t7-2v; Wed, 25 Sep 2019 15:30:20 +0000 Received: from mx2.suse.de ([195.135.220.15] helo=mx1.suse.de) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iD9F9-0006rv-Ca for linux-arm-kernel@lists.infradead.org; Wed, 25 Sep 2019 15:30:18 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 86EB3ACA5; Wed, 25 Sep 2019 15:30:12 +0000 (UTC) Message-ID: <43fb5fe1de317d65a4edf592f88ea150c6e3b8cc.camel@suse.de> Subject: Re: [PATCH 00/11] of: Fix DMA configuration for non-DT masters From: Nicolas Saenz Julienne To: Robin Murphy , Rob Herring Date: Wed, 25 Sep 2019 17:30:10 +0200 In-Reply-To: References: <20190924181244.7159-1-nsaenzjulienne@suse.de> User-Agent: Evolution 3.32.4 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190925_083016_814558_655B4674 X-CRM114-Status: GOOD ( 27.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Matthias Brugger , Frank Rowand , linux-arm-msm , linux-wireless , "linux-kernel@vger.kernel.org" , dri-devel , etnaviv@lists.freedesktop.org, "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , Florian Fainelli , Stefan Wahren , james.quinlan@broadcom.com, linux-pci@vger.kernel.org, linux-tegra@vger.kernel.org, xen-devel@lists.xenproject.org, Dan Williams , freedreno , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Linux Media Mailing List Content-Type: multipart/mixed; boundary="===============3789041086482481464==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============3789041086482481464== Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-Jc6/4bVbm9VDLL08SmH3" --=-Jc6/4bVbm9VDLL08SmH3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2019-09-25 at 16:09 +0100, Robin Murphy wrote: > On 25/09/2019 15:52, Nicolas Saenz Julienne wrote: > > On Tue, 2019-09-24 at 16:59 -0500, Rob Herring wrote: > > > On Tue, Sep 24, 2019 at 1:12 PM Nicolas Saenz Julienne > > > wrote: > > > > Hi All, > > > > this series tries to address one of the issues blocking us from > > > > upstreaming Broadcom's STB PCIe controller[1]. Namely, the fact tha= t > > > > devices not represented in DT which sit behind a PCI bus fail to ge= t the > > > > bus' DMA addressing constraints. > > > >=20 > > > > This is due to the fact that of_dma_configure() assumes it's receiv= ing a > > > > DT node representing the device being configured, as opposed to the= PCIe > > > > bridge node we currently pass. This causes the code to directly jum= p > > > > into PCI's parent node when checking for 'dma-ranges' and misses > > > > whatever was set there. > > > >=20 > > > > To address this I create a new API in OF - inspired from Robin Murp= hys > > > > original proposal[2] - which accepts a bus DT node as it's input in > > > > order to configure a device's DMA constraints. The changes go deep = into > > > > of/address.c's implementation, as a device being having a DT node > > > > assumption was pretty strong. > > > >=20 > > > > On top of this work, I also cleaned up of_dma_configure() removing = its > > > > redundant arguments and creating an alternative function for the sp= ecial > > > > cases > > > > not applicable to either the above case or the default usage. > > > >=20 > > > > IMO the resulting functions are more explicit. They will probably > > > > surface some hacky usages that can be properly fixed as I show with= the > > > > DT fixes on the Layerscape platform. > > > >=20 > > > > This was also tested on a Raspberry Pi 4 with a custom PCIe driver = and > > > > on a Seattle AMD board. > > >=20 > > > Humm, I've been working on this issue too. Looks similar though yours > > > has a lot more churn and there's some other bugs I've found. > >=20 > > That's good news, and yes now that I see it, some stuff on my series is > > overly > > complicated. Specially around of_translate_*(). > >=20 > > On top of that, you removed in of_dma_get_range(): > >=20 > > - /* > > - * At least empty ranges has to be defined for parent node if > > - * DMA is supported > > - */ > > - if (!ranges) > > - break; > >=20 > > Which I assumed was bound to the standard and makes things easier. > >=20 > > > Can you test out this branch[1]. I don't have any h/w needing this, > > > but wrote a unittest and tested with modified QEMU. > >=20 > > I reviewed everything, I did find a minor issue, see the patch attached= . >=20 > WRT that patch, the original intent of "force_dma" was purely to=20 > consider a device DMA-capable regardless of the presence of=20 > "dma-ranges". Expecting of_dma_configure() to do anything for a non-OF= =20 > device has always been bogus - magic paravirt devices which appear out= =20 > of nowhere and expect to be treated as genuine DMA masters are a=20 > separate problem that we haven't really approached yet. I agree it's clearly abusing the function. I have no problem with the behav= iour change if it's OK with you. Robin, have you looked into supporting multiple dma-ranges? It's the next t= hing we need for BCM STB's PCIe. I'll have a go at it myself if nothing is in th= e works already. Regards, Nicolas --=-Jc6/4bVbm9VDLL08SmH3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEErOkkGDHCg2EbPcGjlfZmHno8x/4FAl2LiAIACgkQlfZmHno8 x/7J7Af+NrtcYkM0WphLDC8n2KXI1Rofej10z7b8lAcPZvn586CNcayUtga34+e3 jMIOwHl9qzzFJrgAT9FoyDjkcJ0gfVWKSzQYB798pTOVEND7LdUsHH0ZNqNqf4YM yRmNNvCpZi+i83aeetAQjPoMUeDjKU0dMCX7oEzfvlrmxi4YRx59jcOfIbaqr2Hg SGipuOc97V/so7VcwvypG9xeYU/zTeZ0wFoQzT7X4OdEUp4uBAgHoeou4kez1gSy 27EmZX8DU3l7YbWTM5SBP13uDcQ0I2y25cjjy55r4gBm+zQYdGCuh3oHbdOvyws/ xjAYrC9sFk3+VCjuPTn9CTbfyDqZ8A== =9rW4 -----END PGP SIGNATURE----- --=-Jc6/4bVbm9VDLL08SmH3-- --===============3789041086482481464== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============3789041086482481464==-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C907C432C2 for ; Wed, 25 Sep 2019 15:30:32 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 58098205F4 for ; Wed, 25 Sep 2019 15:30:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 58098205F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iD9FA-0007XM-Jf; Wed, 25 Sep 2019 15:30:16 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iD9F8-0007XD-F5 for xen-devel@lists.xenproject.org; Wed, 25 Sep 2019 15:30:14 +0000 X-Inumbo-ID: 5df0e746-dfa9-11e9-9637-12813bfff9fa Received: from mx1.suse.de (unknown [195.135.220.15]) by localhost (Halon) with ESMTPS id 5df0e746-dfa9-11e9-9637-12813bfff9fa; Wed, 25 Sep 2019 15:30:13 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 86EB3ACA5; Wed, 25 Sep 2019 15:30:12 +0000 (UTC) Message-ID: <43fb5fe1de317d65a4edf592f88ea150c6e3b8cc.camel@suse.de> From: Nicolas Saenz Julienne To: Robin Murphy , Rob Herring Date: Wed, 25 Sep 2019 17:30:10 +0200 In-Reply-To: References: <20190924181244.7159-1-nsaenzjulienne@suse.de> User-Agent: Evolution 3.32.4 MIME-Version: 1.0 Subject: Re: [Xen-devel] [PATCH 00/11] of: Fix DMA configuration for non-DT masters X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Matthias Brugger , Frank Rowand , linux-arm-msm , linux-wireless , "linux-kernel@vger.kernel.org" , dri-devel , etnaviv@lists.freedesktop.org, "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , Florian Fainelli , Stefan Wahren , james.quinlan@broadcom.com, linux-pci@vger.kernel.org, linux-tegra@vger.kernel.org, xen-devel@lists.xenproject.org, Dan Williams , freedreno , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Linux Media Mailing List Content-Type: multipart/mixed; boundary="===============1692644082505188172==" Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" --===============1692644082505188172== Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-Jc6/4bVbm9VDLL08SmH3" --=-Jc6/4bVbm9VDLL08SmH3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2019-09-25 at 16:09 +0100, Robin Murphy wrote: > On 25/09/2019 15:52, Nicolas Saenz Julienne wrote: > > On Tue, 2019-09-24 at 16:59 -0500, Rob Herring wrote: > > > On Tue, Sep 24, 2019 at 1:12 PM Nicolas Saenz Julienne > > > wrote: > > > > Hi All, > > > > this series tries to address one of the issues blocking us from > > > > upstreaming Broadcom's STB PCIe controller[1]. Namely, the fact tha= t > > > > devices not represented in DT which sit behind a PCI bus fail to ge= t the > > > > bus' DMA addressing constraints. > > > >=20 > > > > This is due to the fact that of_dma_configure() assumes it's receiv= ing a > > > > DT node representing the device being configured, as opposed to the= PCIe > > > > bridge node we currently pass. This causes the code to directly jum= p > > > > into PCI's parent node when checking for 'dma-ranges' and misses > > > > whatever was set there. > > > >=20 > > > > To address this I create a new API in OF - inspired from Robin Murp= hys > > > > original proposal[2] - which accepts a bus DT node as it's input in > > > > order to configure a device's DMA constraints. The changes go deep = into > > > > of/address.c's implementation, as a device being having a DT node > > > > assumption was pretty strong. > > > >=20 > > > > On top of this work, I also cleaned up of_dma_configure() removing = its > > > > redundant arguments and creating an alternative function for the sp= ecial > > > > cases > > > > not applicable to either the above case or the default usage. > > > >=20 > > > > IMO the resulting functions are more explicit. They will probably > > > > surface some hacky usages that can be properly fixed as I show with= the > > > > DT fixes on the Layerscape platform. > > > >=20 > > > > This was also tested on a Raspberry Pi 4 with a custom PCIe driver = and > > > > on a Seattle AMD board. > > >=20 > > > Humm, I've been working on this issue too. Looks similar though yours > > > has a lot more churn and there's some other bugs I've found. > >=20 > > That's good news, and yes now that I see it, some stuff on my series is > > overly > > complicated. Specially around of_translate_*(). > >=20 > > On top of that, you removed in of_dma_get_range(): > >=20 > > - /* > > - * At least empty ranges has to be defined for parent node if > > - * DMA is supported > > - */ > > - if (!ranges) > > - break; > >=20 > > Which I assumed was bound to the standard and makes things easier. > >=20 > > > Can you test out this branch[1]. I don't have any h/w needing this, > > > but wrote a unittest and tested with modified QEMU. > >=20 > > I reviewed everything, I did find a minor issue, see the patch attached= . >=20 > WRT that patch, the original intent of "force_dma" was purely to=20 > consider a device DMA-capable regardless of the presence of=20 > "dma-ranges". Expecting of_dma_configure() to do anything for a non-OF= =20 > device has always been bogus - magic paravirt devices which appear out= =20 > of nowhere and expect to be treated as genuine DMA masters are a=20 > separate problem that we haven't really approached yet. I agree it's clearly abusing the function. I have no problem with the behav= iour change if it's OK with you. Robin, have you looked into supporting multiple dma-ranges? It's the next t= hing we need for BCM STB's PCIe. I'll have a go at it myself if nothing is in th= e works already. Regards, Nicolas --=-Jc6/4bVbm9VDLL08SmH3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEErOkkGDHCg2EbPcGjlfZmHno8x/4FAl2LiAIACgkQlfZmHno8 x/7J7Af+NrtcYkM0WphLDC8n2KXI1Rofej10z7b8lAcPZvn586CNcayUtga34+e3 jMIOwHl9qzzFJrgAT9FoyDjkcJ0gfVWKSzQYB798pTOVEND7LdUsHH0ZNqNqf4YM yRmNNvCpZi+i83aeetAQjPoMUeDjKU0dMCX7oEzfvlrmxi4YRx59jcOfIbaqr2Hg SGipuOc97V/so7VcwvypG9xeYU/zTeZ0wFoQzT7X4OdEUp4uBAgHoeou4kez1gSy 27EmZX8DU3l7YbWTM5SBP13uDcQ0I2y25cjjy55r4gBm+zQYdGCuh3oHbdOvyws/ xjAYrC9sFk3+VCjuPTn9CTbfyDqZ8A== =9rW4 -----END PGP SIGNATURE----- --=-Jc6/4bVbm9VDLL08SmH3-- --===============1692644082505188172== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcKaHR0cHM6Ly9saXN0 cy54ZW5wcm9qZWN0Lm9yZy9tYWlsbWFuL2xpc3RpbmZvL3hlbi1kZXZlbA== --===============1692644082505188172==--