From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751843AbdIOC5L (ORCPT ); Thu, 14 Sep 2017 22:57:11 -0400 Received: from smtpbgbr2.qq.com ([54.207.22.56]:60973 "EHLO smtpbgbr2.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751733AbdIOC5K (ORCPT ); Thu, 14 Sep 2017 22:57:10 -0400 X-QQ-mid: bizesmtp2t1505444216tmizky1y3 X-QQ-SSF: 01100000008000F0FNF0B00A0000000 X-QQ-FEAT: PML9g4LxpBqaQSMeq0TkDg5/y69aRpo+myB2p1J0ottpOTpXcmA4vbRo2fNud Tw8/+7EZItP9n5eIEJ1LerpVwucaVZuWApt9UDLk6pFigLr48iKlL8x1xGpxlhVPYnv7kgD c24lfzYQxy68y2ICV24FiN13ENUmndw812Q4DUTkEj5KXXLR1L39B4izthvmpZkdWCiPvRq Vdvp/HCyolGctMDR0aLMN/CsYn5aOQnyi4eERnbND1HirpkMWIoA4YYVLPNaPot4RxeboXx az7O3SPXPyI+003YEFqAxtCGm4/FOO8gRLEw== X-QQ-GoodBg: 0 From: Huacai Chen To: Christoph Hellwig Cc: Marek Szyprowski , Robin Murphy , Andrew Morton , Fuxin Zhang , linux-kernel@vger.kernel.org, Huacai Chen , stable@vger.kernel.org Subject: [PATCH V4 1/3] dma-mapping: Provide a default plat_device_is_coherent() Date: Fri, 15 Sep 2017 10:58:22 +0800 Message-Id: <1505444302-17036-1-git-send-email-chenhc@lemote.com> X-Mailer: git-send-email 2.7.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:lemote.com:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We will use plat_device_is_coherent() in generic cases, but it is MIPS-specific now. So we provide a default implementation. BTW, export the symbol hw_coherentio for MIPS if the caller of plat_device_is_coherent() is in a module. Cc: stable@vger.kernel.org Signed-off-by: Huacai Chen --- arch/mips/include/asm/dma-mapping.h | 1 + arch/mips/mm/dma-default.c | 1 + include/linux/dma-mapping.h | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h index aba7138..662eca9 100644 --- a/arch/mips/include/asm/dma-mapping.h +++ b/arch/mips/include/asm/dma-mapping.h @@ -8,6 +8,7 @@ #ifndef CONFIG_SGI_IP27 /* Kludge to fix 2.6.39 build for IP27 */ #include #endif +#define ARCH_HAS_PLAT_DEVICE_IS_COHERENT extern const struct dma_map_ops *mips_dma_map_ops; diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index 8e78251..b4c74ab 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c @@ -29,6 +29,7 @@ enum coherent_io_user_state coherentio = IO_COHERENCE_DEFAULT; EXPORT_SYMBOL_GPL(coherentio); int hw_coherentio = 0; /* Actual hardware supported DMA coherency setting. */ +EXPORT_SYMBOL_GPL(hw_coherentio); static int __init setcoherentio(char *str) { diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 29ce981..6517388 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -697,6 +697,14 @@ static inline void *dma_zalloc_coherent(struct device *dev, size_t size, } #ifdef CONFIG_HAS_DMA + +#ifndef ARCH_HAS_PLAT_DEVICE_IS_COHERENT +static inline int plat_device_is_coherent(struct device *dev) +{ + return 1; +} +#endif + static inline int dma_get_cache_alignment(void) { #ifdef ARCH_DMA_MINALIGN -- 2.7.0