Re: [PATCH 1/2] HID: intel-ish-hid: fix cache management mistake
From: srinivas pandruvada
Date: Wed May 29 2024 - 18:25:46 EST
On Wed, 2024-05-29 at 09:06 +0200, Arnd Bergmann wrote:
> On Wed, May 29, 2024, at 08:46, Zhang, Lixu wrote:
> > >
> > > -#include <linux/cacheflush.h>
> > > #include <linux/container_of.h>
> > > #include <linux/dev_printk.h>
> > > #include <linux/dma-mapping.h>
> > > @@ -175,10 +174,11 @@ static int prepare_dma_bufs(struct
> > > ishtp_device
> > > *dev,
> > > return -ENOMEM;
> > >
> > > fragment->fragment_tbl[i].ddr_adrs =
> > > cpu_to_le64(dma_addr);
> > > +
> > > + memcpy(dma_bufs[i], ish_fw->data + offset,
> > > fragment-
> > > > fragment_tbl[i].length);
> > fragment->fragment_tbl[i].length was used before assignment.
> >
> > > + dma_wmb();
> > I tested it on the platform, but it didn't wok.
> >
>
> What behavior do you see instead? If the manual cache
> flush works around a bug, that would indicate that the
> device itself is not coherent and the dma_alloc_coherent()
> in the architecture is broken.
Lixu,
What happens if you remove manual cache flush in your code?
It is possible that boot loader at this time not ready to do fully
coherent ops.
Thanks,
Srinivas
>
> Arnd