AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yunxiang Li <Yunxiang.Li@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Alexander.Deucher@amd.com>, <christian.koenig@amd.com>,
	Yunxiang Li <Yunxiang.Li@amd.com>
Subject: [PATCH v4 1/9] drm/amdgpu: add skip_hw_access checks for sriov
Date: Tue, 4 Jun 2024 21:33:10 -0400	[thread overview]
Message-ID: <20240605013318.11260-2-Yunxiang.Li@amd.com> (raw)
In-Reply-To: <20240605013318.11260-1-Yunxiang.Li@amd.com>

Accessing registers via host is missing the check for skip_hw_access and
the lockdep check that comes with it.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 3d5f58e76f2d..3cf8416f8cb0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -977,6 +977,9 @@ u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 f
 		return 0;
 	}
 
+	if (amdgpu_device_skip_hw_access(adev))
+		return 0;
+
 	reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl[xcc_id];
 	scratch_reg0 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg0;
 	scratch_reg1 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg1;
@@ -1047,6 +1050,9 @@ void amdgpu_sriov_wreg(struct amdgpu_device *adev,
 {
 	u32 rlcg_flag;
 
+	if (amdgpu_device_skip_hw_access(adev))
+		return;
+
 	if (!amdgpu_sriov_runtime(adev) &&
 		amdgpu_virt_get_rlcg_reg_access_flag(adev, acc_flags, hwip, true, &rlcg_flag)) {
 		amdgpu_virt_rlcg_reg_rw(adev, offset, value, rlcg_flag, xcc_id);
@@ -1064,6 +1070,9 @@ u32 amdgpu_sriov_rreg(struct amdgpu_device *adev,
 {
 	u32 rlcg_flag;
 
+	if (amdgpu_device_skip_hw_access(adev))
+		return 0;
+
 	if (!amdgpu_sriov_runtime(adev) &&
 		amdgpu_virt_get_rlcg_reg_access_flag(adev, acc_flags, hwip, false, &rlcg_flag))
 		return amdgpu_virt_rlcg_reg_rw(adev, offset, 0, rlcg_flag, xcc_id);
-- 
2.34.1


  reply	other threads:[~2024-06-05  1:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  1:33 [PATCH v4 0/9] drm/amdgpu: prevent concurrent GPU access during reset Yunxiang Li
2024-06-05  1:33 ` Yunxiang Li [this message]
2024-06-05  1:33 ` [PATCH v4 2/9] drm/amdgpu: fix sriov host flr handler Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 3/9] drm/amdgpu/kfd: remove is_hws_hang and is_resetting Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 4/9] drm/amdgpu: remove tlb flush in amdgpu_gtt_mgr_recover Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 5/9] drm/amdgpu: use helper in amdgpu_gart_unbind Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 6/9] drm/amdgpu: call flush_gpu_tlb directly in gfxhub enable Yunxiang Li
2024-06-05  8:00   ` Christian König
2024-06-05  1:33 ` [PATCH v4 7/9] drm/amdgpu: fix locking scope when flushing tlb Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 8/9] drm/amdgpu: add lock in amdgpu_gart_invalidate_tlb Yunxiang Li
2024-06-05  1:33 ` [PATCH v4 9/9] drm/amdgpu: add lock in kfd_process_dequeue_from_device Yunxiang Li
2024-06-06 19:01   ` Felix Kuehling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240605013318.11260-2-Yunxiang.Li@amd.com \
    --to=yunxiang.li@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox