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

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: update rlc autoload function

Update rlc autoload function for gfx v12.1.0
to support muti-XCC firmware autoload.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Likun Gao and committed by
Alex Deucher
08ba5ba0 442903eb

+41 -7
+41 -7
drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
··· 768 768 unsigned int offset; 769 769 unsigned int size; 770 770 unsigned int size_x16; 771 + unsigned int num_inst; 771 772 } rlc_autoload_info[SOC24_FIRMWARE_ID_MAX]; 772 773 773 774 #define RLC_TOC_OFFSET_DWUNIT 8 774 775 #define RLC_SIZE_MULTIPLE 1024 775 776 #define RLC_TOC_UMF_SIZE_inM 23ULL 776 777 #define RLC_TOC_FORMAT_API 165ULL 778 + 779 + #define RLC_NUM_INS_CODE0 1 780 + #define RLC_NUM_INS_CODE1 8 781 + #define RLC_NUM_INS_CODE2 2 782 + #define RLC_NUM_INS_CODE3 16 777 783 778 784 static void gfx_v12_1_parse_rlc_toc(struct amdgpu_device *adev, void *rlc_toc) 779 785 { ··· 792 786 rlc_autoload_info[ucode->id].size = 793 787 ucode->size_x16 ? ucode->size * RLC_SIZE_MULTIPLE * 4 : 794 788 ucode->size * 4; 789 + switch (ucode->vfflr_image_code) { 790 + case 0: 791 + rlc_autoload_info[ucode->id].num_inst = 792 + RLC_NUM_INS_CODE0; 793 + break; 794 + case 1: 795 + rlc_autoload_info[ucode->id].num_inst = 796 + RLC_NUM_INS_CODE1; 797 + break; 798 + case 2: 799 + rlc_autoload_info[ucode->id].num_inst = 800 + RLC_NUM_INS_CODE2; 801 + break; 802 + case 3: 803 + rlc_autoload_info[ucode->id].num_inst = 804 + RLC_NUM_INS_CODE3; 805 + break; 806 + default: 807 + dev_err(adev->dev, 808 + "Invalid Instance number detected\n"); 809 + break; 810 + } 795 811 ucode++; 796 812 } 797 813 } ··· 865 837 uint32_t fw_size) 866 838 { 867 839 uint32_t toc_offset; 868 - uint32_t toc_fw_size; 840 + uint32_t toc_fw_size, toc_fw_inst_size; 869 841 char *ptr = adev->gfx.rlc.rlc_autoload_ptr; 842 + int i, num_inst; 870 843 871 844 if (id <= SOC24_FIRMWARE_ID_INVALID || id >= SOC24_FIRMWARE_ID_MAX) 872 845 return; 873 846 874 847 toc_offset = rlc_autoload_info[id].offset; 875 848 toc_fw_size = rlc_autoload_info[id].size; 849 + num_inst = rlc_autoload_info[id].num_inst; 850 + toc_fw_inst_size = toc_fw_size / num_inst; 876 851 877 852 if (fw_size == 0) 878 - fw_size = toc_fw_size; 853 + fw_size = toc_fw_inst_size; 879 854 880 - if (fw_size > toc_fw_size) 881 - fw_size = toc_fw_size; 855 + if (fw_size > toc_fw_inst_size) 856 + fw_size = toc_fw_inst_size; 882 857 883 - memcpy(ptr + toc_offset, fw_data, fw_size); 858 + for (i = 0; i < num_inst; i++) { 859 + memcpy(ptr + toc_offset + i * toc_fw_inst_size, fw_data, fw_size); 884 860 885 - if (fw_size < toc_fw_size) 886 - memset(ptr + toc_offset + fw_size, 0, toc_fw_size - fw_size); 861 + if (fw_size < toc_fw_inst_size) 862 + memset(ptr + toc_offset + fw_size + i * toc_fw_inst_size, 863 + 0, toc_fw_inst_size - fw_size); 864 + } 887 865 } 888 866 889 867 static void