Commit ac6c0433 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'drm-fixes-2023-04-06' of git://anongit.freedesktop.org/drm/drm

Pull drm fixes from Daniel Vetter:
 "Mostly i915 fixes: dp mst for compression/dsc, perf ioctl uaf, ctx rpm
  accounting, gt reset vs huc loading.

  And a few individual driver fixes: ivpu dma fence&suspend, panfrost
  mmap, nouveau color depth"

* tag 'drm-fixes-2023-04-06' of git://anongit.freedesktop.org/drm/drm:
  accel/ivpu: Fix S3 system suspend when not idle
  accel/ivpu: Add dma fence to command buffers only
  drm/i915: Fix context runtime accounting
  drm/i915: fix race condition UAF in i915_perf_add_config_ioctl
  drm/i915: Use compressed bpp when calculating m/n value for DP MST DSC
  drm/i915/huc: Cancel HuC delayed load timer on reset.
  drm/i915/ttm: fix sparse warning
  drm/panfrost: Fix the panfrost_mmu_map_fault_addr() error path
  drm/nouveau/disp: Support more modes by checking with lower bpc
parents 2a28a8b3 3dfa8926
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -461,26 +461,22 @@ ivpu_job_prepare_bos_for_submit(struct drm_file *file, struct ivpu_job *job, u32

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

	ret = drm_gem_lock_reservations((struct drm_gem_object **)job->bos, buf_count,
					&acquire_ctx);
	ret = drm_gem_lock_reservations((struct drm_gem_object **)job->bos, 1, &acquire_ctx);
	if (ret) {
		ivpu_warn(vdev, "Failed to lock reservations: %d\n", ret);
		return ret;
	}

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

	for (i = 0; i < buf_count; i++)
		dma_resv_add_fence(job->bos[i]->base.resv, job->done_fence, DMA_RESV_USAGE_WRITE);
	dma_resv_add_fence(bo->base.resv, job->done_fence, DMA_RESV_USAGE_WRITE);

unlock_reservations:
	drm_gem_unlock_reservations((struct drm_gem_object **)job->bos, buf_count, &acquire_ctx);
	drm_gem_unlock_reservations((struct drm_gem_object **)job->bos, 1, &acquire_ctx);

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

+11 −15
Original line number Diff line number Diff line
@@ -140,32 +140,28 @@ int ivpu_pm_suspend_cb(struct device *dev)
{
	struct drm_device *drm = dev_get_drvdata(dev);
	struct ivpu_device *vdev = to_ivpu_device(drm);
	int ret;
	unsigned long timeout;

	ivpu_dbg(vdev, PM, "Suspend..\n");

	ret = ivpu_suspend(vdev);
	if (ret && vdev->pm->suspend_reschedule_counter) {
		ivpu_dbg(vdev, PM, "Failed to enter idle, rescheduling suspend, retries left %d\n",
			 vdev->pm->suspend_reschedule_counter);
		pm_schedule_suspend(dev, vdev->timeout.reschedule_suspend);
		vdev->pm->suspend_reschedule_counter--;
	timeout = jiffies + msecs_to_jiffies(vdev->timeout.tdr);
	while (!ivpu_hw_is_idle(vdev)) {
		cond_resched();
		if (time_after_eq(jiffies, timeout)) {
			ivpu_err(vdev, "Failed to enter idle on system suspend\n");
			return -EBUSY;
	} else if (!vdev->pm->suspend_reschedule_counter) {
		ivpu_warn(vdev, "Failed to enter idle, force suspend\n");
		ivpu_pm_prepare_cold_boot(vdev);
	} else {
		ivpu_pm_prepare_warm_boot(vdev);
		}
	}

	vdev->pm->suspend_reschedule_counter = PM_RESCHEDULE_LIMIT;
	ivpu_suspend(vdev);
	ivpu_pm_prepare_warm_boot(vdev);

	pci_save_state(to_pci_dev(dev));
	pci_set_power_state(to_pci_dev(dev), PCI_D3hot);

	ivpu_dbg(vdev, PM, "Suspend done.\n");

	return ret;
	return 0;
}

int ivpu_pm_resume_cb(struct device *dev)
+1 −1
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ static int intel_dp_dsc_mst_compute_link_config(struct intel_encoder *encoder,
			return slots;
	}

	intel_link_compute_m_n(crtc_state->pipe_bpp,
	intel_link_compute_m_n(crtc_state->dsc.compressed_bpp,
			       crtc_state->lane_count,
			       adjusted_mode->crtc_clock,
			       crtc_state->port_clock,
+3 −2
Original line number Diff line number Diff line
@@ -1067,11 +1067,12 @@ static vm_fault_t vm_fault_ttm(struct vm_fault *vmf)
			.interruptible = true,
			.no_wait_gpu = true, /* should be idle already */
		};
		int err;

		GEM_BUG_ON(!bo->ttm || !(bo->ttm->page_flags & TTM_TT_FLAG_SWAPPED));

		ret = ttm_bo_validate(bo, i915_ttm_sys_placement(), &ctx);
		if (ret) {
		err = ttm_bo_validate(bo, i915_ttm_sys_placement(), &ctx);
		if (err) {
			dma_resv_unlock(bo->base.resv);
			return VM_FAULT_SIGBUS;
		}
+10 −2
Original line number Diff line number Diff line
@@ -2018,6 +2018,8 @@ process_csb(struct intel_engine_cs *engine, struct i915_request **inactive)
	 * inspecting the queue to see if we need to resumbit.
	 */
	if (*prev != *execlists->active) { /* elide lite-restores */
		struct intel_context *prev_ce = NULL, *active_ce = NULL;

		/*
		 * Note the inherent discrepancy between the HW runtime,
		 * recorded as part of the context switch, and the CPU
@@ -2029,9 +2031,15 @@ process_csb(struct intel_engine_cs *engine, struct i915_request **inactive)
		 * and correct overselves later when updating from HW.
		 */
		if (*prev)
			lrc_runtime_stop((*prev)->context);
			prev_ce = (*prev)->context;
		if (*execlists->active)
			lrc_runtime_start((*execlists->active)->context);
			active_ce = (*execlists->active)->context;
		if (prev_ce != active_ce) {
			if (prev_ce)
				lrc_runtime_stop(prev_ce);
			if (active_ce)
				lrc_runtime_start(active_ce);
		}
		new_timeslice(execlists);
	}

Loading