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=-5.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 A8A61C43461 for ; Fri, 11 Sep 2020 06:26:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 6057A221EB for ; Fri, 11 Sep 2020 06:26:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Nj3sJ+gW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6057A221EB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject: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=V5K/MWkBTDZ1jR0hlREXgjwfYkR/B1DWb4AYLnGfF1A=; b=Nj3sJ+gW2C5aBgbN2MxpOK/or 228wBjJnGjpONQOTmfOHu9kI8uHXQqdvhfVz/Ihi4dqluCADP/tvOb1tWI2wA+slFD/QC2q6JOE4d R/GzD7B9g8pc2+57pSI0OD2Hed0NR1i8HpF3R8hx0DlzF7FA24kMN4cOZPuFKp95IwoCx1sDlnCfx TNIQQNe/AmOkPKjTlc+th2Wx5glN/ZQYP2/Qbilo/PTCflZOIUKO168MhNas7P1mqMSDnfAGJvJLv ZKEa+BNxNCsVIrvfiKOQdoQm1RCbQVBohmaf5bOSAhpGzYKDaYptPdFVNreVWduUWIi8cNfEzKzKk 1BlmfY3Sg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGcUn-0005Dp-Hn; Fri, 11 Sep 2020 06:25:17 +0000 Received: from verein.lst.de ([213.95.11.211]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGcUl-0005DJ-D7 for linux-arm-kernel@lists.infradead.org; Fri, 11 Sep 2020 06:25:16 +0000 Received: by verein.lst.de (Postfix, from userid 2407) id 9D35867373; Fri, 11 Sep 2020 08:25:12 +0200 (CEST) Date: Fri, 11 Sep 2020 08:25:12 +0200 From: Christoph Hellwig To: Robin Murphy Subject: Re: [PATCH 1/3] ARM/dma-mapping: move various helpers from dma-mapping.h to dma-direct.h Message-ID: <20200911062512.GC21597@lst.de> References: <20200910054038.324517-1-hch@lst.de> <20200910054038.324517-2-hch@lst.de> <42497691-ec93-1e93-d3e5-e841eaf8247a@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <42497691-ec93-1e93-d3e5-e841eaf8247a@arm.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-20200911_022515_566776_BEA6EFDD X-CRM114-Status: GOOD ( 23.06 ) 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, Florian Fainelli , linux-sh@vger.kernel.org, linux-pci@vger.kernel.org, linux-usb@vger.kernel.org, Russell King , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, iommu@lists.linux-foundation.org, Rob Herring , Jim Quinlan , Santosh Shilimkar , Nathan Chancellor , Frank Rowand , Christoph Hellwig , linux-arm-kernel@lists.infradead.org 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 Thu, Sep 10, 2020 at 07:02:23PM +0100, Robin Murphy wrote: > On 2020-09-10 06:40, Christoph Hellwig wrote: >> Move the helpers to translate to and from direct mapping DMA addresses >> to dma-direct.h. This not only is the most logical place, but the new >> placement also avoids dependency loops with pending commits. > > For the straightforward move as it should be, > > Reviewed-by: Robin Murphy > > However I do wonder how much of this could be cleaned up further... >> + >> +#ifdef __arch_page_to_dma >> +#error Please update to __arch_pfn_to_dma >> +#endif > > This must be long, long dead by now. Yeah. I had a patch to remove this which lead me into the rabbit hole your described later. A few patches in I decided to give up and just do the trivial move. But it probably makes sense to pick up at least the two trivial dead code removal patches.. >> +static inline unsigned long dma_to_pfn(struct device *dev, dma_addr_t addr) >> +{ >> + unsigned long pfn = __bus_to_pfn(addr); >> + >> + if (dev) >> + pfn += dev->dma_pfn_offset; >> + >> + return pfn; >> +} > > These are only overridden for OMAP1510, and it looks like it wouldn't take > much for the platform code or ohci-omap driver to set up a generic DMA > offset for the relevant device. I sent a ping to the omap maintainers earlier this week to ask for that :) >> +static inline dma_addr_t virt_to_dma(struct device *dev, void *addr) >> +{ >> + if (dev) >> + return pfn_to_dma(dev, virt_to_pfn(addr)); >> + >> + return (dma_addr_t)__virt_to_bus((unsigned long)(addr)); >> +} > > And this is only used for some debug prints in dmabounce. > > Similarly the __bus_to_*()/__*_to_bus() calls themselves only appear > significant to mach-footbridge any more, and could probably also be evolved > into regular DMA offsets now that all API calls must have a non-NULL > device. I think I might come back and take a closer look at all this at > some point in future... :) Yes, pretty much all of this should eventually go away. I just don't want to bock the ranges work on all kinds of random arm cleanups.. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel