Re: [PATCH] drm/amdgpu: Fix missing error code in 'gmc_v6/7/8/9/10 _0_hw_init()' function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 22.12.23 um 12:34 schrieb Srinivasan Shanmugam:
The gmc_v6/7/8/9/10 _0_hw_init() function in emulation checks whether
all of the memory range of shared system memory could be accessed by
GPU, from this aspect, -EIO is returned for error scenarios.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c:919 gmc_v6_0_hw_init() warn: missing error code? 'r'
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c:1103 gmc_v7_0_hw_init() warn: missing error code? 'r'
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c:1223 gmc_v8_0_hw_init() warn: missing error code? 'r'
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c:2344 gmc_v9_0_hw_init() warn: missing error code? 'r'

Cc: Xiaojian Du <Xiaojian.Du@xxxxxxx>
Cc: Lijo Lazar <lijo.lazar@xxxxxxx>
Cc: Christian König <christian.koenig@xxxxxxx>
Cc: Alex Deucher <alexander.deucher@xxxxxxx>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c |  2 +-
  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c  | 11 +++++++----
  drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c  | 11 +++++++----
  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c  | 11 +++++++----
  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 11 +++++++----
  5 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
index a5a05c16c10d..6172816f54da 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
@@ -1004,7 +1004,7 @@ static int gmc_v10_0_hw_init(void *handle)
  	if (amdgpu_emu_mode == 1) {
  		r = amdgpu_gmc_vram_checking(adev);
  		if (r)
-			return r;
+			return -EIO;

We should probably adjust amdgpu_gmc_vram_checking() instead to return -EIO when it failed.

The number of not matching bytes is actually completely uninteresting to the caller.

Regards,
Christian.

  	}
if (adev->umc.funcs && adev->umc.funcs->init_registers)
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
index 42e103d7077d..68e3fff02308 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
@@ -913,10 +913,13 @@ static int gmc_v6_0_hw_init(void *handle)
  	if (r)
  		return r;
- if (amdgpu_emu_mode == 1)
-		return amdgpu_gmc_vram_checking(adev);
-	else
-		return r;
+	if (amdgpu_emu_mode == 1) {
+		r = amdgpu_gmc_vram_checking(adev);
+		if (r)
+			return -EIO;
+	}
+
+	return 0;
  }
static int gmc_v6_0_hw_fini(void *handle)
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index efc16e580f1e..1a6bee9b4777 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
@@ -1097,10 +1097,13 @@ static int gmc_v7_0_hw_init(void *handle)
  	if (r)
  		return r;
- if (amdgpu_emu_mode == 1)
-		return amdgpu_gmc_vram_checking(adev);
-	else
-		return r;
+	if (amdgpu_emu_mode == 1) {
+		r = amdgpu_gmc_vram_checking(adev);
+		if (r)
+			return -EIO;
+	}
+
+	return 0;
  }
static int gmc_v7_0_hw_fini(void *handle)
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index ff4ae73d27ec..192041c707a6 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -1217,10 +1217,13 @@ static int gmc_v8_0_hw_init(void *handle)
  	if (r)
  		return r;
- if (amdgpu_emu_mode == 1)
-		return amdgpu_gmc_vram_checking(adev);
-	else
-		return r;
+	if (amdgpu_emu_mode == 1) {
+		r = amdgpu_gmc_vram_checking(adev);
+		if (r)
+			return -EIO;
+	}
+
+	return 0;
  }
static int gmc_v8_0_hw_fini(void *handle)
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 473a774294ce..f2ef1d8107f8 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -2338,10 +2338,13 @@ static int gmc_v9_0_hw_init(void *handle)
  	if (r)
  		return r;
- if (amdgpu_emu_mode == 1)
-		return amdgpu_gmc_vram_checking(adev);
-	else
-		return r;
+	if (amdgpu_emu_mode == 1) {
+		r = amdgpu_gmc_vram_checking(adev);
+		if (r)
+			return -EIO;
+	}
+
+	return 0;
  }
/**




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux