drm/amdgpu: Fix KFD-related kernel oops on Hawaii
authorFelix Kuehling <Felix.Kuehling@amd.com>
Thu, 5 Sep 2019 23:22:02 +0000 (19:22 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Oct 2019 16:21:16 +0000 (18:21 +0200)
[ Upstream commit dcafbd50f2e4d5cc964aae409fb5691b743fba23 ]

Hawaii needs to flush caches explicitly, submitting an IB in a user
VMID from kernel mode. There is no s_fence in this case.

Fixes: eb3961a57424 ("drm/amdgpu: remove fence context from the job")
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c

index 51b5e97..f4e9d1b 100644 (file)
@@ -139,7 +139,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
        /* ring tests don't use a job */
        if (job) {
                vm = job->vm;
-               fence_ctx = job->base.s_fence->scheduled.context;
+               fence_ctx = job->base.s_fence ?
+                       job->base.s_fence->scheduled.context : 0;
        } else {
                vm = NULL;
                fence_ctx = 0;