amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: return an error for hw access in INFO ioctl when in reset
@ 2020-06-26 14:04 Alex Deucher
  2020-07-01  5:33 ` Alex Deucher
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Deucher @ 2020-06-26 14:04 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

When the GPU is in reset, accessing the hw is unreliable and could
interfere with the reset.  Return an error in those cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 341d072edd95..fd51d6554ee2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -684,6 +684,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 		if (info->read_mmr_reg.count > 128)
 			return -EINVAL;
 
+		if (adev->in_gpu_reset)
+			return -EPERM;
+
 		regs = kmalloc_array(info->read_mmr_reg.count, sizeof(*regs), GFP_KERNEL);
 		if (!regs)
 			return -ENOMEM;
@@ -854,6 +857,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 		if (!adev->pm.dpm_enabled)
 			return -ENOENT;
 
+		if (adev->in_gpu_reset)
+			return -EPERM;
+
 		switch (info->sensor_info.type) {
 		case AMDGPU_INFO_SENSOR_GFX_SCLK:
 			/* get sclk in Mhz */
-- 
2.25.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-03  7:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26 14:04 [PATCH] drm/amdgpu: return an error for hw access in INFO ioctl when in reset Alex Deucher
2020-07-01  5:33 ` Alex Deucher
2020-07-01  8:20   ` Christian König
2020-07-01 14:34     ` Li, Dennis
2020-07-03  6:05       ` Felix Kuehling
2020-07-03  7:50         ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).