<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:#0000FF;margin:5pt;" align="Left">
[AMD Official Use Only]<br>
</p>
<br>
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
ping...</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
add <a id="OWAAM160069" class="P8b7u5KH31KY6Eljcf5yw mention ms-bgc-nlr ms-fcl-b" href="mailto:Monk.Liu@amd.com">
@Liu, Monk</a> <a id="OWAAM254265" class="P8b7u5KH31KY6Eljcf5yw mention ms-bgc-nlr ms-fcl-b" href="mailto:Christian.Koenig@amd.com">@Koenig, Christian</a> <a id="OWAAM277931" class="P8b7u5KH31KY6Eljcf5yw mention ms-bgc-nlr ms-fcl-b" href="mailto:Alexander.Deucher@amd.com">@Deucher,
Alexander</a></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Best Regards,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Kevin</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Wang, Yang(Kevin) <KevinYang.Wang@amd.com><br>
<b>Sent:</b> Wednesday, January 19, 2022 11:16 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Min, Frank <Frank.Min@amd.com>; Chen, Horace <Horace.Chen@amd.com>; Wang, Yang(Kevin) <KevinYang.Wang@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu: force using sdma to update vm page table when mmio is blocked</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">when mmio protection feature is enabled in hypervisor,<br>
it will cause guest OS can't R/W HDP regiters,<br>
and using cpu to update page table is not working well.<br>
<br>
force using sdma to update page table when mmio is blocked.<br>
<br>
Signed-off-by: Yang Wang <KevinYang.Wang@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++++++<br>
1 file changed, 7 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
index b23cb463b106..0f86f0b2e183 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c<br>
@@ -2959,6 +2959,9 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)<br>
vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &<br>
AMDGPU_VM_USE_CPU_FOR_GFX);<br>
<br>
+ if (vm->use_cpu_for_update && amdgpu_sriov_vf(adev) && amdgpu_virt_mmio_blocked(adev))<br>
+ vm->use_cpu_for_update = false;<br>
+<br>
DRM_DEBUG_DRIVER("VM update mode is %s\n",<br>
vm->use_cpu_for_update ? "CPU" : "SDMA");<br>
WARN_ONCE((vm->use_cpu_for_update &&<br>
@@ -3094,6 +3097,10 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm)<br>
/* Update VM state */<br>
vm->use_cpu_for_update = !!(adev->vm_manager.vm_update_mode &<br>
AMDGPU_VM_USE_CPU_FOR_COMPUTE);<br>
+<br>
+ if (vm->use_cpu_for_update && amdgpu_sriov_vf(adev) && amdgpu_virt_mmio_blocked(adev))<br>
+ vm->use_cpu_for_update = false;<br>
+<br>
DRM_DEBUG_DRIVER("VM update mode is %s\n",<br>
vm->use_cpu_for_update ? "CPU" : "SDMA");<br>
WARN_ONCE((vm->use_cpu_for_update &&<br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>