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] [day] [month] [year] [list]
Message-ID: <17085043.8Me19Fq1r8@wuerfel>
Date:	Thu, 17 Mar 2016 18:01:23 +0100
From:	Arnd Bergmann <arnd@...db.de>
To:	Sinan Kaya <okaya@...eaurora.org>
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 Thursday 17 March 2016 12:36:28 Sinan Kaya wrote:
> 
> 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.
> 
> 

Sounds ok to me, but I'd prefer using a macro instead of a __weak symbol:

#ifndef swiotlb_phys_to_dma
static inline dma_addr_t swiotlb_phys_to_dma(struct device *dev, phys_addr_t paddr)
{
         return paddr;
}
#endif

and then let the architectures that override it provide a self-referencing
macro:

#define swiotlb_phys_to_dma swiotlb_phys_to_dma

Also note swiotlb instead of swio, to match the existing naming.

	Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ