]> git.dujemihanovic.xyz Git - linux.git/commitdiff
drm/amdgpu: Disable dpm_enabled flag while VF is in reset
authorVictor Skvortsov <victor.skvortsov@amd.com>
Thu, 8 Aug 2024 17:22:34 +0000 (13:22 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 13 Aug 2024 16:12:52 +0000 (12:12 -0400)
VFs do not perform HW fini/suspend in FLR, so the dpm_enabled
is incorrectly kept enabled. Add interface to disable it in
virt_pre_reset call.

v2: Made implementation generic for all asics
v3: Re-order conditionals so PP_MP1_STATE_FLR is only evaluated on VF

Signed-off-by: Victor Skvortsov <victor.skvortsov@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
drivers/gpu/drm/amd/include/kgd_pp_interface.h
drivers/gpu/drm/amd/pm/amdgpu_dpm.c

index 29a4adee92864a1dbd4faae6e06c1706f2d01707..a6b8d0ba4758c8dbf3847fda9c7b90527e54f59c 100644 (file)
@@ -5289,10 +5289,8 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
        if (reset_context->reset_req_dev == adev)
                job = reset_context->job;
 
-       if (amdgpu_sriov_vf(adev)) {
-               /* stop the data exchange thread */
-               amdgpu_virt_fini_data_exchange(adev);
-       }
+       if (amdgpu_sriov_vf(adev))
+               amdgpu_virt_pre_reset(adev);
 
        amdgpu_fence_driver_isr_toggle(adev, true);
 
index b287a82e6177e9b3614595ada9eba8f721fc1363..b6397d3229e1ba10f1cabd80c4c42c90c0aaca00 100644 (file)
@@ -33,6 +33,7 @@
 #include "amdgpu.h"
 #include "amdgpu_ras.h"
 #include "amdgpu_reset.h"
+#include "amdgpu_dpm.h"
 #include "vi.h"
 #include "soc15.h"
 #include "nv.h"
@@ -849,6 +850,13 @@ enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode(struct amdgpu_device *ad
        return mode;
 }
 
+void amdgpu_virt_pre_reset(struct amdgpu_device *adev)
+{
+       /* stop the data exchange thread */
+       amdgpu_virt_fini_data_exchange(adev);
+       amdgpu_dpm_set_mp1_state(adev, PP_MP1_STATE_FLR);
+}
+
 void amdgpu_virt_post_reset(struct amdgpu_device *adev)
 {
        if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(11, 0, 3)) {
index b42a8854dca0cb3a9f1d56e3bac1438a0c7717d6..b650a2032c42bd8ebbea3522056f8c1568512811 100644 (file)
@@ -376,6 +376,7 @@ u32 amdgpu_sriov_rreg(struct amdgpu_device *adev,
                      u32 offset, u32 acc_flags, u32 hwip, u32 xcc_id);
 bool amdgpu_virt_fw_load_skip_check(struct amdgpu_device *adev,
                        uint32_t ucode_id);
+void amdgpu_virt_pre_reset(struct amdgpu_device *adev);
 void amdgpu_virt_post_reset(struct amdgpu_device *adev);
 bool amdgpu_sriov_xnack_support(struct amdgpu_device *adev);
 bool amdgpu_virt_get_rlcg_reg_access_flag(struct amdgpu_device *adev,
index 4b20e227431354524c29dd90fbf95c7b69545d8a..19a48d98830a393d3212b62ea8ae56456c517921 100644 (file)
@@ -218,6 +218,7 @@ enum pp_mp1_state {
        PP_MP1_STATE_SHUTDOWN,
        PP_MP1_STATE_UNLOAD,
        PP_MP1_STATE_RESET,
+       PP_MP1_STATE_FLR,
 };
 
 enum pp_df_cstate {
index 8b7d6ed7e2ed235af9dcff50f14bb2f3996803dc..9dc82f4d7c937aa6e021db4212d8deed025c4fbf 100644 (file)
@@ -168,7 +168,11 @@ int amdgpu_dpm_set_mp1_state(struct amdgpu_device *adev,
        int ret = 0;
        const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
 
-       if (pp_funcs && pp_funcs->set_mp1_state) {
+       if (mp1_state == PP_MP1_STATE_FLR) {
+               /* VF lost access to SMU */
+               if (amdgpu_sriov_vf(adev))
+                       adev->pm.dpm_enabled = false;
+       } else if (pp_funcs && pp_funcs->set_mp1_state) {
                mutex_lock(&adev->pm.mutex);
 
                ret = pp_funcs->set_mp1_state(