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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 2C167C25B78 for ; Tue, 28 May 2024 06:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6B6Ay7bPDlEbraAnVXIbKceHi9sbXhk9cf+BDKsGqNk=; b=gky2F5deWAoyK3 mpcJCJHMm/XRDIpH4O/tKLX+Mf79mk38bXMYFTkPQmiPcBLMnt0QKw3S9lX4sMFXSi3A/z/XQ4ST3 ZUZdmlsZFYLPOtDjX4dTC3hN0LP+n7+FxEe9dy9E8vCyhjvnRnxaXySkVmCVD5Pz6Pf0ss4D3h3HU 8AKtnAbn7Kav6/A/UU2gcVu7Es6IgmC8v+BBIV44dITfyqu2Ox5ZZKtmhfAuM4YgkLrXWqUjI7vas 9NcNn8ONz34Cx9oXv4CDHnpq/tQHhQ0oAXq+o4uIOpeOTSBgqtXXjTA+eoYLtJDtkFgRUe8f08oY4 RceaYVKYpEfir+4iFBcg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBqP0-0000000HCuX-2h4w; Tue, 28 May 2024 06:33:42 +0000 Received: from verein.lst.de ([213.95.11.211]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sBqOx-0000000HCu6-2G2e; Tue, 28 May 2024 06:33:41 +0000 Received: by verein.lst.de (Postfix, from userid 2407) id ED81868BEB; Tue, 28 May 2024 08:33:32 +0200 (CEST) Date: Tue, 28 May 2024 08:33:32 +0200 From: Christoph Hellwig To: Dave Stevenson Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Vinod Koul , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Ulf Hansson , Mark Brown , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Vladimir Murzin , Phil Elwell , Stefan Wahren , Serge Semin , devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, iommu@lists.linux.dev, linux-sound@vger.kernel.org Subject: Re: [PATCH 01/18] dma-direct: take dma-ranges/offsets into account in resource mapping Message-ID: <20240528063332.GA30051@lst.de> References: <20240524182702.1317935-1-dave.stevenson@raspberrypi.com> <20240524182702.1317935-2-dave.stevenson@raspberrypi.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240524182702.1317935-2-dave.stevenson@raspberrypi.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240527_233339_749117_85ED7599 X-CRM114-Status: GOOD ( 18.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, May 24, 2024 at 07:26:45PM +0100, Dave Stevenson wrote: > From: Serge Semin > > A basic device-specific linear memory mapping was introduced back in > commit ("dma: Take into account dma_pfn_offset") as a single-valued offset > preserved in the device.dma_pfn_offset field, which was initialized for > instance by means of the "dma-ranges" DT property. Afterwards the > functionality was extended to support more than one device-specific region > defined in the device.dma_range_map list of maps. But all of these > improvements concerned a single pointer, page or sg DMA-mapping methods, > while the system resource mapping function turned to miss the > corresponding modification. Thus the dma_direct_map_resource() method now > just casts the CPU physical address to the device DMA address with no > dma-ranges-based mapping taking into account, which is obviously wrong. > Let's fix it by using the phys_to_dma_direct() method to get the > device-specific bus address from the passed memory resource for the case > of the directly mapped DMA. My memory is getting a little bad, but as dma_direct_map_resource is mostly used for (non-PCIe) peer to peer transfers, any kind of mapping from the host address should be excluded. (dma_direct_map_resource in general is a horrible interface and I'd prefer everyone to switch to the map_sg based P2P support, but we have plenty of users for it unfortunately) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel