mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-10 19:28:49 -04:00
drm/amdgpu: add ACA support for vcn v4.0.3
v1: Add ACA support for vcn v4.0.3. v2: - split VCN ACA(v1) to 2 parts: vcn and jpeg. - move mmSMNAID_AID0_MCA_SMU to amdgpu_aca.h file. v3: - split JPEG ACA to another patch. Signed-off-by: Yang Wang <kevinyang.wang@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -1915,9 +1915,94 @@ static const struct amdgpu_ras_block_hw_ops vcn_v4_0_3_ras_hw_ops = {
|
||||
.reset_ras_error_count = vcn_v4_0_3_reset_ras_error_count,
|
||||
};
|
||||
|
||||
static int vcn_v4_0_3_aca_bank_parser(struct aca_handle *handle, struct aca_bank *bank,
|
||||
enum aca_smu_type type, void *data)
|
||||
{
|
||||
struct aca_bank_info info;
|
||||
u64 misc0;
|
||||
int ret;
|
||||
|
||||
ret = aca_bank_info_decode(bank, &info);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
misc0 = bank->regs[ACA_REG_IDX_MISC0];
|
||||
switch (type) {
|
||||
case ACA_SMU_TYPE_UE:
|
||||
ret = aca_error_cache_log_bank_error(handle, &info, ACA_ERROR_TYPE_UE,
|
||||
1ULL);
|
||||
break;
|
||||
case ACA_SMU_TYPE_CE:
|
||||
ret = aca_error_cache_log_bank_error(handle, &info, ACA_ERROR_TYPE_CE,
|
||||
ACA_REG__MISC0__ERRCNT(misc0));
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* reference to smu driver if header file */
|
||||
static int vcn_v4_0_3_err_codes[] = {
|
||||
14, 15, /* VCN */
|
||||
};
|
||||
|
||||
static bool vcn_v4_0_3_aca_bank_is_valid(struct aca_handle *handle, struct aca_bank *bank,
|
||||
enum aca_smu_type type, void *data)
|
||||
{
|
||||
u32 instlo;
|
||||
|
||||
instlo = ACA_REG__IPID__INSTANCEIDLO(bank->regs[ACA_REG_IDX_IPID]);
|
||||
instlo &= GENMASK(31, 1);
|
||||
|
||||
if (instlo != mmSMNAID_AID0_MCA_SMU)
|
||||
return false;
|
||||
|
||||
if (aca_bank_check_error_codes(handle->adev, bank,
|
||||
vcn_v4_0_3_err_codes,
|
||||
ARRAY_SIZE(vcn_v4_0_3_err_codes)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static const struct aca_bank_ops vcn_v4_0_3_aca_bank_ops = {
|
||||
.aca_bank_parser = vcn_v4_0_3_aca_bank_parser,
|
||||
.aca_bank_is_valid = vcn_v4_0_3_aca_bank_is_valid,
|
||||
};
|
||||
|
||||
static const struct aca_info vcn_v4_0_3_aca_info = {
|
||||
.hwip = ACA_HWIP_TYPE_SMU,
|
||||
.mask = ACA_ERROR_UE_MASK,
|
||||
.bank_ops = &vcn_v4_0_3_aca_bank_ops,
|
||||
};
|
||||
|
||||
static int vcn_v4_0_3_ras_late_init(struct amdgpu_device *adev, struct ras_common_if *ras_block)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = amdgpu_ras_block_late_init(adev, ras_block);
|
||||
if (r)
|
||||
return r;
|
||||
|
||||
r = amdgpu_ras_bind_aca(adev, AMDGPU_RAS_BLOCK__VCN,
|
||||
&vcn_v4_0_3_aca_info, NULL);
|
||||
if (r)
|
||||
goto late_fini;
|
||||
|
||||
return 0;
|
||||
|
||||
late_fini:
|
||||
amdgpu_ras_block_late_fini(adev, ras_block);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static struct amdgpu_vcn_ras vcn_v4_0_3_ras = {
|
||||
.ras_block = {
|
||||
.hw_ops = &vcn_v4_0_3_ras_hw_ops,
|
||||
.ras_late_init = vcn_v4_0_3_ras_late_init,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user