From 1cbeaaa474df5320c4c2de489a943ce30db568e0 Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 18 Aug 2022 00:41:20 +0000 Subject: [PATCH] drm/amdgpu: Check BO's requested pinning domains against its preferred_domains From Leo Li eb3c69c7c777d9d3c016568cb062ef02197a5a4e in linux 5.15.y/5.15.61 f5ba14043621f4afdf3ad5f92ee2d8dbebbe4340 in mainline linux --- sys/dev/pci/drm/amd/amdgpu/amdgpu_object.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_object.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_object.c index b5c67fbb6f6..54b498d5bba 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_object.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_object.c @@ -914,6 +914,10 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, if (WARN_ON_ONCE(min_offset > max_offset)) return -EINVAL; + /* Check domain to be pinned to against preferred domains */ + if (bo->preferred_domains & domain) + domain = bo->preferred_domains & domain; + /* A shared bo cannot be migrated to VRAM */ if (bo->tbo.base.import_attach) { if (domain & AMDGPU_GEM_DOMAIN_GTT) -- 2.20.1