Re: [PATCH] soc: qcom: cmd-db: map shared memory as WT, not WB
From: Pavan Kondeti
Date: Fri Jul 12 2024 - 06:26:46 EST
Hi Volodymyr/Maulik,
On Fri, Mar 29, 2024 at 10:22:47AM +0530, Maulik Shah (mkshah) wrote:
>
>
> On 3/29/2024 3:49 AM, Volodymyr Babchuk wrote:
> >
> > Hi Maulik
> >
> > "Maulik Shah (mkshah)" <quic_mkshah@xxxxxxxxxxx> writes:
> >
> > > On 3/28/2024 1:39 AM, Volodymyr Babchuk wrote:
> > > > It appears that hardware does not like cacheable accesses to this
> > > > region. Trying to access this shared memory region as Normal Memory
> > > > leads to secure interrupt which causes an endless loop somewhere in
> > > > Trust Zone.
> > >
> > > Linux does not write into cmd-db region. This region is write
> > > protected by XPU. Making this region uncached magically solves the XPU
> > > write fault
> > > issue.
> > >
> > > Can you please include above details?
> >
> > Sure, I'll add this to the next version.
> >
>
> Thanks.
>
> > >
> > > In downstream, we have below which resolved similar issue on qcm6490.
> > >
> > > cmd_db_header = memremap(rmem->base, rmem->size, MEMREMAP_WC);
> > >
> > > Downstream SA8155P also have MEMREMAP_WC. Can you please give it a try
> > > on your device?
> >
> > Yes, MEMREMAP_WC works as well. This opens the question: which type is
> > more correct? I have no deep understanding in QCOM internals so it is
> > hard to me to answer this question.
> >
>
> XPU may have falsely detected clean cache eviction as "write" into the write
> protected region so using uncached flag MEMREMAP_WC may be helping here and
> is more correct in my understanding.
>
I have got the very same explanation from my other colleagues at Qualcomm. I could
reproduce the problem 100% of the time on QCS6490 RB3 board with Linux booting
in EL2. The problem goes away with non-cached mapping
(MEMREMAP_WC/MEMREMAP_WB).
Do you guys plan to send V2? Please CC me on the V2.
Thanks,
Pavan