27
27
#include "soc15.h"
28
28
#include "soc15d.h"
29
29
#include "jpeg_v2_0.h"
30
+ #include "jpeg_v4_0.h"
30
31
31
32
#include "vcn/vcn_4_0_0_offset.h"
32
33
#include "vcn/vcn_4_0_0_sh_mask.h"
@@ -38,6 +39,7 @@ static void jpeg_v4_0_set_dec_ring_funcs(struct amdgpu_device *adev);
38
39
static void jpeg_v4_0_set_irq_funcs (struct amdgpu_device * adev );
39
40
static int jpeg_v4_0_set_powergating_state (void * handle ,
40
41
enum amd_powergating_state state );
42
+ static void jpeg_v4_0_set_ras_funcs (struct amdgpu_device * adev );
41
43
42
44
/**
43
45
* jpeg_v4_0_early_init - set function pointers
@@ -55,6 +57,7 @@ static int jpeg_v4_0_early_init(void *handle)
55
57
56
58
jpeg_v4_0_set_dec_ring_funcs (adev );
57
59
jpeg_v4_0_set_irq_funcs (adev );
60
+ jpeg_v4_0_set_ras_funcs (adev );
58
61
59
62
return 0 ;
60
63
}
@@ -607,3 +610,63 @@ const struct amdgpu_ip_block_version jpeg_v4_0_ip_block = {
607
610
.rev = 0 ,
608
611
.funcs = & jpeg_v4_0_ip_funcs ,
609
612
};
613
+
614
+ static uint32_t jpeg_v4_0_query_poison_by_instance (struct amdgpu_device * adev ,
615
+ uint32_t instance , uint32_t sub_block )
616
+ {
617
+ uint32_t poison_stat = 0 , reg_value = 0 ;
618
+
619
+ switch (sub_block ) {
620
+ case AMDGPU_JPEG_V4_0_JPEG0 :
621
+ reg_value = RREG32_SOC15 (JPEG , instance , regUVD_RAS_JPEG0_STATUS );
622
+ poison_stat = REG_GET_FIELD (reg_value , UVD_RAS_JPEG0_STATUS , POISONED_PF );
623
+ break ;
624
+ case AMDGPU_JPEG_V4_0_JPEG1 :
625
+ reg_value = RREG32_SOC15 (JPEG , instance , regUVD_RAS_JPEG1_STATUS );
626
+ poison_stat = REG_GET_FIELD (reg_value , UVD_RAS_JPEG1_STATUS , POISONED_PF );
627
+ break ;
628
+ default :
629
+ break ;
630
+ }
631
+
632
+ if (poison_stat )
633
+ dev_info (adev -> dev , "Poison detected in JPEG%d sub_block%d\n" ,
634
+ instance , sub_block );
635
+
636
+ return poison_stat ;
637
+ }
638
+
639
+ static bool jpeg_v4_0_query_ras_poison_status (struct amdgpu_device * adev )
640
+ {
641
+ uint32_t inst = 0 , sub = 0 , poison_stat = 0 ;
642
+
643
+ for (inst = 0 ; inst < adev -> jpeg .num_jpeg_inst ; inst ++ )
644
+ for (sub = 0 ; sub < AMDGPU_JPEG_V4_0_MAX_SUB_BLOCK ; sub ++ )
645
+ poison_stat +=
646
+ jpeg_v4_0_query_poison_by_instance (adev , inst , sub );
647
+
648
+ return !!poison_stat ;
649
+ }
650
+
651
+ const struct amdgpu_ras_block_hw_ops jpeg_v4_0_ras_hw_ops = {
652
+ .query_poison_status = jpeg_v4_0_query_ras_poison_status ,
653
+ };
654
+
655
+ static struct amdgpu_jpeg_ras jpeg_v4_0_ras = {
656
+ .ras_block = {
657
+ .hw_ops = & jpeg_v4_0_ras_hw_ops ,
658
+ },
659
+ };
660
+
661
+ static void jpeg_v4_0_set_ras_funcs (struct amdgpu_device * adev )
662
+ {
663
+ switch (adev -> ip_versions [JPEG_HWIP ][0 ]) {
664
+ case IP_VERSION (4 , 0 , 0 ):
665
+ adev -> jpeg .ras = & jpeg_v4_0_ras ;
666
+ break ;
667
+ default :
668
+ break ;
669
+ }
670
+
671
+ jpeg_set_ras_funcs (adev );
672
+ }
0 commit comments