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]
Date:	Fri, 18 Mar 2016 09:55:21 -0400
From:	Sinan Kaya <okaya@...eaurora.org>
To:	Robin Murphy <robin.murphy@....com>,
	linux-arm-kernel@...ts.infradead.org, timur@...eaurora.org,
	cov@...eaurora.org, nwatters@...eaurora.org
Cc:	linux-mips@...ux-mips.org, linux-ia64@...r.kernel.org,
	linux-xtensa@...ux-xtensa.org,
	Catalin Marinas <catalin.marinas@....com>,
	Will Deacon <will.deacon@....com>,
	Max Filippov <jcmvbkbc@...il.com>,
	Chris Metcalf <cmetcalf@...hip.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Guan Xuetao <gxt@...c.pku.edu.cn>,
	Florian Fainelli <f.fainelli@...il.com>, x86@...nel.org,
	Ingo Molnar <mingo@...hat.com>,
	Guenter Roeck <linux@...ck-us.net>,
	Fenghua Yu <fenghua.yu@...el.com>,
	Denys Vlasenko <dvlasenk@...hat.com>,
	Arnd Bergmann <arnd@...db.de>,
	Akinobu Mita <akinobu.mita@...il.com>,
	Geliang Tang <geliangtang@....com>,
	Zhen Lei <thunder.leizhen@...wei.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Valentin Rothberg <valentinrothberg@...il.com>,
	Chris Zankel <chris@...kel.net>,
	Tony Luck <tony.luck@...el.com>, linux-kernel@...r.kernel.org,
	Ralf Baechle <ralf@...ux-mips.org>,
	"Suthikulpanit, Suravee" <Suravee.Suthikulpanit@....com>,
	Joe Perches <joe@...ches.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 3/3] dma-mapping: move swiotlb dma-phys functions to
 common header

On 3/18/2016 7:31 AM, Robin Murphy wrote:
> On 17/03/16 22:02, Sinan Kaya wrote:
>> Moving the default implementation of swiotlb_dma_to_phys and
>> swiotlb_phys_to_dma functions to dma-mapping.h so that we can get
>> rid of the duplicate code in multiple ARCH.
>>
>> Signed-off-by: Sinan Kaya <okaya@...eaurora.org>
>> ---
>>   arch/arm64/include/asm/dma-mapping.h               | 14 --------------
>>   arch/ia64/include/asm/dma-mapping.h                | 14 --------------
>>   arch/mips/include/asm/mach-generic/dma-coherence.h | 16 ----------------
>>   arch/tile/include/asm/dma-mapping.h                | 14 --------------
>>   arch/unicore32/include/asm/dma-mapping.h           | 14 --------------
>>   arch/x86/include/asm/dma-mapping.h                 | 13 -------------
>>   arch/xtensa/include/asm/dma-mapping.h              | 14 --------------
>>   include/linux/dma-mapping.h                        | 14 ++++++++++++++
>>   8 files changed, 14 insertions(+), 99 deletions(-)
> 
> [...]
> 
>> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
>> index 728ef07..871d620 100644
>> --- a/include/linux/dma-mapping.h
>> +++ b/include/linux/dma-mapping.h
>> @@ -683,4 +683,18 @@ static inline int dma_mmap_writecombine(struct device *dev,
>>   #define dma_unmap_len_set(PTR, LEN_NAME, VAL)    do { } while (0)
>>   #endif
>>
>> +#ifndef swiotlb_phys_to_dma
>> +static inline dma_addr_t swiotlb_phys_to_dma(struct device *dev, phys_addr_t paddr)
>> +{
>> +         return paddr;
>> +}
>> +#endif
>> +
>> +#ifndef swiotlb_dma_to_phys
>> +static inline phys_addr_t swiotlb_dma_to_phys(struct device *dev, dma_addr_t daddr)
>> +{
>> +        return daddr;
>> +}
>> +#endif
>> +
>>   #endif
>>
> 
> Could the default definition not be pushed all the way down into swiotlb.c (or at least swiotlb.h)?

I can do that but then we lose the inlining capability of the compiler. This could cost
performance penalty on architectures using it.

I tried moving it to swiotlb.h. swiotlb.h seems to be only used by swiotlb.c file. I could try 
including it into dma-mapping.h and then moving the definitions into swiotlb.h file. 

Let me give this a try.

> 
> Robin.
> 


-- 
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