<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">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Can you update nv.c as well?  With that fixed,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-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 Monk Liu <Monk.Liu@amd.com><br>
<b>Sent:</b> Tuesday, August 27, 2019 4:34 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Liu, Monk <Monk.Liu@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu: introduce vram lost for reset</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">for SOC15/vega10 the BACO reset & mode1 would introduce vram lost<br>
in high end address range, current kmd's vram lost checking cannot<br>
catch it since it only check very ahead visible frame buffer<br>
<br>
Signed-off-by: Monk Liu <Monk.Liu@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 1 +<br>
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++--<br>
 drivers/gpu/drm/amd/amdgpu/soc15.c         | 2 ++<br>
 3 files changed, 5 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
index f6ae565..11e0fc0 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
@@ -1155,6 +1155,7 @@ int emu_soc_asic_init(struct amdgpu_device *adev);<br>
 #define amdgpu_asic_get_pcie_usage(adev, cnt0, cnt1) ((adev)->asic_funcs->get_pcie_usage((adev), (cnt0), (cnt1)))<br>
 #define amdgpu_asic_need_reset_on_init(adev) (adev)->asic_funcs->need_reset_on_init((adev))<br>
 #define amdgpu_asic_get_pcie_replay_count(adev) ((adev)->asic_funcs->get_pcie_replay_count((adev)))<br>
+#define amdgpu_inc_vram_lost(adev) atomic_inc(&((adev)->vram_lost_counter));<br>
 <br>
 /* Common functions */<br>
 bool amdgpu_device_should_recover_gpu(struct amdgpu_device *adev);<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
index 02b3e7d..31690e9 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -3482,7 +3482,7 @@ static int amdgpu_device_reset_sriov(struct amdgpu_device *adev,<br>
         amdgpu_virt_init_data_exchange(adev);<br>
         amdgpu_virt_release_full_gpu(adev, true);<br>
         if (!r && adev->virt.gim_feature & AMDGIM_FEATURE_GIM_FLR_VRAMLOST) {<br>
-               atomic_inc(&adev->vram_lost_counter);<br>
+               amdgpu_inc_vram_lost(adev);<br>
                 r = amdgpu_device_recover_vram(adev);<br>
         }<br>
 <br>
@@ -3648,7 +3648,7 @@ static int amdgpu_do_asic_reset(struct amdgpu_hive_info *hive,<br>
                                 vram_lost = amdgpu_device_check_vram_lost(tmp_adev);<br>
                                 if (vram_lost) {<br>
                                         DRM_INFO("VRAM is lost due to GPU reset!\n");<br>
-                                       atomic_inc(&tmp_adev->vram_lost_counter);<br>
+                                       amdgpu_inc_vram_lost(tmp_adev);<br>
                                 }<br>
 <br>
                                 r = amdgpu_gtt_mgr_recover(<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
index fe2212df..8af7501 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c<br>
@@ -557,10 +557,12 @@ static int soc15_asic_reset(struct amdgpu_device *adev)<br>
 {<br>
         switch (soc15_asic_reset_method(adev)) {<br>
                 case AMD_RESET_METHOD_BACO:<br>
+                       amdgpu_inc_vram_lost(adev);<br>
                         return soc15_asic_baco_reset(adev);<br>
                 case AMD_RESET_METHOD_MODE2:<br>
                         return soc15_mode2_reset(adev);<br>
                 default:<br>
+                       amdgpu_inc_vram_lost(adev);<br>
                         return soc15_asic_mode1_reset(adev);<br>
         }<br>
 }<br>
-- <br>
2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
</span></font></div>
</body>
</html>