On 2020-08-27 16:45, Thierry Reding wrote:
On Thu, Aug 20, 2020 at 04:08:32PM +0100, Robin Murphy wrote:
Now that arch/arm is wired up for default domains and iommu-dma,
implement the corresponding driver-side support for DMA domains.
Signed-off-by: Robin Murphy <robin.murphy@xxxxxxx>
---
drivers/iommu/tegra-smmu.c | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
We can't do that yet because it will currently still break for use-cases
such as display where we don't properly set up identity mappings during
boot. The result is that the dma-iommu code will enable translations
before the driver gets a chance to set up any mappings and if the
display controller was left on by the bootloader, scanning out a splash
screen, this causes faults between the point where dma-iommu is being
set up for the display controller and where the display controller
starts mapping its own buffers (rather than the ones mapped by the
bootloader).
Rest assured that I understand the situation all too well ;) As with
tegra-gart, the unspoken point here is that since tegra-smmu implements
of_xlate(), then arm_setup_iommu_dma_ops() must already be causing the
exact same problem, no? This patch only seeks to move any existing
behaviour over to the common backend, regardless of whether it was ever
really appropriate in the first place.
That said, I do have a series that I've been carrying around for longer
than I've wanted that does exactly this for Tegra SMMU and I'd prefer if
you could drop this particular change from your series so that I can
keep working on resolving the identity mapping issues first.
That would mean you'd see a functional change from the final patch,
wherein nothing would ever be able to get translation unless drivers do
their own explicit IOMMU API management. If you definitely want that
change then OK, but it would still be nice to do it "properly" with
IOMMU_DOMAIN_IDENTITY support, rather than just forcibly failing default
domain allocation. I'm having a go at reworking the tegra-gart patch in
that direction, so I can certainly try it for tegra-smmu as well.
Robin.