Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu/vcn: Add VCN ras error query support

RAS error query support addition for VCN 2.6

V2: removed unused option and corrected comment format
Moved the register definition under header file

V3: poison query status check added.
Removed error query interface

V4: MMSCH poison check option removed, return true/false refactored.

Signed-off-by: Mohammad Zafar Ziya <Mohammadzafar.ziya@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>

authored by

Mohammad Zafar Ziya and committed by
Alex Deucher
c543dcbe f0a339a8

+78
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
··· 508 508 void (*query_ras_error_address)(struct amdgpu_device *adev, void *ras_error_status); 509 509 void (*reset_ras_error_count)(struct amdgpu_device *adev); 510 510 void (*reset_ras_error_status)(struct amdgpu_device *adev); 511 + bool (*query_poison_status)(struct amdgpu_device *adev); 511 512 }; 512 513 513 514 /* work flow
+71
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
··· 31 31 #include "soc15d.h" 32 32 #include "vcn_v2_0.h" 33 33 #include "mmsch_v1_0.h" 34 + #include "vcn_v2_5.h" 34 35 35 36 #include "vcn/vcn_2_5_offset.h" 36 37 #include "vcn/vcn_2_5_sh_mask.h" ··· 60 59 static int vcn_v2_5_pause_dpg_mode(struct amdgpu_device *adev, 61 60 int inst_idx, struct dpg_pause_state *new_state); 62 61 static int vcn_v2_5_sriov_start(struct amdgpu_device *adev); 62 + static void vcn_v2_5_set_ras_funcs(struct amdgpu_device *adev); 63 63 64 64 static int amdgpu_ih_clientid_vcns[] = { 65 65 SOC15_IH_CLIENTID_VCN, ··· 102 100 vcn_v2_5_set_dec_ring_funcs(adev); 103 101 vcn_v2_5_set_enc_ring_funcs(adev); 104 102 vcn_v2_5_set_irq_funcs(adev); 103 + vcn_v2_5_set_ras_funcs(adev); 105 104 106 105 return 0; 107 106 } ··· 1935 1932 .rev = 0, 1936 1933 .funcs = &vcn_v2_6_ip_funcs, 1937 1934 }; 1935 + 1936 + static uint32_t vcn_v2_6_query_poison_by_instance(struct amdgpu_device *adev, 1937 + uint32_t instance, uint32_t sub_block) 1938 + { 1939 + uint32_t poison_stat = 0, reg_value = 0; 1940 + 1941 + switch (sub_block) { 1942 + case AMDGPU_VCN_V2_6_VCPU_VCODEC: 1943 + reg_value = RREG32_SOC15(VCN, instance, mmUVD_RAS_VCPU_VCODEC_STATUS); 1944 + poison_stat = REG_GET_FIELD(reg_value, UVD_RAS_VCPU_VCODEC_STATUS, POISONED_PF); 1945 + break; 1946 + default: 1947 + break; 1948 + }; 1949 + 1950 + if (poison_stat) 1951 + dev_info(adev->dev, "Poison detected in VCN%d, sub_block%d\n", 1952 + instance, sub_block); 1953 + 1954 + return poison_stat; 1955 + } 1956 + 1957 + static bool vcn_v2_6_query_poison_status(struct amdgpu_device *adev) 1958 + { 1959 + uint32_t inst, sub; 1960 + uint32_t poison_stat = 0; 1961 + 1962 + for (inst = 0; inst < adev->vcn.num_vcn_inst; inst++) 1963 + for (sub = 0; sub < AMDGPU_VCN_V2_6_MAX_SUB_BLOCK; sub++) 1964 + poison_stat += 1965 + vcn_v2_6_query_poison_by_instance(adev, inst, sub); 1966 + 1967 + return !!poison_stat; 1968 + } 1969 + 1970 + const struct amdgpu_ras_block_hw_ops vcn_v2_6_ras_hw_ops = { 1971 + .query_poison_status = vcn_v2_6_query_poison_status, 1972 + }; 1973 + 1974 + static struct amdgpu_vcn_ras vcn_v2_6_ras = { 1975 + .ras_block = { 1976 + .hw_ops = &vcn_v2_6_ras_hw_ops, 1977 + }, 1978 + }; 1979 + 1980 + static void vcn_v2_5_set_ras_funcs(struct amdgpu_device *adev) 1981 + { 1982 + switch (adev->ip_versions[VCN_HWIP][0]) { 1983 + case IP_VERSION(2, 6, 0): 1984 + adev->vcn.ras = &vcn_v2_6_ras; 1985 + break; 1986 + default: 1987 + break; 1988 + } 1989 + 1990 + if (adev->vcn.ras) { 1991 + amdgpu_ras_register_ras_block(adev, &adev->vcn.ras->ras_block); 1992 + 1993 + strcpy(adev->vcn.ras->ras_block.ras_comm.name, "vcn"); 1994 + adev->vcn.ras->ras_block.ras_comm.block = AMDGPU_RAS_BLOCK__VCN; 1995 + adev->vcn.ras->ras_block.ras_comm.type = AMDGPU_RAS_ERROR__POISON; 1996 + adev->vcn.ras_if = &adev->vcn.ras->ras_block.ras_comm; 1997 + 1998 + /* If don't define special ras_late_init function, use default ras_late_init */ 1999 + if (!adev->vcn.ras->ras_block.ras_late_init) 2000 + adev->vcn.ras->ras_block.ras_late_init = amdgpu_ras_block_late_init; 2001 + } 2002 + }
+6
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.h
··· 24 24 #ifndef __VCN_V2_5_H__ 25 25 #define __VCN_V2_5_H__ 26 26 27 + enum amdgpu_vcn_v2_6_sub_block { 28 + AMDGPU_VCN_V2_6_VCPU_VCODEC = 0, 29 + 30 + AMDGPU_VCN_V2_6_MAX_SUB_BLOCK, 31 + }; 32 + 27 33 extern const struct amdgpu_ip_block_version vcn_v2_5_ip_block; 28 34 extern const struct amdgpu_ip_block_version vcn_v2_6_ip_block; 29 35