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=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,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 AF862C43141 for ; Tue, 19 Nov 2019 12:57:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 911C6222EF for ; Tue, 19 Nov 2019 12:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727992AbfKSM5w (ORCPT ); Tue, 19 Nov 2019 07:57:52 -0500 Received: from mx2.suse.de ([195.135.220.15]:53112 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727255AbfKSM5v (ORCPT ); Tue, 19 Nov 2019 07:57:51 -0500 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 9B69FB1A0; Tue, 19 Nov 2019 12:57:47 +0000 (UTC) Message-ID: Subject: Re: [PATCH] dma-mapping: treat dev->bus_dma_mask as a DMA limit From: Nicolas Saenz Julienne To: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Bjorn Helgaas , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Jens Axboe , Joerg Roedel , Rob Herring , Frank Rowand , Christoph Hellwig , Marek Szyprowski , Robin Murphy Cc: Benjamin Herrenschmidt , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, Paul Mackerras , "H. Peter Anvin" , Paul Burton , Michael Ellerman , x86@kernel.org, phil@raspberrypi.org, linux-acpi@vger.kernel.org, Ingo Molnar , James Hogan , Len Brown , devicetree@vger.kernel.org, Borislav Petkov , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, "Rafael J. Wysocki" , linux-mips@vger.kernel.org, Ralf Baechle , iommu@lists.linux-foundation.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 19 Nov 2019 13:57:43 +0100 In-Reply-To: <20191113161340.27228-1-nsaenzjulienne@suse.de> References: <20191113161340.27228-1-nsaenzjulienne@suse.de> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-KZ1OEZ2plCMDP0ydmpq5" User-Agent: Evolution 3.34.1 MIME-Version: 1.0 Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org --=-KZ1OEZ2plCMDP0ydmpq5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2019-11-13 at 17:13 +0100, Nicolas Saenz Julienne wrote: > Using a mask to represent bus DMA constraints has a set of limitations. > The biggest one being it can only hold a power of two (minus one). The > DMA mapping code is already aware of this and treats dev->bus_dma_mask > as a limit. This quirk is already used by some architectures although > still rare. >=20 > With the introduction of the Raspberry Pi 4 we've found a new contender > for the use of bus DMA limits, as its PCIe bus can only address the > lower 3GB of memory (of a total of 4GB). This is impossible to represent > with a mask. To make things worse the device-tree code rounds non power > of two bus DMA limits to the next power of two, which is unacceptable in > this case. >=20 > In the light of this, rename dev->bus_dma_mask to dev->bus_dma_limit all > over the tree and treat it as such. Note that dev->bus_dma_limit is > meant to contain the higher accesible DMA address. >=20 > Signed-off-by: Nicolas Saenz Julienne >=20 Hi Rob & Christoph, do you mind if I append v2 of this into my upcoming v3 RPi4 PCIe support series, I didn't do it initially as I thought this was going to be a contentious patch. But as it turned out better than expected, I think it should go into the PCIe series. In the end it's the first explicit user of = the bus DMA limit. Here's v2 in case you don't know what I'm talking about: https://www.spinics.net/lists/arm-kernel/msg768459.html Regards, Nicolas --=-KZ1OEZ2plCMDP0ydmpq5 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/4FAl3T5scACgkQlfZmHno8 x/7FNgf/TPvrVamDNHipGFKFiSr22YaNYJU4aGZyFuJab0Z9dF35ZbNQqx3sXA83 gyltGXByQ4c747nqq+LWQTaXLvI4NEMDu/ueQ6T4Vgs0ijtKvI9hVjrjlKU7UVsR /v+6HHolAP4q5zxgJbL3PRMlFeJlLs9xRbikBEmGDbc4INP8nBSUiQmk4lrgCAwH xV11EcSTA5eKJPS1jpsEP/vKwfu7LQ9ASExtpK5Oud7ZBD8zq1qKQBSVMGXQ1m9L l0ok+gqBZtMgwKtigs9mAr0Y09evU1GOVS0ttcncZ854J6/+hr9nuK8eXyhLEm0J l/jpo2vtZH0gMy68b+P8LkDtGJisYg== =9wOf -----END PGP SIGNATURE----- --=-KZ1OEZ2plCMDP0ydmpq5--