drm/amdgpu: Use function for IP version check
Subsystems (5)
PATCH v2 1/2 drm/amdgpu: Use function for IP version check
Use an inline function for version check. Gives more flexibility to handle any format changes.
--- drivers/gpu/drm/amd/amdgpu/aldebaran.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 6 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 2 +- .../drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c | 2 +- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 29 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 92 +++++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 28 ++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 12 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 11 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 48 +++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 38 ++++--- .../gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 7 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 15 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 11 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 3 +- drivers/gpu/drm/amd/amdgpu/athub_v1_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/athub_v2_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/athub_v2_1.c | 2 +- drivers/gpu/drm/amd/amdgpu/athub_v3_0.c | 6 +- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 98 ++++++++++--------- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 27 ++--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 83 ++++++++-------- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 8 +- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 13 ++- drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c | 4 +- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 28 +++--- drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c | 8 +- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 96 +++++++++--------- drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c | 18 ++-- drivers/gpu/drm/amd/amdgpu/hdp_v6_0.c | 6 +- drivers/gpu/drm/amd/amdgpu/imu_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c | 4 +- drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/mes_v10_1.c | 10 +- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c | 12 +-- drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c | 2 +- drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_1.c | 2 +- drivers/gpu/drm/amd/amdgpu/mmhub_v3_3.c | 2 +- drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 4 +- drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 2 +- drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c | 6 +- drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c | 10 +- drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 4 +- drivers/gpu/drm/amd/amdgpu/nv.c | 8 +- drivers/gpu/drm/amd/amdgpu/psp_v10_0.c | 7 +- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/psp_v13_0.c | 6 +- drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 48 +++++---- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 7 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 4 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 9 +- drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/sienna_cichlid.c | 2 +- drivers/gpu/drm/amd/amdgpu/soc15.c | 27 +++-- drivers/gpu/drm/amd/amdgpu/soc21.c | 12 +-- drivers/gpu/drm/amd/amdgpu/umsch_mm_v4_0.c | 9 +- drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 9 +- drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 14 ++- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 7 +- drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 14 +-- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 12 ++- drivers/gpu/drm/amd/amdkfd/kfd_migrate.c | 2 +- .../drm/amd/amdkfd/kfd_packet_manager_v9.c | 3 +- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 34 +++---- .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 10 +- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 12 +-- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 24 ++--- .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 46 +++++---- .../amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 63 +++++++----- .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 32 +++--- .../gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 8 +- .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 18 ++-- .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 8 +- .../drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c | 2 +- .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c | 18 ++-- 94 files changed, 714 insertions(+), 593 deletions(-)
drivers/gpu/drm/amd/amdgpu/aldebaran.c +3 -3
@@ -35,7 +35,7 @@ static bool aldebaran_is_mode2_default(struct amdgpu_reset_control *reset_ctl) {struct amdgpu_device *adev = (struct amdgpu_device *)reset_ctl->handle; -if ((adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (13 ,0 ,2 ) && +if ((amdgpu_ip_version (adev,MP1_HWIP ,0 ) ==IP_VERSION (13 ,0 ,2 ) && adev->gmc.xgmi.connected_to_cpu))return true;
@@ -154,7 +154,7 @@ aldebaran_mode2_perform_reset(struct amdgpu_reset_control *reset_ctl,if (reset_device_list ==NULL )return -EINVAL ; -if (adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (13 ,0 ,2 ) && +if (amdgpu_ip_version (adev,MP1_HWIP ,0 ) ==IP_VERSION (13 ,0 ,2 ) && reset_context->hive ==NULL ) {/* Wrong context, return error */ return -EINVAL ;
@@ -335,7 +335,7 @@ aldebaran_mode2_restore_hwcontext(struct amdgpu_reset_control *reset_ctl,if (reset_device_list ==NULL )return -EINVAL ; -if (reset_context->reset_req_dev->ip_versions[MP1_HWIP ][0 ] == +if (amdgpu_ip_version (reset_context->reset_req_dev,MP1_HWIP ,0 ) ==IP_VERSION (13 ,0 ,2 ) && reset_context->hive ==NULL ) {/* Wrong context, return error */
drivers/gpu/drm/amd/amdgpu/amdgpu.h +6 -0
@@ -1106,6 +1106,12 @@ struct amdgpu_device {bool debug_disable_soft_recovery; }; +static inline uint32_t amdgpu_ip_version (const struct amdgpu_device *adev, +uint8_t ip,uint8_t inst) +{ +return adev->ip_versions[ip][inst]; +} +static inline struct amdgpu_device *drm_to_adev (struct drm_device *ddev) { return container_of(ddev, struct amdgpu_device, ddev);
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1 -1
@@ -707,7 +707,7 @@ void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool idle)/* Temporary workaround to fix issues observed in some * compute applications when GFXOFF is enabled on GFX11. */ -if (IP_VERSION_MAJ (adev->ip_versions[GC_HWIP ][0 ]) ==11 ) { +if (IP_VERSION_MAJ (amdgpu_ip_version (adev,GC_HWIP ,0 )) ==11 ) {pr_debug ("GFXOFF is %s\n" , idle ?"enabled" :"disabled" );amdgpu_gfx_off_ctrl (adev, idle); }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v11.c +1 -1
@@ -658,7 +658,7 @@ static int kgd_gfx_v11_validate_trap_override_request(struct amdgpu_device *adevKFD_DBG_TRAP_MASK_DBG_ADDRESS_WATCH |KFD_DBG_TRAP_MASK_DBG_MEMORY_VIOLATION ; -if (adev->ip_versions[GC_HWIP ][0 ] >=IP_VERSION (11 ,0 ,4 )) +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) >=IP_VERSION (11 ,0 ,4 )) *trap_mask_supported |=KFD_DBG_TRAP_MASK_TRAP_ON_WAVE_START |KFD_DBG_TRAP_MASK_TRAP_ON_WAVE_END ;
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +1 -1
@@ -677,7 +677,7 @@ void kgd_gfx_v9_set_wave_launch_stall(struct amdgpu_device *adev,int i;uint32_t data =RREG32 (SOC15_REG_OFFSET (GC ,0 , mmSPI_GDBG_WAVE_CNTL)); -if (adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (9 ,4 ,1 )) +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (9 ,4 ,1 )) data =REG_SET_FIELD (data,SPI_GDBG_WAVE_CNTL ,STALL_VMID , stall ?1 << vmid :0 );else
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +17 -12
@@ -1003,8 +1003,8 @@ static int amdgpu_device_asic_init(struct amdgpu_device *adev)amdgpu_asic_pre_asic_init (adev); -if (adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (9 ,4 ,3 ) || - adev->ip_versions[GC_HWIP ][0 ] >=IP_VERSION (11 ,0 ,0 )) { +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (9 ,4 ,3 ) || +amdgpu_ip_version (adev,GC_HWIP ,0 ) >=IP_VERSION (11 ,0 ,0 )) {amdgpu_psp_wait_for_bootloader (adev); ret =amdgpu_atomfirmware_asic_init (adev, true);return ret;
@@ -2845,7 +2845,7 @@ static void amdgpu_device_smu_fini_early(struct amdgpu_device *adev) {int i, r; -if (adev->ip_versions[GC_HWIP ][0 ] >IP_VERSION (9 ,0 ,0 )) +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) >IP_VERSION (9 ,0 ,0 ))return ;for (i =0 ; i < adev->num_ip_blocks; i++) {
@@ -3098,8 +3098,10 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)/* SDMA 5.x+ is part of GFX power domain so it's covered by GFXOFF */ if (adev->in_s0ix && - (adev->ip_versions[SDMA0_HWIP ][0 ] >=IP_VERSION (5 ,0 ,0 )) && - (adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_SDMA )) + (amdgpu_ip_version (adev,SDMA0_HWIP ,0 ) >= +IP_VERSION (5 ,0 ,0 )) && + (adev->ip_blocks[i].version->type == +AMD_IP_BLOCK_TYPE_SDMA ))continue ;/* Once swPSP provides the IMU, RLC FW binaries to TOS during cold-boot.
@@ -3590,8 +3592,8 @@ static void amdgpu_device_set_mcbp(struct amdgpu_device *adev) adev->gfx.mcbp = true; else if (amdgpu_mcbp == 0) adev->gfx.mcbp = false; - else if ((adev->ip_versions[GC_HWIP][0] >= IP_VERSION(9, 0, 0)) && - (adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 0, 0)) && + else if ((amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(9, 0, 0)) && + (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(10, 0, 0)) && adev->gfx.num_gfx_rings) adev->gfx.mcbp = true;
@@ -3811,7 +3813,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,* internal path natively support atomics, set have_atomics_support to true. */ }else if ((adev->flags &AMD_IS_APU ) && - (adev->ip_versions[GC_HWIP ][0 ] >IP_VERSION (9 ,0 ,0 ))) { + (amdgpu_ip_version (adev,GC_HWIP ,0 ) > +IP_VERSION (9 ,0 ,0 ))) { adev->have_atomics_support = true; }else { adev->have_atomics_support =
@@ -5444,8 +5447,9 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, adev->asic_reset_res = r;/* Aldebaran and gfx_11_0_3 support ras in SRIOV, so need resume ras during reset */ -if (adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (9 ,4 ,2 ) || - adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (11 ,0 ,3 )) +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) == +IP_VERSION (9 ,4 ,2 ) || +amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (11 ,0 ,3 ))amdgpu_ras_resume (adev); }else { r =amdgpu_do_asic_reset (device_list_handle, reset_context);
@@ -5470,7 +5474,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,drm_sched_start (&ring->sched, true); } -if (adev->enable_mes && adev->ip_versions[GC_HWIP ][0 ] !=IP_VERSION (11 ,0 ,3 )) +if (adev->enable_mes && +amdgpu_ip_version (adev,GC_HWIP ,0 ) !=IP_VERSION (11 ,0 ,3 ))amdgpu_mes_self_test (tmp_adev);if (!drm_drv_uses_atomic_modeset (adev_to_drm (tmp_adev)) && !job_signaled)
@@ -6147,7 +6152,7 @@ bool amdgpu_device_has_display_hardware(struct amdgpu_device *adev)return true;default :/* IP discovery */ -if (!adev->ip_versions[DCE_HWIP ][0 ] || +if (!amdgpu_ip_version (adev,DCE_HWIP ,0 ) || (adev->harvest_ip_mask &AMD_HARVEST_IP_DMU_MASK ))return false;return true;
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +45 -47
306 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +18 -10
@@ -766,11 +766,13 @@ static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb)return -EINVAL ; } -if (adev->ip_versions[GC_HWIP ][0 ] >=IP_VERSION (11 ,0 ,0 )) +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) >=IP_VERSION (11 ,0 ,0 )) version =AMD_FMT_MOD_TILE_VER_GFX11 ; -else if (adev->ip_versions[GC_HWIP ][0 ] >=IP_VERSION (10 ,3 ,0 )) +else if (amdgpu_ip_version (adev,GC_HWIP ,0 ) >= +IP_VERSION (10 ,3 ,0 )) version =AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS ; -else if (adev->ip_versions[GC_HWIP ][0 ] >=IP_VERSION (10 ,0 ,0 )) +else if (amdgpu_ip_version (adev,GC_HWIP ,0 ) >= +IP_VERSION (10 ,0 ,0 )) version =AMD_FMT_MOD_TILE_VER_GFX10 ;else version =AMD_FMT_MOD_TILE_VER_GFX9 ;
@@ -779,13 +781,15 @@ static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb)case 0 :/* Z microtiling */ return -EINVAL ;case 1 :/* S microtiling */ -if (adev->ip_versions[GC_HWIP ][0 ] <IP_VERSION (11 ,0 ,0 )) { +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) < +IP_VERSION (11 ,0 ,0 )) {if (!has_xor) version =AMD_FMT_MOD_TILE_VER_GFX9 ; }break ;case 2 : -if (adev->ip_versions[GC_HWIP ][0 ] <IP_VERSION (11 ,0 ,0 )) { +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) < +IP_VERSION (11 ,0 ,0 )) {if (!has_xor && afb->base.format->cpp[0 ] !=4 ) version =AMD_FMT_MOD_TILE_VER_GFX9 ; }
@@ -838,10 +842,12 @@ static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb)u64 render_dcc_offset;/* Enable constant encode on RAVEN2 and later. */ -bool dcc_constant_encode = (adev->asic_type >CHIP_RAVEN || - (adev->asic_type ==CHIP_RAVEN && - adev->external_rev_id >=0x81 )) && - adev->ip_versions[GC_HWIP ][0 ] <IP_VERSION (11 ,0 ,0 ); +bool dcc_constant_encode = + (adev->asic_type >CHIP_RAVEN || + (adev->asic_type ==CHIP_RAVEN && + adev->external_rev_id >=0x81 )) && +amdgpu_ip_version (adev,GC_HWIP ,0 ) < +IP_VERSION (11 ,0 ,0 );int max_cblock_size = dcc_i64b ?AMD_FMT_MOD_DCC_BLOCK_64B : dcc_i128b ? AMD_FMT_MOD_DCC_BLOCK_128B :
@@ -878,7 +884,9 @@ static int convert_tiling_flags_to_modifier(struct amdgpu_framebuffer *afb)if (adev->family >=AMDGPU_FAMILY_NV ) {int extra_pipe =0 ; -if ((adev->ip_versions[GC_HWIP ][0 ] >=IP_VERSION (10 ,3 ,0 )) && +if ((amdgpu_ip_version (adev,GC_HWIP , +0 ) >= +IP_VERSION (10 ,3 ,0 )) && pipes == packers && pipes >1 ) extra_pipe =1 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
@@ -2274,7 +2274,7 @@ amdgpu_pci_remove(struct pci_dev *pdev)pm_runtime_forbid (dev->dev); } -if (adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (13 ,0 ,2 ) && +if (amdgpu_ip_version (adev,MP1_HWIP ,0 ) ==IP_VERSION (13 ,0 ,2 ) && !amdgpu_sriov_vf (adev)) {bool need_to_reset_gpu = false;
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +2 -1
@@ -570,7 +570,8 @@ static bool amdgpu_fence_need_ring_interrupt_restore(struct amdgpu_ring *ring)switch (ring->funcs->type) {case AMDGPU_RING_TYPE_SDMA :/* SDMA 5.x+ is part of GFX power domain so it's covered by GFXOFF */ -if (adev->ip_versions[SDMA0_HWIP ][0 ] >=IP_VERSION (5 ,0 ,0 )) +if (amdgpu_ip_version (adev,SDMA0_HWIP ,0 ) >= +IP_VERSION (5 ,0 ,0 )) is_gfx_power_domain = true;break ;case AMDGPU_RING_TYPE_GFX :
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2 -2
@@ -158,7 +158,7 @@ static bool amdgpu_gfx_is_compute_multipipe_capable(struct amdgpu_device *adev)return amdgpu_compute_multipipe ==1 ; } -if (adev->ip_versions[GC_HWIP ][0 ] >IP_VERSION (9 ,0 ,0 )) +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) >IP_VERSION (9 ,0 ,0 ))return true;/* FIXME: spreading the queues across pipes causes perf regressions
@@ -385,7 +385,7 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,u32 domain =AMDGPU_GEM_DOMAIN_GTT ;/* Only enable on gfx10 and 11 for now to avoid changing behavior on older chips */ -if (adev->ip_versions[GC_HWIP ][0 ] >=IP_VERSION (10 ,0 ,0 )) +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) >=IP_VERSION (10 ,0 ,0 )) domain |=AMDGPU_GEM_DOMAIN_VRAM ;/* create MQD for KIQ */
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +2 -2
@@ -588,7 +588,7 @@ int amdgpu_gmc_allocate_vm_inv_eng(struct amdgpu_device *adev)*/ void amdgpu_gmc_tmz_set (struct amdgpu_device *adev) { -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {/* RAVEN */ case IP_VERSION (9 ,2 ,2 ):case IP_VERSION (9 ,1 ,0 ):
@@ -652,7 +652,7 @@ void amdgpu_gmc_tmz_set(struct amdgpu_device *adev)void amdgpu_gmc_noretry_set (struct amdgpu_device *adev) {struct amdgpu_gmc *gmc = &adev->gmc; -uint32_t gc_ver = adev->ip_versions[GC_HWIP ][0 ]; +uint32_t gc_ver =amdgpu_ip_version (adev,GC_HWIP ,0 ); bool noretry_default = (gc_ver == IP_VERSION(9, 0, 1) || gc_ver == IP_VERSION(9, 3, 0) || gc_ver == IP_VERSION(9, 4, 0) ||
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +8 -4
@@ -501,18 +501,22 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,if (adev->asic_type >=CHIP_VEGA10 ) {switch (type) {case AMD_IP_BLOCK_TYPE_GFX : - result->ip_discovery_version = adev->ip_versions[GC_HWIP ][0 ]; + result->ip_discovery_version = +amdgpu_ip_version (adev,GC_HWIP ,0 );break ;case AMD_IP_BLOCK_TYPE_SDMA : - result->ip_discovery_version = adev->ip_versions[SDMA0_HWIP ][0 ]; + result->ip_discovery_version = +amdgpu_ip_version (adev,SDMA0_HWIP ,0 );break ;case AMD_IP_BLOCK_TYPE_UVD :case AMD_IP_BLOCK_TYPE_VCN :case AMD_IP_BLOCK_TYPE_JPEG : - result->ip_discovery_version = adev->ip_versions[UVD_HWIP ][0 ]; + result->ip_discovery_version = +amdgpu_ip_version (adev,UVD_HWIP ,0 );break ;case AMD_IP_BLOCK_TYPE_VCE : - result->ip_discovery_version = adev->ip_versions[VCE_HWIP ][0 ]; + result->ip_discovery_version = +amdgpu_ip_version (adev,VCE_HWIP ,0 );break ;default : result->ip_discovery_version =0 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +7 -4
@@ -131,7 +131,8 @@ int amdgpu_mes_init(struct amdgpu_device *adev) adev->mes.gfx_hqd_mask[i] = i ?0 :0xfffffffe ;for (i =0 ; i <AMDGPU_MES_MAX_SDMA_PIPES ; i++) { -if (adev->ip_versions[SDMA0_HWIP ][0 ] <IP_VERSION (6 ,0 ,0 )) +if (amdgpu_ip_version (adev,SDMA0_HWIP ,0 ) < +IP_VERSION (6 ,0 ,0 )) adev->mes.sdma_hqd_mask[i] = i ?0 :0x3fc ;/* zero sdma_hqd_mask for non-existent engine */ else if (adev->sdma.num_instances ==1 )
@@ -1339,8 +1340,10 @@ int amdgpu_mes_self_test(struct amdgpu_device *adev)for (i =0 ; i <ARRAY_SIZE (queue_types); i++) {/* On GFX v10.3, fw hasn't supported to map sdma queue. */ -if (adev->ip_versions[GC_HWIP ][0 ] >=IP_VERSION (10 ,3 ,0 ) && - adev->ip_versions[GC_HWIP ][0 ] <IP_VERSION (11 ,0 ,0 ) && +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) >= +IP_VERSION (10 ,3 ,0 ) && +amdgpu_ip_version (adev,GC_HWIP ,0 ) < +IP_VERSION (11 ,0 ,0 ) && queue_types[i][0 ] ==AMDGPU_RING_TYPE_SDMA )continue ;
@@ -1401,7 +1404,7 @@ int amdgpu_mes_init_microcode(struct amdgpu_device *adev, int pipe)amdgpu_ucode_ip_version_decode (adev,GC_HWIP , ucode_prefix,sizeof (ucode_prefix)); -if (adev->ip_versions[GC_HWIP ][0 ] >=IP_VERSION (11 ,0 ,0 )) { +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) >=IP_VERSION (11 ,0 ,0 )) {snprintf (fw_name,sizeof (fw_name),"amdgpu/%s_mes%s.bin" , ucode_prefix, pipe ==AMDGPU_MES_SCHED_PIPE ?"_2" :"1" );
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +27 -21
127 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +22 -16
@@ -201,8 +201,8 @@ static ssize_t amdgpu_ras_debugfs_read(struct file *f, char __user *buf,return -EINVAL ;/* Hardware counter will be reset automatically after the query on Vega20 and Arcturus */ -if (obj->adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,2 ) && - obj->adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,4 )) { +if (amdgpu_ip_version (obj->adev,MP0_HWIP ,0 ) !=IP_VERSION (11 ,0 ,2 ) && +amdgpu_ip_version (obj->adev,MP0_HWIP ,0 ) !=IP_VERSION (11 ,0 ,4 )) {if (amdgpu_ras_reset_error_status (obj->adev, info.head.block))dev_warn (obj->adev->dev,"Failed to reset error counter and error status" ); }
@@ -611,8 +611,8 @@ static ssize_t amdgpu_ras_sysfs_read(struct device *dev,if (amdgpu_ras_query_error_status (obj->adev, &info))return -EINVAL ; -if (obj->adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,2 ) && - obj->adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,4 )) { +if (amdgpu_ip_version (obj->adev,MP0_HWIP ,0 ) !=IP_VERSION (11 ,0 ,2 ) && +amdgpu_ip_version (obj->adev,MP0_HWIP ,0 ) !=IP_VERSION (11 ,0 ,4 )) {if (amdgpu_ras_reset_error_status (obj->adev, info.head.block))dev_warn (obj->adev->dev,"Failed to reset error counter and error status" ); }
@@ -1208,8 +1208,8 @@ static int amdgpu_ras_query_error_count_helper(struct amdgpu_device *adev,/* some hardware/IP supports read to clear * no need to explictly reset the err status after the query call */ -if (adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,2 ) && - adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,4 )) { +if (amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (11 ,0 ,2 ) && +amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (11 ,0 ,4 )) {if (amdgpu_ras_reset_error_status (adev, query_info->head.block))dev_warn (adev->dev,"Failed to reset error counter and error status\n" );
@@ -1905,14 +1905,18 @@ static void amdgpu_ras_log_on_err_counter(struct amdgpu_device *adev)* should be removed until smu fix handle ecc_info table. */ if ((info.head.block ==AMDGPU_RAS_BLOCK__UMC ) && - (adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (13 ,0 ,2 ))) + (amdgpu_ip_version (adev,MP1_HWIP ,0 ) == +IP_VERSION (13 ,0 ,2 )))continue ;amdgpu_ras_query_error_status (adev, &info); -if (adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,2 ) && - adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (11 ,0 ,4 ) && - adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (13 ,0 ,0 )) { +if (amdgpu_ip_version (adev,MP0_HWIP ,0 ) != +IP_VERSION (11 ,0 ,2 ) && +amdgpu_ip_version (adev,MP0_HWIP ,0 ) != +IP_VERSION (11 ,0 ,4 ) && +amdgpu_ip_version (adev,MP0_HWIP ,0 ) != +IP_VERSION (13 ,0 ,0 )) {if (amdgpu_ras_reset_error_status (adev, info.head.block))dev_warn (adev->dev,"Failed to reset error counter and error status" ); }
@@ -2400,7 +2404,7 @@ static int amdgpu_ras_recovery_fini(struct amdgpu_device *adev)static bool amdgpu_ras_asic_supported (struct amdgpu_device *adev) {if (amdgpu_sriov_vf (adev)) { -switch (adev->ip_versions[MP0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP0_HWIP ,0 )) {case IP_VERSION (13 ,0 ,2 ):case IP_VERSION (13 ,0 ,6 ):return true;
@@ -2410,7 +2414,7 @@ static bool amdgpu_ras_asic_supported(struct amdgpu_device *adev) }if (adev->asic_type ==CHIP_IP_DISCOVERY ) { -switch (adev->ip_versions[MP0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP0_HWIP ,0 )) {case IP_VERSION (13 ,0 ,0 ):case IP_VERSION (13 ,0 ,6 ):case IP_VERSION (13 ,0 ,10 ):
@@ -2484,8 +2488,10 @@ static void amdgpu_ras_check_supported(struct amdgpu_device *adev)/* VCN/JPEG RAS can be supported on both bare metal and * SRIOV environment */ -if (adev->ip_versions[VCN_HWIP ][0 ] ==IP_VERSION (2 ,6 ,0 ) || - adev->ip_versions[VCN_HWIP ][0 ] ==IP_VERSION (4 ,0 ,0 )) +if (amdgpu_ip_version (adev,VCN_HWIP ,0 ) == +IP_VERSION (2 ,6 ,0 ) || +amdgpu_ip_version (adev,VCN_HWIP ,0 ) == +IP_VERSION (4 ,0 ,0 )) adev->ras_hw_enabled |= (1 <<AMDGPU_RAS_BLOCK__VCN |1 <<AMDGPU_RAS_BLOCK__JPEG );else
@@ -2519,7 +2525,7 @@ static void amdgpu_ras_check_supported(struct amdgpu_device *adev)* Disable ras feature for aqua vanjaram * by default on apu platform. */ -if (adev->ip_versions[MP0_HWIP ][0 ] ==IP_VERSION (13 ,0 ,6 ) && +if (amdgpu_ip_version (adev,MP0_HWIP ,0 ) ==IP_VERSION (13 ,0 ,6 ) && adev->gmc.is_app_apu) adev->ras_enabled = amdgpu_ras_enable !=1 ?0 : adev->ras_hw_enabled & amdgpu_ras_mask;
@@ -2634,7 +2640,7 @@ int amdgpu_ras_init(struct amdgpu_device *adev)/* initialize nbio ras function ahead of any other * ras functions so hardware fatal error interrupt * can be enabled as early as possible */ -switch (adev->ip_versions[NBIO_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,NBIO_HWIP ,0 )) {case IP_VERSION (7 ,4 ,0 ):case IP_VERSION (7 ,4 ,1 ):case IP_VERSION (7 ,4 ,4 ):
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +2 -2
@@ -153,7 +153,7 @@static bool __is_ras_eeprom_supported (struct amdgpu_device *adev) { -switch (adev->ip_versions[MP1_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP1_HWIP ,0 )) {case IP_VERSION (11 ,0 ,2 ):/* VEGA20 and ARCTURUS */ case IP_VERSION (11 ,0 ,7 ):/* Sienna cichlid */ case IP_VERSION (13 ,0 ,0 ):
@@ -191,7 +191,7 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,return true; } -switch (adev->ip_versions[MP1_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP1_HWIP ,0 )) {case IP_VERSION (11 ,0 ,2 ):/* VEGA20 and ARCTURUS */ if (adev->asic_type ==CHIP_VEGA20 )
drivers/gpu/drm/amd/amdgpu/amdgpu_reset.c +2 -2
@@ -30,7 +30,7 @@ int amdgpu_reset_init(struct amdgpu_device *adev) {int ret =0 ; -switch (adev->ip_versions[MP1_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP1_HWIP ,0 )) {case IP_VERSION (13 ,0 ,2 ):case IP_VERSION (13 ,0 ,6 ): ret =aldebaran_reset_init (adev);
@@ -52,7 +52,7 @@ int amdgpu_reset_fini(struct amdgpu_device *adev) {int ret =0 ; -switch (adev->ip_versions[MP1_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP1_HWIP ,0 )) {case IP_VERSION (13 ,0 ,2 ):case IP_VERSION (13 ,0 ,6 ): ret =aldebaran_reset_fini (adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +5 -2
@@ -251,8 +251,11 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,else {/* Use a single copy per SDMA firmware type. PSP uses the same instance for all * groups of SDMAs */ -if (adev->ip_versions[SDMA0_HWIP ][0 ] ==IP_VERSION (4 ,4 ,2 ) && - adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP && +if (amdgpu_ip_version (adev,SDMA0_HWIP , +0 ) == +IP_VERSION (4 ,4 ,2 ) && + adev->firmware.load_type == +AMDGPU_FW_LOAD_PSP && adev->sdma.num_inst_per_aid == i) {break ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -1
@@ -1727,7 +1727,8 @@ static int amdgpu_ttm_reserve_tmr(struct amdgpu_device *adev) reserve_size =amdgpu_atomfirmware_get_fw_reserved_fb_size (adev); -if (!adev->bios && adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (9 ,4 ,3 )) +if (!adev->bios && +amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (9 ,4 ,3 )) reserve_size =max (reserve_size, (uint32_t )280 <<20 );else if (!reserve_size) reserve_size =DISCOVERY_TMR_OFFSET ;
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +8 -7
@@ -1119,7 +1119,7 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev)static const char *amdgpu_ucode_legacy_naming (struct amdgpu_device *adev,int block_type) {if (block_type ==MP0_HWIP ) { -switch (adev->ip_versions[MP0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP0_HWIP ,0 )) {case IP_VERSION (9 ,0 ,0 ):switch (adev->asic_type) {case CHIP_VEGA10 :
@@ -1170,7 +1170,7 @@ static const char *amdgpu_ucode_legacy_naming(struct amdgpu_device *adev, int blreturn "yellow_carp" ; } }else if (block_type ==MP1_HWIP ) { -switch (adev->ip_versions[MP1_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP1_HWIP ,0 )) {case IP_VERSION (9 ,0 ,0 ):case IP_VERSION (10 ,0 ,0 ):case IP_VERSION (10 ,0 ,1 ):
@@ -1196,7 +1196,7 @@ static const char *amdgpu_ucode_legacy_naming(struct amdgpu_device *adev, int blreturn "aldebaran_smc" ; } }else if (block_type ==SDMA0_HWIP ) { -switch (adev->ip_versions[SDMA0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,SDMA0_HWIP ,0 )) {case IP_VERSION (4 ,0 ,0 ):return "vega10_sdma" ;case IP_VERSION (4 ,0 ,1 ):
@@ -1240,7 +1240,7 @@ static const char *amdgpu_ucode_legacy_naming(struct amdgpu_device *adev, int blreturn "vangogh_sdma" ; } }else if (block_type ==UVD_HWIP ) { -switch (adev->ip_versions[UVD_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,UVD_HWIP ,0 )) {case IP_VERSION (1 ,0 ,0 ):case IP_VERSION (1 ,0 ,1 ):if (adev->apu_flags &AMD_APU_IS_RAVEN2 )
@@ -1265,7 +1265,8 @@ static const char *amdgpu_ucode_legacy_naming(struct amdgpu_device *adev, int blcase IP_VERSION (3 ,0 ,0 ):case IP_VERSION (3 ,0 ,64 ):case IP_VERSION (3 ,0 ,192 ): -if (adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (10 ,3 ,0 )) +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) == +IP_VERSION (10 ,3 ,0 ))return "sienna_cichlid_vcn" ;return "navy_flounder_vcn" ;case IP_VERSION (3 ,0 ,2 ):
@@ -1278,7 +1279,7 @@ static const char *amdgpu_ucode_legacy_naming(struct amdgpu_device *adev, int blreturn "yellow_carp_vcn" ; } }else if (block_type ==GC_HWIP ) { -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (9 ,0 ,1 ):return "vega10" ;case IP_VERSION (9 ,2 ,1 ):
@@ -1331,7 +1332,7 @@ void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type,int maj, min, rev;char *ip_name;const char *legacy; -uint32_t version = adev->ip_versions[block_type][0 ]; +uint32_t version =amdgpu_ip_version (adev, block_type,0 ); legacy =amdgpu_ucode_legacy_naming (adev, block_type);if (legacy) {
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +1 -1
@@ -28,7 +28,7 @@ static int amdgpu_umc_convert_error_address(struct amdgpu_device *adev, struct ras_err_data *err_data, uint64_t err_addr, uint32_t ch_inst, uint32_t umc_inst) { - switch (adev->ip_versions[UMC_HWIP][0]) { + switch (amdgpu_ip_version(adev, UMC_HWIP, 0)) { case IP_VERSION(6, 7, 0):umc_v6_7_convert_error_address (adev ,err_data ,err_addr ,ch_inst ,umc_inst );
drivers/gpu/drm/amd/amdgpu/amdgpu_umsch_mm.c +2 -2
@@ -581,7 +581,7 @@ int amdgpu_umsch_mm_init_microcode(struct amdgpu_umsch_mm *umsch)const char *fw_name =NULL ;int r; -switch (adev->ip_versions[VCN_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,VCN_HWIP ,0 )) {case IP_VERSION (4 ,0 ,5 ): fw_name ="amdgpu/umsch_mm_4_0_0.bin" ;break ;
@@ -758,7 +758,7 @@ static int umsch_mm_early_init(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; -switch (adev->ip_versions[VCN_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,VCN_HWIP ,0 )) {case IP_VERSION (4 ,0 ,5 ):umsch_mm_v4_0_set_funcs (&adev->umsch_mm);break ;
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +6 -5
@@ -126,7 +126,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)* Hence, check for these versions here - notice this is * restricted to Vangogh (Deck's APU). */ -if (adev->ip_versions[UVD_HWIP ][0 ] ==IP_VERSION (3 ,0 ,2 )) { +if (amdgpu_ip_version (adev,UVD_HWIP ,0 ) ==IP_VERSION (3 ,0 ,2 )) {const char *bios_ver =dmi_get_system_info (DMI_BIOS_VERSION ); if (bios_ver && (!strncmp("F7A0113", bios_ver, 7) ||
@@ -171,7 +171,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)if (adev->firmware.load_type !=AMDGPU_FW_LOAD_PSP ) bo_size +=AMDGPU_GPU_PAGE_ALIGN (le32_to_cpu (hdr->ucode_size_bytes) +8 ); -if (adev->ip_versions[UVD_HWIP ][0 ] >=IP_VERSION (4 ,0 ,0 )) { +if (amdgpu_ip_version (adev,UVD_HWIP ,0 ) >=IP_VERSION (4 ,0 ,0 )) { fw_shared_size =AMDGPU_GPU_PAGE_ALIGN (sizeof (struct amdgpu_vcn4_fw_shared )); log_offset = offsetof(struct amdgpu_vcn4_fw_shared , fw_log); }else {
@@ -267,7 +267,7 @@ static bool amdgpu_vcn_using_unified_queue(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;bool ret = false; -if (adev->ip_versions[UVD_HWIP ][0 ] >=IP_VERSION (4 ,0 ,0 )) +if (amdgpu_ip_version (adev,UVD_HWIP ,0 ) >=IP_VERSION (4 ,0 ,0 )) ret = true;return ret;
@@ -998,7 +998,7 @@ int amdgpu_vcn_unified_ring_test_ib(struct amdgpu_ring *ring, long timeout)struct amdgpu_device *adev = ring->adev;long r; -if (adev->ip_versions[UVD_HWIP ][0 ] !=IP_VERSION (4 ,0 ,3 )) { +if (amdgpu_ip_version (adev,UVD_HWIP ,0 ) !=IP_VERSION (4 ,0 ,3 )) { r =amdgpu_vcn_enc_ring_test_ib (ring, timeout);if (r) goto error;
@@ -1048,7 +1048,8 @@ void amdgpu_vcn_setup_ucode(struct amdgpu_device *adev) adev->firmware.fw_size +=ALIGN (le32_to_cpu (hdr->ucode_size_bytes),PAGE_SIZE ); -if (adev->ip_versions[UVD_HWIP ][0 ] ==IP_VERSION (4 ,0 ,3 )) +if (amdgpu_ip_version (adev,UVD_HWIP ,0 ) == +IP_VERSION (4 ,0 ,3 ))break ; }dev_info (adev->dev,"Will use PSP to load VCN firmware\n" );
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +2 -2
@@ -837,7 +837,7 @@ enum amdgpu_sriov_vf_mode amdgpu_virt_get_sriov_vf_mode(struct amdgpu_device *advoid amdgpu_virt_post_reset (struct amdgpu_device *adev) { -if (adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (11 ,0 ,3 )) { +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (11 ,0 ,3 )) {/* force set to GFXOFF state after reset, * to avoid some invalid operation before GC enable */
@@ -847,7 +847,7 @@ void amdgpu_virt_post_reset(struct amdgpu_device *adev)bool amdgpu_virt_fw_load_skip_check (struct amdgpu_device *adev,uint32_t ucode_id) { -switch (adev->ip_versions[MP0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP0_HWIP ,0 )) {case IP_VERSION (13 ,0 ,0 ):/* no vf autoload, white list */ if (ucode_id == AMDGPU_UCODE_ID_VCN1 ||
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -2
@@ -802,12 +802,12 @@ int amdgpu_vm_update_range(struct amdgpu_device *adev, struct amdgpu_vm *vm,* heavy-weight flush TLB unconditionally. */ flush_tlb |= adev->gmc.xgmi.num_physical_nodes && - adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (9 ,4 ,0 ); +amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (9 ,4 ,0 );/* * On GFX8 and older any 8 PTE block with a valid bit set enters the TLB */ - flush_tlb |= adev->ip_versions[GC_HWIP ][0 ] <IP_VERSION (9 ,0 ,0 ); + flush_tlb |=amdgpu_ip_version (adev,GC_HWIP ,0 ) <IP_VERSION (9 ,0 ,0 );memset (¶ms,0 ,sizeof (params)); params.adev = adev;
drivers/gpu/drm/amd/amdgpu/amdgpu_vpe.c +1 -1
@@ -123,7 +123,7 @@ static int vpe_early_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;struct amdgpu_vpe *vpe = &adev->vpe; -switch (adev->ip_versions[VPE_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,VPE_HWIP ,0 )) {case IP_VERSION (6 ,1 ,0 ):vpe_v6_1_set_funcs (vpe);break ;
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +2 -1
@@ -948,7 +948,8 @@ static int amdgpu_xgmi_query_pcs_error_status(struct amdgpu_device *adev,uint32_t field_array_size =0 ;if (is_xgmi_pcs) { -if (adev->ip_versions[XGMI_HWIP ][0 ] ==IP_VERSION (6 ,1 ,0 )) { +if (amdgpu_ip_version (adev,XGMI_HWIP ,0 ) == +IP_VERSION (6 ,1 ,0 )) { pcs_ras_fields = &xgmi3x16_pcs_ras_fields[0 ]; field_array_size =ARRAY_SIZE (xgmi3x16_pcs_ras_fields); }else {
drivers/gpu/drm/amd/amdgpu/athub_v1_0.c +1 -1
@@ -68,7 +68,7 @@ int athub_v1_0_set_clockgating(struct amdgpu_device *adev,if (amdgpu_sriov_vf (adev))return 0 ; -switch (adev->ip_versions[ATHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,ATHUB_HWIP ,0 )) {case IP_VERSION (9 ,0 ,0 ):case IP_VERSION (9 ,1 ,0 ):case IP_VERSION (9 ,2 ,0 ):
drivers/gpu/drm/amd/amdgpu/athub_v2_0.c +1 -1
@@ -77,7 +77,7 @@ int athub_v2_0_set_clockgating(struct amdgpu_device *adev,if (amdgpu_sriov_vf (adev))return 0 ; -switch (adev->ip_versions[ATHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,ATHUB_HWIP ,0 )) {case IP_VERSION (1 ,3 ,1 ):case IP_VERSION (2 ,0 ,0 ):case IP_VERSION (2 ,0 ,2 ):
drivers/gpu/drm/amd/amdgpu/athub_v2_1.c +1 -1
@@ -70,7 +70,7 @@ int athub_v2_1_set_clockgating(struct amdgpu_device *adev,if (amdgpu_sriov_vf (adev))return 0 ; -switch (adev->ip_versions[ATHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,ATHUB_HWIP ,0 )) {case IP_VERSION (2 ,1 ,0 ):case IP_VERSION (2 ,1 ,1 ):case IP_VERSION (2 ,1 ,2 ):
drivers/gpu/drm/amd/amdgpu/athub_v3_0.c +3 -3
@@ -36,7 +36,7 @@ static uint32_t athub_v3_0_get_cg_cntl(struct amdgpu_device *adev) {uint32_t data; -switch (adev->ip_versions[ATHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,ATHUB_HWIP ,0 )) {case IP_VERSION (3 ,0 ,1 ): data =RREG32_SOC15 (ATHUB ,0 , regATHUB_MISC_CNTL_V3_0_1);break ;
@@ -49,7 +49,7 @@ static uint32_t athub_v3_0_get_cg_cntl(struct amdgpu_device *adev)static void athub_v3_0_set_cg_cntl (struct amdgpu_device *adev,uint32_t data) { -switch (adev->ip_versions[ATHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,ATHUB_HWIP ,0 )) {case IP_VERSION (3 ,0 ,1 ):WREG32_SOC15 (ATHUB ,0 , regATHUB_MISC_CNTL_V3_0_1, data);break ;
@@ -99,7 +99,7 @@ int athub_v3_0_set_clockgating(struct amdgpu_device *adev,if (amdgpu_sriov_vf (adev))return 0 ; -switch (adev->ip_versions[ATHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,ATHUB_HWIP ,0 )) {case IP_VERSION (3 ,0 ,0 ):case IP_VERSION (3 ,0 ,1 ):case IP_VERSION (3 ,0 ,2 ):
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +54 -44
298 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +14 -13
@@ -288,7 +288,7 @@ static void gfx_v11_0_set_kiq_pm4_funcs(struct amdgpu_device *adev)static void gfx_v11_0_init_golden_registers (struct amdgpu_device *adev) { -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (11 ,0 ,1 ):case IP_VERSION (11 ,0 ,4 ): soc15_program_register_sequence(adev,
@@ -493,7 +493,7 @@ static int gfx_v11_0_init_toc_microcode(struct amdgpu_device *adev, const char *static void gfx_v11_0_check_fw_cp_gfx_shadow (struct amdgpu_device *adev) { -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (11 ,0 ,0 ):case IP_VERSION (11 ,0 ,2 ):case IP_VERSION (11 ,0 ,3 ):
@@ -884,8 +884,7 @@ static const struct amdgpu_gfx_funcs gfx_v11_0_gfx_funcs = {static int gfx_v11_0_gpu_early_init (struct amdgpu_device *adev) { - -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (11 ,0 ,0 ):case IP_VERSION (11 ,0 ,2 ): adev->gfx.config.max_hw_contexts =8 ;
@@ -1332,7 +1331,7 @@ static int gfx_v11_0_sw_init(void *handle) adev->gfxhub.funcs->init (adev); -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (11 ,0 ,0 ):case IP_VERSION (11 ,0 ,2 ):case IP_VERSION (11 ,0 ,3 ):
@@ -1364,8 +1363,8 @@ static int gfx_v11_0_sw_init(void *handle) }/* Enable CG flag in one VF mode for enabling RLC safe mode enter/exit */ -if (adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (11 ,0 ,3 ) && -amdgpu_sriov_is_pp_one_vf (adev)) +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (11 ,0 ,3 ) && +amdgpu_sriov_is_pp_one_vf (adev)) adev->cg_flags =AMD_CG_SUPPORT_GFX_CGCG ;/* EOP Event */
@@ -2592,9 +2591,11 @@ static int gfx_v11_0_wait_for_rlc_autoload_complete(struct amdgpu_device *adev)for (i =0 ; i < adev->usec_timeout; i++) { cp_status =RREG32_SOC15 (GC ,0 , regCP_STAT); -if (adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (11 ,0 ,1 ) || - adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (11 ,0 ,4 ) || - adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (11 ,5 ,0 )) +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) == +IP_VERSION (11 ,0 ,1 ) || +amdgpu_ip_version (adev,GC_HWIP ,0 ) == +IP_VERSION (11 ,0 ,4 ) || +amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (11 ,5 ,0 )) bootload_status =RREG32_SOC15 (GC ,0 , regRLC_RLCS_BOOTLOAD_STATUS_gc_11_0_1);else
@@ -5025,7 +5026,7 @@ static void gfx_v11_cntl_power_gating(struct amdgpu_device *adev, bool enable)// Program RLC_PG_DELAY3 for CGPG hysteresis if (enable && (adev->pg_flags &AMD_PG_SUPPORT_GFX_PG )) { -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (11 ,0 ,1 ):case IP_VERSION (11 ,0 ,4 ):WREG32_SOC15 (GC ,0 , regRLC_PG_DELAY_3,RLC_PG_DELAY_3_DEFAULT_GC_11_0_1 );
@@ -5054,7 +5055,7 @@ static int gfx_v11_0_set_powergating_state(void *handle,if (amdgpu_sriov_vf (adev))return 0 ; -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (11 ,0 ,0 ):case IP_VERSION (11 ,0 ,2 ):case IP_VERSION (11 ,0 ,3 ):
@@ -5086,7 +5087,7 @@ static int gfx_v11_0_set_clockgating_state(void *handle,if (amdgpu_sriov_vf (adev))return 0 ; -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (11 ,0 ,0 ):case IP_VERSION (11 ,0 ,1 ):case IP_VERSION (11 ,0 ,2 ):
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +43 -40
272 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +4 -4
@@ -682,7 +682,7 @@ static int gfx_v9_4_3_gpu_early_init(struct amdgpu_device *adev) adev->gfx.funcs = &gfx_v9_4_3_gfx_funcs; adev->gfx.ras = &gfx_v9_4_3_ras; -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (9 ,4 ,3 ): adev->gfx.config.max_hw_contexts =8 ; adev->gfx.config.sc_prim_fifo_size_frontend =0x20 ;
@@ -2430,7 +2430,7 @@ static int gfx_v9_4_3_set_clockgating_state(void *handle,return 0 ; num_xcc =NUM_XCC (adev->gfx.xcc_mask); -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (9 ,4 ,3 ):for (i =0 ; i < num_xcc; i++) gfx_v9_4_3_xcc_update_gfx_clock_gating(
@@ -4231,7 +4231,7 @@ static void gfx_v9_4_3_set_rlc_funcs(struct amdgpu_device *adev)static void gfx_v9_4_3_set_gds_init (struct amdgpu_device *adev) {/* init asci gds info */ -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (9 ,4 ,3 ):/* 9.4.3 removed all the GDS internal memory, * only support GWS opcode in kernel, like barrier
@@ -4243,7 +4243,7 @@ static void gfx_v9_4_3_set_gds_init(struct amdgpu_device *adev)break ; } -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (9 ,4 ,3 ):/* deprecated for 9.4.3, no usage at all */ adev->gds.gds_compute_max_wave_id =0 ;
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +8 -5
@@ -356,11 +356,14 @@ static void gfxhub_v1_2_xcc_setup_vmid_config(struct amdgpu_device *adev,* the SQ per-process. * Retry faults need to be enabled for that to work. */ - tmp =REG_SET_FIELD (tmp,VM_CONTEXT1_CNTL , -RETRY_PERMISSION_OR_INVALID_PAGE_FAULT , - !adev->gmc.noretry || - adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (9 ,4 ,2 ) || - adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (9 ,4 ,3 )); + tmp =REG_SET_FIELD ( + tmp,VM_CONTEXT1_CNTL , +RETRY_PERMISSION_OR_INVALID_PAGE_FAULT , + !adev->gmc.noretry || +amdgpu_ip_version (adev,GC_HWIP ,0 ) == +IP_VERSION (9 ,4 ,2 ) || +amdgpu_ip_version (adev,GC_HWIP ,0 ) == +IP_VERSION (9 ,4 ,3 ));WREG32_SOC15_OFFSET (GC ,GET_INST (GC , j), regVM_CONTEXT1_CNTL, i * hub->ctx_distance, tmp); WREG32_SOC15_OFFSET(GC, GET_INST(GC, j),
drivers/gpu/drm/amd/amdgpu/gfxhub_v2_1.c +2 -2
@@ -510,7 +510,7 @@ static int gfxhub_v2_1_get_xgmi_info(struct amdgpu_device *adev)u32 max_num_physical_nodes =0 ;u32 max_physical_node_id =0 ; -switch (adev->ip_versions[XGMI_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,XGMI_HWIP ,0 )) {case IP_VERSION (4 ,8 ,0 ): max_num_physical_nodes =4 ; max_physical_node_id =3 ;
@@ -548,7 +548,7 @@ static void gfxhub_v2_1_utcl2_harvest(struct amdgpu_device *adev) adev->gfx.config.max_sh_per_se * adev->gfx.config.max_shader_engines); -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (10 ,3 ,1 ):case IP_VERSION (10 ,3 ,3 ):/* Get SA disabled bitmap from eFuse setting */
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +15 -13
@@ -145,7 +145,8 @@ static int gmc_v10_0_process_interrupt(struct amdgpu_device *adev,* the new fast GRBM interface. */ if ((entry->vmid_src ==AMDGPU_GFXHUB (0 )) && - (adev->ip_versions[GC_HWIP ][0 ] <IP_VERSION (10 ,3 ,0 ))) + (amdgpu_ip_version (adev,GC_HWIP ,0 ) < +IP_VERSION (10 ,3 ,0 )))RREG32 (hub->vm_l2_pro_fault_status); status =RREG32 (hub->vm_l2_pro_fault_status);
@@ -278,7 +279,7 @@ static void gmc_v10_0_flush_vm_hub(struct amdgpu_device *adev, uint32_t vmid,* to avoid a false ACK due to the new fast GRBM interface. */ if ((vmhub ==AMDGPU_GFXHUB (0 )) && - (adev->ip_versions[GC_HWIP ][0 ] <IP_VERSION (10 ,3 ,0 ))) + (amdgpu_ip_version (adev,GC_HWIP ,0 ) <IP_VERSION (10 ,3 ,0 )))RREG32_RLC_NO_KIQ (hub->vm_inv_eng0_req + hub->eng_distance * eng, hub_ip);
@@ -680,7 +681,7 @@ static void gmc_v10_0_set_gmc_funcs(struct amdgpu_device *adev)static void gmc_v10_0_set_umc_funcs (struct amdgpu_device *adev) { -switch (adev->ip_versions[UMC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,UMC_HWIP ,0 )) {case IP_VERSION (8 ,7 ,0 ): adev->umc.max_ras_err_cnt_per_query =UMC_V8_7_TOTAL_CHANNEL_NUM ; adev->umc.channel_inst_num =UMC_V8_7_CHANNEL_INSTANCE_NUM ;
@@ -697,7 +698,7 @@ static void gmc_v10_0_set_umc_funcs(struct amdgpu_device *adev)static void gmc_v10_0_set_mmhub_funcs (struct amdgpu_device *adev) { -switch (adev->ip_versions[MMHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) {case IP_VERSION (2 ,3 ,0 ):case IP_VERSION (2 ,4 ,0 ):case IP_VERSION (2 ,4 ,1 ):
@@ -711,7 +712,7 @@ static void gmc_v10_0_set_mmhub_funcs(struct amdgpu_device *adev)static void gmc_v10_0_set_gfxhub_funcs (struct amdgpu_device *adev) { -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (10 ,3 ,0 ):case IP_VERSION (10 ,3 ,2 ):case IP_VERSION (10 ,3 ,1 ):
@@ -825,7 +826,7 @@ static int gmc_v10_0_mc_init(struct amdgpu_device *adev)/* set the gart size */ if (amdgpu_gart_size ==-1 ) { -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {default : adev->gmc.gart_size =512ULL <<20 ;break ;
@@ -892,7 +893,7 @@ static int gmc_v10_0_sw_init(void *handle) adev->gmc.vram_vendor = vram_vendor; } -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (10 ,3 ,0 ): adev->gmc.mall_size =128 *1024 *1024 ;break ;
@@ -910,7 +911,7 @@ static int gmc_v10_0_sw_init(void *handle)break ; } -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (10 ,1 ,10 ):case IP_VERSION (10 ,1 ,1 ):case IP_VERSION (10 ,1 ,2 ):
@@ -1195,7 +1196,8 @@ static int gmc_v10_0_set_clockgating_state(void *handle,* is a new problem observed at DF 3.0.3, however with the same suspend sequence not * seen any issue on the DF 3.0.2 series platform. */ -if (adev->in_s0ix && adev->ip_versions[DF_HWIP ][0 ] >IP_VERSION (3 ,0 ,2 )) { +if (adev->in_s0ix && +amdgpu_ip_version (adev,DF_HWIP ,0 ) >IP_VERSION (3 ,0 ,2 )) {dev_dbg (adev->dev,"keep mmhub clock gating being enabled for s0ix\n" );return 0 ; }
@@ -1204,7 +1206,7 @@ static int gmc_v10_0_set_clockgating_state(void *handle,if (r)return r; -if (adev->ip_versions[ATHUB_HWIP ][0 ] >=IP_VERSION (2 ,1 ,0 )) +if (amdgpu_ip_version (adev,ATHUB_HWIP ,0 ) >=IP_VERSION (2 ,1 ,0 ))return athub_v2_1_set_clockgating (adev, state);else return athub_v2_0_set_clockgating (adev, state);
@@ -1214,13 +1216,13 @@ static void gmc_v10_0_get_clockgating_state(void *handle, u64 *flags) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; -if (adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (10 ,1 ,3 ) || - adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (10 ,1 ,4 )) +if (amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (10 ,1 ,3 ) || +amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (10 ,1 ,4 ))return ; adev->mmhub.funcs->get_clockgating (adev, flags); -if (adev->ip_versions[ATHUB_HWIP ][0 ] >=IP_VERSION (2 ,1 ,0 )) +if (amdgpu_ip_version (adev,ATHUB_HWIP ,0 ) >=IP_VERSION (2 ,1 ,0 ))athub_v2_1_get_clockgating (adev, flags);else athub_v2_0_get_clockgating (adev, flags);
drivers/gpu/drm/amd/amdgpu/gmc_v11_0.c +4 -4
@@ -588,7 +588,7 @@ static void gmc_v11_0_set_gmc_funcs(struct amdgpu_device *adev)static void gmc_v11_0_set_umc_funcs (struct amdgpu_device *adev) { -switch (adev->ip_versions[UMC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,UMC_HWIP ,0 )) {case IP_VERSION (8 ,10 ,0 ): adev->umc.channel_inst_num =UMC_V8_10_CHANNEL_INSTANCE_NUM ; adev->umc.umc_inst_num =UMC_V8_10_UMC_INSTANCE_NUM ;
@@ -611,7 +611,7 @@ static void gmc_v11_0_set_umc_funcs(struct amdgpu_device *adev)static void gmc_v11_0_set_mmhub_funcs (struct amdgpu_device *adev) { -switch (adev->ip_versions[MMHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) {case IP_VERSION (3 ,0 ,1 ): adev->mmhub.funcs = &mmhub_v3_0_1_funcs;break ;
@@ -629,7 +629,7 @@ static void gmc_v11_0_set_mmhub_funcs(struct amdgpu_device *adev)static void gmc_v11_0_set_gfxhub_funcs (struct amdgpu_device *adev) { -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (11 ,0 ,3 ): adev->gfxhub.funcs = &gfxhub_v3_0_3_funcs;break ;
@@ -782,7 +782,7 @@ static int gmc_v11_0_sw_init(void *handle) adev->gmc.vram_type = vram_type; adev->gmc.vram_vendor = vram_vendor; -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (11 ,0 ,0 ):case IP_VERSION (11 ,0 ,1 ):case IP_VERSION (11 ,0 ,2 ):
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +52 -44
301 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/hdp_v4_0.c +9 -9
@@ -49,8 +49,8 @@ static void hdp_v4_0_flush_hdp(struct amdgpu_device *adev,static void hdp_v4_0_invalidate_hdp (struct amdgpu_device *adev,struct amdgpu_ring *ring) { -if (adev->ip_versions[HDP_HWIP ][0 ] ==IP_VERSION (4 ,4 ,0 ) || - adev->ip_versions[HDP_HWIP ][0 ] ==IP_VERSION (4 ,4 ,2 )) +if (amdgpu_ip_version (adev,HDP_HWIP ,0 ) ==IP_VERSION (4 ,4 ,0 ) || +amdgpu_ip_version (adev,HDP_HWIP ,0 ) ==IP_VERSION (4 ,4 ,2 ))return ;if (!ring || !ring->funcs->emit_wreg)
@@ -80,7 +80,7 @@ static void hdp_v4_0_reset_ras_error_count(struct amdgpu_device *adev)if (!amdgpu_ras_is_supported (adev,AMDGPU_RAS_BLOCK__HDP ))return ; -if (adev->ip_versions[HDP_HWIP ][0 ] >=IP_VERSION (4 ,4 ,0 )) +if (amdgpu_ip_version (adev,HDP_HWIP ,0 ) >=IP_VERSION (4 ,4 ,0 ))WREG32_SOC15 (HDP ,0 , mmHDP_EDC_CNT,0 );else /*read back hdp ras counter to reset it to 0 */
@@ -92,10 +92,10 @@ static void hdp_v4_0_update_clock_gating(struct amdgpu_device *adev, {uint32_t def, data; -if (adev->ip_versions[HDP_HWIP ][0 ] ==IP_VERSION (4 ,0 ,0 ) || - adev->ip_versions[HDP_HWIP ][0 ] ==IP_VERSION (4 ,0 ,1 ) || - adev->ip_versions[HDP_HWIP ][0 ] ==IP_VERSION (4 ,1 ,1 ) || - adev->ip_versions[HDP_HWIP ][0 ] ==IP_VERSION (4 ,1 ,0 )) { +if (amdgpu_ip_version (adev,HDP_HWIP ,0 ) ==IP_VERSION (4 ,0 ,0 ) || +amdgpu_ip_version (adev,HDP_HWIP ,0 ) ==IP_VERSION (4 ,0 ,1 ) || +amdgpu_ip_version (adev,HDP_HWIP ,0 ) ==IP_VERSION (4 ,1 ,1 ) || +amdgpu_ip_version (adev,HDP_HWIP ,0 ) ==IP_VERSION (4 ,1 ,0 )) { def = data =RREG32 (SOC15_REG_OFFSET (HDP ,0 , mmHDP_MEM_POWER_LS));if (enable && (adev->cg_flags &AMD_CG_SUPPORT_HDP_LS ))
@@ -137,7 +137,7 @@ static void hdp_v4_0_get_clockgating_state(struct amdgpu_device *adev,static void hdp_v4_0_init_registers (struct amdgpu_device *adev) { -switch (adev->ip_versions[HDP_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,HDP_HWIP ,0 )) {case IP_VERSION (4 ,2 ,1 ):WREG32_FIELD15 (HDP ,0 ,HDP_MMHUB_CNTL ,HDP_MMHUB_GCC ,1 );break ;
@@ -147,7 +147,7 @@ static void hdp_v4_0_init_registers(struct amdgpu_device *adev)WREG32_FIELD15 (HDP ,0 ,HDP_MISC_CNTL ,FLUSH_INVALIDATE_CACHE ,1 ); -if (adev->ip_versions[HDP_HWIP ][0 ] ==IP_VERSION (4 ,4 ,0 )) +if (amdgpu_ip_version (adev,HDP_HWIP ,0 ) ==IP_VERSION (4 ,4 ,0 ))WREG32_FIELD15 (HDP ,0 ,HDP_MISC_CNTL ,READ_BUFFER_WATERMARK ,2 );WREG32_SOC15 (HDP ,0 , mmHDP_NONSURFACE_BASE, (adev->gmc.vram_start >>8 ));
drivers/gpu/drm/amd/amdgpu/hdp_v6_0.c +3 -3
@@ -51,7 +51,7 @@ static void hdp_v6_0_update_clock_gating(struct amdgpu_device *adev, AMD_CG_SUPPORT_HDP_SD)))return ; -if (adev->ip_versions[HDP_HWIP ][0 ] ==IP_VERSION (6 ,1 ,0 )) +if (amdgpu_ip_version (adev,HDP_HWIP ,0 ) ==IP_VERSION (6 ,1 ,0 )) hdp_clk_cntl =RREG32_SOC15 (HDP ,0 , regHDP_CLK_CNTL_V6_1);else hdp_clk_cntl =RREG32_SOC15 (HDP ,0 , regHDP_CLK_CNTL);
@@ -61,7 +61,7 @@ static void hdp_v6_0_update_clock_gating(struct amdgpu_device *adev,* forced on IPH & RC clock */ hdp_clk_cntl =REG_SET_FIELD (hdp_clk_cntl,HDP_CLK_CNTL ,RC_MEM_CLK_SOFT_OVERRIDE ,1 ); -if (adev->ip_versions[HDP_HWIP ][0 ] ==IP_VERSION (6 ,1 ,0 )) +if (amdgpu_ip_version (adev,HDP_HWIP ,0 ) ==IP_VERSION (6 ,1 ,0 ))WREG32_SOC15 (HDP ,0 , regHDP_CLK_CNTL_V6_1, hdp_clk_cntl);else WREG32_SOC15 (HDP ,0 , regHDP_CLK_CNTL, hdp_clk_cntl);
@@ -126,7 +126,7 @@ static void hdp_v6_0_update_clock_gating(struct amdgpu_device *adev,/* disable IPH & RC clock override after clock/power mode changing */ hdp_clk_cntl =REG_SET_FIELD (hdp_clk_cntl,HDP_CLK_CNTL ,RC_MEM_CLK_SOFT_OVERRIDE ,0 ); -if (adev->ip_versions[HDP_HWIP ][0 ] ==IP_VERSION (6 ,1 ,0 )) +if (amdgpu_ip_version (adev,HDP_HWIP ,0 ) ==IP_VERSION (6 ,1 ,0 ))WREG32_SOC15 (HDP ,0 , regHDP_CLK_CNTL_V6_1, hdp_clk_cntl);else WREG32_SOC15 (HDP ,0 , regHDP_CLK_CNTL, hdp_clk_cntl);
drivers/gpu/drm/amd/amdgpu/imu_v11_0.c +1 -1
@@ -353,7 +353,7 @@ static void imu_v11_0_program_rlc_ram(struct amdgpu_device *adev)WREG32_SOC15 (GC ,0 , regGFX_IMU_RLC_RAM_INDEX,0x2 ); -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (11 ,0 ,0 ):program_imu_rlc_ram (adev, imu_rlc_ram_golden_11, (const u32 )ARRAY_SIZE (imu_rlc_ram_golden_11));
drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c +2 -2
@@ -128,7 +128,7 @@ static int jpeg_v2_5_sw_init(void *handle) ring = adev->jpeg.inst[i].ring_dec; ring->use_doorbell = true; -if (adev->ip_versions[UVD_HWIP ][0 ] ==IP_VERSION (2 ,5 ,0 )) +if (amdgpu_ip_version (adev,UVD_HWIP ,0 ) ==IP_VERSION (2 ,5 ,0 )) ring->vm_hub =AMDGPU_MMHUB1 (0 );else ring->vm_hub =AMDGPU_MMHUB0 (0 );
@@ -822,7 +822,7 @@ static struct amdgpu_jpeg_ras jpeg_v2_6_ras = {static void jpeg_v2_5_set_ras_funcs (struct amdgpu_device *adev) { -switch (adev->ip_versions[JPEG_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,JPEG_HWIP ,0 )) {case IP_VERSION (2 ,6 ,0 ): adev->jpeg.ras = &jpeg_v2_6_ras;break ;
drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c +1 -1
@@ -52,7 +52,7 @@ static int jpeg_v3_0_early_init(void *handle)u32 harvest; -switch (adev->ip_versions[UVD_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,UVD_HWIP ,0 )) {case IP_VERSION (3 ,1 ,1 ):case IP_VERSION (3 ,1 ,2 ):break ;
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c +1 -1
@@ -831,7 +831,7 @@ static struct amdgpu_jpeg_ras jpeg_v4_0_ras = {static void jpeg_v4_0_set_ras_funcs (struct amdgpu_device *adev) { -switch (adev->ip_versions[JPEG_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,JPEG_HWIP ,0 )) {case IP_VERSION (4 ,0 ,0 ): adev->jpeg.ras = &jpeg_v4_0_ras;break ;
drivers/gpu/drm/amd/amdgpu/mes_v10_1.c +5 -5
@@ -558,7 +558,7 @@ static int mes_v10_1_load_microcode(struct amdgpu_device *adev,WREG32_SOC15 (GC ,0 , mmCP_MES_MDBOUND_LO,0x3FFFF );/* invalidate ICACHE */ -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (10 ,3 ,0 ): data =RREG32_SOC15 (GC ,0 , mmCP_MES_IC_OP_CNTL_Sienna_Cichlid);break ;
@@ -568,7 +568,7 @@ static int mes_v10_1_load_microcode(struct amdgpu_device *adev, } data =REG_SET_FIELD (data,CP_MES_IC_OP_CNTL ,PRIME_ICACHE ,0 ); data =REG_SET_FIELD (data,CP_MES_IC_OP_CNTL ,INVALIDATE_CACHE ,1 ); -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (10 ,3 ,0 ):WREG32_SOC15 (GC ,0 , mmCP_MES_IC_OP_CNTL_Sienna_Cichlid, data);break ;
@@ -578,7 +578,7 @@ static int mes_v10_1_load_microcode(struct amdgpu_device *adev, }/* prime the ICACHE. */ -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (10 ,3 ,0 ): data =RREG32_SOC15 (GC ,0 , mmCP_MES_IC_OP_CNTL_Sienna_Cichlid);break ;
@@ -587,7 +587,7 @@ static int mes_v10_1_load_microcode(struct amdgpu_device *adev,break ; } data =REG_SET_FIELD (data,CP_MES_IC_OP_CNTL ,PRIME_ICACHE ,1 ); -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (10 ,3 ,0 ):WREG32_SOC15 (GC ,0 , mmCP_MES_IC_OP_CNTL_Sienna_Cichlid, data);break ;
@@ -995,7 +995,7 @@ static void mes_v10_1_kiq_setting(struct amdgpu_ring *ring)struct amdgpu_device *adev = ring->adev;/* tell RLC which is KIQ queue */ -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (10 ,3 ,0 ):case IP_VERSION (10 ,3 ,2 ):case IP_VERSION (10 ,3 ,1 ):
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c +1 -1
@@ -1316,7 +1316,7 @@ static int mes_v11_0_late_init(void *handle)/* it's only intended for use in mes_self_test case, not for s0ix and reset */ if (!amdgpu_in_reset (adev) && !adev->in_s0ix && !adev->in_suspend && - (adev->ip_versions[GC_HWIP ][0 ] !=IP_VERSION (11 ,0 ,3 ))) + (amdgpu_ip_version (adev,GC_HWIP ,0 ) !=IP_VERSION (11 ,0 ,3 )))amdgpu_mes_self_test (adev);return 0 ;
drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c +6 -6
@@ -151,7 +151,7 @@ mmhub_v2_0_print_l2_protection_fault_status(struct amdgpu_device *adev,dev_err (adev->dev,"MMVM_L2_PROTECTION_FAULT_STATUS:0x%08X\n" , status); -switch (adev->ip_versions[MMHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) {case IP_VERSION (2 ,0 ,0 ):case IP_VERSION (2 ,0 ,2 ): mmhub_cid = mmhub_client_ids_navi1x[cid][rw];
@@ -568,7 +568,7 @@ static void mmhub_v2_0_update_medium_grain_clock_gating(struct amdgpu_device *adif (!(adev->cg_flags &AMD_CG_SUPPORT_MC_MGCG ))return ; -switch (adev->ip_versions[MMHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) {case IP_VERSION (2 ,1 ,0 ):case IP_VERSION (2 ,1 ,1 ):case IP_VERSION (2 ,1 ,2 ):
@@ -601,7 +601,7 @@ static void mmhub_v2_0_update_medium_grain_clock_gating(struct amdgpu_device *ad DAGB0_CNTL_MISC2__DISABLE_TLBRD_CG_MASK); } -switch (adev->ip_versions[MMHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) {case IP_VERSION (2 ,1 ,0 ):case IP_VERSION (2 ,1 ,1 ):case IP_VERSION (2 ,1 ,2 ):
@@ -625,7 +625,7 @@ static void mmhub_v2_0_update_medium_grain_light_sleep(struct amdgpu_device *adeif (!(adev->cg_flags &AMD_CG_SUPPORT_MC_LS ))return ; -switch (adev->ip_versions[MMHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) {case IP_VERSION (2 ,1 ,0 ):case IP_VERSION (2 ,1 ,1 ):case IP_VERSION (2 ,1 ,2 ):
@@ -651,7 +651,7 @@ static int mmhub_v2_0_set_clockgating(struct amdgpu_device *adev,if (amdgpu_sriov_vf (adev))return 0 ; -switch (adev->ip_versions[MMHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) {case IP_VERSION (2 ,0 ,0 ):case IP_VERSION (2 ,0 ,2 ):case IP_VERSION (2 ,1 ,0 ):
@@ -676,7 +676,7 @@ static void mmhub_v2_0_get_clockgating(struct amdgpu_device *adev, u64 *flags)if (amdgpu_sriov_vf (adev)) *flags =0 ; -switch (adev->ip_versions[MMHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) {case IP_VERSION (2 ,1 ,0 ):case IP_VERSION (2 ,1 ,1 ):case IP_VERSION (2 ,1 ,2 ):
drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c +1 -1
@@ -90,7 +90,7 @@ mmhub_v2_3_print_l2_protection_fault_status(struct amdgpu_device *adev,dev_err (adev->dev,"MMVM_L2_PROTECTION_FAULT_STATUS:0x%08X\n" , status); -switch (adev->ip_versions[MMHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) {case IP_VERSION (2 ,3 ,0 ):case IP_VERSION (2 ,4 ,0 ):case IP_VERSION (2 ,4 ,1 ):
drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c +1 -1
@@ -107,7 +107,7 @@ mmhub_v3_0_print_l2_protection_fault_status(struct amdgpu_device *adev,dev_err (adev->dev,"MMVM_L2_PROTECTION_FAULT_STATUS:0x%08X\n" , status); -switch (adev->ip_versions[MMHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) {case IP_VERSION (3 ,0 ,0 ):case IP_VERSION (3 ,0 ,1 ): mmhub_cid = mmhub_client_ids_v3_0_0[cid][rw];
drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_1.c +1 -1
@@ -108,7 +108,7 @@ mmhub_v3_0_1_print_l2_protection_fault_status(struct amdgpu_device *adev,"MMVM_L2_PROTECTION_FAULT_STATUS:0x%08X\n" , status); -switch (adev->ip_versions[MMHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) {case IP_VERSION (3 ,0 ,1 ): mmhub_cid = mmhub_client_ids_v3_0_1[cid][rw];break ;
drivers/gpu/drm/amd/amdgpu/mmhub_v3_3.c +1 -1
@@ -96,7 +96,7 @@ mmhub_v3_3_print_l2_protection_fault_status(struct amdgpu_device *adev,"MMVM_L2_PROTECTION_FAULT_STATUS:0x%08X\n" , status); -switch (adev->ip_versions[MMHUB_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MMHUB_HWIP ,0 )) {case IP_VERSION (3 ,3 ,0 ): mmhub_cid = mmhub_client_ids_v3_3[cid][rw];break ;
drivers/gpu/drm/amd/amdgpu/navi10_ih.c +2 -2
@@ -107,7 +107,7 @@ force_update_wptr_for_self_int(struct amdgpu_device *adev, {u32 ih_cntl, ih_rb_cntl; -if (adev->ip_versions[OSSSYS_HWIP ][0 ] <IP_VERSION (5 ,0 ,3 )) +if (amdgpu_ip_version (adev,OSSSYS_HWIP ,0 ) <IP_VERSION (5 ,0 ,3 ))return ; ih_cntl =RREG32_SOC15 (OSSSYS ,0 , mmIH_CNTL2);
@@ -330,7 +330,7 @@ static int navi10_ih_irq_init(struct amdgpu_device *adev)if (unlikely (adev->firmware.load_type ==AMDGPU_FW_LOAD_DIRECT )) {if (ih[0 ]->use_bus_addr) { -switch (adev->ip_versions[OSSSYS_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,OSSSYS_HWIP ,0 )) {case IP_VERSION (5 ,0 ,3 ):case IP_VERSION (5 ,2 ,0 ):case IP_VERSION (5 ,2 ,1 ):
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +1 -1
@@ -536,7 +536,7 @@ static void nbio_v2_3_clear_doorbell_interrupt(struct amdgpu_device *adev) {uint32_t reg, reg_data; -if (adev->ip_versions[NBIO_HWIP ][0 ] !=IP_VERSION (3 ,3 ,0 )) +if (amdgpu_ip_version (adev,NBIO_HWIP ,0 ) !=IP_VERSION (3 ,3 ,0 ))return ; reg =RREG32_SOC15 (NBIO ,0 , mmBIF_RB_CNTL);
drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c +3 -3
@@ -338,7 +338,7 @@ const struct nbio_hdp_flush_reg nbio_v4_3_hdp_flush_reg = {static void nbio_v4_3_init_registers (struct amdgpu_device *adev) { -if (adev->ip_versions[NBIO_HWIP ][0 ] ==IP_VERSION (4 ,3 ,0 )) { +if (amdgpu_ip_version (adev,NBIO_HWIP ,0 ) ==IP_VERSION (4 ,3 ,0 )) {uint32_t data; data =RREG32_SOC15 (NBIO ,0 , regRCC_DEV0_EPF2_STRAP2);
@@ -392,8 +392,8 @@ static void nbio_v4_3_program_aspm(struct amdgpu_device *adev)#ifdef CONFIG_PCIEASPM uint32_t def, data; -if (!(adev->ip_versions[PCIE_HWIP ][0 ] ==IP_VERSION (7 ,4 ,0 )) && - !(adev->ip_versions[PCIE_HWIP ][0 ] ==IP_VERSION (7 ,6 ,0 ))) +if (!(amdgpu_ip_version (adev,PCIE_HWIP ,0 ) ==IP_VERSION (7 ,4 ,0 )) && + !(amdgpu_ip_version (adev,PCIE_HWIP ,0 ) ==IP_VERSION (7 ,6 ,0 )))return ; def = data =RREG32_SOC15 (NBIO ,0 , regPCIE_LC_CNTL);
drivers/gpu/drm/amd/amdgpu/nbio_v7_2.c +5 -5
@@ -59,7 +59,7 @@ static u32 nbio_v7_2_get_rev_id(struct amdgpu_device *adev) {u32 tmp; -switch (adev->ip_versions[NBIO_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,NBIO_HWIP ,0 )) {case IP_VERSION (7 ,2 ,1 ):case IP_VERSION (7 ,3 ,0 ):case IP_VERSION (7 ,5 ,0 ):
@@ -78,7 +78,7 @@ static u32 nbio_v7_2_get_rev_id(struct amdgpu_device *adev)static void nbio_v7_2_mc_access_enable (struct amdgpu_device *adev,bool enable) { -switch (adev->ip_versions[NBIO_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,NBIO_HWIP ,0 )) {case IP_VERSION (7 ,2 ,1 ):case IP_VERSION (7 ,3 ,0 ):case IP_VERSION (7 ,5 ,0 ):
@@ -262,7 +262,7 @@ static void nbio_v7_2_update_medium_grain_light_sleep(struct amdgpu_device *adev {uint32_t def, data; -switch (adev->ip_versions[NBIO_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,NBIO_HWIP ,0 )) {case IP_VERSION (7 ,2 ,1 ):case IP_VERSION (7 ,3 ,0 ):case IP_VERSION (7 ,5 ,0 ):
@@ -369,7 +369,7 @@ const struct nbio_hdp_flush_reg nbio_v7_2_hdp_flush_reg = {static void nbio_v7_2_init_registers (struct amdgpu_device *adev) {uint32_t def, data; -switch (adev->ip_versions[NBIO_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,NBIO_HWIP ,0 )) {case IP_VERSION (7 ,2 ,1 ):case IP_VERSION (7 ,3 ,0 ):case IP_VERSION (7 ,5 ,0 ):
@@ -394,7 +394,7 @@ static void nbio_v7_2_init_registers(struct amdgpu_device *adev)break ; } -switch (adev->ip_versions[NBIO_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,NBIO_HWIP ,0 )) {case IP_VERSION (7 ,3 ,0 ):case IP_VERSION (7 ,5 ,1 ): data =RREG32_SOC15 (NBIO ,0 , regRCC_DEV2_EPF0_STRAP2);
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +2 -2
@@ -347,7 +347,7 @@ static void nbio_v7_4_init_registers(struct amdgpu_device *adev) adev->rmmio_remap.reg_offset =SOC15_REG_OFFSET (NBIO ,0 , mmBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) <<2 ; -if (adev->ip_versions[NBIO_HWIP ][0 ] ==IP_VERSION (7 ,4 ,4 ) && +if (amdgpu_ip_version (adev,NBIO_HWIP ,0 ) ==IP_VERSION (7 ,4 ,4 ) && !amdgpu_sriov_vf (adev)) { baco_cntl =RREG32_SOC15 (NBIO ,0 , mmBACO_CNTL); if (baco_cntl &
@@ -702,7 +702,7 @@ static void nbio_v7_4_program_aspm(struct amdgpu_device *adev)#ifdef CONFIG_PCIEASPM uint32_t def, data; -if (adev->ip_versions[NBIO_HWIP ][0 ] ==IP_VERSION (7 ,4 ,4 )) +if (amdgpu_ip_version (adev,NBIO_HWIP ,0 ) ==IP_VERSION (7 ,4 ,4 ))return ; def = data =RREG32_PCIE (smnPCIE_LC_CNTL);
drivers/gpu/drm/amd/amdgpu/nv.c +4 -4
@@ -214,7 +214,7 @@ static int nv_query_video_codecs(struct amdgpu_device *adev, bool encode,if (adev->vcn.num_vcn_inst ==hweight8 (adev->vcn.harvest_config))return -EINVAL ; -switch (adev->ip_versions[UVD_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,UVD_HWIP ,0 )) {case IP_VERSION (3 ,0 ,0 ):case IP_VERSION (3 ,0 ,64 ):case IP_VERSION (3 ,0 ,192 ):
@@ -453,7 +453,7 @@ nv_asic_reset_method(struct amdgpu_device *adev)dev_warn (adev->dev,"Specified reset method:%d isn't supported, using AUTO instead.\n" , amdgpu_reset_method); -switch (adev->ip_versions[MP1_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP1_HWIP ,0 )) {case IP_VERSION (11 ,5 ,0 ):case IP_VERSION (13 ,0 ,1 ):case IP_VERSION (13 ,0 ,3 ):
@@ -669,7 +669,7 @@ static int nv_common_early_init(void *handle)/* TODO: split the GC and PG flags based on the relevant IP version for which * they are relevant. */ -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (10 ,1 ,10 ): adev->cg_flags =AMD_CG_SUPPORT_GFX_MGCG | AMD_CG_SUPPORT_GFX_CGCG |
@@ -1073,7 +1073,7 @@ static int nv_common_set_clockgating_state(void *handle,if (amdgpu_sriov_vf (adev))return 0 ; -switch (adev->ip_versions[NBIO_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,NBIO_HWIP ,0 )) {case IP_VERSION (2 ,3 ,0 ):case IP_VERSION (2 ,3 ,1 ):case IP_VERSION (2 ,3 ,2 ):
drivers/gpu/drm/amd/amdgpu/psp_v10_0.c +4 -3
@@ -58,9 +58,10 @@ static int psp_v10_0_init_microcode(struct psp_context *psp)return err; err =psp_init_ta_microcode (psp, ucode_prefix); -if ((adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (9 ,1 ,0 )) && - (adev->pdev->revision ==0xa1 ) && - (psp->securedisplay_context.context.bin_desc.fw_version >=0x27000008 )) { +if ((amdgpu_ip_version (adev,GC_HWIP ,0 ) ==IP_VERSION (9 ,1 ,0 )) && + (adev->pdev->revision ==0xa1 ) && + (psp->securedisplay_context.context.bin_desc.fw_version >= +0x27000008 )) { adev->psp.securedisplay_context.context.bin_desc.size_bytes =0 ; }return err;
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +1 -1
@@ -95,7 +95,7 @@ static int psp_v11_0_init_microcode(struct psp_context *psp)amdgpu_ucode_ip_version_decode (adev,MP0_HWIP , ucode_prefix,sizeof (ucode_prefix)); -switch (adev->ip_versions[MP0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP0_HWIP ,0 )) {case IP_VERSION (11 ,0 ,2 ):case IP_VERSION (11 ,0 ,4 ): err =psp_init_sos_microcode (psp, ucode_prefix);
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c +3 -3
@@ -79,7 +79,7 @@ static int psp_v13_0_init_microcode(struct psp_context *psp)amdgpu_ucode_ip_version_decode (adev,MP0_HWIP , ucode_prefix,sizeof (ucode_prefix)); -switch (adev->ip_versions[MP0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP0_HWIP ,0 )) {case IP_VERSION (13 ,0 ,2 ): err =psp_init_sos_microcode (psp, ucode_prefix);if (err)
@@ -181,7 +181,7 @@ static int psp_v13_0_wait_for_bootloader_steady_state(struct psp_context *psp) {struct amdgpu_device *adev = psp->adev; -if (adev->ip_versions[MP0_HWIP ][0 ] ==IP_VERSION (13 ,0 ,6 )) { +if (amdgpu_ip_version (adev,MP0_HWIP ,0 ) ==IP_VERSION (13 ,0 ,6 )) {psp_v13_0_wait_for_vmbx_ready (psp);return psp_v13_0_wait_for_bootloader (psp);
@@ -728,7 +728,7 @@ static int psp_v13_0_fatal_error_recovery_quirk(struct psp_context *psp) {struct amdgpu_device *adev = psp->adev; -if (adev->ip_versions[MP0_HWIP ][0 ] ==IP_VERSION (13 ,0 ,10 )) { +if (amdgpu_ip_version (adev,MP0_HWIP ,0 ) ==IP_VERSION (13 ,0 ,10 )) {uint32_t reg_data;/* MP1 fatal error: trigger PSP dram read to unhalt PSP * during MP1 triggered sync flood.
drivers/gpu/drm/amd/amdgpu/psp_v13_0_4.c +1 -1
@@ -40,7 +40,7 @@ static int psp_v13_0_4_init_microcode(struct psp_context *psp)amdgpu_ucode_ip_version_decode (adev,MP0_HWIP , ucode_prefix,sizeof (ucode_prefix)); -switch (adev->ip_versions[MP0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP0_HWIP ,0 )) {case IP_VERSION (13 ,0 ,4 ): err =psp_init_toc_microcode (psp, ucode_prefix);if (err)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +29 -19
144 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +4 -3
@@ -132,7 +132,8 @@ static int sdma_v4_4_2_init_microcode(struct amdgpu_device *adev)int ret, i;for (i =0 ; i < adev->sdma.num_instances; i++) { -if (adev->ip_versions[SDMA0_HWIP ][0 ] ==IP_VERSION (4 ,4 ,2 )) { +if (amdgpu_ip_version (adev,SDMA0_HWIP ,0 ) == +IP_VERSION (4 ,4 ,2 )) { ret =amdgpu_sdma_init_microcode (adev,0 , true);break ; }else {
@@ -1231,7 +1232,7 @@ static void sdma_v4_4_2_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t restatic bool sdma_v4_4_2_fw_support_paging_queue (struct amdgpu_device *adev) { -switch (adev->ip_versions[SDMA0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,SDMA0_HWIP ,0 )) {case IP_VERSION (4 ,4 ,2 ):return false;default :
@@ -1401,7 +1402,7 @@ static int sdma_v4_4_2_sw_fini(void *handle)amdgpu_ring_fini (&adev->sdma.instance[i].page); } -if (adev->ip_versions[SDMA0_HWIP ][0 ] ==IP_VERSION (4 ,4 ,2 )) +if (amdgpu_ip_version (adev,SDMA0_HWIP ,0 ) ==IP_VERSION (4 ,4 ,2 ))amdgpu_sdma_destroy_inst_ctx (adev, true);else amdgpu_sdma_destroy_inst_ctx (adev, false);
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +2 -2
@@ -184,7 +184,7 @@ static u32 sdma_v5_0_get_reg_offset(struct amdgpu_device *adev, u32 instance, u3static void sdma_v5_0_init_golden_registers (struct amdgpu_device *adev) { -switch (adev->ip_versions[SDMA0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,SDMA0_HWIP ,0 )) {case IP_VERSION (5 ,0 ,0 ): soc15_program_register_sequence(adev, golden_settings_sdma_5,
@@ -1697,7 +1697,7 @@ static int sdma_v5_0_set_clockgating_state(void *handle,if (amdgpu_sriov_vf (adev))return 0 ; -switch (adev->ip_versions[SDMA0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,SDMA0_HWIP ,0 )) {case IP_VERSION (5 ,0 ,0 ):case IP_VERSION (5 ,0 ,2 ):case IP_VERSION (5 ,0 ,5 ):
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +5 -4
@@ -1510,7 +1510,7 @@ static int sdma_v5_2_process_illegal_inst_irq(struct amdgpu_device *adev,static bool sdma_v5_2_firmware_mgcg_support (struct amdgpu_device *adev,int i) { -switch (adev->ip_versions[SDMA0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,SDMA0_HWIP ,0 )) {case IP_VERSION (5 ,2 ,1 ):if (adev->sdma.instance[i].fw_version <70 )return false;
@@ -1575,8 +1575,9 @@ static void sdma_v5_2_update_medium_grain_light_sleep(struct amdgpu_device *adevint i;for (i =0 ; i < adev->sdma.num_instances; i++) { - -if (adev->sdma.instance[i].fw_version <70 && adev->ip_versions[SDMA0_HWIP ][0 ] ==IP_VERSION (5 ,2 ,1 )) +if (adev->sdma.instance[i].fw_version <70 && +amdgpu_ip_version (adev,SDMA0_HWIP ,0 ) == +IP_VERSION (5 ,2 ,1 )) adev->cg_flags &= ~AMD_CG_SUPPORT_SDMA_LS ;if (enable && (adev->cg_flags &AMD_CG_SUPPORT_SDMA_LS )) {
@@ -1605,7 +1606,7 @@ static int sdma_v5_2_set_clockgating_state(void *handle,if (amdgpu_sriov_vf (adev))return 0 ; -switch (adev->ip_versions[SDMA0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,SDMA0_HWIP ,0 )) {case IP_VERSION (5 ,2 ,0 ):case IP_VERSION (5 ,2 ,2 ):case IP_VERSION (5 ,2 ,1 ):
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +1 -2
@@ -1246,14 +1246,13 @@ static struct amdgpu_sdma_ras sdma_v6_0_3_ras = {static void sdma_v6_0_set_ras_funcs (struct amdgpu_device *adev) { -switch (adev->ip_versions[SDMA0_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,SDMA0_HWIP ,0 )) {case IP_VERSION (6 ,0 ,3 ): adev->sdma.ras = &sdma_v6_0_3_ras;break ;default :break ; } - }static int sdma_v6_0_early_init (void *handle)
drivers/gpu/drm/amd/amdgpu/sienna_cichlid.c +1 -1
@@ -36,7 +36,7 @@ static bool sienna_cichlid_is_mode2_default(struct amdgpu_reset_control *reset_c#if 0 struct amdgpu_device *adev = (struct amdgpu_device *)reset_ctl->handle; -if (adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (11 ,0 ,7 ) && +if (amdgpu_ip_version (adev,MP1_HWIP ,0 ) ==IP_VERSION (11 ,0 ,7 ) && adev->pm.fw_version >=0x3a5500 && !amdgpu_sriov_vf (adev))return true;#endif
drivers/gpu/drm/amd/amdgpu/soc15.c +13 -14
@@ -174,8 +174,8 @@ static const struct amdgpu_video_codecs vcn_4_0_3_video_codecs_encode = {static int soc15_query_video_codecs (struct amdgpu_device *adev,bool encode,const struct amdgpu_video_codecs **codecs) { -if (adev->ip_versions[VCE_HWIP ][0 ]) { -switch (adev->ip_versions[VCE_HWIP ][0 ]) { +if (amdgpu_ip_version (adev,VCE_HWIP ,0 )) { +switch (amdgpu_ip_version (adev,VCE_HWIP ,0 )) {case IP_VERSION (4 ,0 ,0 ):case IP_VERSION (4 ,1 ,0 ):if (encode)
@@ -187,7 +187,7 @@ static int soc15_query_video_codecs(struct amdgpu_device *adev, bool encode,return -EINVAL ; } }else { -switch (adev->ip_versions[UVD_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,UVD_HWIP ,0 )) {case IP_VERSION (1 ,0 ,0 ):case IP_VERSION (1 ,0 ,1 ):if (encode)
@@ -324,12 +324,12 @@ static u32 soc15_get_xclk(struct amdgpu_device *adev) {u32 reference_clock = adev->clock.spll.reference_freq; -if (adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (12 ,0 ,0 ) || - adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (12 ,0 ,1 ) || - adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (13 ,0 ,6 )) +if (amdgpu_ip_version (adev,MP1_HWIP ,0 ) ==IP_VERSION (12 ,0 ,0 ) || +amdgpu_ip_version (adev,MP1_HWIP ,0 ) ==IP_VERSION (12 ,0 ,1 ) || +amdgpu_ip_version (adev,MP1_HWIP ,0 ) ==IP_VERSION (13 ,0 ,6 ))return 10000 ; -if (adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (10 ,0 ,0 ) || - adev->ip_versions[MP1_HWIP ][0 ] ==IP_VERSION (10 ,0 ,1 )) +if (amdgpu_ip_version (adev,MP1_HWIP ,0 ) ==IP_VERSION (10 ,0 ,0 ) || +amdgpu_ip_version (adev,MP1_HWIP ,0 ) ==IP_VERSION (10 ,0 ,1 ))return reference_clock /4 ;return reference_clock;
@@ -523,7 +523,7 @@ soc15_asic_reset_method(struct amdgpu_device *adev)dev_warn (adev->dev,"Specified reset method:%d isn't supported, using AUTO instead.\n" , amdgpu_reset_method); -switch (adev->ip_versions[MP1_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP1_HWIP ,0 )) {case IP_VERSION (10 ,0 ,0 ):case IP_VERSION (10 ,0 ,1 ):case IP_VERSION (12 ,0 ,0 ):
@@ -599,7 +599,7 @@ static int soc15_asic_reset(struct amdgpu_device *adev)static bool soc15_supports_baco (struct amdgpu_device *adev) { -switch (adev->ip_versions[MP1_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP1_HWIP ,0 )) {case IP_VERSION (9 ,0 ,0 ):case IP_VERSION (11 ,0 ,2 ):if (adev->asic_type ==CHIP_VEGA20 ) {
@@ -938,7 +938,7 @@ static int soc15_common_early_init(void *handle)/* TODO: split the GC and PG flags based on the relevant IP version for which * they are relevant. */ -switch (adev->ip_versions[GC_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) {case IP_VERSION (9 ,0 ,1 ): adev->asic_funcs = &soc15_asic_funcs; adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
@@ -1367,7 +1367,7 @@ static int soc15_common_set_clockgating_state(void *handle,if (amdgpu_sriov_vf (adev))return 0 ; -switch (adev->ip_versions[NBIO_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,NBIO_HWIP ,0 )) {case IP_VERSION (6 ,1 ,0 ):case IP_VERSION (6 ,2 ,0 ):case IP_VERSION (7 ,4 ,0 ):
@@ -1423,8 +1423,7 @@ static void soc15_common_get_clockgating_state(void *handle, u64 *flags) adev->hdp.funcs->get_clock_gating_state (adev, flags); -if (adev->ip_versions[MP0_HWIP ][0 ] !=IP_VERSION (13 ,0 ,2 )) { - +if (amdgpu_ip_version (adev,MP0_HWIP ,0 ) !=IP_VERSION (13 ,0 ,2 )) {/* AMD_CG_SUPPORT_DRM_MGCG */ data =RREG32 (SOC15_REG_OFFSET (MP0 ,0 , mmMP0_MISC_CGTT_CTRL0));if (!(data &0x01000000 ))
drivers/gpu/drm/amd/amdgpu/soc21.c +6 -6
@@ -153,7 +153,7 @@ static int soc21_query_video_codecs(struct amdgpu_device *adev, bool encode,if (adev->vcn.num_vcn_inst ==hweight8 (adev->vcn.harvest_config))return -EINVAL ; -switch (adev->ip_versions[UVD_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,UVD_HWIP ,0 )) {case IP_VERSION (4 ,0 ,0 ):case IP_VERSION (4 ,0 ,2 ):case IP_VERSION (4 ,0 ,4 ):
@@ -374,7 +374,7 @@ soc21_asic_reset_method(struct amdgpu_device *adev)dev_warn (adev->dev,"Specified reset method:%d isn't supported, using AUTO instead.\n" , amdgpu_reset_method); -switch (adev->ip_versions[MP1_HWIP ][0 ]) { +switch (amdgpu_ip_version (adev,MP1_HWIP ,0 )) {case IP_VERSION (13 ,0 ,0 ):case IP_VERSION (13 ,0 ,7 ):case IP_VERSION (13 ,0 ,10 ):
@@ -448,7 +448,7 @@ const struct amdgpu_ip_block_version soc21_common_ip_block = {
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/amdgpu/umsch_mm_v4_0.c +5 -4
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/amdkfd/kfd_device.c +7 -5
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c +2 -1
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +17 -17
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +5 -5
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +12 -12
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +29 -17
46 lines not on this page · raw message
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +37 -26
63 lines not on this page · raw message
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +17 -15
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +6 -2
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +9 -9
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +4 -4
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +9 -9
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.25.1
Part of the diff is not shown here. View the raw message.
PATCH v2 2/2 drm/amdgpu: Add more fields to IP version
Include subrevision and variant fileds also to IP version.
---
v2:
Use major/min/rev format in drm_amdgpu_info_hw_ip discovery version
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 18 ++++++++++++----- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 20 ++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 8 ++++---- 3 files changed, 34 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +13 -5
@@ -681,10 +681,15 @@ enum amd_hw_ip_block_type {#define HWIP_MAX_INSTANCE 44#define HW_ID_MAX 300 -#define IP_VERSION (mj, mn, rv) (((mj) << 16) | ((mn) << 8) | (rv)) -#define IP_VERSION_MAJ (ver) ((ver) >> 16) -#define IP_VERSION_MIN (ver) (((ver) >> 8) & 0xFF) -#define IP_VERSION_REV (ver) ((ver) & 0xFF) +#define IP_VERSION_FULL (mj, mn, rv, var, srev) \ + (((mj) << 24) | ((mn) << 16) | ((rv) << 8) | ((var) << 4) | (srev)) +#define IP_VERSION (mj, mn, rv) IP_VERSION_FULL(mj, mn, rv, 0, 0) +#define IP_VERSION_MAJ (ver) ((ver) >> 24) +#define IP_VERSION_MIN (ver) (((ver) >> 16) & 0xFF) +#define IP_VERSION_REV (ver) (((ver) >> 8) & 0xFF) +#define IP_VERSION_VARIANT (ver) (((ver) >> 4) & 0xF) +#define IP_VERSION_SUBREV (ver) ((ver) & 0xF) +#define IP_VERSION_MAJ_MIN_REV (ver) ((ver) >> 8)struct amdgpu_ip_map_info {/* Map of logical to actual dev instances/mask */
@@ -1109,7 +1114,10 @@ struct amdgpu_device {static inline uint32_t amdgpu_ip_version (const struct amdgpu_device *adev,uint8_t ip,uint8_t inst) { -return adev->ip_versions[ip][inst]; +/* This considers only major/minor/rev and ignores +* subrevision/variant fields. +*/ +return adev->ip_versions[ip][inst] & ~0xFFU ; }static inline struct amdgpu_device *drm_to_adev (struct drm_device *ddev)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +17 -3
@@ -1191,6 +1191,7 @@ static void amdgpu_discovery_sysfs_fini(struct amdgpu_device *adev)static int amdgpu_discovery_reg_base_init (struct amdgpu_device *adev) { +uint8_t num_base_address, subrev, variant;struct binary_header *bhdr;struct ip_discovery_header *ihdr;struct die_header *dhdr;
@@ -1199,7 +1200,6 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)uint16_t ip_offset;uint16_t num_dies;uint16_t num_ips; -uint8_t num_base_address;int hw_ip;int i, j, k;int r;
@@ -1337,8 +1337,22 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)* example. On most chips there are multiple instances * with the same HWID. */ - adev->ip_versions[hw_ip][ip->instance_number] = -IP_VERSION (ip->major, ip->minor, ip->revision); + +if (ihdr->version <3 ) { + subrev =0 ; + variant =0 ; + }else { + subrev = ip->sub_revision; + variant = ip->variant; + } + + adev->ip_versions[hw_ip] + [ip->instance_number] = +IP_VERSION_FULL (ip->major, + ip->minor, + ip->revision, + variant, + subrev); } }
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +4 -4
@@ -502,21 +502,21 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,switch (type) {case AMD_IP_BLOCK_TYPE_GFX : result->ip_discovery_version = -amdgpu_ip_version (adev,GC_HWIP ,0 ); +IP_VERSION_MAJ_MIN_REV (amdgpu_ip_version (adev,GC_HWIP ,0 ));break ;case AMD_IP_BLOCK_TYPE_SDMA : result->ip_discovery_version = -amdgpu_ip_version (adev,SDMA0_HWIP ,0 ); +IP_VERSION_MAJ_MIN_REV (amdgpu_ip_version (adev,SDMA0_HWIP ,0 ));break ;case AMD_IP_BLOCK_TYPE_UVD :case AMD_IP_BLOCK_TYPE_VCN :case AMD_IP_BLOCK_TYPE_JPEG : result->ip_discovery_version = -amdgpu_ip_version (adev,UVD_HWIP ,0 ); +IP_VERSION_MAJ_MIN_REV (amdgpu_ip_version (adev,UVD_HWIP ,0 ));break ;case AMD_IP_BLOCK_TYPE_VCE : result->ip_discovery_version = -amdgpu_ip_version (adev,VCE_HWIP ,0 ); +IP_VERSION_MAJ_MIN_REV (amdgpu_ip_version (adev,VCE_HWIP ,0 ));break ;default : result->ip_discovery_version =0 ;
Signature · 1 line
2.25.1
RE: [PATCH v2 2/2] drm/amdgpu: Add more fields to IP version
[AMD Official Use Only - General]
Series is
Regards,
Hawking
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 13, 2023 13:58
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Olsak, Marek <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH v2 2/2] drm/amdgpu: Add more fields to IP version
Include subrevision and variant fileds also to IP version.
---
v2:
Use major/min/rev format in drm_amdgpu_info_hw_ip discovery version
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 18 ++++++++++++----- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 20 ++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 8 ++++---- 3 files changed, 34 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +9 -1
@@ -681,10 +681,15 @@ enum amd_hw_ip_block_type {#define HWIP_MAX_INSTANCE 44#define HW_ID_MAX 300 -#define IP_VERSION (mj, mn, rv) (((mj) << 16) | ((mn) << 8) | (rv)) -#define IP_VERSION_MAJ(ver) ((ver) >> 16) -#define IP_VERSION_MIN(ver) (((ver) >> 8) & 0xFF) -#define IP_VERSION_REV(ver) ((ver) & 0xFF) +#define IP_VERSION_FULL (mj, mn, rv, var, srev) \ + (((mj) << 24) | ((mn) << 16) | ((rv) << 8) | ((var) << 4) | (srev)) +#define IP_VERSION (mj, mn, rv) IP_VERSION_FULL(mj, mn, rv, 0, 0) +#define IP_VERSION_MAJ (ver) ((ver) >> 24) +#define IP_VERSION_MIN (ver) (((ver) >> 16) & 0xFF) +#define IP_VERSION_REV (ver) (((ver) >> 8) & 0xFF) +#define IP_VERSION_VARIANT (ver) (((ver) >> 4) & 0xF) +#define IP_VERSION_SUBREV (ver) ((ver) & 0xF) +#define IP_VERSION_MAJ_MIN_REV (ver) ((ver) >> 8) struct amdgpu_ip_map_info { /* Map of logical to actual dev instances/mask */ @@ -1109,7 +1114,10 @@ struct amdgpu_device { static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
uint8_t ip, uint8_t inst)
{
- return adev->ip_versions[ip][inst];
+ /* This considers only major/minor/rev and ignores
+ * subrevision/variant fields.
+ */
+ return adev->ip_versions[ip][inst] & ~0xFFU;
}
static inline struct amdgpu_device *drm_to_adev(struct drm_device *ddev) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index 430ee7f64a97..42d379956ef3 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +17 -3
@@ -1191,6 +1191,7 @@ static void amdgpu_discovery_sysfs_fini(struct amdgpu_device *adev)static int amdgpu_discovery_reg_base_init (struct amdgpu_device *adev) { +uint8_t num_base_address, subrev, variant;struct binary_header *bhdr;struct ip_discovery_header *ihdr;struct die_header *dhdr;
@@ -1199,7 +1200,6 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)uint16_t ip_offset;uint16_t num_dies;uint16_t num_ips; -uint8_t num_base_address;int hw_ip;int i, j, k;int r;
@@ -1337,8 +1337,22 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)* example. On most chips there are multiple instances * with the same HWID. */ - adev->ip_versions[hw_ip][ip->instance_number] = -IP_VERSION (ip->major, ip->minor, ip->revision); + +if (ihdr->version <3 ) { + subrev =0 ; + variant =0 ; + }else { + subrev = ip->sub_revision; + variant = ip->variant; + } + + adev->ip_versions[hw_ip] + [ip->instance_number] = +IP_VERSION_FULL (ip->major, + ip->minor, + ip->revision, + variant, + subrev); } }
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +4 -4
@@ -502,21 +502,21 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,switch (type) {case AMD_IP_BLOCK_TYPE_GFX : result->ip_discovery_version = -amdgpu_ip_version (adev,GC_HWIP ,0 ); +IP_VERSION_MAJ_MIN_REV (amdgpu_ip_version (adev,GC_HWIP ,0 ));break ;case AMD_IP_BLOCK_TYPE_SDMA : result->ip_discovery_version = -amdgpu_ip_version (adev,SDMA0_HWIP ,0 ); +IP_VERSION_MAJ_MIN_REV (amdgpu_ip_version (adev,SDMA0_HWIP ,0 ));break ;case AMD_IP_BLOCK_TYPE_UVD :case AMD_IP_BLOCK_TYPE_VCN :case AMD_IP_BLOCK_TYPE_JPEG : result->ip_discovery_version = -amdgpu_ip_version (adev,UVD_HWIP ,0 ); +IP_VERSION_MAJ_MIN_REV (amdgpu_ip_version (adev,UVD_HWIP ,0 ));break ;case AMD_IP_BLOCK_TYPE_VCE : result->ip_discovery_version = -amdgpu_ip_version (adev,VCE_HWIP ,0 ); +IP_VERSION_MAJ_MIN_REV (amdgpu_ip_version (adev,VCE_HWIP ,0 ));break ;default : result->ip_discovery_version =0 ;
--
2.25.1
Re: [PATCH v2 2/2] drm/amdgpu: Add more fields to IP version
Quoted 121 lines · Hawking
[AMD Official Use Only - General]
Series is
Reviewed-by Hawking Zhang <[email protected]>Regards,
Hawking
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, September 13, 2023 13:58
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Olsak, Marek <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH v2 2/2] drm/amdgpu: Add more fields to IP versionInclude subrevision and variant fileds also to IP version.
Signed-off-by Lijo Lazar <[email protected]>Reviewed-by Alex Deucher <[email protected]>---
v2:
Use major/min/rev format indrm_amdgpu_info_hw_ipdiscovery versiondrivers/gpu/drm/amd/amdgpu/amdgpu.h | 18 ++++++++++++----- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 20 ++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 8 ++++---- 3 files changed, 34 insertions(+), 12 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +13
-2@@ -681,10 +681,15 @@ enum amd_hw_ip_block_type {#define HWIP_MAX_INSTANCE 44#define HW_ID_MAX 300 -#define IP_VERSION (mj, mn, rv) (((mj) << 16) | ((mn) << 8) | (rv)) -#define IP_VERSION_MAJ(ver) ((ver) >> 16) -#define IP_VERSION_MIN(ver) (((ver) >> 8) & 0xFF) -#define IP_VERSION_REV(ver) ((ver) & 0xFF) +#define IP_VERSION_FULL (mj, mn, rv, var, srev) \ + (((mj) << 24) | ((mn) << 16) | ((rv) << 8) | ((var) << 4) | (srev)) +#define IP_VERSION (mj, mn, rv) IP_VERSION_FULL(mj, mn, rv, 0, 0) +#define IP_VERSION_MAJ (ver) ((ver) >> 24) +#define IP_VERSION_MIN (ver) (((ver) >> 16) & 0xFF) +#define IP_VERSION_REV (ver) (((ver) >> 8) & 0xFF) +#define IP_VERSION_VARIANT (ver) (((ver) >> 4) & 0xF) +#define IP_VERSION_SUBREV (ver) ((ver) & 0xF) +#define IP_VERSION_MAJ_MIN_REV (ver) ((ver) >> 8) struct amdgpu_ip_map_info { /* Map of logical to actual dev instances/mask */ @@ -1109,7 +1114,10 @@ struct amdgpu_device { static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev, uint8_t ip, uint8_t inst) { -return adev->ip_versions[ip][inst]; + /* This considers only major/minor/rev and ignores + * subrevision/variant fields. + */ + return adev->ip_versions[ip][inst] & ~0xFFU; } static inline struct amdgpu_device *drm_to_adev(struct drm_device *ddev) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.cindex
430ee7f64a97..42d379956ef3100644drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +17
-3@@ -1191,6 +1191,7 @@ static void amdgpu_discovery_sysfs_fini(struct amdgpu_device *adev)static int amdgpu_discovery_reg_base_init (struct amdgpu_device *adev) { +uint8_t num_base_address, subrev, variant;struct binary_header *bhdr;struct ip_discovery_header *ihdr;struct die_header *dhdr;@@ -1199,7 +1200,6 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)uint16_t ip_offset;uint16_t num_dies;uint16_t num_ips; -uint8_t num_base_address;int hw_ip;int i, j, k;int r;@@ -1337,8 +1337,22 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)* example. On most chips there are multiple instances * with the same HWID. */ - adev->ip_versions[hw_ip][ip->instance_number] = -IP_VERSION (ip->major, ip->minor, ip->revision); + +if (ihdr->version <3 ) { + subrev =0 ; + variant =0 ; + }else { + subrev = ip->sub_revision; + variant = ip->variant; + } + + adev->ip_versions[hw_ip] + [ip->instance_number] = +IP_VERSION_FULL (ip->major, + ip->minor, + ip->revision, + variant, + subrev); } }drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2
-2@@ -502,21 +502,21 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,switch (type) {case AMD_IP_BLOCK_TYPE_GFX : result->ip_discovery_version = -amdgpu_ip_version (adev,GC_HWIP ,0 ); +IP_VERSION_MAJ_MIN_REV (amdgpu_ip_version (adev,GC_HWIP ,0 ));break ;case AMD_IP_BLOCK_TYPE_SDMA : result->ip_discovery_version = -amdgpu_ip_version (adev,SDMA0_HWIP ,0 ); +IP_VERSION_MAJ_MIN_REV (amdgpu_ip_version (adev,SDMA0_HWIP ,0 ));break ;case AMD_IP_BLOCK_TYPE_UVD :case AMD_IP_BLOCK_TYPE_VCN :
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_hw_ip_info(struct amdgpu_device *adev, · line 520
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2
-2case AMD_IP_BLOCK_TYPE_JPEG : result->ip_discovery_version = -amdgpu_ip_version (adev,UVD_HWIP ,0 ); +IP_VERSION_MAJ_MIN_REV (amdgpu_ip_version (adev,UVD_HWIP ,0 ));break ;case AMD_IP_BLOCK_TYPE_VCE : result->ip_discovery_version = -amdgpu_ip_version (adev,VCE_HWIP ,0 ); +IP_VERSION_MAJ_MIN_REV (amdgpu_ip_version (adev,VCE_HWIP ,0 ));break ;
Just a heads up that I just pushed a patch which added a case for VPE here, so please make sure that gets fixed too when you push this.
Thanks,
Alex