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

drm/amdgpu: add RAS error query for JPEG 4.0

Initialize JPEG RAS structure and add error query interface.

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Tao Zhou and committed by
Alex Deucher
53317458 377d0221

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