<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#317100;margin:15pt;" align="Left">
[AMD Public Use]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Zhou, Tiecheng <Tiecheng.Zhou@amd.com><br>
<b>Sent:</b> Tuesday, March 3, 2020 6:04 AM<br>
<b>To:</b> Zhou, Tiecheng <Tiecheng.Zhou@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> RE: [PATCH] drm/amdgpu/sriov: skip programing some regs with new L1 policy</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">[AMD Official Use Only - Internal Distribution Only]<br>
<br>
Ping<br>
<br>
-----Original Message-----<br>
From: Tiecheng Zhou <Tiecheng.Zhou@amd.com> <br>
Sent: Monday, March 2, 2020 3:08 PM<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Zhou, Tiecheng <Tiecheng.Zhou@amd.com><br>
Subject: [PATCH] drm/amdgpu/sriov: skip programing some regs with new L1 policy<br>
<br>
With new L1 policy, some regs are blocked at guest and they are programed at host side. So skip programing the regs under sriov.<br>
<br>
the regs are:<br>
GCMC_VM_FB_LOCATION_TOP<br>
GCMC_VM_FB_LOCATION_BASE<br>
MMMC_VM_FB_LOCATION_TOP<br>
MMMC_VM_FB_LOCATION_BASE<br>
GCMC_VM_SYSTEM_APERTURE_HIGH_ADDR<br>
GCMC_VM_SYSTEM_APERTURE_LOW_ADDR<br>
MMMC_VM_SYSTEM_APERTURE_HIGH_ADDR<br>
MMMC_VM_SYSTEM_APERTURE_LOW_ADDR<br>
HDP_NONSURFACE_BASE<br>
HDP_NONSURFACE_BASE_HI<br>
GCMC_VM_AGP_TOP<br>
GCMC_VM_AGP_BOT<br>
GCMC_VM_AGP_BASE<br>
<br>
Signed-off-by: Tiecheng Zhou <Tiecheng.Zhou@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c | 55 +++++++++++------------- drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c | 29 ++++++-------<br>
2 files changed, 37 insertions(+), 47 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c<br>
index e0654a216ab5..cc866c367939 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v2_0.c<br>
@@ -81,24 +81,31 @@ static void gfxhub_v2_0_init_system_aperture_regs(struct amdgpu_device *adev) {<br>
uint64_t value;<br>
<br>
- /* Disable AGP. */<br>
- WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_BASE, 0);<br>
- WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_TOP, 0);<br>
- WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_BOT, 0x00FFFFFF);<br>
-<br>
- /* Program the system aperture low logical page number. */<br>
- WREG32_SOC15(GC, 0, mmGCMC_VM_SYSTEM_APERTURE_LOW_ADDR,<br>
- adev->gmc.vram_start >> 18);<br>
- WREG32_SOC15(GC, 0, mmGCMC_VM_SYSTEM_APERTURE_HIGH_ADDR,<br>
- adev->gmc.vram_end >> 18);<br>
-<br>
- /* Set default page address. */<br>
- value = adev->vram_scratch.gpu_addr - adev->gmc.vram_start<br>
- + adev->vm_manager.vram_base_offset;<br>
- WREG32_SOC15(GC, 0, mmGCMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB,<br>
- (u32)(value >> 12));<br>
- WREG32_SOC15(GC, 0, mmGCMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB,<br>
- (u32)(value >> 44));<br>
+ if (!amdgpu_sriov_vf(adev)) {<br>
+ /*<br>
+ * the new L1 policy will block SRIOV guest from writing<br>
+ * these regs, and they will be programed at host.<br>
+ * so skip programing these regs.<br>
+ */<br>
+ /* Disable AGP. */<br>
+ WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_BASE, 0);<br>
+ WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_TOP, 0);<br>
+ WREG32_SOC15(GC, 0, mmGCMC_VM_AGP_BOT, 0x00FFFFFF);<br>
+<br>
+ /* Program the system aperture low logical page number. */<br>
+ WREG32_SOC15(GC, 0, mmGCMC_VM_SYSTEM_APERTURE_LOW_ADDR,<br>
+ adev->gmc.vram_start >> 18);<br>
+ WREG32_SOC15(GC, 0, mmGCMC_VM_SYSTEM_APERTURE_HIGH_ADDR,<br>
+ adev->gmc.vram_end >> 18);<br>
+<br>
+ /* Set default page address. */<br>
+ value = adev->vram_scratch.gpu_addr - adev->gmc.vram_start<br>
+ + adev->vm_manager.vram_base_offset;<br>
+ WREG32_SOC15(GC, 0, mmGCMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_LSB,<br>
+ (u32)(value >> 12));<br>
+ WREG32_SOC15(GC, 0, mmGCMC_VM_SYSTEM_APERTURE_DEFAULT_ADDR_MSB,<br>
+ (u32)(value >> 44));<br>
+ }<br>
<br>
/* Program "protection fault". */<br>
WREG32_SOC15(GC, 0, mmGCVM_L2_PROTECTION_FAULT_DEFAULT_ADDR_LO32,<br>
@@ -260,18 +267,6 @@ static void gfxhub_v2_0_program_invalidation(struct amdgpu_device *adev)<br>
<br>
int gfxhub_v2_0_gart_enable(struct amdgpu_device *adev) {<br>
- if (amdgpu_sriov_vf(adev)) {<br>
- /*<br>
- * GCMC_VM_FB_LOCATION_BASE/TOP is NULL for VF, becuase they are<br>
- * VF copy registers so vbios post doesn't program them, for<br>
- * SRIOV driver need to program them<br>
- */<br>
- WREG32_SOC15(GC, 0, mmGCMC_VM_FB_LOCATION_BASE,<br>
- adev->gmc.vram_start >> 24);<br>
- WREG32_SOC15(GC, 0, mmGCMC_VM_FB_LOCATION_TOP,<br>
- adev->gmc.vram_end >> 24);<br>
- }<br>
-<br>
/* GART Enable. */<br>
gfxhub_v2_0_init_gart_aperture_regs(adev);<br>
gfxhub_v2_0_init_system_aperture_regs(adev);<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c<br>
index bde189680521..fb3f228458e5 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c<br>
@@ -72,11 +72,18 @@ static void mmhub_v2_0_init_system_aperture_regs(struct amdgpu_device *adev)<br>
WREG32_SOC15(MMHUB, 0, mmMMMC_VM_AGP_TOP, 0);<br>
WREG32_SOC15(MMHUB, 0, mmMMMC_VM_AGP_BOT, 0x00FFFFFF);<br>
<br>
- /* Program the system aperture low logical page number. */<br>
- WREG32_SOC15(MMHUB, 0, mmMMMC_VM_SYSTEM_APERTURE_LOW_ADDR,<br>
- adev->gmc.vram_start >> 18);<br>
- WREG32_SOC15(MMHUB, 0, mmMMMC_VM_SYSTEM_APERTURE_HIGH_ADDR,<br>
- adev->gmc.vram_end >> 18);<br>
+ if (!amdgpu_sriov_vf(adev)) {<br>
+ /*<br>
+ * the new L1 policy will block SRIOV guest from writing<br>
+ * these regs, and they will be programed at host.<br>
+ * so skip programing these regs.<br>
+ */<br>
+ /* Program the system aperture low logical page number. */<br>
+ WREG32_SOC15(MMHUB, 0, mmMMMC_VM_SYSTEM_APERTURE_LOW_ADDR,<br>
+ adev->gmc.vram_start >> 18);<br>
+ WREG32_SOC15(MMHUB, 0, mmMMMC_VM_SYSTEM_APERTURE_HIGH_ADDR,<br>
+ adev->gmc.vram_end >> 18);<br>
+ }<br>
<br>
/* Set default page address. */<br>
value = adev->vram_scratch.gpu_addr - adev->gmc.vram_start + @@ -247,18 +254,6 @@ static void mmhub_v2_0_program_invalidation(struct amdgpu_device *adev)<br>
<br>
int mmhub_v2_0_gart_enable(struct amdgpu_device *adev) {<br>
- if (amdgpu_sriov_vf(adev)) {<br>
- /*<br>
- * MMMC_VM_FB_LOCATION_BASE/TOP is NULL for VF, becuase they are<br>
- * VF copy registers so vbios post doesn't program them, for<br>
- * SRIOV driver need to program them<br>
- */<br>
- WREG32_SOC15(MMHUB, 0, mmMMMC_VM_FB_LOCATION_BASE,<br>
- adev->gmc.vram_start >> 24);<br>
- WREG32_SOC15(MMHUB, 0, mmMMMC_VM_FB_LOCATION_TOP,<br>
- adev->gmc.vram_end >> 24);<br>
- }<br>
-<br>
/* GART Enable. */<br>
mmhub_v2_0_init_gart_aperture_regs(adev);<br>
mmhub_v2_0_init_system_aperture_regs(adev);<br>
--<br>
2.17.1<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Calexander.deucher%40amd.com%7C5c67ab87ec474567746608d7bf62b5ce%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637188303458046365&sdata=xQ%2Fx7i5LhvDFFZ%2BOJzhJYPr0TbHLpUW4NrbBxvcvyaE%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Calexander.deucher%40amd.com%7C5c67ab87ec474567746608d7bf62b5ce%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637188303458046365&sdata=xQ%2Fx7i5LhvDFFZ%2BOJzhJYPr0TbHLpUW4NrbBxvcvyaE%3D&reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>