Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] drm/nouveau: nouveau_mem_host() strips mem->kind on coherent Tegra GV11B - [Medium] drm/nouveau/tegra: dma_set_mask() in nvkm_device_tegra_new() leaves 32-bit coherent_dma_mask --
commit e289bf50b9036cbe5f5e82400aac0bfdb50c7154 Author: Mikko Perttunen <[email protected]> drm/nouveau/tegra: Add device tree compatible for GV11B This commit adds the "nvidia,gv11b" device tree compatible string and its platform data with a 38-bit DMA mask and IOMMU disabled. > diff --git a/drivers/gpu/drm/nouveau/nouveau_platform.c > b/drivers/gpu/drm/nouveau/nouveau_platform.c > index 9ca6272ce809f..56a482dae2318 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_platform.c > +++ b/drivers/gpu/drm/nouveau/nouveau_platform.c > @@ -78,6 +78,10 @@ static const struct nvkm_device_tegra_func > gp10b_platform_data = { > .require_vdd = false, > }; > > +static const struct nvkm_device_tegra_func gv11b_platform_data = { > + .dma_bits = 38, > +}; [Severity: Medium] Does leaving .iommu_bit at 0 with .dma_bits = 38 restrict GV11B instance memory allocations to a 32-bit coherent_dma_mask? With .iommu_bit == 0, tdev->iommu.domain is NULL and gk20a_instmem_new() uses gk20a_instobj_ctor_dma(), which allocates GPU instance memory via dma_alloc_attrs(). However, nvkm_device_tegra_new() only calls dma_set_mask(&pdev->dev, DMA_BIT_MASK(func->dma_bits)) instead of dma_set_mask_and_coherent(), leaving pdev->dev.coherent_dma_mask at the default 32-bit mask and constraining dma_alloc_attrs() allocations to 32-bit addresses. > + > static const struct of_device_id nouveau_platform_match[] = { > { > .compatible = "nvidia,gk20a", > @@ -91,6 +95,10 @@ static const struct of_device_id nouveau_platform_match[] > = { > .compatible = "nvidia,gp10b", > .data = &gp10b_platform_data, > }, > + { > + .compatible = "nvidia,gv11b", > + .data = &gv11b_platform_data, > + }, > { } > }; [Severity: High] Will probing GV11B cause nouveau_mem_host() to strip mem->kind to 0 on every tiled buffer object? The nvidia,gv11b node in tegra194.dtsi carries dma-coherent, so nvkm_device_tegra_new() sets tdev->device.cpu_coherent = true. In nvkm_mmu_host(), the coherent cached host memory type is registered with NVKM_MEM_KIND cleared: drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c:nvkm_mmu_host() { ... type |= NVKM_MEM_COHERENT; if (device->cpu_coherent) nvkm_mmu_type(mmu, heap, type & ~NVKM_MEM_KIND); } Because that type becomes drm->ttm.type_host[0] without NVIF_MEM_UNCACHED, nouveau_drm_use_coherent_gpu_mapping(drm) returns true on GV11B. nouveau_mem_host() then selects drm->ttm.type_host[0] regardless of mem->kind and clears mem->kind because type_host[0] lacks NVIF_MEM_KIND: drivers/gpu/drm/nouveau/nouveau_mem.c:nouveau_mem_host() { ... if (!nouveau_drm_use_coherent_gpu_mapping(drm)) type = drm->ttm.type_ncoh[!!mem->kind]; else type = drm->ttm.type_host[0]; if (mem->kind && !(mmu->type[type].type & NVIF_MEM_KIND)) mem->comp = mem->kind = 0; ... } All GEM buffers on GV11B live in system memory, so block-linear tiled surfaces will be mapped into the GPU VMM as pitch-linear (kind 0), breaking tiled rendering. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=19
