Skip to content

Commit 33f2b57

Browse files
committed
Merge tag 'drm-fixes-2023-06-09' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Bit busier and a bit more scattered than usual. amdgpu is the main one, with ivpu and msm having a few fixes, then i915, exynos, ast, lima, radeon with some misc bits, but overall nothing standing out. fb-helper: - Fill in fb-helper vars more correctly amdgpu: - S0ix fixes - GPU reset fixes - SMU13 fixes - SMU11 fixes - Misc Display fixes - Revert RV/RV2/PCO clock counter changes - Fix Stoney xclk value - Fix reserved vram debug info radeon: - Fix a potential use after free i915: - CDCLK voltage fix for ADL-P - eDP wake sync pulse fix - Two error handling fixes to selftests exynos: - Fix wrong return in Exynos vidi driver - Fix use-after-free issue to Exynos g2d driver ast: - resume and modeset fixes for ast ivpu: - Assorted ivpu fixes lima: - lima context destroy fix msm: - Fix max segment size to address splat on newer a6xx - Disable PSR by default w/ modparam to re-enable, since there still seems to be a lingering issue - Fix HPD issue - Fix issue with unitialized GMU mutex" * tag 'drm-fixes-2023-06-09' of git://anongit.freedesktop.org/drm/drm: (32 commits) drm/msm/a6xx: initialize GMU mutex earlier drm/msm/dp: enable HDP plugin/unplugged interrupts at hpd_enable/disable accel/ivpu: Fix sporadic VPU boot failure accel/ivpu: Do not use mutex_lock_interruptible accel/ivpu: Do not trigger extra VPU reset if the VPU is idle drm/amd/display: Reduce sdp bw after urgent to 90% drm/amdgpu: change reserved vram info print drm/amdgpu: fix xclk freq on CHIP_STONEY drm/radeon: fix race condition UAF in radeon_gem_set_domain_ioctl Revert "drm/amdgpu: switch to golden tsc registers for raven/raven2" Revert "drm/amdgpu: Differentiate between Raven2 and Raven/Picasso according to revision id" Revert "drm/amdgpu: change the reference clock for raven/raven2" drm/amd/display: add ODM case when looking for first split pipe drm/amd: Make lack of `ACPI_FADT_LOW_POWER_S0` or `CONFIG_AMD_PMC` louder during suspend path drm/amd/pm: conditionally disable pcie lane switching for some sienna_cichlid SKUs drm/amd/pm: Fix power context allocation in SMU13 drm/amdgpu: fix Null pointer dereference error in amdgpu_device_recover_vram drm/amd: Disallow s0ix without BIOS support again drm/i915/selftests: Add some missing error propagation drm/exynos: fix race condition UAF in exynos_g2d_exec_ioctl ...
2 parents 9cd6357 + 986c34b commit 33f2b57

38 files changed

+342
-238
lines changed

drivers/accel/ivpu/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ config DRM_ACCEL_IVPU
77
depends on PCI && PCI_MSI
88
select FW_LOADER
99
select SHMEM
10+
select GENERIC_ALLOCATOR
1011
help
1112
Choose this option if you have a system that has an 14th generation Intel CPU
1213
or newer. VPU stands for Versatile Processing Unit and it's a CPU-integrated

drivers/accel/ivpu/ivpu_hw_mtl.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ static void ivpu_pll_init_frequency_ratios(struct ivpu_device *vdev)
197197
hw->pll.pn_ratio = clamp_t(u8, fuse_pn_ratio, hw->pll.min_ratio, hw->pll.max_ratio);
198198
}
199199

200+
static int ivpu_hw_mtl_wait_for_vpuip_bar(struct ivpu_device *vdev)
201+
{
202+
return REGV_POLL_FLD(MTL_VPU_HOST_SS_CPR_RST_CLR, AON, 0, 100);
203+
}
204+
200205
static int ivpu_pll_drive(struct ivpu_device *vdev, bool enable)
201206
{
202207
struct ivpu_hw_info *hw = vdev->hw;
@@ -239,6 +244,12 @@ static int ivpu_pll_drive(struct ivpu_device *vdev, bool enable)
239244
ivpu_err(vdev, "Timed out waiting for PLL ready status\n");
240245
return ret;
241246
}
247+
248+
ret = ivpu_hw_mtl_wait_for_vpuip_bar(vdev);
249+
if (ret) {
250+
ivpu_err(vdev, "Timed out waiting for VPUIP bar\n");
251+
return ret;
252+
}
242253
}
243254

244255
return 0;
@@ -256,7 +267,7 @@ static int ivpu_pll_disable(struct ivpu_device *vdev)
256267

257268
static void ivpu_boot_host_ss_rst_clr_assert(struct ivpu_device *vdev)
258269
{
259-
u32 val = REGV_RD32(MTL_VPU_HOST_SS_CPR_RST_CLR);
270+
u32 val = 0;
260271

261272
val = REG_SET_FLD(MTL_VPU_HOST_SS_CPR_RST_CLR, TOP_NOC, val);
262273
val = REG_SET_FLD(MTL_VPU_HOST_SS_CPR_RST_CLR, DSS_MAS, val);
@@ -754,18 +765,19 @@ static int ivpu_hw_mtl_power_down(struct ivpu_device *vdev)
754765
{
755766
int ret = 0;
756767

757-
if (ivpu_hw_mtl_reset(vdev)) {
768+
if (!ivpu_hw_mtl_is_idle(vdev) && ivpu_hw_mtl_reset(vdev)) {
758769
ivpu_err(vdev, "Failed to reset the VPU\n");
759-
ret = -EIO;
760770
}
761771

762772
if (ivpu_pll_disable(vdev)) {
763773
ivpu_err(vdev, "Failed to disable PLL\n");
764774
ret = -EIO;
765775
}
766776

767-
if (ivpu_hw_mtl_d0i3_enable(vdev))
768-
ivpu_warn(vdev, "Failed to enable D0I3\n");
777+
if (ivpu_hw_mtl_d0i3_enable(vdev)) {
778+
ivpu_err(vdev, "Failed to enter D0I3\n");
779+
ret = -EIO;
780+
}
769781

770782
return ret;
771783
}

drivers/accel/ivpu/ivpu_hw_mtl_reg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
#define MTL_VPU_HOST_SS_CPR_RST_SET_MSS_MAS_MASK BIT_MASK(11)
9292

9393
#define MTL_VPU_HOST_SS_CPR_RST_CLR 0x00000098u
94+
#define MTL_VPU_HOST_SS_CPR_RST_CLR_AON_MASK BIT_MASK(0)
9495
#define MTL_VPU_HOST_SS_CPR_RST_CLR_TOP_NOC_MASK BIT_MASK(1)
9596
#define MTL_VPU_HOST_SS_CPR_RST_CLR_DSS_MAS_MASK BIT_MASK(10)
9697
#define MTL_VPU_HOST_SS_CPR_RST_CLR_MSS_MAS_MASK BIT_MASK(11)

drivers/accel/ivpu/ivpu_ipc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,7 @@ ivpu_ipc_send(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, struct v
183183
struct ivpu_ipc_info *ipc = vdev->ipc;
184184
int ret;
185185

186-
ret = mutex_lock_interruptible(&ipc->lock);
187-
if (ret)
188-
return ret;
186+
mutex_lock(&ipc->lock);
189187

190188
if (!ipc->on) {
191189
ret = -EAGAIN;

drivers/accel/ivpu/ivpu_job.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ ivpu_job_prepare_bos_for_submit(struct drm_file *file, struct ivpu_job *job, u32
431431
struct ivpu_file_priv *file_priv = file->driver_priv;
432432
struct ivpu_device *vdev = file_priv->vdev;
433433
struct ww_acquire_ctx acquire_ctx;
434+
enum dma_resv_usage usage;
434435
struct ivpu_bo *bo;
435436
int ret;
436437
u32 i;
@@ -461,22 +462,28 @@ ivpu_job_prepare_bos_for_submit(struct drm_file *file, struct ivpu_job *job, u32
461462

462463
job->cmd_buf_vpu_addr = bo->vpu_addr + commands_offset;
463464

464-
ret = drm_gem_lock_reservations((struct drm_gem_object **)job->bos, 1, &acquire_ctx);
465+
ret = drm_gem_lock_reservations((struct drm_gem_object **)job->bos, buf_count,
466+
&acquire_ctx);
465467
if (ret) {
466468
ivpu_warn(vdev, "Failed to lock reservations: %d\n", ret);
467469
return ret;
468470
}
469471

470-
ret = dma_resv_reserve_fences(bo->base.resv, 1);
471-
if (ret) {
472-
ivpu_warn(vdev, "Failed to reserve fences: %d\n", ret);
473-
goto unlock_reservations;
472+
for (i = 0; i < buf_count; i++) {
473+
ret = dma_resv_reserve_fences(job->bos[i]->base.resv, 1);
474+
if (ret) {
475+
ivpu_warn(vdev, "Failed to reserve fences: %d\n", ret);
476+
goto unlock_reservations;
477+
}
474478
}
475479

476-
dma_resv_add_fence(bo->base.resv, job->done_fence, DMA_RESV_USAGE_WRITE);
480+
for (i = 0; i < buf_count; i++) {
481+
usage = (i == CMD_BUF_IDX) ? DMA_RESV_USAGE_WRITE : DMA_RESV_USAGE_BOOKKEEP;
482+
dma_resv_add_fence(job->bos[i]->base.resv, job->done_fence, usage);
483+
}
477484

478485
unlock_reservations:
479-
drm_gem_unlock_reservations((struct drm_gem_object **)job->bos, 1, &acquire_ctx);
486+
drm_gem_unlock_reservations((struct drm_gem_object **)job->bos, buf_count, &acquire_ctx);
480487

481488
wmb(); /* Flush write combining buffers */
482489

drivers/accel/ivpu/ivpu_mmu.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -587,16 +587,11 @@ static int ivpu_mmu_strtab_init(struct ivpu_device *vdev)
587587
int ivpu_mmu_invalidate_tlb(struct ivpu_device *vdev, u16 ssid)
588588
{
589589
struct ivpu_mmu_info *mmu = vdev->mmu;
590-
int ret;
591-
592-
ret = mutex_lock_interruptible(&mmu->lock);
593-
if (ret)
594-
return ret;
590+
int ret = 0;
595591

596-
if (!mmu->on) {
597-
ret = 0;
592+
mutex_lock(&mmu->lock);
593+
if (!mmu->on)
598594
goto unlock;
599-
}
600595

601596
ret = ivpu_mmu_cmdq_write_tlbi_nh_asid(vdev, ssid);
602597
if (ret)
@@ -614,7 +609,7 @@ static int ivpu_mmu_cd_add(struct ivpu_device *vdev, u32 ssid, u64 cd_dma)
614609
struct ivpu_mmu_cdtab *cdtab = &mmu->cdtab;
615610
u64 *entry;
616611
u64 cd[4];
617-
int ret;
612+
int ret = 0;
618613

619614
if (ssid > IVPU_MMU_CDTAB_ENT_COUNT)
620615
return -EINVAL;
@@ -655,14 +650,9 @@ static int ivpu_mmu_cd_add(struct ivpu_device *vdev, u32 ssid, u64 cd_dma)
655650
ivpu_dbg(vdev, MMU, "CDTAB %s entry (SSID=%u, dma=%pad): 0x%llx, 0x%llx, 0x%llx, 0x%llx\n",
656651
cd_dma ? "write" : "clear", ssid, &cd_dma, cd[0], cd[1], cd[2], cd[3]);
657652

658-
ret = mutex_lock_interruptible(&mmu->lock);
659-
if (ret)
660-
return ret;
661-
662-
if (!mmu->on) {
663-
ret = 0;
653+
mutex_lock(&mmu->lock);
654+
if (!mmu->on)
664655
goto unlock;
665-
}
666656

667657
ret = ivpu_mmu_cmdq_write_cfgi_all(vdev);
668658
if (ret)

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,16 +1092,20 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
10921092
* S0ix even though the system is suspending to idle, so return false
10931093
* in that case.
10941094
*/
1095-
if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0))
1096-
dev_warn_once(adev->dev,
1095+
if (!(acpi_gbl_FADT.flags & ACPI_FADT_LOW_POWER_S0)) {
1096+
dev_err_once(adev->dev,
10971097
"Power consumption will be higher as BIOS has not been configured for suspend-to-idle.\n"
10981098
"To use suspend-to-idle change the sleep mode in BIOS setup.\n");
1099+
return false;
1100+
}
10991101

11001102
#if !IS_ENABLED(CONFIG_AMD_PMC)
1101-
dev_warn_once(adev->dev,
1103+
dev_err_once(adev->dev,
11021104
"Power consumption will be higher as the kernel has not been compiled with CONFIG_AMD_PMC.\n");
1103-
#endif /* CONFIG_AMD_PMC */
1105+
return false;
1106+
#else
11041107
return true;
1108+
#endif /* CONFIG_AMD_PMC */
11051109
}
11061110

11071111
#endif /* CONFIG_SUSPEND */

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ static void amdgpu_bo_user_destroy(struct ttm_buffer_object *tbo)
7979
static void amdgpu_bo_vm_destroy(struct ttm_buffer_object *tbo)
8080
{
8181
struct amdgpu_device *adev = amdgpu_ttm_adev(tbo->bdev);
82-
struct amdgpu_bo *bo = ttm_to_amdgpu_bo(tbo);
82+
struct amdgpu_bo *shadow_bo = ttm_to_amdgpu_bo(tbo), *bo;
8383
struct amdgpu_bo_vm *vmbo;
8484

85+
bo = shadow_bo->parent;
8586
vmbo = to_amdgpu_bo_vm(bo);
8687
/* in case amdgpu_device_recover_vram got NULL of bo->parent */
8788
if (!list_empty(&vmbo->shadow_list)) {
@@ -694,11 +695,6 @@ int amdgpu_bo_create_vm(struct amdgpu_device *adev,
694695
return r;
695696

696697
*vmbo_ptr = to_amdgpu_bo_vm(bo_ptr);
697-
INIT_LIST_HEAD(&(*vmbo_ptr)->shadow_list);
698-
/* Set destroy callback to amdgpu_bo_vm_destroy after vmbo->shadow_list
699-
* is initialized.
700-
*/
701-
bo_ptr->tbo.destroy = &amdgpu_bo_vm_destroy;
702698
return r;
703699
}
704700

@@ -715,6 +711,8 @@ void amdgpu_bo_add_to_shadow_list(struct amdgpu_bo_vm *vmbo)
715711

716712
mutex_lock(&adev->shadow_list_lock);
717713
list_add_tail(&vmbo->shadow_list, &adev->shadow_list);
714+
vmbo->shadow->parent = amdgpu_bo_ref(&vmbo->bo);
715+
vmbo->shadow->tbo.destroy = &amdgpu_bo_vm_destroy;
718716
mutex_unlock(&adev->shadow_list_lock);
719717
}
720718

drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,6 @@ int amdgpu_vm_pt_create(struct amdgpu_device *adev, struct amdgpu_vm *vm,
564564
return r;
565565
}
566566

567-
(*vmbo)->shadow->parent = amdgpu_bo_ref(bo);
568567
amdgpu_bo_add_to_shadow_list(*vmbo);
569568

570569
return 0;

drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ static void amdgpu_vram_mgr_debug(struct ttm_resource_manager *man,
800800
{
801801
struct amdgpu_vram_mgr *mgr = to_vram_mgr(man);
802802
struct drm_buddy *mm = &mgr->mm;
803-
struct drm_buddy_block *block;
803+
struct amdgpu_vram_reservation *rsv;
804804

805805
drm_printf(printer, " vis usage:%llu\n",
806806
amdgpu_vram_mgr_vis_usage(mgr));
@@ -812,8 +812,9 @@ static void amdgpu_vram_mgr_debug(struct ttm_resource_manager *man,
812812
drm_buddy_print(mm, printer);
813813

814814
drm_printf(printer, "reserved:\n");
815-
list_for_each_entry(block, &mgr->reserved_pages, link)
816-
drm_buddy_block_print(mm, block, printer);
815+
list_for_each_entry(rsv, &mgr->reserved_pages, blocks)
816+
drm_printf(printer, "%#018llx-%#018llx: %llu\n",
817+
rsv->start, rsv->start + rsv->size, rsv->size);
817818
mutex_unlock(&mgr->lock);
818819
}
819820

0 commit comments

Comments
 (0)