Skip to contentSkip to conversation

drm/amdgpu: move amdgpu_device_get_job_timeout_settings

PATCH In review Alex Deucher 2 participants 2 messages Oct 4, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: move amdgpu_device_get_job_timeout_settings

It's only used in amdgpu_device.c and the naming also reflects that. Move it there.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 64 +++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 67 ----------------------
 3 files changed, 67 insertions(+), 68 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -1
index 79ea620aac04..f321dc2751e4 100644
@@ -107,6 +107,8 @@ struct amdgpu_mgpu_info
 	uint32_t			num_apu;
 };
 
+#define AMDGPU_MAX_TIMEOUT_PARAM_LENTH	256
+
 /*
  * Modules parameters.
  */
@@ -123,6 +125,7 @@ extern int amdgpu_disp_priority;
 extern int amdgpu_hw_i2c;
 extern int amdgpu_pcie_gen2;
 extern int amdgpu_msi;
+extern char amdgpu_lockup_timeout[AMDGPU_MAX_TIMEOUT_PARAM_LENTH];
 extern int amdgpu_dpm;
 extern int amdgpu_fw_load_type;
 extern int amdgpu_aspm;
@@ -427,7 +430,6 @@ struct amdgpu_fpriv {
 };
 
 int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv);
-int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev);
 
 int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
 		  unsigned size, struct amdgpu_ib *ib);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +64 -0

70 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -67

79 lines not on this page · raw message

Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20191004183806.30377-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org

Reviewed-by Andrey Grodzovsky
#2 lore raw

Andrey

Quoted 189 lines · Alex Deucher

It's only used in amdgpu_device.c and the naming also reflects that. Move it there.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  4 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 64 +++++++++++++++++++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 67 ----------------------
  3 files changed, 67 insertions(+), 68 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -1
index 79ea620aac04..f321dc2751e4 100644
@@ -107,6 +107,8 @@ struct amdgpu_mgpu_info
  	uint32_t			num_apu;
  };
 
+#define AMDGPU_MAX_TIMEOUT_PARAM_LENTH	256
+
  /*
   * Modules parameters.
   */
@@ -123,6 +125,7 @@ extern int amdgpu_disp_priority;
  extern int amdgpu_hw_i2c;
  extern int amdgpu_pcie_gen2;
  extern int amdgpu_msi;
+extern char amdgpu_lockup_timeout[AMDGPU_MAX_TIMEOUT_PARAM_LENTH];
  extern int amdgpu_dpm;
  extern int amdgpu_fw_load_type;
  extern int amdgpu_aspm;
@@ -427,7 +430,6 @@ struct amdgpu_fpriv {
  };
 
  int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv);
-int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev);
 
  int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm,
  		  unsigned size, struct amdgpu_ib *ib);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +64 -0
index ba7d1fa58c5b..660ce71e1ea1 100644
@@ -2579,6 +2579,70 @@ static void amdgpu_device_xgmi_reset_func(struct work_struct *__work)
  			 adev->asic_reset_res, adev->ddev->unique);
  }
 
+static int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
+{
+	char *input = amdgpu_lockup_timeout;
+	char *timeout_setting = NULL;
+	int index = 0;
+	long timeout;
+	int ret = 0;
+
+	/*
+	 * By default timeout for non compute jobs is 10000.
+	 * And there is no timeout enforced on compute jobs.
+	 * In SR-IOV or passthrough mode, timeout for compute
+	 * jobs are 10000 by default.
+	 */
+	adev->gfx_timeout = msecs_to_jiffies(10000);
+	adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
+	if (amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev))
+		adev->compute_timeout = adev->gfx_timeout;
+	else
+		adev->compute_timeout = MAX_SCHEDULE_TIMEOUT;
+
+	if (strnlen(input, AMDGPU_MAX_TIMEOUT_PARAM_LENTH)) {
+		while ((timeout_setting = strsep(&input, ",")) &&
+				strnlen(timeout_setting, AMDGPU_MAX_TIMEOUT_PARAM_LENTH)) {
+			ret = kstrtol(timeout_setting, 0, &timeout);
+			if (ret)
+				return ret;
+
+			if (timeout == 0) {
+				index++;
+				continue;
+			} else if (timeout < 0) {
+				timeout = MAX_SCHEDULE_TIMEOUT;
+			} else {
+				timeout = msecs_to_jiffies(timeout);
+			}
+
+			switch (index++) {
+			case 0:
+				adev->gfx_timeout = timeout;
+				break;
+			case 1:
+				adev->compute_timeout = timeout;
+				break;
+			case 2:
+				adev->sdma_timeout = timeout;
+				break;
+			case 3:
+				adev->video_timeout = timeout;
+				break;
+			default:
+				break;
+			}
+		}
+		/*
+		 * There is only one value specified and
+		 * it should apply to all non-compute jobs.
+		 */
+		if (index == 1)
+			adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
+	}
+
+	return ret;
+}
 
  /**
   * amdgpu_device_init - initialize the driver
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -60
index 5edf74b5c860..bfb4504fa195 100644
@@ -88,8 +88,6 @@
  #define KMS_DRIVER_MINOR	35
  #define KMS_DRIVER_PATCHLEVEL	0
 
-#define AMDGPU_MAX_TIMEOUT_PARAM_LENTH	256
-
  int amdgpu_vram_limit = 0;
  int amdgpu_vis_vram_limit = 0;
  int amdgpu_gart_size = -1; /* auto */
@@ -1306,71 +1304,6 @@ int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv)
  	return 0;
  }
 
-int amdgpu_device_get_job_timeout_settings(struct amdgpu_device *adev)
-{
-	char *input = amdgpu_lockup_timeout;
-	char *timeout_setting = NULL;
-	int index = 0;
-	long timeout;
-	int ret = 0;
-
-	/*
-	 * By default timeout for non compute jobs is 10000.
-	 * And there is no timeout enforced on compute jobs.
-	 * In SR-IOV or passthrough mode, timeout for compute
-	 * jobs are 10000 by default.
-	 */
-	adev->gfx_timeout = msecs_to_jiffies(10000);
-	adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
-	if (amdgpu_sriov_vf(adev) || amdgpu_passthrough(adev))
-		adev->compute_timeout = adev->gfx_timeout;
-	else
-		adev->compute_timeout = MAX_SCHEDULE_TIMEOUT;
-
-	if (strnlen(input, AMDGPU_MAX_TIMEOUT_PARAM_LENTH)) {
-		while ((timeout_setting = strsep(&input, ",")) &&
-				strnlen(timeout_setting, AMDGPU_MAX_TIMEOUT_PARAM_LENTH)) {
-			ret = kstrtol(timeout_setting, 0, &timeout);
-			if (ret)
-				return ret;
-
-			if (timeout == 0) {
-				index++;
-				continue;
-			} else if (timeout < 0) {
-				timeout = MAX_SCHEDULE_TIMEOUT;
-			} else {
-				timeout = msecs_to_jiffies(timeout);
-			}
-
-			switch (index++) {
-			case 0:
-				adev->gfx_timeout = timeout;
-				break;
-			case 1:
-				adev->compute_timeout = timeout;
-				break;
-			case 2:
-				adev->sdma_timeout = timeout;
-				break;
-			case 3:
-				adev->video_timeout = timeout;
-				break;
-			default:
-				break;
-			}
-		}
-		/*
-		 * There is only one value specified and
-		 * it should apply to all non-compute jobs.
-		 */

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv) · line 1309

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -7
-		if (index == 1)
-			adev->sdma_timeout = adev->video_timeout = adev->gfx_timeout;
-	}
-
-	return ret;
-}
-
  static bool
  amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe,
  				 bool in_vblank_irq, int *vpos, int *hpos,

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx