提交 50b0197a 编写于 作者: C Chunming Zhou 提交者: Alex Deucher

drm/amdgpu: implement gmc8 check/pre/post_soft_reset

Signed-off-by: NChunming Zhou <David1.Zhou@amd.com>
Reviewed-by: NChristian König <christian.koenig@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 e702a680
...@@ -677,6 +677,8 @@ struct amdgpu_mc { ...@@ -677,6 +677,8 @@ struct amdgpu_mc {
uint32_t fw_version; uint32_t fw_version;
struct amdgpu_irq_src vm_fault; struct amdgpu_irq_src vm_fault;
uint32_t vram_type; uint32_t vram_type;
uint32_t srbm_soft_reset;
struct amdgpu_mode_mc_save save;
}; };
/* /*
......
...@@ -1092,9 +1092,8 @@ static int gmc_v8_0_wait_for_idle(void *handle) ...@@ -1092,9 +1092,8 @@ static int gmc_v8_0_wait_for_idle(void *handle)
} }
static int gmc_v8_0_soft_reset(void *handle) static int gmc_v8_0_check_soft_reset(void *handle)
{ {
struct amdgpu_mode_mc_save save;
u32 srbm_soft_reset = 0; u32 srbm_soft_reset = 0;
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
u32 tmp = RREG32(mmSRBM_STATUS); u32 tmp = RREG32(mmSRBM_STATUS);
...@@ -1109,13 +1108,42 @@ static int gmc_v8_0_soft_reset(void *handle) ...@@ -1109,13 +1108,42 @@ static int gmc_v8_0_soft_reset(void *handle)
srbm_soft_reset = REG_SET_FIELD(srbm_soft_reset, srbm_soft_reset = REG_SET_FIELD(srbm_soft_reset,
SRBM_SOFT_RESET, SOFT_RESET_MC, 1); SRBM_SOFT_RESET, SOFT_RESET_MC, 1);
} }
if (srbm_soft_reset) { if (srbm_soft_reset) {
gmc_v8_0_mc_stop(adev, &save); adev->ip_block_status[AMD_IP_BLOCK_TYPE_GMC].hang = true;
if (gmc_v8_0_wait_for_idle((void *)adev)) { adev->mc.srbm_soft_reset = srbm_soft_reset;
dev_warn(adev->dev, "Wait for GMC idle timed out !\n"); } else {
} adev->ip_block_status[AMD_IP_BLOCK_TYPE_GMC].hang = false;
adev->mc.srbm_soft_reset = 0;
}
return 0;
}
static int gmc_v8_0_pre_soft_reset(void *handle)
{
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
if (!adev->ip_block_status[AMD_IP_BLOCK_TYPE_GMC].hang)
return 0;
gmc_v8_0_mc_stop(adev, &adev->mc.save);
if (gmc_v8_0_wait_for_idle(adev)) {
dev_warn(adev->dev, "Wait for GMC idle timed out !\n");
}
return 0;
}
static int gmc_v8_0_soft_reset(void *handle)
{
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
u32 srbm_soft_reset;
if (!adev->ip_block_status[AMD_IP_BLOCK_TYPE_GMC].hang)
return 0;
srbm_soft_reset = adev->mc.srbm_soft_reset;
if (srbm_soft_reset) {
u32 tmp;
tmp = RREG32(mmSRBM_SOFT_RESET); tmp = RREG32(mmSRBM_SOFT_RESET);
tmp |= srbm_soft_reset; tmp |= srbm_soft_reset;
...@@ -1131,14 +1159,22 @@ static int gmc_v8_0_soft_reset(void *handle) ...@@ -1131,14 +1159,22 @@ static int gmc_v8_0_soft_reset(void *handle)
/* Wait a little for things to settle down */ /* Wait a little for things to settle down */
udelay(50); udelay(50);
gmc_v8_0_mc_resume(adev, &save);
udelay(50);
} }
return 0; return 0;
} }
static int gmc_v8_0_post_soft_reset(void *handle)
{
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
if (!adev->ip_block_status[AMD_IP_BLOCK_TYPE_GMC].hang)
return 0;
gmc_v8_0_mc_resume(adev, &adev->mc.save);
return 0;
}
static int gmc_v8_0_vm_fault_interrupt_state(struct amdgpu_device *adev, static int gmc_v8_0_vm_fault_interrupt_state(struct amdgpu_device *adev,
struct amdgpu_irq_src *src, struct amdgpu_irq_src *src,
unsigned type, unsigned type,
...@@ -1406,7 +1442,10 @@ const struct amd_ip_funcs gmc_v8_0_ip_funcs = { ...@@ -1406,7 +1442,10 @@ const struct amd_ip_funcs gmc_v8_0_ip_funcs = {
.resume = gmc_v8_0_resume, .resume = gmc_v8_0_resume,
.is_idle = gmc_v8_0_is_idle, .is_idle = gmc_v8_0_is_idle,
.wait_for_idle = gmc_v8_0_wait_for_idle, .wait_for_idle = gmc_v8_0_wait_for_idle,
.check_soft_reset = gmc_v8_0_check_soft_reset,
.pre_soft_reset = gmc_v8_0_pre_soft_reset,
.soft_reset = gmc_v8_0_soft_reset, .soft_reset = gmc_v8_0_soft_reset,
.post_soft_reset = gmc_v8_0_post_soft_reset,
.set_clockgating_state = gmc_v8_0_set_clockgating_state, .set_clockgating_state = gmc_v8_0_set_clockgating_state,
.set_powergating_state = gmc_v8_0_set_powergating_state, .set_powergating_state = gmc_v8_0_set_powergating_state,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册