Re: [PATCH 1/4] media: venus: use dma_iova_size() to check the reserved IOVA size
From: Vikash Garodia
Date: Sun Nov 29 2026 - 09:19:38 EST
On 11/27/2026 10:56 PM, Jason Gunthorpe wrote:
On Fri, Nov 27, 2026 at 05:21:35PM +0000, Bryan O'Donoghue wrote:
On 27/11/2026 14:29, Jason Gunthorpe wrote:
On Fri, Nov 27, 2026 at 12:58:45PM +0100, Marek Szyprowski wrote:
The IOVA reservation code compares dma_iova_state::__size directly with
the requested chunk size. __size is internal to the DMA IOVA API and may
carry flags in its upper bits, so use the dma_iova_size() accessor
instead.
WTF is this even doing?
Fix this by reserving the 0-600MB range, below the boundary the
non-pixel stream cannot address, using dma_iova_try_alloc() so the
IOMMU-DMA core never hands that range out to a real DMA mapping. This
reserves only IOVA space, it does not allocate any physical memory.
That isn't what this API is for, and it isn't how it even works! It is
pure luck that the first call to it happens to take out the lower
address space.
We even had a long discussion about this driver and this need in
another thread and this is the hack job you guys merged?
Have to say I wasn't aware of an objection from you, I don't think I was on
that thread.
Nobody ever shared this insane thing with us. Seriously, this isn't
even remotely using these APIs for what they are for. Nobody thought
"hey this seems like a creative use of APIs, lets ask someone" ?
Sure, its a miss to add the maintainers of the file which defines the api. Relying on b4 alone was not the right approach. Noted for any future submissions.
It would be possible to reserve this IOVA range in DT so given what you've
highlighted I think this and the Iris commit should be reverted and the DT
constraint implemented.
That was the other thread, obviously using DT to describe a hardware
issue is the correct choice. But there was some problem where they
also wanted to split the SID space using DT and then the DT mechansim
doesn't work because the whole thing becomes too hacky :\
We discussed this earlier here[1] and concluded DT as the right place to address this.
The DT approach is waiting for the series [2] to land, which should take care of the reservation in a definite way.
[1] https://lore.kernel.org/all/c7b956a9-d3e8-4e18-b780-5d08f5cd2ca1@xxxxxxxxxx/
[2] https://lore.kernel.org/all/20261120-add_iommu_ranges-v8-0-d90486973b73@xxxxxxxxxxxxxxxx/
Regards,
Vikash
Jason