From: Leon Romanovsky <leon@kernel.org>
To: Barry Song <21cnbao@gmail.com>
Cc: v-songbaohua@oppo.com, zhengtangquan@oppo.com,
ryan.roberts@arm.com, will@kernel.org, anshuman.khandual@arm.com,
catalin.marinas@arm.com, linux-kernel@vger.kernel.org,
surenb@google.com, iommu@lists.linux.dev, maz@kernel.org,
robin.murphy@arm.com, ardb@kernel.org,
linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com
Subject: Re: [PATCH 5/6] dma-mapping: Allow batched DMA sync operations if supported by the arch
Date: Thu, 25 Dec 2025 14:36:50 +0200 [thread overview]
Message-ID: <20251225123650.GJ11869@unreal> (raw)
In-Reply-To: <20251225054509.39917-1-21cnbao@gmail.com>
On Thu, Dec 25, 2025 at 06:45:09PM +1300, Barry Song wrote:
> > > >
> > >
> > > OK. Could you take a look at [1] and see if any further
> > > improvements are needed before I send v2?
> >
> > Everything looks ok, except these renames:
> > - arch_sync_dma_for_cpu(paddr, sg->length, dir);
> > + arch_sync_dma_for_cpu_batch_add(paddr, sg->length, dir);
>
> Thanks!
> I'm happy to drop the rename as outlined below-feedback welcome :-)
>
> diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
> index dd2c8586a725..487fb7c355ed 100644
> --- a/arch/arm64/include/asm/cache.h
> +++ b/arch/arm64/include/asm/cache.h
> @@ -87,6 +87,12 @@ int cache_line_size(void);
>
> #define dma_get_cache_alignment cache_line_size
>
> +static inline void arch_sync_dma_flush(void)
> +{
> + dsb(sy);
> +}
> +#define arch_sync_dma_flush arch_sync_dma_flush
> +
> /* Compress a u64 MPIDR value into 32 bits. */
> static inline u64 arch_compact_of_hwid(u64 id)
> {
> diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
> index b2b5792b2caa..ae1ae0280eef 100644
> --- a/arch/arm64/mm/dma-mapping.c
> +++ b/arch/arm64/mm/dma-mapping.c
> @@ -17,7 +17,7 @@ void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
> {
> unsigned long start = (unsigned long)phys_to_virt(paddr);
>
> - dcache_clean_poc(start, start + size);
> + dcache_clean_poc_nosync(start, start + size);
> }
>
> void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
> @@ -28,7 +28,7 @@ void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
> if (dir == DMA_TO_DEVICE)
> return;
>
> - dcache_inval_poc(start, start + size);
> + dcache_inval_poc_nosync(start, start + size);
> }
>
> void arch_dma_prep_coherent(struct page *page, size_t size)
> diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h
> index 4809204c674c..e7dd8a63b40e 100644
> --- a/include/linux/dma-map-ops.h
> +++ b/include/linux/dma-map-ops.h
> @@ -361,6 +361,12 @@ static inline void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
> }
> #endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */
>
> +#ifndef arch_sync_dma_flush
You likely need to wrap this in "#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FLUSH"
as done in the surrounding code.
Thanks
> +static inline void arch_sync_dma_flush(void)
> +{
> +}
> +#endif
> +
> #ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL
> void arch_sync_dma_for_cpu_all(void);
> #else
>
WARNING: multiple messages have this Message-ID (diff)
From: Leon Romanovsky <leon@kernel.org>
To: Barry Song <21cnbao@gmail.com>
Cc: ada.coupriediaz@arm.com, anshuman.khandual@arm.com,
ardb@kernel.org, catalin.marinas@arm.com, iommu@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, m.szyprowski@samsung.com,
maz@kernel.org, robin.murphy@arm.com, ryan.roberts@arm.com,
surenb@google.com, v-songbaohua@oppo.com, will@kernel.org,
zhengtangquan@oppo.com
Subject: Re: [PATCH 5/6] dma-mapping: Allow batched DMA sync operations if supported by the arch
Date: Thu, 25 Dec 2025 14:36:50 +0200 [thread overview]
Message-ID: <20251225123650.GJ11869@unreal> (raw)
In-Reply-To: <20251225054509.39917-1-21cnbao@gmail.com>
On Thu, Dec 25, 2025 at 06:45:09PM +1300, Barry Song wrote:
> > > >
> > >
> > > OK. Could you take a look at [1] and see if any further
> > > improvements are needed before I send v2?
> >
> > Everything looks ok, except these renames:
> > - arch_sync_dma_for_cpu(paddr, sg->length, dir);
> > + arch_sync_dma_for_cpu_batch_add(paddr, sg->length, dir);
>
> Thanks!
> I'm happy to drop the rename as outlined below-feedback welcome :-)
>
> diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
> index dd2c8586a725..487fb7c355ed 100644
> --- a/arch/arm64/include/asm/cache.h
> +++ b/arch/arm64/include/asm/cache.h
> @@ -87,6 +87,12 @@ int cache_line_size(void);
>
> #define dma_get_cache_alignment cache_line_size
>
> +static inline void arch_sync_dma_flush(void)
> +{
> + dsb(sy);
> +}
> +#define arch_sync_dma_flush arch_sync_dma_flush
> +
> /* Compress a u64 MPIDR value into 32 bits. */
> static inline u64 arch_compact_of_hwid(u64 id)
> {
> diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
> index b2b5792b2caa..ae1ae0280eef 100644
> --- a/arch/arm64/mm/dma-mapping.c
> +++ b/arch/arm64/mm/dma-mapping.c
> @@ -17,7 +17,7 @@ void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
> {
> unsigned long start = (unsigned long)phys_to_virt(paddr);
>
> - dcache_clean_poc(start, start + size);
> + dcache_clean_poc_nosync(start, start + size);
> }
>
> void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
> @@ -28,7 +28,7 @@ void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
> if (dir == DMA_TO_DEVICE)
> return;
>
> - dcache_inval_poc(start, start + size);
> + dcache_inval_poc_nosync(start, start + size);
> }
>
> void arch_dma_prep_coherent(struct page *page, size_t size)
> diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h
> index 4809204c674c..e7dd8a63b40e 100644
> --- a/include/linux/dma-map-ops.h
> +++ b/include/linux/dma-map-ops.h
> @@ -361,6 +361,12 @@ static inline void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
> }
> #endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */
>
> +#ifndef arch_sync_dma_flush
You likely need to wrap this in "#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FLUSH"
as done in the surrounding code.
Thanks
> +static inline void arch_sync_dma_flush(void)
> +{
> +}
> +#endif
> +
> #ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL
> void arch_sync_dma_for_cpu_all(void);
> #else
>
next prev parent reply other threads:[~2025-12-25 12:37 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 5:36 [PATCH 0/6] dma-mapping: arm64: support batched cache sync Barry Song
2025-12-19 5:36 ` Barry Song
2025-12-19 5:36 ` [PATCH 1/6] arm64: Provide dcache_by_myline_op_nosync helper Barry Song
2025-12-19 5:36 ` Barry Song
2025-12-19 12:20 ` Robin Murphy
2025-12-19 12:20 ` Robin Murphy
2025-12-21 7:22 ` Barry Song
2025-12-21 7:22 ` Barry Song
2025-12-19 5:36 ` [PATCH 2/6] arm64: Provide dcache_clean_poc_nosync helper Barry Song
2025-12-19 5:36 ` Barry Song
2025-12-19 5:36 ` [PATCH 3/6] arm64: Provide dcache_inval_poc_nosync helper Barry Song
2025-12-19 5:36 ` Barry Song
2025-12-19 12:34 ` Robin Murphy
2025-12-19 12:34 ` Robin Murphy
2025-12-21 7:59 ` Barry Song
2025-12-21 7:59 ` Barry Song
2025-12-19 5:36 ` [PATCH 4/6] arm64: Provide arch_sync_dma_ batched helpers Barry Song
2025-12-19 5:36 ` Barry Song
2025-12-19 5:36 ` [PATCH 5/6] dma-mapping: Allow batched DMA sync operations if supported by the arch Barry Song
2025-12-19 5:36 ` Barry Song
2025-12-20 17:37 ` kernel test robot
2025-12-20 17:37 ` kernel test robot
2025-12-21 5:15 ` Barry Song
2025-12-21 5:15 ` Barry Song
2025-12-21 11:55 ` Leon Romanovsky
2025-12-21 11:55 ` Leon Romanovsky
2025-12-21 19:24 ` Barry Song
2025-12-21 19:24 ` Barry Song
2025-12-22 8:49 ` Leon Romanovsky
2025-12-22 8:49 ` Leon Romanovsky
2025-12-23 0:02 ` Barry Song
2025-12-23 0:02 ` Barry Song
2025-12-23 2:36 ` Barry Song
2025-12-23 2:36 ` Barry Song
2025-12-23 14:14 ` Leon Romanovsky
2025-12-23 14:14 ` Leon Romanovsky
2025-12-24 1:29 ` Barry Song
2025-12-24 1:29 ` Barry Song
2025-12-24 8:51 ` Leon Romanovsky
2025-12-24 8:51 ` Leon Romanovsky
2025-12-25 5:45 ` Barry Song
2025-12-25 5:45 ` Barry Song
2025-12-25 12:36 ` Leon Romanovsky [this message]
2025-12-25 12:36 ` Leon Romanovsky
2025-12-25 13:31 ` Barry Song
2025-12-25 13:31 ` Barry Song
2025-12-25 13:40 ` Leon Romanovsky
2025-12-25 13:40 ` Leon Romanovsky
2025-12-21 12:36 ` kernel test robot
2025-12-21 12:36 ` kernel test robot
2025-12-22 12:43 ` kernel test robot
2025-12-22 12:43 ` kernel test robot
2025-12-22 14:00 ` kernel test robot
2025-12-22 14:00 ` kernel test robot
2025-12-19 5:36 ` [PATCH RFC 6/6] dma-iommu: Allow DMA sync batching for IOVA link/unlink Barry Song
2025-12-19 5:36 ` Barry Song
2025-12-19 6:04 ` [PATCH 0/6] dma-mapping: arm64: support batched cache sync Barry Song
2025-12-19 6:04 ` Barry Song
2025-12-19 6:12 ` Barry Song
2025-12-19 6:12 ` Barry Song
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=20251225123650.GJ11869@unreal \
--to=leon@kernel.org \
--cc=21cnbao@gmail.com \
--cc=anshuman.khandual@arm.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=iommu@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=maz@kernel.org \
--cc=robin.murphy@arm.com \
--cc=ryan.roberts@arm.com \
--cc=surenb@google.com \
--cc=v-songbaohua@oppo.com \
--cc=will@kernel.org \
--cc=zhengtangquan@oppo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.