Skip to content

Commit 69ada05

Browse files
alexdeuchergregkh
authored andcommitted
drm/amdgpu/gfx11: adjust KGQ reset sequence
[ Upstream commit 3eb46fb ] Kernel gfx queues do not need to be reinitialized or remapped after a reset. This fixes queue reset failures on APUs. v2: preserve init and remap for MMIO case. Fixes: b3e9bfd ("drm/amdgpu/gfx11: add ring reset callbacks") Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4789 Reviewed-by: Timur Kristóf <timur.kristof@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit b340ff2) Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 76ee199 commit 69ada05

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6568,36 +6568,39 @@ static void gfx_v11_0_emit_mem_sync(struct amdgpu_ring *ring)
65686568
static int gfx_v11_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)
65696569
{
65706570
struct amdgpu_device *adev = ring->adev;
6571+
bool use_mmio = false;
65716572
int r;
65726573

65736574
if (amdgpu_sriov_vf(adev))
65746575
return -EINVAL;
65756576

6576-
r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, false);
6577+
r = amdgpu_mes_reset_legacy_queue(ring->adev, ring, vmid, use_mmio);
65776578
if (r)
65786579
return r;
65796580

6580-
r = amdgpu_bo_reserve(ring->mqd_obj, false);
6581-
if (unlikely(r != 0)) {
6582-
dev_err(adev->dev, "fail to resv mqd_obj\n");
6583-
return r;
6584-
}
6585-
r = amdgpu_bo_kmap(ring->mqd_obj, (void **)&ring->mqd_ptr);
6586-
if (!r) {
6587-
r = gfx_v11_0_kgq_init_queue(ring, true);
6588-
amdgpu_bo_kunmap(ring->mqd_obj);
6589-
ring->mqd_ptr = NULL;
6590-
}
6591-
amdgpu_bo_unreserve(ring->mqd_obj);
6592-
if (r) {
6593-
dev_err(adev->dev, "fail to unresv mqd_obj\n");
6594-
return r;
6595-
}
6581+
if (use_mmio) {
6582+
r = amdgpu_bo_reserve(ring->mqd_obj, false);
6583+
if (unlikely(r != 0)) {
6584+
dev_err(adev->dev, "fail to resv mqd_obj\n");
6585+
return r;
6586+
}
6587+
r = amdgpu_bo_kmap(ring->mqd_obj, (void **)&ring->mqd_ptr);
6588+
if (!r) {
6589+
r = gfx_v11_0_kgq_init_queue(ring, true);
6590+
amdgpu_bo_kunmap(ring->mqd_obj);
6591+
ring->mqd_ptr = NULL;
6592+
}
6593+
amdgpu_bo_unreserve(ring->mqd_obj);
6594+
if (r) {
6595+
dev_err(adev->dev, "fail to unresv mqd_obj\n");
6596+
return r;
6597+
}
65966598

6597-
r = amdgpu_mes_map_legacy_queue(adev, ring);
6598-
if (r) {
6599-
dev_err(adev->dev, "failed to remap kgq\n");
6600-
return r;
6599+
r = amdgpu_mes_map_legacy_queue(adev, ring);
6600+
if (r) {
6601+
dev_err(adev->dev, "failed to remap kgq\n");
6602+
return r;
6603+
}
66016604
}
66026605

66036606
return amdgpu_ring_test_ring(ring);

0 commit comments

Comments
 (0)