Re: DRM Stuff
Taylor R Campbell <[email protected]> Thu, 29 Sep 2022 06:59:28 +0000
| Newsgroups | gmane.os.netbsd.devel.x11 |
|---|---|
| Message-ID | <[email protected]> |
> Date: Wed, 28 Sep 2022 14:37:47 +0100 > From: Robert Swindells <[email protected]> > > Taylor R Campbell <campbell+netbsd-tech-x11%mumble.net@localhost> wrote: > >> Date: Mon, 26 Sep 2022 09:40:15 +0100 > >> From: Robert Swindells <rjs%fdy2.co.uk@localhost> > >> > >> On arm, bus_dmamap_sync crashes if you have used bus_dmamap_load_raw. > > > >How does it crash? Sounds like a bug. > > It tries to flush VA 0. What exactly did you do? It's hard to see what's going on with a short prose description. References to specific code would be helpful. > >If you need to try this as a hack, you can just map the same pages in > >with kmap or something and issue the CPU flush instructions you > >suspect are necessary -- not fit for committing permanently but enough > >to test a hypothesis. > > I would prefer to find a long-term solution. Yes but this may help to see whether you're barking up the wrong tree altogether and whether to spend any more time on it or try a different approach. > The ARM cache flush instructions operate on a virtual address, they are > not barrier ones like on X86. x86 has an explicit cache flush instruction (clflush) and barriers (lfence/mfence/sfence) just like arm has explicit cache flush instructions (dc/ic) and barriers (dmb/dsb). i915 uses clflush directly sometimes. On arm, not all of these are needed for all memory; see the _BUS_DMAMAP_COHERENT logic in arm32/bus_dma.c. What you need to do here, I don't know. If Linux doesn't use explicit cache flushes in the lima/panfrost drivers, it's extremely unlikely that NetBSD needs to. > I agree that needing to map every buffer into the kernel is a waste, the > lima and panfrost drivers don't touch them. > > The RPi3 DRM driver does need to map every buffer as it does some > checking of them before handing them to the GPU. That seems unlikely -- checking of shaders, yes; checking of all buffers, probably not. > > What does Linux do in the place where you think we need > > bus_dmamap_sync? > > It doesn't do anything. > > Are we setting different page cache properties on buffers to Linux? We shouldn't but I don't know. What do the lima/panfrost drivers pass to pmap_enter?