aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.19.8/1519-drm-amdgpu-Add-a-new-flag-to-AMDGPU_CTX_OP_QUERY_STA.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.19.8/1519-drm-amdgpu-Add-a-new-flag-to-AMDGPU_CTX_OP_QUERY_STA.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.19.8/1519-drm-amdgpu-Add-a-new-flag-to-AMDGPU_CTX_OP_QUERY_STA.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.19.8/1519-drm-amdgpu-Add-a-new-flag-to-AMDGPU_CTX_OP_QUERY_STA.patch b/common/recipes-kernel/linux/linux-yocto-4.19.8/1519-drm-amdgpu-Add-a-new-flag-to-AMDGPU_CTX_OP_QUERY_STA.patch
new file mode 100644
index 00000000..24d1717c
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.19.8/1519-drm-amdgpu-Add-a-new-flag-to-AMDGPU_CTX_OP_QUERY_STA.patch
@@ -0,0 +1,89 @@
+From 14670d7a545ba0b77f4f9ab8b04f3b722f64c033 Mon Sep 17 00:00:00 2001
+From: xinhui pan <xinhui.pan@amd.com>
+Date: Mon, 17 Dec 2018 14:31:12 +0800
+Subject: [PATCH 1519/2940] drm/amdgpu: Add a new flag to
+ AMDGPU_CTX_OP_QUERY_STATE2
+
+Add AMDGPU_CTX_QUERY2_FLAGS_RAS_CE/UE which indicate if any error happened
+between previous query and this query.
+
+Signed-off-by: xinhui pan <xinhui.pan@amd.com>
+Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 17 +++++++++++++++++
+ drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h | 2 ++
+ include/uapi/drm/amdgpu_drm.h | 3 +++
+ 3 files changed, 22 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+index f0f22e20a747..e87184670587 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+@@ -26,6 +26,7 @@
+ #include <drm/drm_auth.h>
+ #include "amdgpu.h"
+ #include "amdgpu_sched.h"
++#include "amdgpu_ras.h"
+
+ #define to_amdgpu_ctx_entity(e) \
+ container_of((e), struct amdgpu_ctx_entity, entity)
+@@ -346,6 +347,7 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev,
+ {
+ struct amdgpu_ctx *ctx;
+ struct amdgpu_ctx_mgr *mgr;
++ uint32_t ras_counter;
+
+ if (!fpriv)
+ return -EINVAL;
+@@ -370,6 +372,21 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev,
+ if (atomic_read(&ctx->guilty))
+ out->state.flags |= AMDGPU_CTX_QUERY2_FLAGS_GUILTY;
+
++ /*query ue count*/
++ ras_counter = amdgpu_ras_query_error_count(adev, false);
++ /*ras counter is monotonic increasing*/
++ if (ras_counter != ctx->ras_counter_ue) {
++ out->state.flags |= AMDGPU_CTX_QUERY2_FLAGS_RAS_UE;
++ ctx->ras_counter_ue = ras_counter;
++ }
++
++ /*query ce count*/
++ ras_counter = amdgpu_ras_query_error_count(adev, true);
++ if (ras_counter != ctx->ras_counter_ce) {
++ out->state.flags |= AMDGPU_CTX_QUERY2_FLAGS_RAS_CE;
++ ctx->ras_counter_ce = ras_counter;
++ }
++
+ mutex_unlock(&mgr->lock);
+ return 0;
+ }
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h
+index db0ad1e7eace..934780c3140c 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h
+@@ -51,6 +51,8 @@ struct amdgpu_ctx {
+ enum drm_sched_priority override_priority;
+ struct mutex lock;
+ atomic_t guilty;
++ uint32_t ras_counter_ce;
++ uint32_t ras_counter_ue;
+ };
+
+ struct amdgpu_ctx_mgr {
+diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
+index c7d5bc34e18f..0caf21158631 100644
+--- a/include/uapi/drm/amdgpu_drm.h
++++ b/include/uapi/drm/amdgpu_drm.h
+@@ -230,6 +230,9 @@ union drm_amdgpu_bo_list {
+ #define AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST (1<<1)
+ /* indicate some job from this context once cause gpu hang */
+ #define AMDGPU_CTX_QUERY2_FLAGS_GUILTY (1<<2)
++/* indicate some errors are detected by RAS */
++#define AMDGPU_CTX_QUERY2_FLAGS_RAS_CE (1<<3)
++#define AMDGPU_CTX_QUERY2_FLAGS_RAS_UE (1<<4)
+
+ /* Context priority level */
+ #define AMDGPU_CTX_PRIORITY_UNSET -2048
+--
+2.17.1
+