[PATCH v3 1/3] drm/amd: Return -EBUSY in read_sensor() if RAS interrupt triggered

Mario Limonciello mario.limonciello at amd.com
Fri Dec 15 19:55:34 UTC 2023


Any callers to read_sensor() may get the wrong data if the RAS
interrupt has been triggered and no actual sensor read occurred.

Adjust the return code for this condition to be -EBUSY.

Suggested-by: Lijo Lazar <Lijo.Lazar at amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello at amd.com>
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c    | 2 +-
 drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c   | 2 +-
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
index 4cd43bbec910..1fa4c14326ac 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c
@@ -1059,7 +1059,7 @@ static int arcturus_read_sensor(struct smu_context *smu,
 	int ret = 0;
 
 	if (amdgpu_ras_intr_triggered())
-		return 0;
+		return -EBUSY;
 
 	if (!data || !size)
 		return -EINVAL;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
index f1440869d1ce..e1c561ece319 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
@@ -1091,7 +1091,7 @@ static int aldebaran_read_sensor(struct smu_context *smu,
 	int ret = 0;
 
 	if (amdgpu_ras_intr_triggered())
-		return 0;
+		return -EBUSY;
 
 	if (!data || !size)
 		return -EINVAL;
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
index 3998c9b31d07..ac7982132951 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c
@@ -1296,7 +1296,7 @@ static int smu_v13_0_6_read_sensor(struct smu_context *smu,
 	int ret = 0;
 
 	if (amdgpu_ras_intr_triggered())
-		return 0;
+		return -EBUSY;
 
 	if (!data || !size)
 		return -EINVAL;
-- 
2.34.1



More information about the amd-gfx mailing list