ChanServ changed the topic of #etnaviv to: #etnaviv - the home of the reverse-engineered Vivante GPU driver - Logs https://oftc.irclog.whitequark.org/etnaviv
JohnnyonFlame has quit [Read error: Connection reset by peer]
frieder has joined #etnaviv
frieder_ has joined #etnaviv
frieder_ has quit []
frieder has quit []
frieder has joined #etnaviv
cengiz_io has quit [Quit: cengiz_io]
cengiz_io has joined #etnaviv
pcercuei has joined #etnaviv
lynxeye has joined #etnaviv
<mwalle> lynxeye: sorry I had to leave yesterday. Yes I'm aware of the PTA which in turn selects the MTLB base address
<mwalle> lynxeye: but the driver sets the MTLB base address in the PTA entry as well as in etnaviv_buffer_config_mmuv2()
<lynxeye> mwalle: Ah, yea. The mtlb address in the config reg is simply ignored by GPUs with PTA support. I see how this is a bit confusing.
<mwalle> lynxeye: ah ok, thanks
<mwalle> lynxeye: one thing which is odd, the base address of the PTA can be 40bit, the PTA can point to a 40bit mtlb base address but an mtlb entry cannot point to a 40bit address (but the stlb entry can result in a 40bit target address again..)
<lynxeye> mwalle: You see how we skip adding the mtlb address in the flush path in etnaviv_buffer_queue? We could do the same thing in etnaviv_buffer_config_mmuv2 to make things a bit more clear, but it doesn't matter to the HW.
<lynxeye> mwalle: I'm not sure if the mtlb 32bit limit is intentional, or simply a oversight on my side. Have you checked the vivante kernel driver? I would guess that you can just fold the 40bit address for the mtlb entry the same way as is done for the stlb entries.
<mwalle> lynxeye: yes I've checked the vivante kernel driver, and i also played with the tlb stuff quite a bit
<mwalle> it also seems that (sometimes? always) bit 4 of the MTLB is a "secure" bit, so just folding the upper 8 bits to 11:4 doesn't work
<lynxeye> That's odd... So maybe we need to limit the coherent dma mask to 32bit after all. That should not really hurt, as the only coherent dma allocations done by etnaviv are for the command stream buffer and the pagetables.
<mwalle> let me see if i can find that piece of code..
<mwalle> but I've tried to insert upper bits of a 40bit address of the stlb into the mtlb entry and it doesn't work. (I've traced that with an IOMMU exception, expecting that if I change the address, it will trigger a SMMU exception, which it does for both the MTLB entry as well as a PTA entry)
<mwalle> but unfortunantly not for a "wrong" stlb address in the MTLB
<lynxeye> mwalle: Yea, that's also how I read the vivante kernel driver code. The vivante driver also adds GFP_DMA32 to the stlb page allocations and I see no code to add the upper 8bits in the mtlb. So seems the stlb part of the pagetables must be below the 4GB mark...
<mwalle> lynxeye: yep, but if theres an IOMMU in between this GFP_DMA32 doesn't really help (if i'm not missing anything)
<mwalle> the iommu driver just looks at the dma_mask to find a free iova
<lynxeye> mwalle: Huh? Even with an iommu in between dma_coherent allocations should take the dma_coherent_mask into account.
<lynxeye> GFP_DMA32 is useless with coherent allocations, as the coherent alloc paths ignore it in favor of the coherent dma mask.
<lynxeye> mwalle: Currently etnaviv set both dma_mask and coherent_dma_mask to 40bits. You need to split this and only set coherent_dma_mask to 32bits.
<mwalle> lynxeye: yes dma_coherent_mask is taken into account, but how can i tell linux to get a page <32bit if my dma_coherent_mask is 40bit, that isn't possible I guess
<lynxeye> mwalle: No, just reduce the coherent mask to 32bits.
<lynxeye> We only allocate page tables and command stream buffers from coherent memory, so it shouldn't hurt to always put them into the 32bit area.
<mwalle> lynxeye: I can try, but to cite arnd:
<mwalle> arnd | At one point we changed all manual assignments of dma_mask to 'dma_coerce_mask_and_coherent)
<mwalle> arnd | ' to annotate the fact that this is a bad thing of the driver to do, in the hope that new drivers would not attempt it
<lynxeye> mwalle: If our requirements for coherent and non-coherent are different I don't see why we shouldn't use the facilities provided by the kernel for this case...
<mwalle> lynxeye: ok, but it still bothers my why just that one address has to be in the 32 bit range. that doesn't satisfy the sheldon in me *g* its like the hardware is 90% there but stumble on the last 10%
<lynxeye> mwalle: Hahaha, get used to this feeling. There's a lot of cases where the HW is like 90% there, but then falls over. ;)
<mwalle> lynxeye: btw if the MMU is disabled, there is an identity mapping, right?
<mwalle> ie the mmu is just bypassed and but memory access is possible
<lynxeye> mwalle: Yes, as long as the MMU is disabled all GPU addresses are identity mapped to bus addresses.
<lynxeye> This is required to start the GPU, as you need to execute a command stream to enable the MMUv2.
<mwalle> lynxeye: yeah I saw that in the start_fe() function
<lynxeye> TBH I never checked if all GPU engines can access memory without the MMU being enabled, or if just the FE bypasses the MMU, but I guess they all take the same path.
<mwalle> lynxeye: btw there is a ACE (whatever that stands for) feature, which when availble can be used to specify the upper 8bits for the mtlb and safe address, which as you mentioned is just used if there is no PTA. Thus not in my case. I have the code though, I'm not sure if it is still intersting or if i should just drop it
<lynxeye> mwalle: ACE means the GPU supports the AMBA ACE bus standard, which seems to be the same point at which they added the 40bit address support.
<lynxeye> I'm not sure how much value adding more 40bit support has if we just constrain coherent allocations to 32bit, which seems like the most robust solution to me at the moment.
JohnnyonFlame has joined #etnaviv
frieder has quit [Remote host closed the connection]
lynxeye has quit [Quit: Leaving.]
tlwoerner has quit [Remote host closed the connection]
tlwoerner has joined #etnaviv
pcercuei has quit [Quit: dodo]
karolherbst has quit [Remote host closed the connection]
karolherbst has joined #etnaviv
T_UNIX has quit [Ping timeout: 480 seconds]