Skip to contentSkip to conversation

drm/amdgpu: Remove writing GRBM_GFX_CNTL in RLCG interface under SRIOV

PATCH In review Yifan Zha 2 participants 2 messages Feb 1, 2023

Subsystems (2)
lore
Share & tools
lore

Yifan Zha

author
#0 lore raw

PATCH v2 1/1 drm/amdgpu: Remove writing GRBM_GFX_CNTL in RLCG interface under SRIOV

[Why]
Accessing GRBM_GFX_CNTL in full access time has risk when VF is doing MMIO attacking. Therefore, VF writing GRBM_GFX_CNTL are blocked by L1 Policy.
For RLCG interface, RLCG use SCRATCH_REG2 which is copied from GRBM_GFX_CNTL.

[How]
Remove writing GRBM_GFX_CNTL in amdgpu_virt_rlcg_reg_rw.

v2:
Remove directly writing GRBM_GFX_INDEX in amdgpu_virt_rlcg_reg_rw as RLCG interface no need to use it.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0 -2
index f39391e03d46..ca5a1d026f5a 100644
@@ -983,11 +983,9 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v
 	if (offset == reg_access_ctrl->grbm_cntl) {
 		/* if the target reg offset is grbm_cntl, write to scratch_reg2 */
 		writel(v, scratch_reg2);
-		writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));
 	} else if (offset == reg_access_ctrl->grbm_idx) {
 		/* if the target reg offset is grbm_idx, write to scratch_reg3 */
 		writel(v, scratch_reg3);
-		writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));
 	} else {
 		/*
 		 * SCRATCH_REG0 	= read/write value
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#1 lore raw

[AMD Official Use Only - General]

Regards,
Hawking
From: Yifan Zha <[email protected]>
Date: Wednesday, February 1, 2023 at 13:15
To: [email protected] <[email protected]>, Deucher, Alexander <[email protected]>, Zhang, Hawking <[email protected]>
Cc: Chen, Horace <[email protected]>, Chang, HaiJun <[email protected]>, Zha, YiFan(Even) <[email protected]>
Subject: [PATCH v2] drm/amdgpu: Remove writing GRBM_GFX_CNTL in RLCG interface under SRIOV
[Why]
Accessing GRBM_GFX_CNTL in full access time has risk when VF is doing MMIO attacking.
Therefore, VF writing GRBM_GFX_CNTL are blocked by L1 Policy.
For RLCG interface, RLCG use SCRATCH_REG2 which is copied from GRBM_GFX_CNTL.

[How]
Remove writing GRBM_GFX_CNTL in amdgpu_virt_rlcg_reg_rw.

v2:
Remove directly writing GRBM_GFX_INDEX in amdgpu_virt_rlcg_reg_rw as RLCG interface no need to use it.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0 -2
index f39391e03d46..ca5a1d026f5a 100644
@@ -983,11 +983,9 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v
         if (offset == reg_access_ctrl->grbm_cntl) {
                 /* if the target reg offset is grbm_cntl, write to scratch_reg2 */
                 writel(v, scratch_reg2);
-               writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));
         } else if (offset == reg_access_ctrl->grbm_idx) {
                 /* if the target reg offset is grbm_idx, write to scratch_reg3 */
                 writel(v, scratch_reg3);
-               writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));
         } else {
                 /*
                  * SCRATCH_REG0   = read/write value

--
2.25.1