Commit 3224a12b authored by Monk Liu's avatar Monk Liu Committed by Alex Deucher
Browse files

drm/amdgpu/sriov:move in_reset to adev and rename



currently in_reset is only used in sriov gpu reset, and it
will be used for other non-gfx hw component later, like
PSP, so move it from gfx to adev and rename to in_sriov_reset
make more sense.

Signed-off-by: default avatarMonk Liu <Monk.Liu@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 7c3f2167
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1018,7 +1018,6 @@ struct amdgpu_gfx {
	/* reset mask */
	uint32_t                        grbm_soft_reset;
	uint32_t                        srbm_soft_reset;
	bool                            in_reset;
	/* s3/s4 mask */
	bool                            in_suspend;
	/* NGG */
@@ -1583,6 +1582,7 @@ struct amdgpu_device {

	/* record last mm index being written through WREG32*/
	unsigned long last_mm_index;
	bool                            in_sriov_reset;
};

static inline struct amdgpu_device *amdgpu_ttm_adev(struct ttm_bo_device *bdev)
+2 −2
Original line number Diff line number Diff line
@@ -2690,7 +2690,7 @@ int amdgpu_sriov_gpu_reset(struct amdgpu_device *adev, struct amdgpu_job *job)

	mutex_lock(&adev->virt.lock_reset);
	atomic_inc(&adev->gpu_reset_counter);
	adev->gfx.in_reset = true;
	adev->in_sriov_reset = true;

	/* block TTM */
	resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);
@@ -2801,7 +2801,7 @@ give_up_reset:
		dev_info(adev->dev, "GPU reset successed!\n");
	}

	adev->gfx.in_reset = false;
	adev->in_sriov_reset = false;
	mutex_unlock(&adev->virt.lock_reset);
	return r;
}
+3 −3
Original line number Diff line number Diff line
@@ -4811,7 +4811,7 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring)

	gfx_v8_0_kiq_setting(ring);

	if (adev->gfx.in_reset) { /* for GPU_RESET case */
	if (adev->in_sriov_reset) { /* for GPU_RESET case */
		/* reset MQD to a clean status */
		if (adev->gfx.mec.mqd_backup[mqd_idx])
			memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct vi_mqd_allocation));
@@ -4848,7 +4848,7 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)
	struct vi_mqd *mqd = ring->mqd_ptr;
	int mqd_idx = ring - &adev->gfx.compute_ring[0];

	if (!adev->gfx.in_reset && !adev->gfx.in_suspend) {
	if (!adev->in_sriov_reset && !adev->gfx.in_suspend) {
		memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation));
		((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF;
		((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF;
@@ -4860,7 +4860,7 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)

		if (adev->gfx.mec.mqd_backup[mqd_idx])
			memcpy(adev->gfx.mec.mqd_backup[mqd_idx], mqd, sizeof(struct vi_mqd_allocation));
	} else if (adev->gfx.in_reset) { /* for GPU_RESET case */
	} else if (adev->in_sriov_reset) { /* for GPU_RESET case */
		/* reset MQD to a clean status */
		if (adev->gfx.mec.mqd_backup[mqd_idx])
			memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct vi_mqd_allocation));
+3 −3
Original line number Diff line number Diff line
@@ -2698,7 +2698,7 @@ static int gfx_v9_0_kiq_init_queue(struct amdgpu_ring *ring)

	gfx_v9_0_kiq_setting(ring);

	if (adev->gfx.in_reset) { /* for GPU_RESET case */
	if (adev->in_sriov_reset) { /* for GPU_RESET case */
		/* reset MQD to a clean status */
		if (adev->gfx.mec.mqd_backup[mqd_idx])
			memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct v9_mqd_allocation));
@@ -2736,7 +2736,7 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring)
	struct v9_mqd *mqd = ring->mqd_ptr;
	int mqd_idx = ring - &adev->gfx.compute_ring[0];

	if (!adev->gfx.in_reset && !adev->gfx.in_suspend) {
	if (!adev->in_sriov_reset && !adev->gfx.in_suspend) {
		memset((void *)mqd, 0, sizeof(struct v9_mqd_allocation));
		((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF;
		((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF;
@@ -2748,7 +2748,7 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring)

		if (adev->gfx.mec.mqd_backup[mqd_idx])
			memcpy(adev->gfx.mec.mqd_backup[mqd_idx], mqd, sizeof(struct v9_mqd_allocation));
	} else if (adev->gfx.in_reset) { /* for GPU_RESET case */
	} else if (adev->in_sriov_reset) { /* for GPU_RESET case */
		/* reset MQD to a clean status */
		if (adev->gfx.mec.mqd_backup[mqd_idx])
			memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct v9_mqd_allocation));