Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: James Hogan <jhogan@kernel.org>
To: Huacai Chen <chenhc@lemote.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	"Steven J . Hill" <Steven.Hill@cavium.com>,
	linux-mips@linux-mips.org, Fuxin Zhang <zhangfx@lemote.com>,
	Zhangjin Wu <wuzhangjin@gmail.com>,
	Jayachandran C <jchandra@broadcom.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 2/2] MIPS: Loongson64: Add cache_sync to loongson_dma_map_ops
Date: Wed, 24 Jan 2018 14:02:35 +0000	[thread overview]
Message-ID: <20180124140234.GF5446@saruman> (raw)
In-Reply-To: <1510821355-24694-1-git-send-email-chenhc@lemote.com>

[-- Attachment #1: Type: text/plain, Size: 3284 bytes --]

On Thu, Nov 16, 2017 at 04:35:55PM +0800, Huacai Chen wrote:
> To support coherent & non-coherent DMA co-exsistance, we should add
> cache_sync to loongson_dma_map_ops.
> 
> Signed-off-by: Huacai Chen <chenhc@lemote.com>

I presume this was broken by commit c9eb6172c328 ("dma-mapping: turn
dma_cache_sync into a dma_map_ops method") in 4.15-rc1? (Christoph Cc'd)

In that case:

1) we should have a fixes tag:
Fixes: c9eb6172c328 ("dma-mapping: turn dma_cache_sync into a dma_map_ops method")

2) we should get this into 4.15 final (though its probably pushing it a
bit now).

3) Loongson might not be the only MIPS platform that was broken by that
commit. Octeon appears to be coherent, so thats fine. However Netlogic
appears not to be (Jayachandran Cc'd).

Should the following be added?

diff --git a/arch/mips/netlogic/common/nlm-dma.c b/arch/mips/netlogic/common/nlm-dma.c
index 0ec9d9da6d51..58049da72c82 100644
--- a/arch/mips/netlogic/common/nlm-dma.c
+++ b/arch/mips/netlogic/common/nlm-dma.c
@@ -79,7 +79,8 @@ const struct dma_map_ops nlm_swiotlb_dma_ops = {
 	.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
 	.sync_sg_for_device = swiotlb_sync_sg_for_device,
 	.mapping_error = swiotlb_dma_mapping_error,
-	.dma_supported = swiotlb_dma_supported
+	.dma_supported = swiotlb_dma_supported,
+	.cache_sync = mips_dma_cache_sync,
 };
 
 void __init plat_swiotlb_setup(void)

Cheers
James

> ---
>  arch/mips/include/asm/dma-mapping.h       | 3 +++
>  arch/mips/loongson64/common/dma-swiotlb.c | 1 +
>  arch/mips/mm/dma-default.c                | 2 +-
>  3 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
> index 0d9418d..5544276 100644
> --- a/arch/mips/include/asm/dma-mapping.h
> +++ b/arch/mips/include/asm/dma-mapping.h
> @@ -37,4 +37,7 @@ static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
>  #endif
>  }
>  
> +void mips_dma_cache_sync(struct device *dev, void *vaddr,
> +		size_t size, enum dma_data_direction direction);
> +
>  #endif /* _ASM_DMA_MAPPING_H */
> diff --git a/arch/mips/loongson64/common/dma-swiotlb.c b/arch/mips/loongson64/common/dma-swiotlb.c
> index ef07740..17956f2 100644
> --- a/arch/mips/loongson64/common/dma-swiotlb.c
> +++ b/arch/mips/loongson64/common/dma-swiotlb.c
> @@ -120,6 +120,7 @@ static const struct dma_map_ops loongson_dma_map_ops = {
>  	.sync_sg_for_device = loongson_dma_sync_sg_for_device,
>  	.mapping_error = swiotlb_dma_mapping_error,
>  	.dma_supported = loongson_dma_supported,
> +	.cache_sync = mips_dma_cache_sync,
>  };
>  
>  void __init plat_swiotlb_setup(void)
> diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
> index e3e94d0..e86bf5d 100644
> --- a/arch/mips/mm/dma-default.c
> +++ b/arch/mips/mm/dma-default.c
> @@ -383,7 +383,7 @@ static int mips_dma_supported(struct device *dev, u64 mask)
>  	return plat_dma_supported(dev, mask);
>  }
>  
> -static void mips_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
> +void mips_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
>  			 enum dma_data_direction direction)
>  {
>  	BUG_ON(direction == DMA_NONE);
> -- 
> 2.7.0
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-01-24 14:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-16  8:35 [PATCH 2/2] MIPS: Loongson64: Add cache_sync to loongson_dma_map_ops Huacai Chen
2018-01-24 14:02 ` James Hogan [this message]
2018-01-24 14:11   ` Christoph Hellwig
2018-01-24 15:03     ` James Hogan
2018-01-24 15:29       ` Christoph Hellwig
2018-01-25  7:09         ` Huacai Chen
2018-01-25  7:55           ` James Hogan
2018-01-25  8:44             ` Huacai Chen
2018-01-25 10:54               ` James Hogan
2018-01-25 11:04                 ` Huacai Chen
2018-01-25 12:31                   ` James Hogan
2018-01-26  7:56               ` Christoph Hellwig

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=20180124140234.GF5446@saruman \
    --to=jhogan@kernel.org \
    --cc=Steven.Hill@cavium.com \
    --cc=chenhc@lemote.com \
    --cc=hch@lst.de \
    --cc=jchandra@broadcom.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=wuzhangjin@gmail.com \
    --cc=zhangfx@lemote.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox