linux-next: manual merge of the amdgpu tree with the origin tree
Subsystems (5)
Mark Brown
maintainerHi all,
Today's linux-next merge of the amdgpu tree got conflicts in:
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.h
between commits:
0af298e62e5cf ("treewide: refresh kmalloc_obj() conversions")
e5e23f4d97d3e ("drm/amdgpu: dm: Switch to drm_atomic_helper_connector_create_state") 6027db7db7737 ("drm/amd/pm: preserve committed OD features for SMU 13.0.0/13.0.7") 44d0d3031e479 ("drm/amd/pm:restate all customized OD features on every table upload for smu 13.0.0/smu 14.0.2") 947da95066248 ("drm/amdgpu: wake the GPU for INFO queries that access the hardware") 4c2c17f639b39 ("drm/amd/pm: Notify node unload during driver unload")
0c8b2a9b97852 ("drm/amd/pm: Add NPM metrics reads and SetNpmLimit")
1afded4c7642e ("drm/amd/pm: Add set_npm_limit function")
from the origin tree and commits:
184c9b0c4bd16 ("drm/amdgpu/gfx12: program the SPM VMID once the RLC runs")
b1680aea938dd ("drm/amd/display: Fix use-after-free in dm_test_hpd_rx_offload_work_msg_rdy") 907aebc5578ae ("drm/amdgpu/gfx12: disallow GFXOFF while updating the SPM VMID")
5c99c1a6f168c ("drm/amd/pm: Add a metrics revision for SMU 15.0.8")
3888e12e4cd5a ("drm/amd/pm: Report SMU 15.0.8 XGMI bandwidth")
ea449fd526d2c ("drm/amdgpu/gfx12: flush the scratch register write in the ring test") a5b825c0c583c ("drm/amd/display: Assert NOT_NULL on allocs")
137f79a560320 ("drm/amd/display: Use kunit_kcalloc for arrays")
adf63026e1fa7 ("drm/amd/pm: preserve committed OD features for SMU 13.0.0/13.0.7") d2c1e98658b6c ("drm/amd/pm: report smu energy accumulator updates")
1b63bb397db20 ("drm/amd/pm:restate all customized OD features on every table upload for smu 13.0.0/smu 14.0.2") d0cf969e9fdc5 ("drm/amd/display: fix NULL dc deref in hpd_init KUnit tests")
f9fcae49dfef2 ("drm/amdgpu: return copy errors from AMDGPU_INFO_UQ_FW_AREAS")
09e125304063e ("drm/amdgpu: defer XCP DRM device free until primary release")
90b1b26bb030d ("drm/amdgpu: remove the unused ring parameter from update_spm_vmid()") 0788f801df5ad ("drm/amdgpu: use spm_vmid for the default RLC SPM VMID")
6c056350226aa ("drm/amdkfd: fix lost wakeup in interrupt drain on debugged process exit") f02d796d69b68 ("drm/amdgpu/gfx_v12_0: Remove legacy CP programming")
002bf1a555a0c ("drm/amdgpu: store the user-queue VMID mask instead of first_kfd_vmid") 5ee0ab19c2c0e ("drm/amdgpu: wake the GPU for INFO queries that access the hardware") 8b810d7825aa9 ("drm/amd/pm: Notify node unload during driver unload")
f918ad983d61e ("drm/amd/pm: Add NPM metrics reads and SetNpmLimit")
65d4256d3cf01 ("drm/amd/pm: Add set_npm_limit function")
from the amdgpu tree.
I fixed it up (see below) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts.
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
@@@ -919,7 -919,8 +919,7 @@@ int amdgpu_info_ioctl(struct drm_devicif (ret)return ret; - regs =kmalloc_array (info->read_mmr_reg.count,sizeof (*regs), -GFP_KERNEL ); + regs =kmalloc_objs (*regs, info->read_mmr_reg.count);if (!regs)return -ENOMEM ;return ret; ret =copy_to_user (out, &meta_info, -min ((size_t )size,sizeof (meta_info))) ? -EFAULT :0 ; -return 0 ; +min ((size_t )size,sizeof (meta_info))); +return ret ? -EFAULT :0 ;case AMDGPU_HW_IP_COMPUTE : ret =amdgpu_userq_metadata_info_compute (adev, info, &meta_info.compute);if (ret)return ret; ret =copy_to_user (out, &meta_info, -min ((size_t )size,sizeof (meta_info))) ? -EFAULT :0 ; -return 0 ; +min ((size_t )size,sizeof (meta_info))); +return ret ? -EFAULT :0 ;case AMDGPU_HW_IP_DMA : ret =amdgpu_userq_metadata_info_sdma (adev, info, &meta_info.sdma);if (ret)return ret; ret =copy_to_user (out, &meta_info, -min ((size_t )size,sizeof (meta_info))) ? -EFAULT :0 ; -return 0 ; +min ((size_t )size,sizeof (meta_info))); +return ret ? -EFAULT :0 ;default :return -EINVAL ; }if (r <0 ) goto pm_put; - fpriv =kzalloc (sizeof (*fpriv),GFP_KERNEL ); + fpriv =kzalloc_obj (*fpriv);if (unlikely (!fpriv)) { r = -ENOMEM ; goto out_suspend;if (r) goto error_pasid; +init_completion (&fpriv->irq_drain_done); + pasid =amdgpu_pasid_alloc (16 , fpriv);if (pasid <0 ) {dev_warn (adev->dev,"No more PASIDs available!" ); {struct amdgpu_device *adev =drm_to_adev (dev); +amdgpu_xcp_dev_fini (adev);amdgpu_device_fini_sw (adev);pci_set_drvdata (adev->pdev,NULL ); }
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +0 -0
@@@ -286,6 -286,8 +286,8 @@@ static void gfx_v12_0_ring_invalidate_t bool all_hub, uint8_t dst_sel);static void gfx_v12_0_set_safe_mode (struct amdgpu_device *adev,int xcc_id);static void gfx_v12_0_unset_safe_mode (struct amdgpu_device *adev,int xcc_id); +static void gfx_v12_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, +unsigned int vmid);static void gfx_v12_0_userq_priv_fault_work (struct work_struct *work);static void gfx_v12_0_update_perf_clk (struct amdgpu_device *adev,bool enable);int r;WREG32 (scratch,0xCAFEDEAD ); +/* +* Read the value back so the posted write reaches the register before +* the CP writes the test value; otherwise it can overwrite the result. +*/ +RREG32 (scratch); r =amdgpu_ring_alloc (ring,5 );if (r) {drm_err (adev_to_drm (adev), return r; } - /* init spm vmid with 0xf */ - if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid(adev, 0, NULL, 0xf); - return 0; } SCRATCH_APP_BASE; mutex_lock(&adev->srbm_mutex); -for (i = adev->vm_manager.first_kfd_vmid; i <AMDGPU_NUM_VMID ; i++) { +for_each_uq_gfx_vmid (i, adev) {soc24_grbm_select (adev,0 ,0 ,0 , i);/* CP and shaders */ WREG32_SOC15 (GC ,0 , regSH_MEM_CONFIG,DEFAULT_SH_MEM_CONFIG ); adev->gfx.rlc.funcs->start (adev); } +/* +* The RLC comes up with RLC_SPM_MC_CNTL cleared, program the SPM VMID +* once it runs, also after a GPU reset or a resume. +*/ +gfx_v12_0_update_spm_vmid (adev,0 , adev->vm_manager.spm_vmid); +return 0 ; } adev->gfx.config.max_hw_contexts - 1);WREG32_SOC15 (GC ,0 , regCP_DEVICE_ID,1 ); -if (!amdgpu_async_gfx_ring) -gfx_v12_0_cp_gfx_enable (adev, true); - -return 0 ; - } - -static void gfx_v12_0_cp_gfx_switch_pipe (struct amdgpu_device *adev, -CP_PIPE_ID pipe) - { -u32 tmp; - - tmp =RREG32_SOC15 (GC ,0 , regGRBM_GFX_CNTL); - tmp =REG_SET_FIELD (tmp,GRBM_GFX_CNTL ,PIPEID , pipe); - -WREG32_SOC15 (GC ,0 , regGRBM_GFX_CNTL, tmp); - } - -static void gfx_v12_0_cp_gfx_set_doorbell (struct amdgpu_device *adev, -struct amdgpu_ring *ring) - { -u32 tmp; - - tmp =RREG32_SOC15 (GC ,0 , regCP_RB_DOORBELL_CONTROL); -if (ring->use_doorbell) { - tmp =REG_SET_FIELD (tmp,CP_RB_DOORBELL_CONTROL , -DOORBELL_OFFSET , ring->doorbell_index); - tmp =REG_SET_FIELD (tmp,CP_RB_DOORBELL_CONTROL , -DOORBELL_EN ,1 ); - }else { - tmp =REG_SET_FIELD (tmp,CP_RB_DOORBELL_CONTROL , -DOORBELL_EN ,0 ); - } -WREG32_SOC15 (GC ,0 , regCP_RB_DOORBELL_CONTROL, tmp); - - tmp =REG_SET_FIELD (0 ,CP_RB_DOORBELL_RANGE_LOWER , -DOORBELL_RANGE_LOWER , ring->doorbell_index); -WREG32_SOC15 (GC ,0 , regCP_RB_DOORBELL_RANGE_LOWER, tmp); - -WREG32_SOC15 (GC ,0 , regCP_RB_DOORBELL_RANGE_UPPER, -CP_RB_DOORBELL_RANGE_UPPER__DOORBELL_RANGE_UPPER_MASK ); - } - -static int gfx_v12_0_cp_gfx_resume (struct amdgpu_device *adev) - { -struct amdgpu_ring *ring; -u32 tmp; -u32 rb_bufsz; -u64 rb_addr, rptr_addr, wptr_gpu_addr; - -/* Set the write pointer delay */ -WREG32_SOC15 (GC ,0 , regCP_RB_WPTR_DELAY,0 ); - -/* set the RB to use vmid 0 */ -WREG32_SOC15 (GC ,0 , regCP_RB_VMID,0 ); - -/* Init gfx ring 0 for pipe 0 */ -mutex_lock (&adev->srbm_mutex); -gfx_v12_0_cp_gfx_switch_pipe (adev,PIPE_ID0 ); - -/* Set ring buffer size */ - ring = &adev->gfx.gfx_ring[0 ]; - rb_bufsz =order_base_2 (ring->ring_size /8 ); - tmp =REG_SET_FIELD (0 ,CP_RB0_CNTL ,RB_BUFSZ , rb_bufsz); - tmp =REG_SET_FIELD (tmp,CP_RB0_CNTL ,RB_BLKSZ , rb_bufsz -2 ); - tmp =REG_SET_FIELD (tmp,CP_RB0_CNTL ,KMD_QUEUE ,1 ); -WREG32_SOC15 (GC ,0 , regCP_RB0_CNTL, tmp); - -/* Initialize the ring buffer's write pointers */ - ring->wptr =0 ; -WREG32_SOC15 (GC ,0 , regCP_RB0_WPTR,lower_32_bits (ring->wptr)); -WREG32_SOC15 (GC ,0 , regCP_RB0_WPTR_HI,upper_32_bits (ring->wptr)); - -/* set the wb address whether it's enabled or not */ - rptr_addr = ring->rptr_gpu_addr; -WREG32_SOC15 (GC ,0 , regCP_RB0_RPTR_ADDR,lower_32_bits (rptr_addr)); -WREG32_SOC15 (GC ,0 , regCP_RB0_RPTR_ADDR_HI,upper_32_bits (rptr_addr) & -CP_RB_RPTR_ADDR_HI__RB_RPTR_ADDR_HI_MASK ); - - wptr_gpu_addr = ring->wptr_gpu_addr; -WREG32_SOC15 (GC ,0 , regCP_RB_WPTR_POLL_ADDR_LO, -lower_32_bits (wptr_gpu_addr)); -WREG32_SOC15 (GC ,0 , regCP_RB_WPTR_POLL_ADDR_HI, -upper_32_bits (wptr_gpu_addr)); - -mdelay (1 ); -WREG32_SOC15 (GC ,0 , regCP_RB0_CNTL, tmp); - - rb_addr = ring->gpu_addr >>8 ; -WREG32_SOC15 (GC ,0 , regCP_RB0_BASE, rb_addr); -WREG32_SOC15 (GC ,0 , regCP_RB0_BASE_HI,upper_32_bits (rb_addr)); - -WREG32_SOC15 (GC ,0 , regCP_RB_ACTIVE,1 ); - -gfx_v12_0_cp_gfx_set_doorbell (adev, ring); -mutex_unlock (&adev->srbm_mutex); - -/* Switch to pipe 0 */ -mutex_lock (&adev->srbm_mutex); -gfx_v12_0_cp_gfx_switch_pipe (adev,PIPE_ID0 ); -mutex_unlock (&adev->srbm_mutex); - -/* start the ring */ -gfx_v12_0_cp_gfx_start (adev);return 0 ; } {int i, r; -if (!amdgpu_async_gfx_ring) -gfx_v12_0_cp_compute_enable (adev, true); -for (i =0 ; i < adev->gfx.num_compute_rings; i++) { r =gfx_v12_0_kcq_init_queue (&adev->gfx.compute_ring[i]);if (r)gfx_v12_0_cp_set_doorbell_range (adev); -if (amdgpu_async_gfx_ring) { -gfx_v12_0_cp_compute_enable (adev, true); -gfx_v12_0_cp_gfx_enable (adev, true); - } +gfx_v12_0_cp_compute_enable (adev, true); +gfx_v12_0_cp_gfx_enable (adev, true);if (adev->enable_mes_kiq && adev->mes.kiq_hw_init) { r =amdgpu_mes_kiq_hw_init (adev,0 );if (r)return r; -if (!amdgpu_async_gfx_ring) { - r =gfx_v12_0_cp_gfx_resume (adev); -if (r) -return r; - }else { - r =gfx_v12_0_cp_async_gfx_ring_resume (adev); -if (r) -return r; - } + r =gfx_v12_0_cp_async_gfx_ring_resume (adev); +if (r) +return r;for (i =0 ; i < adev->gfx.num_gfx_rings; i++) { ring = &adev->gfx.gfx_ring[i];amdgpu_irq_put (adev, &adev->gfx.priv_reg_irq,0 );if (!adev->no_hw_access) { -if (amdgpu_async_gfx_ring) { -if (amdgpu_gfx_disable_kgq (adev,0 )) -DRM_ERROR ("KGQ disable failed\n" ); - } +if (amdgpu_gfx_disable_kgq (adev,0 )) +DRM_ERROR ("KGQ disable failed\n" );if (amdgpu_gfx_disable_kcq (adev,0 ))DRM_ERROR ("KCQ disable failed\n" );static void gfx_v12_0_update_spm_vmid (struct amdgpu_device *adev,int xcc_id, -struct amdgpu_ring *ring,unsigned vmid) {u32 reg, data; else WREG32_SOC15(GC, 0, regRLC_SPM_MC_CNTL, data);amdgpu_gfx_off_ctrl (adev, true); - -if (ring - &&amdgpu_sriov_is_pp_one_vf (adev) - && ((ring->funcs->type ==AMDGPU_RING_TYPE_GFX ) - || (ring->funcs->type ==AMDGPU_RING_TYPE_COMPUTE ))) { -uint32_t reg =SOC15_REG_OFFSET (GC ,0 , regRLC_SPM_MC_CNTL); -amdgpu_ring_emit_wreg (ring, reg, data); - } } static const struct amdgpu_rlc_funcs gfx_v12_0_rlc_funcs = {
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c +0 -0
@@@ -114,7 -114,7 +114,7 @@@ static void dm_test_crtc_vrr_active_irqstruct amdgpu_crtc *acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->dm_irq_params.freesync_config.state =VRR_STATE_ACTIVE_VARIABLE ;struct amdgpu_crtc *acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->dm_irq_params.freesync_config.state =VRR_STATE_ACTIVE_FIXED ;struct amdgpu_crtc *acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->dm_irq_params.freesync_config.state =VRR_STATE_INACTIVE ;struct amdgpu_crtc *acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->dm_irq_params.freesync_config.state =VRR_STATE_DISABLED ;struct amdgpu_crtc *acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->dm_irq_params.freesync_config.state =VRR_STATE_UNSUPPORTED ;sizeof (*dm_state), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_state); +KUNIT_ASSERT_NOT_NULL (test, dm_state); dm_state->freesync_config.state =VRR_STATE_ACTIVE_VARIABLE ;sizeof (*dm_state), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_state); +KUNIT_ASSERT_NOT_NULL (test, dm_state); dm_state->freesync_config.state =VRR_STATE_ACTIVE_FIXED ;sizeof (*dm_state), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_state); +KUNIT_ASSERT_NOT_NULL (test, dm_state); dm_state->freesync_config.state =VRR_STATE_INACTIVE ;sizeof (*dm_state), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_state); +KUNIT_ASSERT_NOT_NULL (test, dm_state); dm_state->freesync_config.state =VRR_STATE_DISABLED ;sizeof (*dm_state), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_state); +KUNIT_ASSERT_NOT_NULL (test, dm_state); dm_state->freesync_config.state =VRR_STATE_UNSUPPORTED ;struct amdgpu_device *adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL );struct drm_device *dev =dm_kunit_alloc_drm_with_connector_list (test); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, adev); adev->dm.ddev = dev;KUNIT_EXPECT_TRUE (test,amdgpu_dm_is_headless (adev));struct drm_device *dev =dm_kunit_alloc_drm_with_connector_list (test);struct drm_connector *wb =kunit_kzalloc (test,sizeof (*wb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, wb); +KUNIT_ASSERT_NOT_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, wb); adev->dm.ddev = dev;dm_test_add_connector (dev, wb,DRM_MODE_CONNECTOR_WRITEBACK , struct drm_device *dev = dm_kunit_alloc_drm_with_connector_list(test);struct drm_connector *display =kunit_kzalloc (test,sizeof (*display),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, display); +KUNIT_ASSERT_NOT_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, display); adev->dm.ddev = dev;dm_test_add_connector (dev, display,DRM_MODE_CONNECTOR_HDMIA , struct drm_device *dev = dm_kunit_alloc_drm_with_connector_list(test);struct drm_connector *display =kunit_kzalloc (test,sizeof (*display),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, display); +KUNIT_ASSERT_NOT_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, display); adev->dm.ddev = dev;dm_test_add_connector (dev, display,DRM_MODE_CONNECTOR_HDMIA , struct drm_connector *wb = kunit_kzalloc(test, sizeof(*wb), GFP_KERNEL);struct drm_connector *display =kunit_kzalloc (test,sizeof (*display),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, wb); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, display); +KUNIT_ASSERT_NOT_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, wb); +KUNIT_ASSERT_NOT_NULL (test, display); adev->dm.ddev = dev;dm_test_add_connector (dev, wb,DRM_MODE_CONNECTOR_WRITEBACK , adev = dm_kunit_alloc_adev(test); acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->base.dev = &adev->ddev; acrtc->otg_inst =-1 ;KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->base.dev = &adev->ddev; acrtc->otg_inst =0 ;KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); dc =dm_kunit_alloc_dc_with_ctx (test); res_pool =kunit_kzalloc (test,sizeof (*res_pool),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, res_pool); +KUNIT_ASSERT_NOT_NULL (test, res_pool); irqs =kunit_kzalloc (test,sizeof (*irqs),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, irqs); +KUNIT_ASSERT_NOT_NULL (test, irqs);/* * Populate the per-source info table so amdgpu_dm_irq_set() succeeds. */ - info =kunit_kzalloc (test,sizeof (*info) *DAL_IRQ_SOURCES_NUMBER , -GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, info); + info =kunit_kcalloc (test,DAL_IRQ_SOURCES_NUMBER ,sizeof (*info),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, info);for (i =0 ; i <DAL_IRQ_SOURCES_NUMBER ; i++) info[i].funcs = &dm_test_vupdate_irq_src_funcs;struct idle_workqueue *idle_work; adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, adev); idle_work =idle_create_workqueue (adev);KUNIT_ASSERT_NOT_ERR_OR_NULL (test, idle_work);KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); idle_work =kunit_kzalloc (test,sizeof (*idle_work),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, idle_work); +KUNIT_ASSERT_NOT_NULL (test, idle_work); idle_work->dm = &adev->dm; idle_work->enable = false; adev->dm.dc->idle_optimizations_allowed = false; idle_work =kunit_kzalloc (test,sizeof (*idle_work),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, idle_work); +KUNIT_ASSERT_NOT_NULL (test, idle_work); idle_work->dm = &adev->dm; idle_work->enable = true;/* A connected display makes amdgpu_dm_is_headless() false. */ display =kunit_kzalloc (test,sizeof (*display),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, display); +KUNIT_ASSERT_NOT_NULL (test, display);dm_test_add_connector (adev->dm.ddev, display,DRM_MODE_CONNECTOR_HDMIA , connector_status_connected); idle_work =kunit_kzalloc (test,sizeof (*idle_work),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, idle_work); +KUNIT_ASSERT_NOT_NULL (test, idle_work); idle_work->dm = &adev->dm; idle_work->enable = true; adev->dm.idle_workqueue = idle_work; adev->dm.dc->caps.is_apu = true;/* dc_allow() logs via DC_LOG_DEBUG() when it flips the flag. */ logger =kunit_kzalloc (test,sizeof (*logger),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, logger); +KUNIT_ASSERT_NOT_NULL (test, logger); logger->dev = &adev->ddev; adev->dm.dc->ctx->logger = logger;/* dc_allow() only flips the flag when clk_mgr and apply() are present. */ adev->dm.dc->hwss.apply_idle_power_optimizations = dm_test_idle_apply_flip; idle_work =kunit_kzalloc (test,sizeof (*idle_work),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, idle_work); +KUNIT_ASSERT_NOT_NULL (test, idle_work); idle_work->dm = &adev->dm; idle_work->enable = true; adev->dm.idle_workqueue = idle_work;struct dc_stream_state *stream; dm =kunit_kzalloc (test,sizeof (*dm),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm); +KUNIT_ASSERT_NOT_NULL (test, dm); link =dm_kunit_alloc_link (test); stream =dm_kunit_alloc_stream (test, link);struct dc_stream_state *stream; dm =kunit_kzalloc (test,sizeof (*dm),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm); +KUNIT_ASSERT_NOT_NULL (test, dm); link =dm_kunit_alloc_link (test); stream =dm_kunit_alloc_stream (test, link);struct dc_stream_state *stream; dm =kunit_kzalloc (test,sizeof (*dm),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm); +KUNIT_ASSERT_NOT_NULL (test, dm); link =dm_kunit_alloc_link (test); stream =dm_kunit_alloc_stream (test, link);struct amdgpu_crtc *acrtc; acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->base.dev = &adev->ddev; acrtc->base.enabled = false;atomic_t *enabled; enabled =kunit_kzalloc (test,sizeof (*enabled),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, enabled); +KUNIT_ASSERT_NOT_NULL (test, enabled);atomic_set (enabled, count); src->num_types =1 ; adev->mode_info.num_crtc =1 ; reset_domain =kunit_kzalloc (test,sizeof (*reset_domain),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, reset_domain); +KUNIT_ASSERT_NOT_NULL (test, reset_domain); adev->reset_domain = reset_domain; acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->base.dev = &adev->ddev; acrtc->base.funcs = &dm_test_crtc_funcs; acrtc->base.enabled = true; stream =dm_kunit_alloc_stream (test, link); dm_state =kunit_kzalloc (test,sizeof (*dm_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_state); +KUNIT_ASSERT_NOT_NULL (test, dm_state); dm_state->stream = stream; acrtc->base.state = &dm_state->base; acrtc_state->freesync_config.state =VRR_STATE_ACTIVE_VARIABLE ; res_pool =kunit_kzalloc (test,sizeof (*res_pool),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, res_pool); +KUNIT_ASSERT_NOT_NULL (test, res_pool); irqs =kunit_kzalloc (test,sizeof (*irqs),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, irqs); +KUNIT_ASSERT_NOT_NULL (test, irqs);/* * Per-source .set fails so amdgpu_dm_irq_set() reports the source busy. */ - info =kunit_kzalloc (test,sizeof (*info) *DAL_IRQ_SOURCES_NUMBER , -GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, info); + info =kunit_kcalloc (test,DAL_IRQ_SOURCES_NUMBER ,sizeof (*info),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, info);for (i =0 ; i <DAL_IRQ_SOURCES_NUMBER ; i++) info[i].funcs = &dm_test_vupdate_irq_src_busy_funcs;KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, crtc); crtc->dev = &adev->ddev; adev->ip_versions[DCE_HWIP ][0 ] = ip_version;struct dm_crtc_state *dm_state; dm_state =kunit_kzalloc (test,sizeof (*dm_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_state); +KUNIT_ASSERT_NOT_NULL (test, dm_state); dm_state->stream =NULL ; dm_state->active_planes =5 ;INIT_LIST_HEAD (&dev->mode_config.plane_list); state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state); +KUNIT_ASSERT_NOT_NULL (test, state); state->dev = dev; crtc_state =kunit_kzalloc (test,sizeof (*crtc_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc_state); +KUNIT_ASSERT_NOT_NULL (test, crtc_state); crtc_state->state = state; crtc_state->plane_mask =0 ;INIT_LIST_HEAD (&dev->mode_config.plane_list); plane_no_state =kunit_kzalloc (test,sizeof (*plane_no_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, plane_no_state); +KUNIT_ASSERT_NOT_NULL (test, plane_no_state); plane_cursor =kunit_kzalloc (test,sizeof (*plane_cursor),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, plane_cursor); +KUNIT_ASSERT_NOT_NULL (test, plane_cursor); plane_with_fb =kunit_kzalloc (test,sizeof (*plane_with_fb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, plane_with_fb); +KUNIT_ASSERT_NOT_NULL (test, plane_with_fb); plane_no_fb =kunit_kzalloc (test,sizeof (*plane_no_fb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, plane_no_fb); +KUNIT_ASSERT_NOT_NULL (test, plane_no_fb); plane_excluded =kunit_kzalloc (test,sizeof (*plane_excluded),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, plane_excluded); +KUNIT_ASSERT_NOT_NULL (test, plane_excluded);dm_test_add_plane (dev, plane_no_state,0 ,DRM_PLANE_TYPE_PRIMARY );dm_test_add_plane (dev, plane_cursor,1 ,DRM_PLANE_TYPE_CURSOR );dm_test_add_plane (dev, plane_excluded,4 ,DRM_PLANE_TYPE_PRIMARY ); fb =kunit_kzalloc (test,sizeof (*fb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, fb); +KUNIT_ASSERT_NOT_NULL (test, fb); ps_fb =kunit_kzalloc (test,sizeof (*ps_fb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ps_fb); +KUNIT_ASSERT_NOT_NULL (test, ps_fb); ps_fb->fb = fb; ps_no_fb =kunit_kzalloc (test,sizeof (*ps_no_fb),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ps_no_fb); +KUNIT_ASSERT_NOT_NULL (test, ps_no_fb); ps_no_fb->fb =NULL ; state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state); +KUNIT_ASSERT_NOT_NULL (test, state); state->dev = dev; - state->planes =kunit_kzalloc (test,sizeof (*state->planes) *5 ,GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state->planes); + state->planes =kunit_kcalloc (test,5 ,sizeof (*state->planes),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, state->planes); state->planes[0 ].new_state =NULL ; state->planes[1 ].new_state = ps_fb; state->planes[2 ].new_state = ps_fb; state->planes[4 ].new_state = ps_fb; crtc_state =kunit_kzalloc (test,sizeof (*crtc_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc_state); +KUNIT_ASSERT_NOT_NULL (test, crtc_state); crtc_state->state = state;/* Exclude plane index 4 from the CRTC. */ crtc_state->plane_mask =BIT (0 ) |BIT (1 ) |BIT (2 ) |BIT (3 );struct dm_crtc_state *dm_dup; crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, crtc); cur =kunit_kzalloc (test,sizeof (*cur),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, cur); +KUNIT_ASSERT_NOT_NULL (test, cur); cur->abm_level =3 ; cur->active_planes =2 ;struct dc_link *link; crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, crtc); cur =kunit_kzalloc (test,sizeof (*cur),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, cur); +KUNIT_ASSERT_NOT_NULL (test, cur); link =dm_kunit_alloc_link (test); stream =dm_kunit_alloc_stream (test, link);struct drm_crtc *crtc; crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, crtc); crtc->state =NULL ;KUNIT_EXPECT_NULL (test,amdgpu_dm_crtc_duplicate_state (crtc));KUNIT_ASSERT_NOT_ERR_OR_NULL (test, plane);/* amdgpu_dm_crtc_destroy() kfree()s the CRTC, so use a plain alloc. */ - acrtc =kzalloc_obj (*acrtc,GFP_KERNEL ); + acrtc =kzalloc_obj (*acrtc); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); ret =drm_crtc_init_with_planes (&adev->ddev, &acrtc->base, plane,NULL , &dm_test_crtc_funcs,NULL );struct drm_crtc *crtc; crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, crtc); crtc->dev = &adev->ddev; crtc->state =NULL ;struct dc_link *link; crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, crtc); crtc->dev = &adev->ddev; link =dm_kunit_alloc_link (test);kref_get (&stream->refcount);/* reset_state kfree()s the old state, so use a plain (unmanaged) alloc. */ ++<<<<<<< HEAD + old =kzalloc_obj (*old); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, old); ++======= + old =kzalloc_obj (*old,GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, old); ++>>>>>>> amdgpu/drm-next old->stream = stream; crtc->state = &old->base;/* destroy_state kfree()s the state, so use a plain (unmanaged) alloc. */ dm_state =kzalloc_obj (*dm_state); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_state); +KUNIT_ASSERT_NOT_NULL (test, dm_state);amdgpu_dm_crtc_destroy_state (NULL , &dm_state->base); }/* destroy_state kfree()s the state, so use a plain (unmanaged) alloc. */ dm_state =kzalloc_obj (*dm_state); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_state); +KUNIT_ASSERT_NOT_NULL (test, dm_state); dm_state->stream = stream;amdgpu_dm_crtc_destroy_state (NULL , &dm_state->base);KUNIT_ASSERT_EQ (test,drm_vblank_init (&adev->ddev,1 ),0 ); acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->base.dev = &adev->ddev; acrtc->event =NULL ;KUNIT_ASSERT_EQ (test,drm_vblank_init (&adev->ddev,1 ),0 ); acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); event =kunit_kzalloc (test,sizeof (*event),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, event); +KUNIT_ASSERT_NOT_NULL (test, event); acrtc->base.dev = &adev->ddev; acrtc->base.funcs = &dm_test_crtc_funcs;KUNIT_ASSERT_EQ (test,drm_vblank_init (&adev->ddev,1 ),0 ); acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc);/* drm_crtc_send_vblank_event() consumes (kfree()s) the event. */ event =kzalloc_obj (*event); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, event); +KUNIT_ASSERT_NOT_NULL (test, event); acrtc->base.dev = &adev->ddev; acrtc->base.funcs = &dm_test_crtc_funcs; adev->dm.active_vblank_irq_count = count; acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->base.dev = &adev->ddev; acrtc->base.state =NULL ;/* Worker kfree()s the work item, so it must be a plain allocation. */ work =kzalloc_obj (*work); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, work); +KUNIT_ASSERT_NOT_NULL (test, work); work->dm = &adev->dm; work->acrtc = acrtc; work->stream = stream; adev->irq.installed = false; acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->base.dev = &adev->ddev; acrtc->crtc_id =0 ; adev->irq.installed = true; reset_domain =kunit_kzalloc (test,sizeof (*reset_domain),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, reset_domain); +KUNIT_ASSERT_NOT_NULL (test, reset_domain); adev->reset_domain = reset_domain;/* Seed with 2 so amdgpu_irq_put() drops to a non-zero refcount. */ dm_test_crtc_arm_irq_src (test, &adev->pageflip_irq,2 ); acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->base.dev = &adev->ddev; acrtc->crtc_id =0 ;/* OTG unassigned -> amdgpu_dm_crtc_set_vupdate_irq() returns 0 early. */ adev->irq.installed = true; reset_domain =kunit_kzalloc (test,sizeof (*reset_domain),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, reset_domain); +KUNIT_ASSERT_NOT_NULL (test, reset_domain); adev->reset_domain = reset_domain;/* Seed with 2 so amdgpu_irq_put() drops to a non-zero refcount. */ dm_test_crtc_arm_irq_src (test, &adev->pageflip_irq,2 ); acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc); acrtc->base.dev = &adev->ddev; acrtc->crtc_id =0 ; acrtc->otg_inst =-1 ;/* CRTC state with no stream -> the stream-retain branch is skipped. */ dm_state =kunit_kzalloc (test,sizeof (*dm_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_state); +KUNIT_ASSERT_NOT_NULL (test, dm_state); acrtc->base.state = &dm_state->base;/* Real workqueue so the queue_work() branch runs the control worker. */ int ret; crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, crtc); crtc->debugfs_entry =debugfs_create_dir ("dm_test_crtc" ,NULL );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, crtc); crtc->dev = &adev->ddev; dm_crtc_state =kunit_kzalloc (test,sizeof (*dm_crtc_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_crtc_state); +KUNIT_ASSERT_NOT_NULL (test, dm_crtc_state); dm_crtc_state->base.crtc = crtc; state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state); +KUNIT_ASSERT_NOT_NULL (test, state); state->dev = &adev->ddev; state->crtcs =kunit_kzalloc (test,sizeof (*state->crtcs),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state->crtcs); +KUNIT_ASSERT_NOT_NULL (test, state->crtcs); state->crtcs[0 ].new_state = &dm_crtc_state->base; dm_crtc_state->base.state = state;KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); primary =kunit_kzalloc (test,sizeof (*primary),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, primary); +KUNIT_ASSERT_NOT_NULL (test, primary); crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, crtc); crtc->dev = &adev->ddev; crtc->primary = primary; dm_crtc_state =kunit_kzalloc (test,sizeof (*dm_crtc_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_crtc_state); +KUNIT_ASSERT_NOT_NULL (test, dm_crtc_state); dm_crtc_state->base.crtc = crtc; dm_crtc_state->base.enable = true; dm_crtc_state->base.plane_mask =0 ; state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state); +KUNIT_ASSERT_NOT_NULL (test, state); state->dev = &adev->ddev; state->crtcs =kunit_kzalloc (test,sizeof (*state->crtcs),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state->crtcs); +KUNIT_ASSERT_NOT_NULL (test, state->crtcs); state->crtcs[0 ].new_state = &dm_crtc_state->base; dm_crtc_state->base.state = state;KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, crtc); crtc->dev = &adev->ddev; dm_crtc_state =kunit_kzalloc (test,sizeof (*dm_crtc_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_crtc_state); +KUNIT_ASSERT_NOT_NULL (test, dm_crtc_state); dm_crtc_state->base.crtc = crtc; dm_crtc_state->base.async_flip = true; dm_crtc_state->update_type =UPDATE_TYPE_FULL ; state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state); +KUNIT_ASSERT_NOT_NULL (test, state); state->dev = &adev->ddev; state->crtcs =kunit_kzalloc (test,sizeof (*state->crtcs),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state->crtcs); +KUNIT_ASSERT_NOT_NULL (test, state->crtcs); state->crtcs[0 ].new_state = &dm_crtc_state->base; dm_crtc_state->base.state = state;KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); primary =kunit_kzalloc (test,sizeof (*primary),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, primary); +KUNIT_ASSERT_NOT_NULL (test, primary); crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, crtc); crtc->dev = &adev->ddev; crtc->primary = primary; dm_crtc_state =kunit_kzalloc (test,sizeof (*dm_crtc_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_crtc_state); +KUNIT_ASSERT_NOT_NULL (test, dm_crtc_state); dm_crtc_state->base.crtc = crtc; dm_crtc_state->freesync_config.state =VRR_STATE_ACTIVE_VARIABLE ; state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state); +KUNIT_ASSERT_NOT_NULL (test, state); state->dev = &adev->ddev; state->crtcs =kunit_kzalloc (test,sizeof (*state->crtcs),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state->crtcs); +KUNIT_ASSERT_NOT_NULL (test, state->crtcs); state->crtcs[0 ].new_state = &dm_crtc_state->base; dm_crtc_state->base.state = state;/* acquire ctx must be set; existing plane state avoids taking a lock. */ state->acquire_ctx =kunit_kzalloc (test,sizeof (*state->acquire_ctx),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state->acquire_ctx); +KUNIT_ASSERT_NOT_NULL (test, state->acquire_ctx); state->planes =kunit_kzalloc (test,sizeof (*state->planes),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state->planes); +KUNIT_ASSERT_NOT_NULL (test, state->planes); primary_plane_state =kunit_kzalloc (test,sizeof (*primary_plane_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, primary_plane_state); +KUNIT_ASSERT_NOT_NULL (test, primary_plane_state); state->planes[0 ].new_state = primary_plane_state; ret =amdgpu_dm_crtc_helper_atomic_check (crtc, state); dc =dm_kunit_alloc_dc_with_ctx (test); res_pool =kunit_kzalloc (test,sizeof (*res_pool),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, res_pool); +KUNIT_ASSERT_NOT_NULL (test, res_pool); tg =kunit_kzalloc (test,sizeof (*tg),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, tg); +KUNIT_ASSERT_NOT_NULL (test, tg); tg_funcs =kunit_kzalloc (test,sizeof (*tg_funcs),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, tg_funcs); +KUNIT_ASSERT_NOT_NULL (test, tg_funcs); tg_funcs->validate_timing = dm_test_atomic_check_validate_timing_ok; tg->funcs = tg_funcs; res_pool->timing_generators[0 ] = tg; dc->res_pool = res_pool; link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link_srv); +KUNIT_ASSERT_NOT_NULL (test, link_srv); link_srv->validate_mode_timing = dm_test_atomic_check_validate_mode_timing_ok; dc->link_srv = link_srv; adev->dm.dc = dc; stream =dm_kunit_alloc_stream (test, link); crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, crtc); crtc->dev = &adev->ddev; dm_crtc_state =kunit_kzalloc (test,sizeof (*dm_crtc_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_crtc_state); +KUNIT_ASSERT_NOT_NULL (test, dm_crtc_state); dm_crtc_state->base.crtc = crtc; dm_crtc_state->stream = stream; state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state); +KUNIT_ASSERT_NOT_NULL (test, state); state->dev = &adev->ddev; state->crtcs =kunit_kzalloc (test,sizeof (*state->crtcs),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state->crtcs); +KUNIT_ASSERT_NOT_NULL (test, state->crtcs); state->crtcs[0 ].new_state = &dm_crtc_state->base; dm_crtc_state->base.state = state; dc =dm_kunit_alloc_dc_with_ctx (test); res_pool =kunit_kzalloc (test,sizeof (*res_pool),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, res_pool); +KUNIT_ASSERT_NOT_NULL (test, res_pool); tg =kunit_kzalloc (test,sizeof (*tg),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, tg); +KUNIT_ASSERT_NOT_NULL (test, tg); tg_funcs =kunit_kzalloc (test,sizeof (*tg_funcs),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, tg_funcs); +KUNIT_ASSERT_NOT_NULL (test, tg_funcs); tg_funcs->validate_timing = dm_test_atomic_check_validate_timing_fail; tg->funcs = tg_funcs; res_pool->timing_generators[0 ] = tg; stream =dm_kunit_alloc_stream (test, link); crtc =kunit_kzalloc (test,sizeof (*crtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, crtc); +KUNIT_ASSERT_NOT_NULL (test, crtc); crtc->dev = &adev->ddev; dm_crtc_state =kunit_kzalloc (test,sizeof (*dm_crtc_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dm_crtc_state); +KUNIT_ASSERT_NOT_NULL (test, dm_crtc_state); dm_crtc_state->base.crtc = crtc; dm_crtc_state->stream = stream; state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state); +KUNIT_ASSERT_NOT_NULL (test, state); state->dev = &adev->ddev; state->crtcs =kunit_kzalloc (test,sizeof (*state->crtcs),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state->crtcs); +KUNIT_ASSERT_NOT_NULL (test, state->crtcs); state->crtcs[0 ].new_state = &dm_crtc_state->base; dm_crtc_state->base.state = state;
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c +0 -0
@@@ -428,17 -428,16 +428,16 @@@ static struct dc *dm_test_alloc_dc_withdc = dm_kunit_alloc_dc_with_ctx(test); res_pool = kunit_kzalloc(test, sizeof(*res_pool), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, res_pool); +KUNIT_ASSERT_NOT_NULL(test, res_pool); irqs = kunit_kzalloc(test, sizeof(*irqs), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, irqs); +KUNIT_ASSERT_NOT_NULL(test, irqs); /* * Populate the per-source info table so amdgpu_dm_irq_set()/_ack() * succeed without touching hardware registers. */ - info =kunit_kzalloc (test,sizeof (*info) *DAL_IRQ_SOURCES_NUMBER , -GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, info); + info =kunit_kcalloc (test,DAL_IRQ_SOURCES_NUMBER ,sizeof (*info),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, info);for (i =0 ; i <DAL_IRQ_SOURCES_NUMBER ; i++) info[i].funcs = &dm_test_irq_src_funcs;struct amdgpu_crtc *acrtc; acrtc =kunit_kzalloc (test,sizeof (*acrtc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, acrtc); +KUNIT_ASSERT_NOT_NULL (test, acrtc);INIT_LIST_HEAD (&acrtc->base.head); acrtc->base.dev = &adev->ddev; }static const struct drm_connector_funcs dm_test_connector_funcs = { - .reset = drm_atomic_helper_connector_reset, + .atomic_create_state = drm_atomic_helper_connector_create_state, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, .fill_modes = drm_helper_probe_single_connector_modes, struct hdcp_workqueue *hdcp_work; hdcp_work = kunit_kzalloc(test, sizeof(*hdcp_work), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hdcp_work); + KUNIT_ASSERT_NOT_NULL(test, hdcp_work); mutex_init(&hdcp_work->mutex); INIT_WORK(&hdcp_work->cpirq_work, dm_test_hdcp_dummy_work);struct dc_sink *sink2; sink2 =kunit_kzalloc (test,sizeof (*sink2),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink2); +KUNIT_ASSERT_NOT_NULL (test, sink2);KUNIT_EXPECT_FALSE (test,are_sinks_equal (NULL , sink2)); }struct dc_sink *sink1; sink1 =kunit_kzalloc (test,sizeof (*sink1),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink1); +KUNIT_ASSERT_NOT_NULL (test, sink1);KUNIT_EXPECT_FALSE (test,are_sinks_equal (sink1,NULL )); }struct dc_sink *sink1, *sink2; sink1 =kunit_kzalloc (test,sizeof (*sink1),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink1); +KUNIT_ASSERT_NOT_NULL (test, sink1); sink2 =kunit_kzalloc (test,sizeof (*sink2),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink2); +KUNIT_ASSERT_NOT_NULL (test, sink2); sink1->sink_signal =SIGNAL_TYPE_HDMI_TYPE_A ; sink2->sink_signal =SIGNAL_TYPE_DISPLAY_PORT ;struct dc_sink *sink1, *sink2; sink1 =kunit_kzalloc (test,sizeof (*sink1),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink1); +KUNIT_ASSERT_NOT_NULL (test, sink1); sink2 =kunit_kzalloc (test,sizeof (*sink2),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink2); +KUNIT_ASSERT_NOT_NULL (test, sink2); sink1->sink_signal =SIGNAL_TYPE_HDMI_TYPE_A ; sink2->sink_signal =SIGNAL_TYPE_HDMI_TYPE_A ;struct dc_sink *sink1, *sink2; sink1 =kunit_kzalloc (test,sizeof (*sink1),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink1); +KUNIT_ASSERT_NOT_NULL (test, sink1); sink2 =kunit_kzalloc (test,sizeof (*sink2),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink2); +KUNIT_ASSERT_NOT_NULL (test, sink2); sink1->sink_signal =SIGNAL_TYPE_HDMI_TYPE_A ; sink2->sink_signal =SIGNAL_TYPE_HDMI_TYPE_A ;struct dc_sink *sink1, *sink2; sink1 =kunit_kzalloc (test,sizeof (*sink1),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink1); +KUNIT_ASSERT_NOT_NULL (test, sink1); sink2 =kunit_kzalloc (test,sizeof (*sink2),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink2); +KUNIT_ASSERT_NOT_NULL (test, sink2); sink1->sink_signal =SIGNAL_TYPE_DISPLAY_PORT ; sink2->sink_signal =SIGNAL_TYPE_DISPLAY_PORT ;struct dc_sink *sink1, *sink2; sink1 =kunit_kzalloc (test,sizeof (*sink1),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink1); +KUNIT_ASSERT_NOT_NULL (test, sink1); sink2 =kunit_kzalloc (test,sizeof (*sink2),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink2); +KUNIT_ASSERT_NOT_NULL (test, sink2); sink1->sink_signal =SIGNAL_TYPE_HDMI_TYPE_A ; sink2->sink_signal =SIGNAL_TYPE_HDMI_TYPE_A ;struct dc_sink *sink1, *sink2; sink1 =kunit_kzalloc (test,sizeof (*sink1),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink1); +KUNIT_ASSERT_NOT_NULL (test, sink1); sink2 =kunit_kzalloc (test,sizeof (*sink2),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, sink2); +KUNIT_ASSERT_NOT_NULL (test, sink2); sink1->sink_signal =SIGNAL_TYPE_HDMI_TYPE_A ; sink2->sink_signal =SIGNAL_TYPE_HDMI_TYPE_A ;int src; adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, adev);KUNIT_EXPECT_EQ (test,amdgpu_dm_irq_init (adev),0 );struct dc_interrupt_params int_params = {0 }; adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, adev); int_params.int_context =INTERRUPT_LOW_IRQ_CONTEXT ; int_params.irq_source =DC_IRQ_SOURCE_HPD1 ;struct dc_interrupt_params int_params = {0 }; adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, adev); int_params.int_context =INTERRUPT_CONTEXT_NUMBER ; int_params.irq_source =DC_IRQ_SOURCE_HPD1 ;struct dc_interrupt_params int_params = {0 }; adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, adev); int_params.int_context =INTERRUPT_LOW_IRQ_CONTEXT ; int_params.irq_source =DC_IRQ_SOURCE_INVALID ;void *handler; adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, adev);KUNIT_ASSERT_EQ (test,amdgpu_dm_irq_init (adev),0 ); int_params.irq_source =DC_IRQ_SOURCE_HPD5 ;struct amdgpu_device *adev; adev =kunit_kzalloc (test,sizeof (*adev),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, adev); +KUNIT_ASSERT_NOT_NULL (test, adev);KUNIT_ASSERT_EQ (test,amdgpu_dm_irq_init (adev),0 );amdgpu_dm_irq_unregister_interrupt (adev,DC_IRQ_SOURCE_INVALID , struct amdgpu_device *adev; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_ASSERT_EQ(test, amdgpu_dm_irq_init(adev), 0);amdgpu_dm_irq_unregister_interrupt (adev,DC_IRQ_SOURCE_HPD1 , void *handler; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_ASSERT_EQ(test, amdgpu_dm_irq_init(adev), 0); int_params.int_context = INTERRUPT_LOW_IRQ_CONTEXT; void *handler; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_ASSERT_EQ(test, amdgpu_dm_irq_init(adev), 0); int_params.int_context = INTERRUPT_LOW_IRQ_CONTEXT; int src; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_ASSERT_EQ(test, amdgpu_dm_irq_init(adev), 0); amdgpu_dm_irq_fini(adev); drm = &adev->ddev; acrtc_a = kunit_kzalloc(test, sizeof(*acrtc_a), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc_a); + KUNIT_ASSERT_NOT_NULL(test, acrtc_a); acrtc_b = kunit_kzalloc(test, sizeof(*acrtc_b), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc_b); + KUNIT_ASSERT_NOT_NULL(test, acrtc_b); INIT_LIST_HEAD(&acrtc_a->base.head); INIT_LIST_HEAD(&acrtc_b->base.head); drm = &adev->ddev; acrtc = kunit_kzalloc(test, sizeof(*acrtc), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc); + KUNIT_ASSERT_NOT_NULL(test, acrtc); INIT_LIST_HEAD(&acrtc->base.head); acrtc->otg_inst = 2; adev = dm_kunit_alloc_adev(test); acrtc = kunit_kzalloc(test, sizeof(*acrtc), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc); + KUNIT_ASSERT_NOT_NULL(test, acrtc); adev->mode_info.crtcs[0] = acrtc; KUNIT_EXPECT_PTR_EQ(test, amdgpu_dm_get_crtc_by_otg_inst(adev, -1), acrtc); struct amdgpu_device *adev; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); adev->mode_info.num_crtc = 6; adev->mode_info.num_hpd = 4; adev = dm_kunit_alloc_adev(test); dc = kunit_kzalloc(test, sizeof(*dc), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dc); + KUNIT_ASSERT_NOT_NULL(test, dc); dc->caps.max_links = 4; adev->dm.dc = dc; ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); + KUNIT_ASSERT_NOT_NULL(test, ctx); ctx->wq = amdgpu_dm_hpd_rx_irq_create_workqueue(adev); KUNIT_ASSERT_NOT_NULL(test, ctx->wq); struct amdgpu_display_manager *dm; dm = kunit_kzalloc(test, sizeof(*dm), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dm); + KUNIT_ASSERT_NOT_NULL(test, dm);/* A NULL hpd_rx_offload_wq must be a safe no-op (DC untouched). */ amdgpu_dm_hpd_rx_irq_work_suspend(dm); adev = dm_kunit_alloc_adev(test); dc = kunit_kzalloc(test, sizeof(*dc), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dc); + KUNIT_ASSERT_NOT_NULL(test, dc); dc->caps.max_links = 2; adev->dm.dc = dc; ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); + KUNIT_ASSERT_NOT_NULL(test, ctx); ctx->wq = amdgpu_dm_hpd_rx_irq_create_workqueue(adev); KUNIT_ASSERT_NOT_NULL(test, ctx->wq); struct amdgpu_device *adev; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev);/* mode_info.crtcs[0] is NULL -> returns 0 without dereferencing DC. */ KUNIT_EXPECT_EQ (test, struct amdgpu_device *adev; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_EXPECT_EQ(test, amdgpu_dm_set_pflip_irq_state(adev, NULL, 0, AMDGPU_IRQ_STATE_DISABLE), 0); struct amdgpu_device *adev; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_EXPECT_EQ(test, amdgpu_dm_set_vline0_irq_state(adev, NULL, 0, AMDGPU_IRQ_STATE_ENABLE), 0); struct amdgpu_device *adev; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_EXPECT_EQ(test, amdgpu_dm_set_vupdate_irq_state(adev, NULL, 0, AMDGPU_IRQ_STATE_ENABLE), 0); struct amdgpu_crtc *acrtc; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); acrtc = kunit_kzalloc(test, sizeof(*acrtc), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc); + KUNIT_ASSERT_NOT_NULL(test, acrtc);/* otg_inst == -1 short-circuits before computing the irq source. */ acrtc->otg_inst = -1; struct amdgpu_crtc *acrtc; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); acrtc = kunit_kzalloc(test, sizeof(*acrtc), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc); + KUNIT_ASSERT_NOT_NULL(test, acrtc);/* * otg_inst >= 0 computes the irq source and reaches the NULL-safe struct amdgpu_crtc *acrtc; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); +KUNIT_ASSERT_NOT_NULL(test, adev); acrtc = kunit_kzalloc(test, sizeof(*acrtc), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc); +KUNIT_ASSERT_NOT_NULL(test, acrtc); /* The disable state exercises the st == false path. */ acrtc->otg_inst = 1; adev = dm_kunit_alloc_adev(test); acrtc = kunit_kzalloc(test, sizeof(*acrtc), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc); + KUNIT_ASSERT_NOT_NULL(test, acrtc); dc = dm_test_alloc_dc_with_irq_service(test, &dm_test_irq_service_funcs_dcn10);/* DC_LOG_* dereferences ctx->logger->dev, so wire a real drm device. */ logger = kunit_kzalloc(test, sizeof(*logger), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, logger); + KUNIT_ASSERT_NOT_NULL(test, logger); logger->dev = &adev->ddev; dc->ctx->logger = logger; struct amdgpu_device *adev; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_ASSERT_EQ(test, amdgpu_dm_irq_init(adev), 0); /* No registered high-context handlers: must be a safe no-op. */ void *handler; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_ASSERT_EQ(test, amdgpu_dm_irq_init(adev), 0); int_params.int_context = INTERRUPT_HIGH_IRQ_CONTEXT; struct amdgpu_device *adev; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_ASSERT_EQ(test, amdgpu_dm_irq_init(adev), 0); /* Empty handler list: schedule_work returns immediately. */ void *handler; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_ASSERT_EQ(test, amdgpu_dm_irq_init(adev), 0); int_params.int_context = INTERRUPT_LOW_IRQ_CONTEXT; void *handler; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_ASSERT_EQ(test, amdgpu_dm_irq_init(adev), 0); int_params.int_context = INTERRUPT_LOW_IRQ_CONTEXT; void *handler; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_ASSERT_EQ(test, amdgpu_dm_irq_init(adev), 0); int_params.int_context = INTERRUPT_LOW_IRQ_CONTEXT; struct amdgpu_device *adev; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev);/* amdgpu_dm_irq_set() is a no-op when dc is NULL, so both states * return 0 without dereferencing the (absent) DC. struct amdgpu_device *adev; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); +KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_EXPECT_EQ(test, amdgpu_dm_set_dmub_outbox_irq_state(adev, NULL, 0, AMDGPU_IRQ_STATE_ENABLE), 0); struct amdgpu_device *adev; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); +KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_EXPECT_EQ(test, amdgpu_dm_set_dmub_trace_irq_state(adev, NULL, 0, AMDGPU_IRQ_STATE_ENABLE), 0); struct amdgpu_device *adev; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); +KUNIT_ASSERT_NOT_NULL(test, adev); /* Single amdgpu_dm_irq_set() call must be skipped when dc is NULL. */ amdgpu_dm_outbox_init(adev); static void dm_test_hpd_init_empty_connectors(struct kunit *test) {struct amdgpu_device *adev; +struct dc_link *link; +struct dc *dc; adev =dm_kunit_alloc_adev (test);/* -* With an empty connector list the per-connector loop is skipped and -* the initial clear loop relies on amdgpu_dm_irq_set() being a no-op -* for a NULL dc, so init must complete without touching the DC. +* The initial clear loop walks adev->dm.dc->links, so a DC with a +* populated irq service is required. With an empty connector list the +* per-connector loop is skipped, so init must complete after only the +* clear loop runs. */ + dc =dm_test_alloc_dc_with_irq_service (test, &dm_test_irq_service_funcs_dcn10); + adev->dm.dc = dc; + + link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); +KUNIT_ASSERT_NOT_NULL (test, link); + link->irq_source_hpd =DC_IRQ_SOURCE_HPD1 ; + link->irq_source_hpd_rx =DC_IRQ_SOURCE_HPD1RX ; + dc->links[0 ] = link; + dc->link_count =1 ; +amdgpu_dm_hpd_init (adev); } struct drm_connector *wbconn; struct amdgpu_device *adev; struct dc_link *link; + struct dc *dc; adev = dm_kunit_alloc_adev(test); + /* The clear loop walks dc->links, so set up a DC with an irq service. */ + dc = dm_test_alloc_dc_with_irq_service(test, &dm_test_irq_service_funcs_dcn10); + adev->dm.dc = dc; +/* * num_hpd = 0 forces irq_type >= num_hpd so the loop takes the HW - * fallback (amdgpu_dm_irq_set()) instead of amdgpu_irq_get(); with a - * NULL dc that fallback is a safe no-op. +* fallback (amdgpu_dm_irq_set()) instead of amdgpu_irq_get(). */ adev->mode_info.num_hpd =0 ;/* A writeback connector must be skipped by the per-connector loop. */ wbconn =kunit_kzalloc (test,sizeof (*wbconn),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, wbconn); +KUNIT_ASSERT_NOT_NULL (test, wbconn);KUNIT_ASSERT_EQ (test,drm_connector_init (&adev->ddev, wbconn, &dm_test_connector_funcs,DRM_MODE_CONNECTOR_WRITEBACK ),0 );KUNIT_ASSERT_EQ (test,/* A DisplayPort connector with a dc_link exercises the loop body. */ aconn = kunit_kzalloc(test, sizeof(*aconn), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, aconn); +KUNIT_ASSERT_NOT_NULL (test, aconn);KUNIT_ASSERT_EQ (test,drm_connector_init (&adev->ddev, &aconn->base, &dm_test_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort),0 ); kunit_add_action_or_reset(test, dm_test_connector_cleanup, &aconn->base), 0); link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); +KUNIT_ASSERT_NOT_NULL (test, link); link->irq_source_hpd =DC_IRQ_SOURCE_HPD1 ; link->irq_source_hpd_rx =DC_IRQ_SOURCE_HPD1RX ; aconn->dc_link = link; + dc->links[0 ] = link; + dc->link_count =1 ; -/* DC is absent (NULL), so the HW writes are NULL-safe no-ops. */ +/* The irq service stubs accept the HW writes without register access. */ amdgpu_dm_hpd_init (adev);amdgpu_dm_hpd_fini (adev); }struct amdgpu_dm_connector *aconn;struct amdgpu_device *adev;struct dc_link *link; +struct dc *dc; adev =dm_kunit_alloc_adev (test); adev->mode_info.num_hpd =0 ; +/* The clear loop walks dc->links, so set up a DC with an irq service. */ + dc =dm_test_alloc_dc_with_irq_service (test, &dm_test_irq_service_funcs_dcn10); + adev->dm.dc = dc; + aconn =kunit_kzalloc (test,sizeof (*aconn),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, aconn); +KUNIT_ASSERT_NOT_NULL (test, aconn);KUNIT_ASSERT_EQ (test,drm_connector_init (&adev->ddev, &aconn->base, &dm_test_connector_funcs,DRM_MODE_CONNECTOR_VGA ),0 ); kunit_add_action_or_reset(test, dm_test_connector_cleanup, &aconn->base), 0); link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); +KUNIT_ASSERT_NOT_NULL (test, link); link->irq_source_hpd =DC_IRQ_SOURCE_HPD1 ; link->irq_source_hpd_rx =DC_IRQ_SOURCE_HPD1RX ;/* An analog connector id makes the loop request polling. */ link->link_id.id =CONNECTOR_ID_VGA ; aconn->dc_link = link; + dc->links[0 ] = link; + dc->link_count =1 ;/* use_polling becomes true, so init must enable KMS polling. */ amdgpu_dm_hpd_init (adev);struct amdgpu_dm_connector *aconn;struct amdgpu_device *adev;struct dc_link *link; +struct dc *dc; adev =dm_kunit_alloc_adev (test); +/* The clear loop walks dc->links, so set up a DC with an irq service. */ + dc =dm_test_alloc_dc_with_irq_service (test, &dm_test_irq_service_funcs_dcn10); + adev->dm.dc = dc; +/* * num_hpd >= 1 makes irq_type (0) < num_hpd, so the loop takes the * amdgpu_irq_get()/amdgpu_irq_put() branch instead of the adev->mode_info.num_hpd = 1; aconn = kunit_kzalloc(test, sizeof(*aconn), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, aconn); +KUNIT_ASSERT_NOT_NULL(test, aconn); KUNIT_ASSERT_EQ(test, drm_connector_init(&adev->ddev, &aconn->base, &dm_test_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort), 0); kunit_add_action_or_reset(test, dm_test_connector_cleanup, &aconn->base), 0); link = kunit_kzalloc(test, sizeof(*link), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, link); +KUNIT_ASSERT_NOT_NULL(test, link); link->irq_source_hpd = DC_IRQ_SOURCE_HPD1; link->irq_source_hpd_rx = DC_IRQ_SOURCE_INVALID; aconn->dc_link = link; +dc->links[0] = link; +dc->link_count = 1; amdgpu_dm_hpd_init(adev); amdgpu_dm_hpd_fini(adev); adev = dm_kunit_alloc_adev(test); adev->mode_info.num_hpd = 0; + /* The clear loop walks dc->links, so set up a DC with an irq service. */ + adev->dm.dc =dm_test_alloc_dc_with_irq_service (test, &dm_test_irq_service_funcs_dcn10); + aconn =kunit_kzalloc (test,sizeof (*aconn),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, aconn); +KUNIT_ASSERT_NOT_NULL (test, aconn);KUNIT_ASSERT_EQ (test,drm_connector_init (&adev->ddev, &aconn->base, &dm_test_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort),0 ); adev =dm_kunit_alloc_adev (test); offload_wq =kunit_kzalloc (test,sizeof (*offload_wq),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_wq); +KUNIT_ASSERT_NOT_NULL (test, offload_wq); offload_work =kzalloc_obj (*offload_work); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work); +KUNIT_ASSERT_NOT_NULL (test, offload_work); offload_work->offload_wq = offload_wq; offload_work->adev = adev;INIT_WORK (&offload_work->work, dm_handle_hpd_rx_offload_work);mutex_init (&adev->dm.dc_lock); adev->reset_domain =kunit_kzalloc (test,sizeof (*adev->reset_domain),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev->reset_domain); +KUNIT_ASSERT_NOT_NULL (test, adev->reset_domain); offload_wq =kunit_kzalloc (test,sizeof (*offload_wq),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_wq); +KUNIT_ASSERT_NOT_NULL (test, offload_wq);spin_lock_init (&offload_wq->offload_lock); aconn =dm_kunit_alloc_connector (test, adev,NULL ); offload_wq->aconnector = aconn; dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); +KUNIT_ASSERT_NOT_NULL (test, ctx); link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, link_srv); +KUNIT_ASSERT_NOT_NULL (test, link_srv); link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, link); +KUNIT_ASSERT_NOT_NULL (test, link); link_srv->detect_connection_type = dm_test_detect_connection_single; dc->link_srv = link_srv; link->connector_signal =SIGNAL_TYPE_DISPLAY_PORT ; aconn->dc_link = link; - offload_work =kzalloc_obj (*offload_work,GFP_KERNEL ); + offload_work =kzalloc_obj (*offload_work); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work); +KUNIT_ASSERT_NOT_NULL (test, offload_work); offload_work->offload_wq = offload_wq; offload_work->adev = adev;INIT_WORK (&offload_work->work, dm_handle_hpd_rx_offload_work); */static void dm_test_hpd_rx_offload_work_msg_rdy (struct kunit *test) { +struct hpd_rx_irq_offload_work_queue *offload_wq;struct hpd_rx_irq_offload_work *offload_work;struct amdgpu_dm_connector *aconn;struct link_service *link_srv; offload_work->offload_wq->is_handling_mst_msg_rdy_event = true; offload_work->data.bytes.device_service_irq.bits.UP_REQ_MSG_RDY =1 ; +/* NB: offload_work is freed by dm_handle_hpd_rx_offload_work so need to +* save a pointer to the wq to do the final KUNIT_EXPECT. This is safe +* because the wq is actually a kunit_alloc and is not freed along with +* the offload_work object. +*/ + offload_wq = offload_work->offload_wq;dm_handle_hpd_rx_offload_work (&offload_work->work); -KUNIT_EXPECT_FALSE (test, offload_work->offload_wq->is_handling_mst_msg_rdy_event); +KUNIT_EXPECT_FALSE (test, offload_wq->is_handling_mst_msg_rdy_event); }/** amdgpu_dm_hdmi_hpd_debounce_work); dc = kunit_kzalloc(test, sizeof(*dc), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dc); +KUNIT_ASSERT_NOT_NULL(test, dc); ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); +KUNIT_ASSERT_NOT_NULL(test, ctx); link_srv = kunit_kzalloc(test, sizeof(*link_srv), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, link_srv); +KUNIT_ASSERT_NOT_NULL(test, link_srv); link = kunit_kzalloc(test, sizeof(*link), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, link); +KUNIT_ASSERT_NOT_NULL(test, link); link_srv->detect_link = dm_test_detect_link_false; dc->ctx = ctx; dc = aconn->dc_link->ctx->dc; logger = kunit_kzalloc(test, sizeof(*logger), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, logger); +KUNIT_ASSERT_NOT_NULL(test, logger); dmub_srv = kunit_kzalloc(test, sizeof(*dmub_srv), GFP_KERNEL); -KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dmub_srv); +KUNIT_ASSERT_NOT_NULL(test, dmub_srv); /* DC_LOG_* dereferences ctx->logger->dev, so wire a real drm device. */ logger->dev = aconn->base.dev; aconn =dm_kunit_alloc_connector (test, adev,NULL ); state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state); +KUNIT_ASSERT_NOT_NULL (test, state); aconn->base.state = &state->base; dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); +KUNIT_ASSERT_NOT_NULL (test, ctx); link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); +KUNIT_ASSERT_NOT_NULL (test, link); dc->ctx = ctx; ctx->dc = dc; amdgpu_dm_hdmi_hpd_debounce_work); state =kunit_kzalloc (test,sizeof (*state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state); +KUNIT_ASSERT_NOT_NULL (test, state); aconn->base.state = &state->base; dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); +KUNIT_ASSERT_NOT_NULL (test, ctx); link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link_srv); +KUNIT_ASSERT_NOT_NULL (test, link_srv); link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); +KUNIT_ASSERT_NOT_NULL (test, link); link_srv->detect_connection_type = dm_test_detect_connection_none; dc->ctx = ctx; adev->dm.disable_hpd_irq = true; offload_wq =kunit_kzalloc (test,sizeof (*offload_wq),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_wq); +KUNIT_ASSERT_NOT_NULL (test, offload_wq); adev->dm.hpd_rx_offload_wq = offload_wq; aconn =dm_kunit_alloc_connector (test, adev,NULL ); dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); +KUNIT_ASSERT_NOT_NULL (test, ctx); link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link_srv); +KUNIT_ASSERT_NOT_NULL (test, link_srv); link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); +KUNIT_ASSERT_NOT_NULL (test, link); link_srv->dp_handle_hpd_rx_irq = dm_test_handle_hpd_rx_no_work; dc->ctx = ctx; adev =dm_kunit_alloc_adev (test); offload_wq =kunit_kzalloc (test,sizeof (*offload_wq),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_wq); +KUNIT_ASSERT_NOT_NULL (test, offload_wq); offload_wq->wq =create_singlethread_workqueue ("dm_irq_test_hpd_rx" );KUNIT_ASSERT_NOT_NULL (test, offload_wq->wq);mutex_init (&adev->dm.dc_lock); offload_wq =kunit_kzalloc (test,sizeof (*offload_wq),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_wq); +KUNIT_ASSERT_NOT_NULL (test, offload_wq);spin_lock_init (&offload_wq->offload_lock); offload_wq->wq =create_singlethread_workqueue ("dm_irq_test_hpd_rx" );KUNIT_ASSERT_NOT_NULL (test, offload_wq->wq); aconn->mst_mgr.mst_state = true; dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); +KUNIT_ASSERT_NOT_NULL (test, ctx); link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link_srv); +KUNIT_ASSERT_NOT_NULL (test, link_srv); link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); +KUNIT_ASSERT_NOT_NULL (test, link); dc->ctx = ctx; dc->link_srv = link_srv; adev =dm_kunit_alloc_adev (test); dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); adev->dm.dc = dc; notify.link_index =1 ; adev =dm_kunit_alloc_adev (test); dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); adev->dm.dc = dc; adev->dm.ddev = &adev->ddev; dc->link_count =1 ; adev =dm_kunit_alloc_adev (test); dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); adev->dm.dc = dc; adev->in_suspend = true; dc->link_count =1 ; adev =dm_kunit_alloc_adev (test); dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); adev->dm.dc = dc; adev->dm.ddev = &adev->ddev; dc->link_count =1 ; link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); +KUNIT_ASSERT_NOT_NULL (test, link); dc->links[0 ] = link;/* A writeback connector must be skipped by the loop. */ wbconn =kunit_kzalloc (test,sizeof (*wbconn),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, wbconn); +KUNIT_ASSERT_NOT_NULL (test, wbconn);KUNIT_ASSERT_EQ (test,drm_connector_init (&adev->ddev, wbconn, &dm_test_connector_funcs,DRM_MODE_CONNECTOR_WRITEBACK ),0 );KUNIT_ASSERT_EQ (test,kunit_add_action_or_reset (test, dm_test_connector_cleanup, wbconn),0 );/* A DisplayPort connector whose dc_link matches drives the match branch. */ aconn =kunit_kzalloc (test,sizeof (*aconn),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, aconn); +KUNIT_ASSERT_NOT_NULL (test, aconn);KUNIT_ASSERT_EQ (test,drm_connector_init (&adev->ddev, &aconn->base, &dm_test_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort),0 );mutex_init (&adev->dm.dc_lock); dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); +KUNIT_ASSERT_NOT_NULL (test, ctx); link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link_srv); +KUNIT_ASSERT_NOT_NULL (test, link_srv); link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); +KUNIT_ASSERT_NOT_NULL (test, link); link_srv->detect_connection_type = dm_test_detect_connection_none; link_srv->detect_link = dm_test_detect_link_false; dc->links[0 ] = link; aconn =kunit_kzalloc (test,sizeof (*aconn),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, aconn); +KUNIT_ASSERT_NOT_NULL (test, aconn);KUNIT_ASSERT_EQ (test,drm_connector_init (&adev->ddev, &aconn->base, &dm_test_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort),0 );mutex_init (&adev->dm.dc_lock); offload_wq =kunit_kzalloc (test,sizeof (*offload_wq),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, offload_wq); +KUNIT_ASSERT_NOT_NULL (test, offload_wq);spin_lock_init (&offload_wq->offload_lock); adev->dm.hpd_rx_offload_wq = offload_wq; dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); ctx =kunit_kzalloc (test,sizeof (*ctx),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, ctx); +KUNIT_ASSERT_NOT_NULL (test, ctx); link_srv =kunit_kzalloc (test,sizeof (*link_srv),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link_srv); +KUNIT_ASSERT_NOT_NULL (test, link_srv); link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); +KUNIT_ASSERT_NOT_NULL (test, link); link_srv->dp_handle_hpd_rx_irq = dm_test_handle_hpd_rx_no_work; dc->ctx = ctx; dc->links[0 ] = link; aconn =kunit_kzalloc (test,sizeof (*aconn),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, aconn); +KUNIT_ASSERT_NOT_NULL (test, aconn);KUNIT_ASSERT_EQ (test,drm_connector_init (&adev->ddev, &aconn->base, &dm_test_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort),0 ); adev =dm_kunit_alloc_adev (test); dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); adev->dm.dc = dc;KUNIT_EXPECT_EQ (test,amdgpu_dm_register_hpd_handlers (adev),0 ); adev =dm_kunit_alloc_adev (test);KUNIT_ASSERT_EQ (test,amdgpu_dm_irq_init (adev),0 ); dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); adev->dm.dc = dc; wbconn =kunit_kzalloc (test,sizeof (*wbconn),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, wbconn); +KUNIT_ASSERT_NOT_NULL (test, wbconn);KUNIT_ASSERT_EQ (test,drm_connector_init (&adev->ddev, wbconn, &dm_test_connector_funcs,DRM_MODE_CONNECTOR_WRITEBACK ),0 );KUNIT_ASSERT_EQ (test,kunit_add_action_or_reset (test, dm_test_connector_cleanup, wbconn),0 ); aconn =kunit_kzalloc (test,sizeof (*aconn),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, aconn); +KUNIT_ASSERT_NOT_NULL (test, aconn);KUNIT_ASSERT_EQ (test,drm_connector_init (&adev->ddev, &aconn->base, &dm_test_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort),0 ); kunit_add_action_or_reset(test, dm_test_connector_cleanup, &aconn->base), 0); link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); +KUNIT_ASSERT_NOT_NULL (test, link); link->irq_source_hpd =DC_IRQ_SOURCE_HPD1 ; link->irq_source_hpd_rx =DC_IRQ_SOURCE_HPD1RX ; aconn->dc_link = link; adev =dm_kunit_alloc_adev (test);KUNIT_ASSERT_EQ (test,amdgpu_dm_irq_init (adev),0 ); dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); adev->dm.dc = dc; aconn =kunit_kzalloc (test,sizeof (*aconn),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, aconn); +KUNIT_ASSERT_NOT_NULL (test, aconn);KUNIT_ASSERT_EQ (test,drm_connector_init (&adev->ddev, &aconn->base, &dm_test_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort),0 ); kunit_add_action_or_reset(test, dm_test_connector_cleanup, &aconn->base), 0); link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); +KUNIT_ASSERT_NOT_NULL (test, link); link->irq_source_hpd =DC_IRQ_SOURCE_HPD1RX ; link->irq_source_hpd_rx =DC_IRQ_SOURCE_INVALID ; aconn->dc_link = link; adev =dm_kunit_alloc_adev (test);KUNIT_ASSERT_EQ (test,amdgpu_dm_irq_init (adev),0 ); dc =kunit_kzalloc (test,sizeof (*dc),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc); +KUNIT_ASSERT_NOT_NULL (test, dc); adev->dm.dc = dc; aconn =kunit_kzalloc (test,sizeof (*aconn),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, aconn); +KUNIT_ASSERT_NOT_NULL (test, aconn);KUNIT_ASSERT_EQ (test,drm_connector_init (&adev->ddev, &aconn->base, &dm_test_connector_funcs, DRM_MODE_CONNECTOR_DisplayPort),0 ); kunit_add_action_or_reset(test, dm_test_connector_cleanup, &aconn->base), 0); link =kunit_kzalloc (test,sizeof (*link),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, link); +KUNIT_ASSERT_NOT_NULL (test, link); link->irq_source_hpd =DC_IRQ_SOURCE_INVALID ; link->irq_source_hpd_rx =DC_IRQ_SOURCE_HPD1 ; aconn->dc_link = link; acrtc->pflip_status =AMDGPU_FLIP_SUBMITTED ;/* drm_crtc_send_vblank_event() consumes (kfree()s) the event. */ - event =kzalloc_obj (*event,GFP_KERNEL ); + event =kzalloc_obj (*event); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, event); +KUNIT_ASSERT_NOT_NULL (test, event); acrtc->event = event;/* Balance the handler's drm_crtc_vblank_put(). */ dc =dm_kunit_alloc_dc_with_ctx (test); dc->current_state =kunit_kzalloc (test,sizeof (*dc->current_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc->current_state); +KUNIT_ASSERT_NOT_NULL (test, dc->current_state); adev->dm.dc = dc; link =dm_kunit_alloc_link (test); adev =drm_to_adev (acrtc->base.dev);/* drm_crtc_send_vblank_event() consumes (kfree()s) the event. */ - event =kzalloc_obj (*event,GFP_KERNEL ); + event =kzalloc_obj (*event); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, event); +KUNIT_ASSERT_NOT_NULL (test, event); acrtc->event = event;/* Balance the handler's drm_crtc_vblank_put(). */ struct amdgpu_crtc *acrtc; tg =kunit_kzalloc (test,sizeof (*tg),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, tg); +KUNIT_ASSERT_NOT_NULL (test, tg); tg->funcs = &dm_test_tg_funcs; acrtc =dm_test_setup_vrr_pflip_crtc (test, tg); adev =drm_to_adev (acrtc->base.dev); - event =kzalloc_obj (*event,GFP_KERNEL ); + event =kzalloc_obj (*event); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, event); +KUNIT_ASSERT_NOT_NULL (test, event); acrtc->event = event; params.adev = adev; acrtc =dm_test_add_crtc (test, adev); acrtc->pflip_status =AMDGPU_FLIP_SUBMITTED ; - event =kzalloc_obj (*event,GFP_KERNEL ); + event =kzalloc_obj (*event); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, event); +KUNIT_ASSERT_NOT_NULL (test, event); acrtc->event = event; adev->ddev.vblank[0 ].time =ktime_get (); dc =dm_kunit_alloc_dc_with_ctx (test); dc->current_state =kunit_kzalloc (test,sizeof (*dc->current_state),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, dc->current_state); +KUNIT_ASSERT_NOT_NULL (test, dc->current_state); adev->dm.dc = dc; link =dm_kunit_alloc_link (test); acrtc =dm_test_add_crtc (test, adev); wb_conn =kunit_kzalloc (test,sizeof (*wb_conn),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, wb_conn); +KUNIT_ASSERT_NOT_NULL (test, wb_conn); acrtc->wb_conn = wb_conn; acrtc->wb_pending = true; acrtc =dm_test_add_crtc (test, adev); wb_conn =kunit_kzalloc (test,sizeof (*wb_conn),GFP_KERNEL ); -KUNIT_ASSERT_NOT_ERR_OR_NULL (test, wb_conn); +KUNIT_ASSERT_NOT_NULL (test, wb_conn);spin_lock_init (&wb_conn->job_lock);INIT_LIST_HEAD (&wb_conn->job_queue); * The job carries no framebuffer or fence, so the deferred DRM cleanup * work only kfree()s it; it needs nothing from this test. */ - job = kzalloc_obj(*job, GFP_KERNEL); + job = kzalloc_obj(*job); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, job); + KUNIT_ASSERT_NOT_NULL(test, job); list_add_tail(&job->list_entry, &wb_conn->job_queue); acrtc->wb_conn = wb_conn; adev = dm_kunit_alloc_adev(test); hpd_work = kzalloc_obj(*hpd_work); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hpd_work); + KUNIT_ASSERT_NOT_NULL(test, hpd_work); hpd_work->dmub_notify = kzalloc_obj(*hpd_work->dmub_notify); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hpd_work->dmub_notify); + KUNIT_ASSERT_NOT_NULL(test, hpd_work->dmub_notify); hpd_work->dmub_notify->type = (enum dmub_notification_type)ARRAY_SIZE(adev->dm.dmub_callback); hpd_work->adev = adev; struct amdgpu_device *adev; adev = dm_kunit_alloc_adev(test); - hpd_work = kzalloc_obj(*hpd_work, GFP_KERNEL); + hpd_work = kzalloc_obj(*hpd_work); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hpd_work); + KUNIT_ASSERT_NOT_NULL(test, hpd_work); hpd_work->adev = adev; INIT_WORK(&hpd_work->handle_hpd_work, dm_handle_hpd_work); adev = dm_kunit_alloc_adev(test); dc = dm_kunit_alloc_dc_with_ctx(test); dc_dmub_srv = kunit_kzalloc(test, sizeof(*dc_dmub_srv), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dc_dmub_srv); + KUNIT_ASSERT_NOT_NULL(test, dc_dmub_srv); dmub = kunit_kzalloc(test, sizeof(*dmub), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dmub); + KUNIT_ASSERT_NOT_NULL(test, dmub); dmub->hw_funcs.get_outbox0_wptr = dm_test_dmub_get_outbox0_wptr; dc_dmub_srv->dmub = dmub; adev = dm_kunit_alloc_adev(test); dc = dm_kunit_alloc_dc_with_ctx(test); dc_dmub_srv = kunit_kzalloc(test, sizeof(*dc_dmub_srv), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dc_dmub_srv); + KUNIT_ASSERT_NOT_NULL(test, dc_dmub_srv); dmub = kunit_kzalloc(test, sizeof(*dmub), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dmub); + KUNIT_ASSERT_NOT_NULL(test, dmub); rb = kunit_kzalloc(test, DM_TEST_OUTBOX0_RB_SIZE, GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, rb); + KUNIT_ASSERT_NOT_NULL(test, rb); dmub->outbox0_rb.base_address = rb; dmub->outbox0_rb.capacity = DM_TEST_OUTBOX0_RB_SIZE; adev = dm_kunit_alloc_adev(test); dc = dm_kunit_alloc_dc_with_ctx(test); dc_dmub_srv = kunit_kzalloc(test, sizeof(*dc_dmub_srv), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dc_dmub_srv); + KUNIT_ASSERT_NOT_NULL(test, dc_dmub_srv); dmub = kunit_kzalloc(test, sizeof(*dmub), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dmub); + KUNIT_ASSERT_NOT_NULL(test, dmub); dmub->hw_init = true; dmub->hw_funcs.get_outbox0_wptr = dm_test_dmub_get_outbox0_wptr; adev), 0); dc = dm_test_alloc_dc_with_irq_service(test, &dm_test_irq_service_funcs_dcn10); dc_dmub_srv = kunit_kzalloc(test, sizeof(*dc_dmub_srv), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dc_dmub_srv); + KUNIT_ASSERT_NOT_NULL(test, dc_dmub_srv); dc->ctx->dmub_srv = dc_dmub_srv; adev->dm.dc = dc; amdgpu_dm_set_irq_funcs(adev); struct dc *dc; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_ASSERT_EQ(test, amdgpu_dm_irq_init(adev), 0); dc = dm_test_alloc_dc_with_irq_service(test, int low_count = 0; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); KUNIT_ASSERT_EQ(test, amdgpu_dm_irq_init(adev), 0); /* This stub maps every src_id to DC_IRQ_SOURCE_INVALID. */ struct dc *dc; adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); + KUNIT_ASSERT_NOT_NULL(test, adev); mutex_init(&adev->dm.dc_lock); dc = dm_kunit_alloc_dc_with_ctx(test); dc->current_state = kunit_kzalloc(test, sizeof(*dc->current_state), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dc->current_state); + KUNIT_ASSERT_NOT_NULL(test, dc->current_state); adev->dm.dc = dc; stream = kunit_kzalloc(test, sizeof(*stream), GFP_KERNEL); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, stream); + KUNIT_ASSERT_NOT_NULL(test, stream); /* * Start at two references: the worker's dc_stream_release() drops one, * leaving the kunit-managed allocation intact (no kfree). /* The worker kfree()s both, so they must come from the slab. */ work = kzalloc_obj(*work); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, work); + KUNIT_ASSERT_NOT_NULL(test, work); adjust = kzalloc_obj(*adjust); - KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adjust); + KUNIT_ASSERT_NOT_NULL(test, adjust); work->adev = adev; work->stream = stream;
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -0
@@@ -434,6 -434,8 +434,6 @@@ struct smu_table_contextvoid *user_overdrive_table;uint32_t user_od_feature_mask; -/* Set when an OD commit/restore changed the UCLK levels */ - bool od_uclk_changed;struct smu_driver_table driver_tables[SMU_DRIVER_TABLE_COUNT ]; }; enum pp_power_type pp_power_type);bool smu_mode1_reset_is_support (struct smu_context *smu); +bool smu_od_uclk_changed (struct smu_context *smu);bool smu_link_reset_is_support (struct smu_context *smu);int smu_mode1_reset (struct smu_context *smu);int smu_link_reset (struct smu_context *smu);
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0 -0
@@@ -1288,6 -1288,28 +1288,28 @@@ static int smu_v13_0_0_upload_overdrivereturn ret; } +/* +* PMFW rebuilds the UCLK DPM levels from UclkFmin/UclkFmax. Re-read them, so +* that pp_dpm_mclk and the soft limits match, and flag the change for DC. +*/ +static void smu_v13_0_0_od_refresh_uclk_table (struct smu_context *smu) + { +struct smu_13_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context; +int ret; + +if (!smu_cmn_feature_is_enabled (smu,SMU_FEATURE_DPM_UCLK_BIT )) +return ; + + ret =smu_v13_0_set_single_dpm_table (smu,SMU_UCLK , + &dpm_context->dpm_tables.uclk_table); +if (ret) { +dev_err (smu->adev->dev,"Failed to refresh UCLK dpm table!\n" ); +return ; + } + + smu->smu_table.od_uclk_changed = true; + } +static int smu_v13_0_0_emit_clk_levels (struct smu_context *smu,enum smu_clk_type clk_type,char *buf,int *offset) OverDriveTable_t *od = &od_table->OverDriveTable;OverDriveTable_t *boot = &boot_od_table->OverDriveTable;struct amdgpu_device *adev = smu->adev; +u32 prev_od_feature_mask = table_context->user_od_feature_mask;uint32_t offset_of_voltageoffset;int32_t minimum, maximum;u32 next_mask; table_context->user_od_feature_mask = next_mask; od_table->OverDriveTable.FeatureCtrlMask =0 ; + +/* UCLK was customized before (restore) or is now (commit) */ +if ((prev_od_feature_mask | next_mask) &BIT (PP_OD_FEATURE_UCLK_BIT )) +smu_v13_0_0_od_refresh_uclk_table (smu); +memcpy ((u8 *)user_od_table + offset_of_voltageoffset, (u8 *)od_table + offset_of_voltageoffset,sizeof (OverDriveTableExternal_t) - offset_of_voltageoffset); gpu_metrics->average_socket_power = metrics->AverageSocketPower;if ((mp1_ver ==IP_VERSION (13 ,0 ,0 ) && - (smu->smc_fw_version <=0x004e1e00 || smu->smc_fw_version >=0x004e8600 )) || + (smu->smc_fw_version <=0x004e1e00 || + smu->smc_fw_version >=0x004e8600 )) || (mp1_ver ==IP_VERSION (13 ,0 ,10 ) && - smu->smc_fw_version <=0x00500800 )) + (smu->smc_fw_version <=0x00500800 || + smu->smc_fw_version >=0x00505d00 ))) gpu_metrics->energy_accumulator = metrics->EnergyAccumulator;if (metrics->AverageGfxActivity <=SMU_13_0_0_BUSY_THRESHOLD ) !!(next_mask & ~BIT (PP_OD_FEATURE_PPT_BIT ));memcpy (od_table, user_od_table,sizeof (OverDriveTableExternal_t)); od_table->OverDriveTable.FeatureCtrlMask =0 ; +if (next_mask &BIT (PP_OD_FEATURE_UCLK_BIT )) +smu_v13_0_0_od_refresh_uclk_table (smu); }return res;
drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.h +0 -0
@@@ -35,6 -35,10 +35,10 @@@ #define SMU_15_0_8_CAP_NPM 1 #define SMU_15_0_8_CAP_NODE_UNLOAD 2 #define SMU_15_0_8_NODE_UNLOAD_MIN_FW_VERSION 0x027d0c00u /* 2.125.12.0 */ + #define SMU_15_0_8_GPU_METRICS_REVISION 1 + #define SMU_15_0_8_GPUBOARD_TEMP_METRICS_REVISION 1 + #define SMU_15_0_8_BASEBOARD_TEMP_METRICS_REVISION 1 + #define SMU_15_0_8_PARTITION_METRICS_REVISION 1 extern void smu_v15_0_8_set_ppt_funcs(struct smu_context *smu); typedef struct { SMU_ARRAY(SMU_MATTR(XGMI_LINK_STATUS), SMU_MUNIT(NONE), \ SMU_MTYPE(U16), xgmi_link_status, \ SMU_15_0_8_NUM_XGMI_LINKS); \ - SMU_SCALAR(SMU_MATTR(XGMI_READ_DATA_ACC), SMU_MUNIT(DATA_1), \ - SMU_MTYPE(U64), xgmi_read_data_acc); \ - SMU_SCALAR(SMU_MATTR(XGMI_WRITE_DATA_ACC), SMU_MUNIT(DATA_1), \ - SMU_MTYPE(U64), xgmi_write_data_acc); \ + SMU_SCALAR(SMU_MATTR(XGMI_READ_BANDWIDTH_ACC), SMU_MUNIT(BW_1), \ + SMU_MTYPE(U64), xgmi_read_bandwidth_acc); \ + SMU_SCALAR(SMU_MATTR(XGMI_WRITE_BANDWIDTH_ACC), SMU_MUNIT(BW_1), \ + SMU_MTYPE(U64), xgmi_write_bandwidth_acc); \ SMU_SCALAR(SMU_MATTR(FIRMWARE_TIMESTAMP), SMU_MUNIT(TIME_2), \ SMU_MTYPE(U64), firmware_timestamp); \ SMU_ARRAY(SMU_MATTR(CURRENT_GFXCLK), SMU_MUNIT(CLOCK_1), \ SMU_15_0_8_MAX_XCC); \ SMU_ARRAY(SMU_MATTR(GFX_BELOW_HOST_LIMIT_TOTAL_ACC), SMU_MUNIT(NONE), \ SMU_MTYPE(U64), gfx_below_host_limit_total_acc, \ - SMU_15_0_8_MAX_XCC); + SMU_15_0_8_MAX_XCC); \ + SMU_SCALAR(SMU_MATTR(REVISION), SMU_MUNIT(NONE), \ + SMU_MTYPE(U16), revision); DECLARE_SMU_METRICS_CLASS(smu_v15_0_8_gpu_metrics, SMU_15_0_8_METRICS_FIELDS); SMU_SCALAR(SMU_MATTR(VR_TEMP_VDDIO_065_UCIEAM_C), SMU_MUNIT(TEMP_1), \ SMU_MTYPE(S16), vr_temp_vddio_065_ucieam_c); \ SMU_SCALAR(SMU_MATTR(VR_TEMP_VDDAN_075), SMU_MUNIT(TEMP_1), \ - SMU_MTYPE(S16), vr_temp_vddan_075); + SMU_MTYPE(S16), vr_temp_vddan_075); \ + SMU_SCALAR(SMU_MATTR(REVISION), SMU_MUNIT(NONE), \ + SMU_MTYPE(U16), revision); DECLARE_SMU_METRICS_CLASS(smu_v15_0_8_gpuboard_temp_metrics, SMU_15_0_8_GPUBOARD_TEMP_METRICS_FIELDS); SMU_SCALAR(SMU_MATTR(SYSTEM_TEMP_IBC_HSC), SMU_MUNIT(TEMP_1), \ SMU_MTYPE(S16), system_temp_ibc_hsc); \ SMU_SCALAR(SMU_MATTR(SYSTEM_TEMP_IBC), SMU_MUNIT(TEMP_1), \ - SMU_MTYPE(S16), system_temp_ibc); + SMU_MTYPE(S16), system_temp_ibc); \ + SMU_SCALAR(SMU_MATTR(REVISION), SMU_MUNIT(NONE), \ + SMU_MTYPE(U16), revision); DECLARE_SMU_METRICS_CLASS(smu_v15_0_8_baseboard_temp_metrics, SMU_15_0_8_BASEBOARD_TEMP_METRICS_FIELDS); SMU_SCALAR(SMU_MATTR(ACCUMULATION_COUNTER), SMU_MUNIT(NONE), \ SMU_MTYPE(U64), accumulation_counter); \ SMU_SCALAR(SMU_MATTR(FIRMWARE_TIMESTAMP), SMU_MUNIT(TIME_2), \ - SMU_MTYPE(U64), firmware_timestamp); + SMU_MTYPE(U64), firmware_timestamp); \ + SMU_SCALAR(SMU_MATTR(REVISION), SMU_MUNIT(NONE), \ + SMU_MTYPE(U16), revision); DECLARE_SMU_METRICS_CLASS(smu_v15_0_8_partition_metrics, SMU_15_0_8_PARTITION_METRICS_FIELDS);
PATCH 1/1 drm/amd/pm: bring back od_uclk_changed dropped by the amdgpu merge
The amdgpu tree adds od_uclk_changed to struct smu_table_context in commit 62d932f72037 ("drm/amd/pm: smu13.0.0: refresh the UCLK DPM table after an OD_MCLK change"). It sits right next to user_od_feature_mask, which mainline added too, so amdgpu_smu.h conflicts, and the merge dropped the new field.
After that, commit c62c2736d82f ("amdgpu: Merge merge merge cherry-pick cherry-pick cherry-pick") made smu_od_uclk_changed() return false and removed the code that sets the flag. So DC never re-reads the UCLK levels after an overdrive change, which is the whole point of commit b7483797b085 ("drm/amd: let DC re-read UCLK DPM levels after an OD_MCLK change").
Keep both fields and put the removed code back.
---
Mark, this is against next-20261110. Please fold it into the amdgpu merge; it replaces the smu_od_uclk_changed() part of c62c2736d82f.
With this the three files are the same as in the amdgpu tree.
Found by comparing with our llminus-assisted integration tree. Build tested only.
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 9 ++++++++- drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 2 ++ drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +8 -1
@@ -601,6 +601,9 @@ static void smu_restore_dpm_user_profile(struct smu_context *smu) ret = smu->ppt_funcs->restore_user_od_settings (smu);if (ret)dev_err (smu->adev->dev,"Failed to upload customized OD settings\n" ); +else if (smu_od_uclk_changed (smu)) +/* DC read the stock UCLK levels in its init_hw */ +amdgpu_dm_update_memclk_states (smu->adev); } }
@@ -3701,7 +3704,11 @@ static int smu_baco_set_state(void *handle, int state)*/ bool smu_od_uclk_changed (struct smu_context *smu) { -return false; +bool changed = smu->smu_table.od_uclk_changed; + + smu->smu_table.od_uclk_changed = false; + +return changed; }bool smu_mode1_reset_is_support (struct smu_context *smu)
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +2 -0
@@ -434,6 +434,8 @@ struct smu_table_context {void *user_overdrive_table;uint32_t user_od_feature_mask; +/* Set when an OD commit/restore changed the UCLK levels */ +bool od_uclk_changed;struct smu_driver_table driver_tables[SMU_DRIVER_TABLE_COUNT ]; };
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +2 -0
@@ -1306,6 +1306,8 @@ static void smu_v13_0_0_od_refresh_uclk_table(struct smu_context *smu)dev_err (smu->adev->dev,"Failed to refresh UCLK dpm table!\n" );return ; } + + smu->smu_table.od_uclk_changed = true; } static int smu_v13_0_0_emit_clk_levels(struct smu_context *smu,
base-commit: 793807ca13bf3072fc6d16ce6d90e9ab9beff2a5
Signature · 1 line
2.53.0
PATCH 1/1 drm/amd/display: give the dprx CRC test its connector state back
In reply to Mark BrownThe merge fixup in commit c62c2736d82f ("amdgpu: Merge merge merge cherry-pick cherry-pick cherry-pick") dropped the call to drm_atomic_helper_connector_reset(), which drm-misc removed. But that call is what gave the test's connector a state, so the assert right after it always fails now.
Create the state with drm_atomic_helper_connector_create_state() instead, and check it before storing it: cleanup would choke on an error pointer in connector->state.
---
The amdgpu_dm_crc KUnit suite goes from 34/35 to 35/35 with this.
.../gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crc_test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crc_test.c +4 -1
@@ -694,6 +694,7 @@ static void dm_test_crtc_set_crc_source_dprx_connector(struct kunit *test)struct amdgpu_device *adev =dm_kunit_alloc_adev (test);struct amdgpu_crtc *acrtc =dm_test_alloc_crc_crtc (test, adev);struct amdgpu_dm_connector *aconn; +struct drm_connector_state *state;int ret; aconn =kunit_kzalloc (test,sizeof (*aconn),GFP_KERNEL );
@@ -704,7 +705,9 @@ static void dm_test_crtc_set_crc_source_dprx_connector(struct kunit *test)KUNIT_ASSERT_EQ (test, ret,0 ); ret =kunit_add_action_or_reset (test, dm_test_crc_connector_cleanup, &aconn->base);KUNIT_ASSERT_EQ (test, ret,0 ); -KUNIT_ASSERT_NOT_NULL (test, aconn->base.state); + state =drm_atomic_helper_connector_create_state (&aconn->base); +KUNIT_ASSERT_NOT_ERR_OR_NULL (test, state); + aconn->base.state = state; aconn->base.state->crtc = &acrtc->base;/* Balance the reference the state destroy drops for a set CRTC. */ drm_connector_get (&aconn->base);
base-commit: 793807ca13bf3072fc6d16ce6d90e9ab9beff2a5
Signature · 1 line
2.53.0
Mark Brown
maintainerRe: [PATCH linux-next] drm/amd/display: give the dprx CRC test its connector state back
Quoted 9 lines · Sasha Levin
The merge fixup in commit
c62c2736d82f("amdgpu: Merge merge merge cherry-pick cherry-pick cherry-pick") dropped the call todrm_atomic_helper_connector_reset(), which drm-misc removed. But that call is what gave the test's connector a state, so the assert right after it always fails now.Create the state with
drm_atomic_helper_connector_create_state()instead, and check it before storing it: cleanup would choke on an error pointer inconnector->state.
Yeah, that fixup was obviously just a build fixup rather than an attempt to actually get things working.