lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56EADD0C.4040201@codeaurora.org>
Date:	Thu, 17 Mar 2016 12:36:28 -0400
From:	Sinan Kaya <okaya@...eaurora.org>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	Robin Murphy <robin.murphy@....com>,
	linux-arm-kernel@...ts.infradead.org, timur@...eaurora.org,
	cov@...eaurora.org, nwatters@...eaurora.org,
	Catalin Marinas <catalin.marinas@....com>,
	Will Deacon <will.deacon@....com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Max Filippov <jcmvbkbc@...il.com>,
	Joe Perches <joe@...ches.com>,
	"Suthikulpanit, Suravee" <Suravee.Suthikulpanit@....com>,
	Jisheng Zhang <jszhang@...vell.com>,
	Dean Nelson <dnelson@...hat.com>,
	"Suzuki K. Poulose" <suzuki.poulose@....com>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] arm64: dma-mapping: fix dma_to_phys API for IOMMU
 attached devices

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ