Commit bba8eb87 authored by Krystian Pradzynski's avatar Krystian Pradzynski Committed by Xiangwei Li
Browse files

accel/ivpu: Move set autosuspend delay to HW specific code

mainline inclusion
from mainline-v6.7-rc1
commit 8ed520ff4682aaaef7d124bd9c0950092fddb9c1
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBJCMO
CVE: CVE-2024-54193

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8ed520ff4682aaaef7d124bd9c0950092fddb9c1



-------------------------------------

Configure autosuspend values per HW generation and per platform.

For non silicon platforms disable autosuspend for now, for silicon
reduce it to 10 ms.

Signed-off-by: default avatarKrystian Pradzynski <krystian.pradzynski@linux.intel.com>
Reviewed-by: default avatarStanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Reviewed-by: default avatarJeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: default avatarStanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230901094957.168898-2-stanislaw.gruszka@linux.intel.com


Signed-off-by: default avatarXiangwei Li <liwei728@huawei.com>
parent 1b973c5f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@ struct ivpu_device {
		int jsm;
		int tdr;
		int reschedule_suspend;
		int autosuspend;
	} timeout;
};

+2 −0
Original line number Diff line number Diff line
@@ -124,11 +124,13 @@ static void ivpu_hw_timeouts_init(struct ivpu_device *vdev)
		vdev->timeout.jsm = 50000;
		vdev->timeout.tdr = 2000000;
		vdev->timeout.reschedule_suspend = 1000;
		vdev->timeout.autosuspend = -1;
	} else {
		vdev->timeout.boot = 1000;
		vdev->timeout.jsm = 500;
		vdev->timeout.tdr = 2000;
		vdev->timeout.reschedule_suspend = 10;
		vdev->timeout.autosuspend = 10;
	}
}

+3 −0
Original line number Diff line number Diff line
@@ -138,16 +138,19 @@ static void ivpu_hw_timeouts_init(struct ivpu_device *vdev)
		vdev->timeout.jsm = 50000;
		vdev->timeout.tdr = 2000000;
		vdev->timeout.reschedule_suspend = 1000;
		vdev->timeout.autosuspend = -1;
	} else if (ivpu_is_simics(vdev)) {
		vdev->timeout.boot = 50;
		vdev->timeout.jsm = 500;
		vdev->timeout.tdr = 10000;
		vdev->timeout.reschedule_suspend = 10;
		vdev->timeout.autosuspend = -1;
	} else {
		vdev->timeout.boot = 1000;
		vdev->timeout.jsm = 500;
		vdev->timeout.tdr = 2000;
		vdev->timeout.reschedule_suspend = 10;
		vdev->timeout.autosuspend = 10;
	}
}

+8 −6
Original line number Diff line number Diff line
@@ -287,6 +287,7 @@ int ivpu_pm_init(struct ivpu_device *vdev)
{
	struct device *dev = vdev->drm.dev;
	struct ivpu_pm_info *pm = vdev->pm;
	int delay;

	pm->vdev = vdev;
	pm->suspend_reschedule_counter = PM_RESCHEDULE_LIMIT;
@@ -294,14 +295,15 @@ int ivpu_pm_init(struct ivpu_device *vdev)
	atomic_set(&pm->in_reset, 0);
	INIT_WORK(&pm->recovery_work, ivpu_pm_recovery_work);

	pm_runtime_use_autosuspend(dev);

	if (ivpu_disable_recovery)
		pm_runtime_set_autosuspend_delay(dev, -1);
	else if (ivpu_is_silicon(vdev))
		pm_runtime_set_autosuspend_delay(dev, 100);
		delay = -1;
	else
		pm_runtime_set_autosuspend_delay(dev, 60000);
		delay = vdev->timeout.autosuspend;

	pm_runtime_use_autosuspend(dev);
	pm_runtime_set_autosuspend_delay(dev, delay);

	ivpu_dbg(vdev, PM, "Autosuspend delay = %d\n", delay);

	return 0;
}