31
31
#include "soc15_hw_ip.h"
32
32
#include "vcn_v2_0.h"
33
33
#include "mmsch_v4_0.h"
34
+ #include "vcn_v4_0.h"
34
35
35
36
#include "vcn/vcn_4_0_0_offset.h"
36
37
#include "vcn/vcn_4_0_0_sh_mask.h"
@@ -64,6 +65,7 @@ static int vcn_v4_0_set_powergating_state(void *handle,
64
65
static int vcn_v4_0_pause_dpg_mode (struct amdgpu_device * adev ,
65
66
int inst_idx , struct dpg_pause_state * new_state );
66
67
static void vcn_v4_0_unified_ring_set_wptr (struct amdgpu_ring * ring );
68
+ static void vcn_v4_0_set_ras_funcs (struct amdgpu_device * adev );
67
69
68
70
/**
69
71
* vcn_v4_0_early_init - set function pointers
@@ -84,6 +86,7 @@ static int vcn_v4_0_early_init(void *handle)
84
86
85
87
vcn_v4_0_set_unified_ring_funcs (adev );
86
88
vcn_v4_0_set_irq_funcs (adev );
89
+ vcn_v4_0_set_ras_funcs (adev );
87
90
88
91
return 0 ;
89
92
}
@@ -2001,3 +2004,60 @@ const struct amdgpu_ip_block_version vcn_v4_0_ip_block =
2001
2004
.rev = 0 ,
2002
2005
.funcs = & vcn_v4_0_ip_funcs ,
2003
2006
};
2007
+
2008
+ static uint32_t vcn_v4_0_query_poison_by_instance (struct amdgpu_device * adev ,
2009
+ uint32_t instance , uint32_t sub_block )
2010
+ {
2011
+ uint32_t poison_stat = 0 , reg_value = 0 ;
2012
+
2013
+ switch (sub_block ) {
2014
+ case AMDGPU_VCN_V4_0_VCPU_VCODEC :
2015
+ reg_value = RREG32_SOC15 (VCN , instance , regUVD_RAS_VCPU_VCODEC_STATUS );
2016
+ poison_stat = REG_GET_FIELD (reg_value , UVD_RAS_VCPU_VCODEC_STATUS , POISONED_PF );
2017
+ break ;
2018
+ default :
2019
+ break ;
2020
+ }
2021
+
2022
+ if (poison_stat )
2023
+ dev_info (adev -> dev , "Poison detected in VCN%d, sub_block%d\n" ,
2024
+ instance , sub_block );
2025
+
2026
+ return poison_stat ;
2027
+ }
2028
+
2029
+ static bool vcn_v4_0_query_ras_poison_status (struct amdgpu_device * adev )
2030
+ {
2031
+ uint32_t inst , sub ;
2032
+ uint32_t poison_stat = 0 ;
2033
+
2034
+ for (inst = 0 ; inst < adev -> vcn .num_vcn_inst ; inst ++ )
2035
+ for (sub = 0 ; sub < AMDGPU_VCN_V4_0_MAX_SUB_BLOCK ; sub ++ )
2036
+ poison_stat +=
2037
+ vcn_v4_0_query_poison_by_instance (adev , inst , sub );
2038
+
2039
+ return !!poison_stat ;
2040
+ }
2041
+
2042
+ const struct amdgpu_ras_block_hw_ops vcn_v4_0_ras_hw_ops = {
2043
+ .query_poison_status = vcn_v4_0_query_ras_poison_status ,
2044
+ };
2045
+
2046
+ static struct amdgpu_vcn_ras vcn_v4_0_ras = {
2047
+ .ras_block = {
2048
+ .hw_ops = & vcn_v4_0_ras_hw_ops ,
2049
+ },
2050
+ };
2051
+
2052
+ static void vcn_v4_0_set_ras_funcs (struct amdgpu_device * adev )
2053
+ {
2054
+ switch (adev -> ip_versions [VCN_HWIP ][0 ]) {
2055
+ case IP_VERSION (4 , 0 , 0 ):
2056
+ adev -> vcn .ras = & vcn_v4_0_ras ;
2057
+ break ;
2058
+ default :
2059
+ break ;
2060
+ }
2061
+
2062
+ amdgpu_vcn_set_ras_funcs (adev );
2063
+ }
0 commit comments