[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+vQScKTumiXe8n3@spud>
Date: Tue, 14 Feb 2023 18:17:45 +0000
From: Conor Dooley <conor@...nel.org>
To: Cristian Ciocaltea <cristian.ciocaltea@...labora.com>
Cc: Ben Dooks <ben.dooks@...ethink.co.uk>, Lee Jones <lee@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Emil Renner Berthing <kernel@...il.dk>,
Palmer Dabbelt <palmer@...belt.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Albert Ou <aou@...s.berkeley.edu>,
Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Richard Cochran <richardcochran@...il.com>,
Sagar Kadam <sagar.kadam@...ive.com>,
Yanhong Wang <yanhong.wang@...rfivetech.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, linux-riscv@...ts.infradead.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, kernel@...labora.com
Subject: Re: [PATCH 05/12] riscv: Implement non-coherent DMA support via
SiFive cache flushing
On Tue, Feb 14, 2023 at 08:06:49PM +0200, Cristian Ciocaltea wrote:
> On 2/13/23 10:30, Ben Dooks wrote:
> > On 11/02/2023 03:18, Cristian Ciocaltea wrote:
> > > From: Emil Renner Berthing <kernel@...il.dk>
> > > diff --git a/arch/riscv/mm/dma-noncoherent.c
> > > b/arch/riscv/mm/dma-noncoherent.c
> > > index d919efab6eba..e07e53aea537 100644
> > > --- a/arch/riscv/mm/dma-noncoherent.c
> > > +++ b/arch/riscv/mm/dma-noncoherent.c
> > > @@ -9,14 +9,21 @@
> > > #include <linux/dma-map-ops.h>
> > > #include <linux/mm.h>
> > > #include <asm/cacheflush.h>
> > > +#include <soc/sifive/sifive_ccache.h>
> > > static bool noncoherent_supported;
> > > void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
> > > enum dma_data_direction dir)
> > > {
> > > - void *vaddr = phys_to_virt(paddr);
> > > + void *vaddr;
> > > + if (sifive_ccache_handle_noncoherent()) {
> > > + sifive_ccache_flush_range(paddr, size);
> > > + return;
> > > + }
> > > +
> > > + vaddr = phys_to_virt(paddr);
> > > switch (dir) {
> > > case DMA_TO_DEVICE:
> > > ALT_CMO_OP(clean, vaddr, size, riscv_cbom_block_size);
> > > @@ -35,8 +42,14 @@ void arch_sync_dma_for_device(phys_addr_t paddr,
> > > size_t size,
> > > void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size,
> > > enum dma_data_direction dir)
> > > {
> > > - void *vaddr = phys_to_virt(paddr);
> > > + void *vaddr;
> > > +
> > > + if (sifive_ccache_handle_noncoherent()) {
> > > + sifive_ccache_flush_range(paddr, size);
> > > + return;
> > > + }
> >
> > ok, what happens if we have an system where the ccache and another level
> > of cache also requires maintenance operations?
TBH, I'd hope that a system with that complexity is also not trying to
manage the cache in this manner!
> According to [1], the handling of non-coherent DMA on RISC-V is currently
> being worked on, so I will respin the series as soon as the proper support
> arrives.
But yeah, once that stuff lands we can carry out these operations only
for the platforms that need/"need" it.
Cheers,
Conor.
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists