On Mon, Feb 03, 2025 at 02:55:12PM +0000, Diogo Ivo wrote: > Hello, > > Commit c8cc2655cc6c introduced a regression when trying to use the media > accelerators present on the Tegra X1 SoC. > > I came across this regression when testing the branch [1] that leverages > the NVJPG engine in the Tegra X1 for decoding a JPEG file. After commit > c8cc2655cc6c we see the following error messages after submitting a job > through the TEGRA_CHANNEL_SUBMIT IOCTL: > > [ 46.879757] tegra-nvjpg 54380000.nvjpg: invalid gather for push buffer > 0x0000000108f08000 What driver is this? The message comes from drivers/gpu/host1x/hw/channel_hw.c But what driver is 'tegra-nvjpg' that is bound to 54380000.nvjpg ? Is it the stuff in drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/ I don't see "tegra-nvjpg" in the kernel? Can you share where the failing command was sent to the device? > Please let me know if you need more information on my side and I'll be > happy to provide it. It is still ARM64 & CONFIG_ARM_DMA_USE_IOMMU=n ? I'm guessing it is the same basic issue as fae6e669cdc5 ("drm/tegra: Do not assume that a NULL domain means no DMA IOMMU"), except in the host1x not DRM code. It looks to me like the same pattern was copied there. How about this: diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c index be2ad7203d7b96..090b1fc97a7309 100644 --- a/drivers/gpu/host1x/dev.c +++ b/drivers/gpu/host1x/dev.c @@ -361,6 +361,10 @@ static bool host1x_wants_iommu(struct host1x *host1x) return true; } +/* + * Returns ERR_PTR on failure, NULL if the translation is IDENTITY, otherwise a + * valid paging domain. + */ static struct iommu_domain *host1x_iommu_attach(struct host1x *host) { struct iommu_domain *domain = iommu_get_domain_for_dev(host->dev); @@ -385,6 +389,8 @@ static struct iommu_domain *host1x_iommu_attach(struct host1x *host) * Similarly, if host1x is already attached to an IOMMU (via the DMA * API), don't try to attach again. */ + if (domain && domain->type == IOMMU_DOMAIN_IDENTITY) + domain = NULL; if (!host1x_wants_iommu(host) || domain) return domain; (if not can you investigate this function's flow compared to a good kernel?) Jason