summaryrefslogtreecommitdiff
path: root/lib/igt_pm.c
AgeCommit message (Collapse)Author
2022-05-18lib: Optional autosuspend_delay_ms configurationAnshuman Gupta
Add an option to configure autosuspend_delay_ms as i915 read autosuspend_delay_ms to all PCI devices under GFX root port. configuring autosuspend_delay_ms as optional. Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com> Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
2022-05-18lib/igt_pm: D3Cold runtime pm infrastructureAnshuman Gupta
Enable gfx card pci devices runtime pm for all pci devices and bridge under the topology of Gfx Card root port. Added a library function to get the PCI root port ACPI D state and to print the pci card devices runtime pm status. v2: - Save pci dev power attrs to dynamically allocated array. [Rodrigo] - Set autosuspend delay to 0 on supported devices. [Rodrigo] - %s/else if/else in igt_pm_get_acpi_real_d_state. [Kamil] v3: - Add comment for MAX_PCI_DEVICES. [Badal] - Use static global array __pci_dev_pwrattr[]. [Rodrigo] - Use pci_slot_match iter. [Badal] - Destroy the iter. [Badal] v4: - Added igt_pm_enable_pci_card_autosuspend() to avoid any control attr save/restore by exit handler. [Rodrigo] v5: - Code refactoring to avoid code duplication. - Few function name changed. [Rodrigo] %s/igt_pm_enable_pci_card_autosuspend/igt_pm_enable_runtime_pm. %s/__igt_pm_setup_pci_card_runtime_pm/igt_pm_setup_pci_dev_power_attrs. %s/igt_pm_setup_power_attr/igt_pm_write_power_attr. v5: - %s/igt_pm_save_power_attr/igt_pm_read_power_attr/ - Added len argument to igt_pm_write_power_attr(). Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2020-05-18lib/igt_pm: Add lib func to get lpsp capabilityAnshuman Gupta
This lib function evaluate the lpsp capability from the connector specific debugfs attribute i915_lpsp_info. v2: - changed the lib function prefix igt_output_is_lpsp_capable to i915_output_is_lpsp_capable. [Martin] v3: - early return for the connector which doesn't support lpsp on any platform. v4: - debugfs entry changed from i915_lpsp_info to i915_lpsp_capability. v5: - return lpsp capability false if i915_lpsp_capability debugfs is not present. [Animesh] Reviewed-by: Animesh Manna <animesh.manna@intel.com> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
2020-01-31lib: Find the associated runtime-pm sysfs for the deviceChris Wilson
Remove the hardcoded path to the igfx (00:00:02.00) and instead pass in the fd of the DRM device we wish to control, and look up the associated device/power/ under sysfs. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
2019-10-11lib/igt_pm: dump runtime pm status on timeoutDon Hiatt
Display the runtime pm status if we timeout waiting for status. v2: Add helper to map runtime pm status enum to string. Signed-off-by: Don Hiatt <don.hiatt@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Vanshidhar Konda <vanshidhar.r.konda@intel.com>
2019-09-20lib/igt_pm: igt lib helper routines to support DC5/6 testsJyoti Yadav
This patch does the following changes to lib/igt_pm.c -dmc_loaded() will be used by new test i915_pm_dc.c which will validate Display C States. So moving the same to igt_pm library. -Introduced igt_disable_runtime_pm() in order to disable runtime suspend for the function which support dc9. -Changed the igt_pm_enable_sata_link_power_management() and igt_pm_restore_sata_link_power_management() in order to save and restore the sata link power policy by an exit handler. v2: Simplify the comment section. v3: Remove . from the subject line. v4: Rebased, resolve conflicts in pm_rpm.c Included patch set version change log. v5: Listing actual change in patch set changelog to make review easier. v6: igt's lib added support for disabling runtime suspend, change in commit log. rebased due to test name pm_rpm changed to i915_pm_rpm. v7: Addressed review comment by saving POWER_DIR values in igt_disable_runtime_pm(). [Imre] v8: Addressed the review comment, igt_pm_enable_sata_link_power_management function to restore the original SATA link power policy if things fail by using an exit handler. [Imre] v9: IGT failure fixture in i915_pm_backlight and i915_pm_rpm. v10:Review comment fixup in sata_link_power_management lib functions. [Imre] v11:Add igt_assert_fd(pm_status_fd) in igt_disable_runtime_pm(). [Imre & Petri] v12: Refactor igt_pm_pc8_plus_residencies_enabled() from supports_pc8_plus_residencies(). Changed igt_disable_runtime_pm() return type. [Imre] Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
2019-03-08lib/igt_pm: Avoid out-of-bounds reads and writesPetri Latvala
Read sizeof - 1 to buffers so null-termination stays in bounds. v2: Also clear the buffers before reusing (Chris). Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-09-05lib/pm: Fail gracefully if CONFIG_PM is not built into the kernelChris Wilson
We report the failure from igt_setup_runtime_pm() so that the caller can decide how they may proceed, so replace the hard assert with the error propagation. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Imre Deak <imre.deak@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
2018-09-04lib/pm: Increase snd module probe timeout to 10sChris Wilson
5s is often not enough for the sound module to finish loading, so bump the timeout to 10s. For fun, poll quicker over the first 1s! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.linux.com> Reviewed-by: Imre Deak <imre.deak@intel.linux.com>
2018-09-04lib/pm: Wait a little for sound module load to completeChris Wilson
Sometimes we may probe the sound module as it is still being registered and its debugfs not yet fully populated. If we do not find a file we expect to exist, sleep a little and check again. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107801 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.linux.com> Reviewed-by: Imre Deak <imre.deak@intel.linux.com>
2018-09-04lib/pm: Squelch warning for failing to enable audio powermanagementChris Wilson
It doesn't seem to be preventing rpm (see the pm_rpm tests) if we fail to enable runtime-powermanagement for audio, so reduce the warning to a debug. It will still be visible if it fails, but only if it fails. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
2018-08-17lib: Poll for snd_hda_intel discoveryChris Wilson
Loading the sounds modules is asynchronous with the sysfs device hierarchy being instantiated sometime after modprobe returns. As such while we are probing for the sound device, poll a few times to accommodate the async discovery. v2: closedir() after use Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
2018-08-02lib/igt_pm: Export function to restore runtime PM statusTvrtko Ursulin
In cases when runtime PM is enabled only from individual subtests and not whole tests it is usable to be able to restore the old runtime PM config and so avoid running subsequent subtests in an unexpected environment. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-08-02lib/igt_pm: Find HDA device when attempting to enable runtime PMTvrtko Ursulin
HDA audio device can be present at various PCI paths on different systems which the existing code did not account for. Furthermore the failure to enable runtime PM was silent leaving callers in the dark. Improve it by auto-locating the PCI path and logging a warning when something is not as expected. v2: * If there is no audio hw/driver there is no failure. v3: * Comment. * Skip non-symlinks. * Free path on failure and restore. * Simplify with asprintf. (Chris Wilson) v4: * Find snd_hda_intel instance tied with an Intel device. v5: * Fix memory leak and silence Valgrind warning. v6: * Fix error out logic. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-08-02lib/igt_pm: Make exit handlers signal safeTvrtko Ursulin
IGT logging helpers are not signal safe so avoid calling them from exit handlers. At the same time refactor the code a bit to enable following patches. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-03-05lib/igt_pm: Restore runtime pm state on test exitTvrtko Ursulin
Some tests (the ones which call igt_setup_runtime_pm and igt_pm_enable_audio_runtime_pm) change default system configuration and never restore it. The configured runtime suspend is aggressive and may influence behaviour of subsequent tests, so it is better to restore to previous values on test exit. This way system behaviour, with regards to a random sequence of executed tests, will be more consistent from one run to another. v2: Read failure means no runtime pm support so don't assert on it. v3: Install exit handler before the write to close the Ctrl^C race. (Imre) Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Imre Deak <imre.deak@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> # v2 Acked-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
2016-07-27lib: update docs for igt_pmDaniel Vetter
- Move all the pm helpers into igt_pm.c. No idea why that wasn't done in the original commit that created igt_pm.c. - Add missing docs where needed. Cc: David Weinehall <david.weinehall@intel.com> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-02-19lib/igt_pm: Lib for power managementDavid Weinehall
Move power management related code to a separate library. Initially this is done only for workarounds that apply to external components. Modify the users of such workarounds accordingly. This currently involves HD audio and SATA link power management. For SATA link PM there's also code to save the previous settings, to allow for resetting the values after we've finished testing. Signed-off-by: David Weinehall <david.weinehall@intel.com> Reviewed-by: Marius Vlad <marius.c.vlad@intel.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>