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

Merge tag 'drm-fixes-2024-02-16' of git://anongit.freedesktop.org/drm/drm

Pull drm fixes from Dave Airlie:
 "Regular weekly fixes, nothing too major, mostly amdgpu, then i915, xe,
  msm and nouveau with some scattered bits elsewhere.

  crtc:
   - fix uninit variable

  prime:
   - support > 4GB page arrays

  buddy:
   - fix error handling in allocations

  i915:
   - fix blankscreen on JSL chromebooks
   - stable fix to limit DP sst link rates

  xe:
   - Fix an out-of-bounds shift.
   - Fix the display code thinking xe uses shmem
   - Fix a warning about index out-of-bound
   - Fix a clang-16 compilation warning

  amdgpu:
   - PSR fixes
   - Suspend/resume fixes
   - Link training fix
   - Aspect ratio fix
   - DCN 3.5 fixes
   - VCN 4.x fix
   - GFX 11 fix
   - Misc display fixes
   - Misc small fixes

  amdkfd:
   - Cache size reporting fix
   - SIMD distribution fix

  msm:
   - GPU:
   - dmabuf vmap fix
   - a610 UBWC corruption fix (incorrect hbb)
   - revert a commit that was making GPU recovery unreliable
   - tlb invalidation fix

  ivpu:
   - suspend/resume fix

  nouveau:
   - fix scheduler cleanup path
   - fix pointless scheduler creation
   - fix kvalloc argument order

  rockchip:
   - vop2 locking fix"

* tag 'drm-fixes-2024-02-16' of git://anongit.freedesktop.org/drm/drm: (38 commits)
  drm/amdgpu: Fix implicit assumtion in gfx11 debug flags
  drm/amdkfd: update SIMD distribution algo for GFXIP 9.4.2 onwards
  drm/amd/display: Increase ips2_eval delay for DCN35
  drm/amdgpu/display: Initialize gamma correction mode variable in dcn30_get_gamcor_current()
  drm/amdgpu/soc21: update VCN 4 max HEVC encoding resolution
  drm/amd/display: fixed integer types and null check locations
  drm/amd/display: Fix array-index-out-of-bounds in dcn35_clkmgr
  drm/amd/display: Preserve original aspect ratio in create stream
  drm/amd/display: Fix possible NULL dereference on device remove/driver unload
  Revert "drm/amd/display: increased min_dcfclk_mhz and min_fclk_mhz"
  drm/amd/display: Add align done check
  Revert "drm/amd: flush any delayed gfxoff on suspend entry"
  drm/amd: Stop evicting resources on APUs in suspend
  drm/amd/display: Fix possible buffer overflow in 'find_dcfclk_for_voltage()'
  drm/amd/display: Fix possible use of uninitialized 'max_chunks_fbc_mode' in 'calculate_bandwidth()'
  drm/amd/display: Initialize 'wait_time_microsec' variable in link_dp_training_dpia.c
  drm/amd/display: Fix && vs || typos
  drm/amdkfd: Fix L2 cache size reporting in GFX9.4.3
  drm/amdgpu: make damage clips support configurable
  drm/msm: Wire up tlb ops
  ...
parents b8ef9201 ea69f782
Loading
Loading
Loading
Loading
+32 −12
Original line number Diff line number Diff line
@@ -510,16 +510,6 @@ static int ivpu_boot_pwr_domain_enable(struct ivpu_device *vdev)
	return ret;
}

static int ivpu_boot_pwr_domain_disable(struct ivpu_device *vdev)
{
	ivpu_boot_dpu_active_drive(vdev, false);
	ivpu_boot_pwr_island_isolation_drive(vdev, true);
	ivpu_boot_pwr_island_trickle_drive(vdev, false);
	ivpu_boot_pwr_island_drive(vdev, false);

	return ivpu_boot_wait_for_pwr_island_status(vdev, 0x0);
}

static void ivpu_boot_no_snoop_enable(struct ivpu_device *vdev)
{
	u32 val = REGV_RD32(VPU_37XX_HOST_IF_TCU_PTW_OVERRIDES);
@@ -616,12 +606,37 @@ static int ivpu_hw_37xx_info_init(struct ivpu_device *vdev)
	return 0;
}

static int ivpu_hw_37xx_ip_reset(struct ivpu_device *vdev)
{
	int ret;
	u32 val;

	if (IVPU_WA(punit_disabled))
		return 0;

	ret = REGB_POLL_FLD(VPU_37XX_BUTTRESS_VPU_IP_RESET, TRIGGER, 0, TIMEOUT_US);
	if (ret) {
		ivpu_err(vdev, "Timed out waiting for TRIGGER bit\n");
		return ret;
	}

	val = REGB_RD32(VPU_37XX_BUTTRESS_VPU_IP_RESET);
	val = REG_SET_FLD(VPU_37XX_BUTTRESS_VPU_IP_RESET, TRIGGER, val);
	REGB_WR32(VPU_37XX_BUTTRESS_VPU_IP_RESET, val);

	ret = REGB_POLL_FLD(VPU_37XX_BUTTRESS_VPU_IP_RESET, TRIGGER, 0, TIMEOUT_US);
	if (ret)
		ivpu_err(vdev, "Timed out waiting for RESET completion\n");

	return ret;
}

static int ivpu_hw_37xx_reset(struct ivpu_device *vdev)
{
	int ret = 0;

	if (ivpu_boot_pwr_domain_disable(vdev)) {
		ivpu_err(vdev, "Failed to disable power domain\n");
	if (ivpu_hw_37xx_ip_reset(vdev)) {
		ivpu_err(vdev, "Failed to reset NPU\n");
		ret = -EIO;
	}

@@ -661,6 +676,11 @@ static int ivpu_hw_37xx_power_up(struct ivpu_device *vdev)
{
	int ret;

	/* PLL requests may fail when powering down, so issue WP 0 here */
	ret = ivpu_pll_disable(vdev);
	if (ret)
		ivpu_warn(vdev, "Failed to disable PLL: %d\n", ret);

	ret = ivpu_hw_37xx_d0i3_disable(vdev);
	if (ret)
		ivpu_warn(vdev, "Failed to disable D0I3: %d\n", ret);
+22 −17
Original line number Diff line number Diff line
@@ -58,11 +58,14 @@ static int ivpu_suspend(struct ivpu_device *vdev)
{
	int ret;

	/* Save PCI state before powering down as it sometimes gets corrupted if NPU hangs */
	pci_save_state(to_pci_dev(vdev->drm.dev));

	ret = ivpu_shutdown(vdev);
	if (ret) {
	if (ret)
		ivpu_err(vdev, "Failed to shutdown VPU: %d\n", ret);
		return ret;
	}

	pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D3hot);

	return ret;
}
@@ -71,6 +74,9 @@ static int ivpu_resume(struct ivpu_device *vdev)
{
	int ret;

	pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D0);
	pci_restore_state(to_pci_dev(vdev->drm.dev));

retry:
	ret = ivpu_hw_power_up(vdev);
	if (ret) {
@@ -120,15 +126,20 @@ static void ivpu_pm_recovery_work(struct work_struct *work)

	ivpu_fw_log_dump(vdev);

retry:
	ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev));
	if (ret == -EAGAIN && !drm_dev_is_unplugged(&vdev->drm)) {
		cond_resched();
		goto retry;
	}
	atomic_inc(&vdev->pm->reset_counter);
	atomic_set(&vdev->pm->reset_pending, 1);
	down_write(&vdev->pm->reset_lock);

	ivpu_suspend(vdev);
	ivpu_pm_prepare_cold_boot(vdev);
	ivpu_jobs_abort_all(vdev);

	ret = ivpu_resume(vdev);
	if (ret)
		ivpu_err(vdev, "Failed to resume NPU: %d\n", ret);

	if (ret && ret != -EAGAIN)
		ivpu_err(vdev, "Failed to reset VPU: %d\n", ret);
	up_write(&vdev->pm->reset_lock);
	atomic_set(&vdev->pm->reset_pending, 0);

	kobject_uevent_env(&vdev->drm.dev->kobj, KOBJ_CHANGE, evt);
	pm_runtime_mark_last_busy(vdev->drm.dev);
@@ -200,9 +211,6 @@ int ivpu_pm_suspend_cb(struct device *dev)
	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 0;
@@ -216,9 +224,6 @@ int ivpu_pm_resume_cb(struct device *dev)

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

	pci_set_power_state(to_pci_dev(dev), PCI_D0);
	pci_restore_state(to_pci_dev(dev));

	ret = ivpu_resume(vdev);
	if (ret)
		ivpu_err(vdev, "Failed to resume: %d\n", ret);
+3 −0
Original line number Diff line number Diff line
@@ -200,6 +200,7 @@ extern uint amdgpu_dc_debug_mask;
extern uint amdgpu_dc_visual_confirm;
extern uint amdgpu_dm_abm_level;
extern int amdgpu_backlight;
extern int amdgpu_damage_clips;
extern struct amdgpu_mgpu_info mgpu_info;
extern int amdgpu_ras_enable;
extern uint amdgpu_ras_mask;
@@ -1549,9 +1550,11 @@ static inline int amdgpu_acpi_smart_shift_update(struct drm_device *dev,
#if defined(CONFIG_ACPI) && defined(CONFIG_SUSPEND)
bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev);
bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev);
void amdgpu_choose_low_power_state(struct amdgpu_device *adev);
#else
static inline bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev) { return false; }
static inline bool amdgpu_acpi_is_s3_active(struct amdgpu_device *adev) { return false; }
static inline void amdgpu_choose_low_power_state(struct amdgpu_device *adev) { }
#endif

#if defined(CONFIG_DRM_AMD_DC)
+15 −0
Original line number Diff line number Diff line
@@ -1519,4 +1519,19 @@ bool amdgpu_acpi_is_s0ix_active(struct amdgpu_device *adev)
#endif /* CONFIG_AMD_PMC */
}

/**
 * amdgpu_choose_low_power_state
 *
 * @adev: amdgpu_device_pointer
 *
 * Choose the target low power state for the GPU
 */
void amdgpu_choose_low_power_state(struct amdgpu_device *adev)
{
	if (amdgpu_acpi_is_s0ix_active(adev))
		adev->in_s0ix = true;
	else if (amdgpu_acpi_is_s3_active(adev))
		adev->in_s3 = true;
}

#endif /* CONFIG_SUSPEND */
+9 −3
Original line number Diff line number Diff line
@@ -4514,13 +4514,15 @@ int amdgpu_device_prepare(struct drm_device *dev)
	struct amdgpu_device *adev = drm_to_adev(dev);
	int i, r;

	amdgpu_choose_low_power_state(adev);

	if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
		return 0;

	/* Evict the majority of BOs before starting suspend sequence */
	r = amdgpu_device_evict_resources(adev);
	if (r)
		return r;
		goto unprepare;

	for (i = 0; i < adev->num_ip_blocks; i++) {
		if (!adev->ip_blocks[i].status.valid)
@@ -4529,10 +4531,15 @@ int amdgpu_device_prepare(struct drm_device *dev)
			continue;
		r = adev->ip_blocks[i].version->funcs->prepare_suspend((void *)adev);
		if (r)
			return r;
			goto unprepare;
	}

	return 0;

unprepare:
	adev->in_s0ix = adev->in_s3 = false;

	return r;
}

/**
@@ -4569,7 +4576,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
		drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper, true);

	cancel_delayed_work_sync(&adev->delayed_init_work);
	flush_delayed_work(&adev->gfx.gfx_off_delay_work);

	amdgpu_ras_suspend(adev);

Loading