FAILED: patch "[PATCH] drm/amdgpu: fix check in gmc_v9_0_get_vm_pte()" failed to apply to 6.6-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 0e5ac88fb918297a7484b67f2b484d43bed3fbbe
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024111738-jalapeno-unknown-3db3@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 0e5ac88fb918297a7484b67f2b484d43bed3fbbe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <[email protected]>
Date: Thu, 31 Oct 2024 10:04:17 +0100
Subject: [PATCH] drm/amdgpu: fix check in gmc_v9_0_get_vm_pte()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The coherency flags can only be determined when the BO is locked and that in turn is only guaranteed when the mapping is validated.
Fix the check, move the resource check into the function and add an assert that the BO is locked.
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +8 -5
@@ -1124,8 +1124,10 @@ static void gmc_v9_0_get_coherence_flags(struct amdgpu_device *adev, uint64_t *flags) {struct amdgpu_device *bo_adev =amdgpu_ttm_adev (bo->tbo.bdev); -bool is_vram = bo->tbo.resource->mem_type ==TTM_PL_VRAM ; -bool coherent = bo->flags & (AMDGPU_GEM_CREATE_COHERENT |AMDGPU_GEM_CREATE_EXT_COHERENT ); +bool is_vram = bo->tbo.resource && + bo->tbo.resource->mem_type ==TTM_PL_VRAM ; +bool coherent = bo->flags & (AMDGPU_GEM_CREATE_COHERENT | +AMDGPU_GEM_CREATE_EXT_COHERENT );bool ext_coherent = bo->flags &AMDGPU_GEM_CREATE_EXT_COHERENT ;bool uncached = bo->flags &AMDGPU_GEM_CREATE_UNCACHED ;struct amdgpu_vm *vm = mapping->bo_va->base.vm;
@@ -1133,6 +1135,8 @@ static void gmc_v9_0_get_coherence_flags(struct amdgpu_device *adev,bool snoop = false;bool is_local; +dma_resv_assert_held (bo->tbo.base.resv); +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (9 ,4 ,1 ):case IP_VERSION (9 ,4 ,2 ):
@@ -1251,9 +1255,8 @@ static void gmc_v9_0_get_vm_pte(struct amdgpu_device *adev, *flags &= ~AMDGPU_PTE_VALID ; } -if (bo && bo->tbo.resource) -gmc_v9_0_get_coherence_flags (adev, mapping->bo_va->base.bo, - mapping, flags); +if ((*flags &AMDGPU_PTE_VALID ) && bo) +gmc_v9_0_get_coherence_flags (adev, bo, mapping, flags); } static void gmc_v9_0_override_vm_pte_flags(struct amdgpu_device *adev,