All of lore.kernel.org
 help / color / mirror / Atom feed
From: okaya@codeaurora.org (Sinan Kaya)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: dma-mapping: fix dma_to_phys API for IOMMU attached devices
Date: Thu, 17 Mar 2016 12:36:28 -0400	[thread overview]
Message-ID: <56EADD0C.4040201@codeaurora.org> (raw)
In-Reply-To: <3165610.Gdh8F6ejPI@wuerfel>

On 3/17/2016 12:14 PM, Arnd Bergmann wrote:
> On Thursday 17 March 2016 12:07:26 Sinan Kaya wrote:
>> On 3/17/2016 11:57 AM, Robin Murphy wrote:
>>
>> Let me know which direction I should go. 
>>
>> 1. Fix phys_to_dma and keep dma_to_phys as in the patch.
>> 2. Remove both of the API from header file, move it to where it is needed. Rename them as swio_phys_to_dma etc.
> 
> Use 2.
> 
> It has been a long way to remove all virt_to_bus/bus_to_virt users
> from the common architectures, we are not putting them back under
> a different name.
> 
> Drivers already know the physical address because that is what they
> put into dma_map_*() in the first place.
> 
> 	Arnd
> 

The first solution that comes to my mind is to implement a weak function in
swiotlb.c with these contents

dma_addr_t __weak swio_phys_to_dma(struct device *dev, phys_addr_t paddr)
{
        return paddr;
}

 
phys_addr_t __weak  swio_dma_to_phys(struct device *dev, dma_addr_t daddr)
{
        return daddr;
}

then clean up all the duplicates in dma-mapping.h for all ARCHs that have
identical code. 

For others move the implementation to some source file.


-- 
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

WARNING: multiple messages have this Message-ID (diff)
From: Sinan Kaya <okaya@codeaurora.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Robin Murphy <robin.murphy@arm.com>,
	linux-arm-kernel@lists.infradead.org, timur@codeaurora.org,
	cov@codeaurora.org, nwatters@codeaurora.org,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Max Filippov <jcmvbkbc@gmail.com>, Joe Perches <joe@perches.com>,
	"Suthikulpanit, Suravee" <Suravee.Suthikulpanit@amd.com>,
	Jisheng Zhang <jszhang@marvell.com>,
	Dean Nelson <dnelson@redhat.com>,
	"Suzuki K. Poulose" <suzuki.poulose@arm.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: dma-mapping: fix dma_to_phys API for IOMMU attached devices
Date: Thu, 17 Mar 2016 12:36:28 -0400	[thread overview]
Message-ID: <56EADD0C.4040201@codeaurora.org> (raw)
In-Reply-To: <3165610.Gdh8F6ejPI@wuerfel>

On 3/17/2016 12:14 PM, Arnd Bergmann wrote:
> On Thursday 17 March 2016 12:07:26 Sinan Kaya wrote:
>> On 3/17/2016 11:57 AM, Robin Murphy wrote:
>>
>> Let me know which direction I should go. 
>>
>> 1. Fix phys_to_dma and keep dma_to_phys as in the patch.
>> 2. Remove both of the API from header file, move it to where it is needed. Rename them as swio_phys_to_dma etc.
> 
> Use 2.
> 
> It has been a long way to remove all virt_to_bus/bus_to_virt users
> from the common architectures, we are not putting them back under
> a different name.
> 
> Drivers already know the physical address because that is what they
> put into dma_map_*() in the first place.
> 
> 	Arnd
> 

The first solution that comes to my mind is to implement a weak function in
swiotlb.c with these contents

dma_addr_t __weak swio_phys_to_dma(struct device *dev, phys_addr_t paddr)
{
        return paddr;
}

 
phys_addr_t __weak  swio_dma_to_phys(struct device *dev, dma_addr_t daddr)
{
        return daddr;
}

then clean up all the duplicates in dma-mapping.h for all ARCHs that have
identical code. 

For others move the implementation to some source file.


-- 
Sinan Kaya
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

  reply	other threads:[~2016-03-17 16:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-17 15:50 [PATCH] arm64: dma-mapping: fix dma_to_phys API for IOMMU attached devices Sinan Kaya
2016-03-17 15:50 ` Sinan Kaya
2016-03-17 15:57 ` Robin Murphy
2016-03-17 15:57   ` Robin Murphy
2016-03-17 16:07   ` Sinan Kaya
2016-03-17 16:07     ` Sinan Kaya
2016-03-17 16:14     ` Arnd Bergmann
2016-03-17 16:14       ` Arnd Bergmann
2016-03-17 16:36       ` Sinan Kaya [this message]
2016-03-17 16:36         ` Sinan Kaya
2016-03-17 17:01         ` Arnd Bergmann
2016-03-17 17:01           ` Arnd Bergmann

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=56EADD0C.4040201@codeaurora.org \
    --to=okaya@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.