aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorxinhui pan <xinhui.pan@amd.com>2019-04-08 02:49:37 -0400
committerAlex Deucher <alexander.deucher@amd.com>2019-04-10 14:49:15 -0400
commit77de502b088fa4b9ed8060085d0c2d49b2e0a306 (patch)
tree701d1f469780d63df33129e14b67d57bc29ce906 /drivers/gpu
parent191051a1bef8257313d4bc4eafbf201e35e135e7 (diff)
drm/amdgpu: Introduce another ras enable function
Many parts of the whole SW stack can program the ras enablement state during the boot. Now we handle that case by adding one function which check the ras flags and choose different code path. Reviewed-by: Evan Quan <evan.quan@amd.com> Signed-off-by: xinhui pan <xinhui.pan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c27
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h3
2 files changed, 30 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index a0e34f62f110..22bd21efe6b1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -530,6 +530,33 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
530 return 0; 530 return 0;
531} 531}
532 532
533/* Only used in device probe stage and called only once. */
534int amdgpu_ras_feature_enable_on_boot(struct amdgpu_device *adev,
535 struct ras_common_if *head, bool enable)
536{
537 struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
538 int ret;
539
540 if (!con)
541 return -EINVAL;
542
543 if (con->flags & AMDGPU_RAS_FLAG_INIT_BY_VBIOS) {
544 /* If ras is enabled by vbios, we set up ras object first in
545 * both case. For enable, that is all what we need do. For
546 * disable, we need perform a ras TA disable cmd after that.
547 */
548 ret = __amdgpu_ras_feature_enable(adev, head, 1);
549 if (ret)
550 return ret;
551
552 if (!enable)
553 ret = amdgpu_ras_feature_enable(adev, head, 0);
554 } else
555 ret = amdgpu_ras_feature_enable(adev, head, enable);
556
557 return ret;
558}
559
533static int amdgpu_ras_disable_all_features(struct amdgpu_device *adev, 560static int amdgpu_ras_disable_all_features(struct amdgpu_device *adev,
534 bool bypass) 561 bool bypass)
535{ 562{
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
index 682f2be0d68c..eaef5edefc34 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
@@ -262,6 +262,9 @@ int amdgpu_ras_pre_fini(struct amdgpu_device *adev);
262int amdgpu_ras_feature_enable(struct amdgpu_device *adev, 262int amdgpu_ras_feature_enable(struct amdgpu_device *adev,
263 struct ras_common_if *head, bool enable); 263 struct ras_common_if *head, bool enable);
264 264
265int amdgpu_ras_feature_enable_on_boot(struct amdgpu_device *adev,
266 struct ras_common_if *head, bool enable);
267
265int amdgpu_ras_sysfs_create(struct amdgpu_device *adev, 268int amdgpu_ras_sysfs_create(struct amdgpu_device *adev,
266 struct ras_fs_if *head); 269 struct ras_fs_if *head);
267 270