<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:10.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="en-CN" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;" align="Left">
[AMD Official Use Only - General]<br>
</p>
<br>
<div>
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Regards,<br>
Hawking<o:p></o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Yifan Zha <Yifan.Zha@amd.com><br>
<b>Date: </b>Wednesday, February 1, 2023 at 13:15<br>
<b>To: </b>amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>, Deucher, Alexander <Alexander.Deucher@amd.com>, Zhang, Hawking <Hawking.Zhang@amd.com><br>
<b>Cc: </b>Chen, Horace <Horace.Chen@amd.com>, Chang, HaiJun <HaiJun.Chang@amd.com>, Zha, YiFan(Even) <Yifan.Zha@amd.com><br>
<b>Subject: </b>[PATCH v2] drm/amdgpu: Remove writing GRBM_GFX_CNTL in RLCG interface under SRIOV<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt">[Why]<br>
Accessing GRBM_GFX_CNTL in full access time has risk when VF is doing MMIO attacking.<br>
Therefore, VF writing GRBM_GFX_CNTL are blocked by L1 Policy.<br>
For RLCG interface, RLCG use SCRATCH_REG2 which is copied from GRBM_GFX_CNTL.<br>
<br>
[How]<br>
Remove writing GRBM_GFX_CNTL in amdgpu_virt_rlcg_reg_rw.<br>
<br>
v2:<br>
Remove directly writing GRBM_GFX_INDEX in amdgpu_virt_rlcg_reg_rw<br>
as RLCG interface no need to use it.<br>
<br>
Signed-off-by: Yifan Zha <Yifan.Zha@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 --<br>
 1 file changed, 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c<br>
index f39391e03d46..ca5a1d026f5a 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c<br>
@@ -983,11 +983,9 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v<br>
         if (offset == reg_access_ctrl->grbm_cntl) {<br>
                 /* if the target reg offset is grbm_cntl, write to scratch_reg2 */<br>
                 writel(v, scratch_reg2);<br>
-               writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));<br>
         } else if (offset == reg_access_ctrl->grbm_idx) {<br>
                 /* if the target reg offset is grbm_idx, write to scratch_reg3 */<br>
                 writel(v, scratch_reg3);<br>
-               writel(v, ((void __iomem *)adev->rmmio) + (offset * 4));<br>
         } else {<br>
                 /*<br>
                  * SCRATCH_REG0   = read/write value<br>
-- <br>
2.25.1<o:p></o:p></span></p>
</div>
</div>
</div>
</body>
</html>