drm/amdgpu/swsmu: init the baco mutex in early_init
authorAlex Deucher <alexander.deucher@amd.com>
Mon, 12 Oct 2020 14:12:28 +0000 (10:12 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 14 Oct 2020 19:13:34 +0000 (15:13 -0400)
GPU reset might get called during init time, before
sw_init has been called.

Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c

index f78749b..7e1b303 100644 (file)
@@ -422,6 +422,9 @@ static int smu_early_init(void *handle)
        smu->pm_enabled = !!amdgpu_dpm;
        smu->is_apu = false;
        mutex_init(&smu->mutex);
+       mutex_init(&smu->smu_baco.mutex);
+       smu->smu_baco.state = SMU_BACO_STATE_EXIT;
+       smu->smu_baco.platform_support = false;
 
        return smu_set_funcs(adev);
 }
@@ -803,10 +806,6 @@ static int smu_sw_init(void *handle)
        bitmap_zero(smu->smu_feature.enabled, SMU_FEATURE_MAX);
        bitmap_zero(smu->smu_feature.allowed, SMU_FEATURE_MAX);
 
-       mutex_init(&smu->smu_baco.mutex);
-       smu->smu_baco.state = SMU_BACO_STATE_EXIT;
-       smu->smu_baco.platform_support = false;
-
        mutex_init(&smu->sensor_lock);
        mutex_init(&smu->metrics_lock);
        mutex_init(&smu->message_lock);