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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA4CEC433EF for ; Wed, 20 Apr 2022 07:12:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359620AbiDTHPK (ORCPT ); Wed, 20 Apr 2022 03:15:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233550AbiDTHPI (ORCPT ); Wed, 20 Apr 2022 03:15:08 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CBD936B55; Wed, 20 Apr 2022 00:12:23 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 40C0768B05; Wed, 20 Apr 2022 09:12:18 +0200 (CEST) Date: Wed, 20 Apr 2022 09:12:17 +0200 From: Christoph Hellwig To: Serge Semin Cc: Robin Murphy , Serge Semin , Gustavo Pimentel , Vinod Koul , Jingoo Han , Bjorn Helgaas , Frank Li , Manivannan Sadhasivam , Christoph Hellwig , Marek Szyprowski , Vladimir Murzin , Alexey Malahov , Pavel Parkhomenko , Lorenzo Pieralisi , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , linux-pci@vger.kernel.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org Subject: Re: [PATCH 03/25] dma-direct: take dma-ranges/offsets into account in resource mapping Message-ID: <20220420071217.GA5152@lst.de> References: <20220324014836.19149-1-Sergey.Semin@baikalelectronics.ru> <20220324014836.19149-4-Sergey.Semin@baikalelectronics.ru> <0baff803-b0ea-529f-095a-897398b4f63f@arm.com> <20220417224427.drwy3rchwplthelh@mobilestation> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220417224427.drwy3rchwplthelh@mobilestation> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 18, 2022 at 01:44:27AM +0300, Serge Semin wrote: > > but a DMA controller might also want to access something in the MMIO range > > 0x0-0x7fffffff, of which it still has an identical non-offset view. If a > > driver was previously using dma_map_resource() for that, it would now start > > getting DMA_MAPPING_ERROR because the dma_range_map exists but doesn't > > describe the MMIO region. I agree that in hindsight it's not an ideal > > situation, but it's how things have ended up, so at this point I'm wary of > > making potentially-breaking changes. > > Hmm, what if the driver was previously using for instance the > dma_direct_map_sg() method for it? dma_map_resource is for mapping MMIO space, and must not be called on memory in the kernel map. For dma_map_sg (or all the other dma_map_* interface except for dma_map_resource), the reverse is true.