iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Robin Murphy <robin.murphy@arm.com>
Cc: devicetree@vger.kernel.org,
	Florian Fainelli <f.fainelli@gmail.com>,
	linux-sh@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-usb@vger.kernel.org, Russell King <linux@armlinux.org.uk>,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	iommu@lists.linux-foundation.org,
	Rob Herring <robh+dt@kernel.org>,
	Jim Quinlan <james.quinlan@broadcom.com>,
	Santosh Shilimkar <ssantosh@kernel.org>,
	Nathan Chancellor <natechancellor@gmail.com>,
	Frank Rowand <frowand.list@gmail.com>,
	Christoph Hellwig <hch@lst.de>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] ARM/dma-mapping: move various helpers from dma-mapping.h to dma-direct.h
Date: Fri, 11 Sep 2020 08:25:12 +0200	[thread overview]
Message-ID: <20200911062512.GC21597@lst.de> (raw)
In-Reply-To: <42497691-ec93-1e93-d3e5-e841eaf8247a@arm.com>

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 <robin.murphy@arm.com>
>
> 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..
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2020-09-11  6:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10  5:40 support range based offsets in dma-direct Christoph Hellwig
2020-09-10  5:40 ` [PATCH 1/3] ARM/dma-mapping: move various helpers from dma-mapping.h to dma-direct.h Christoph Hellwig
2020-09-10 18:02   ` Robin Murphy
2020-09-11  6:25     ` Christoph Hellwig [this message]
2020-09-10  5:40 ` [PATCH 2/3] ARM/keystone: move the DMA offset handling under ifdef CONFIG_ARM_LPAE Christoph Hellwig
2020-09-11 11:12   ` Robin Murphy
2020-09-11 11:15   ` Russell King - ARM Linux admin
2020-09-11 11:27     ` Robin Murphy
2020-09-11 18:00     ` santosh.shilimkar
2020-09-10  5:40 ` [PATCH 3/3] dma-mapping: introduce DMA range map, supplanting dma_pfn_offset Christoph Hellwig
2020-09-10  7:53   ` Greg KH
2020-09-10  9:13     ` Christoph Hellwig
2020-09-10 16:12       ` Greg KH
2020-09-11 16:12   ` Robin Murphy
2020-09-12  6:46     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200911062512.GC21597@lst.de \
    --to=hch@lst.de \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=frowand.list@gmail.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=james.quinlan@broadcom.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=natechancellor@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=ssantosh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).