| Top |
| #define | IGT_INTEL_PACKAGE_CSTATE_PATH |
| #define | IGT_INTEL_CHECK_DC5 |
| #define | IGT_INTEL_CHECK_DC6 |
| #define | IGT_INTEL_CHECK_DC3CO |
| enum | igt_runtime_pm_status |
| enum | igt_acpi_d_state |
| struct | igt_pm_pci_dev_pwrattr |
| struct | igt_device_card |
This library provides various helpers to enable power management for, and in some cases subsequently allow restoring the old behaviour of, various external components that by default are set up in a way that interferes with the testing of our power management functionality.
void
igt_pm_enable_audio_runtime_pm (void);
We know that if we don't enable audio runtime PM, snd_hda_intel will never release its power well refcount, and we'll never reach the LPSP state. There's no guarantee that it will release the power well if we enable runtime PM, but at least we can try.
We don't have any assertions on open since the user may not even have snd_hda_intel loaded, which is not a problem.
void
igt_pm_enable_sata_link_power_management
(void);
Enables the min_power policy for SATA link power management. Without this we cannot reach deep runtime power states.
void
igt_pm_restore_sata_link_power_management
(void);
Restores the link power management policies to the values prior to enabling min_power.
Caveat: If the system supports hotplugging and hotplugging takes place during our testing so that the hosts change numbers we might restore the settings to the wrong hosts.
bool
igt_setup_runtime_pm (int device);
Sets up the runtime PM helper functions and enables runtime PM. To speed up tests the autosuspend delay is set to 0.
Return: True if runtime pm is available, false otherwise.
void
igt_disable_runtime_pm (void);
Disables the runtime pm for i915 device. igt_disable_runtime_pm assumes that igt_setup_runtime_pm has already called to save runtime autosuspend and control attributes.
void
igt_restore_runtime_pm (void);
Restores the runtime PM configuration as it was before the call to igt_setup_runtime_pm.
enum igt_runtime_pm_status
igt_get_runtime_pm_status (void);
Return: The current runtime PM status.
bool
igt_wait_for_pm_status (enum igt_runtime_pm_status status);
Waits until for the driver to switch to into the desired runtime PM status, with a 10 second timeout.
Return: True if the desired runtime PM status was attained, false if the operation timed out.
bool
igt_pm_dmc_loaded (int debugfs);
Check whether DMC FW is loaded or not. DMC FW is require for few Display C states like DC5 and DC6. FW does the Context Save and Restore during Display C States entry and exit.
Return: True if DMC FW is loaded otherwise false.
bool
igt_pm_pc8_plus_residencies_enabled (int msr_fd);
Check whether BIOS has disabled the PC8 package deeper state.
Return: True if PC8+ package deeper state enabled on machine otherwise false.
bool i915_output_is_lpsp_capable (int drm_fd,igt_output_t *output);
Checks LPSP capability for a given output.
Return: True if given output is LPSP capable otherwise false.
int
igt_pm_get_pcie_acpihp_slot (struct pci_device *pci_dev);
Gets PCI bridge acpi hotplug slot number, if bridge's ACPI firmware_node handle supports _SUN method.
Return: PCIe bridge Slot number or -ENOENT number in case firmware_node/sun is not supported by the bridge.
bool
igt_pm_acpi_d3cold_supported (struct pci_device *pci_dev);
Checks ACPI D3Cold support.
Return: True if ACPI D3Cold supported otherwise false.
enum igt_acpi_d_state
igt_pm_get_acpi_real_d_state (struct pci_device *pci_dev);
Gets ACPI D state for a given root port.
Return: igt_acpi_d_state state.
int
igt_pm_get_autosuspend_delay (struct pci_device *pci_dev);
Return: The autosuspend delay time in milliseconds.
void igt_pm_set_autosuspend_delay (struct pci_device *pci_dev,int delay_ms);
Sets the autosuspend delay value for the PCI device through.
void igt_pm_enable_pci_card_runtime_pm (struct pci_device *root,struct pci_device *i915);
Enables runtime PM for all PCI endpoints devices for a given root port by setting power/control attr to "auto" and setting autosuspend_delay_ms to zero.
void igt_pm_get_d3cold_allowed (const char *pci_slot_name,uint32_t *value);
Reads the value of d3cold_allowed attribute of the PCI device.
void igt_pm_set_d3cold_allowed (const char *pci_slot_name,uint32_t value);
Writes the value to d3cold_allowed attribute of PCI device.
void
igt_pm_setup_pci_card_runtime_pm (struct pci_device *pci_dev);
Setup runtime PM for all PCI endpoints devices for a given root port by enabling runtime suspend and setting autosuspend_delay_ms to zero. It also saves and restore power control attribute for all PCI endpoints devices under given root port.
void
igt_pm_restore_pci_card_runtime_pm (void);
Restores control and autosuspend_delay_ms power attribute for all
PCI endpoints devices under gfx root port, which were saved earlier
by igt_pm_setup_pci_card_runtime_pm().
void
igt_pm_print_pci_card_runtime_status (void);
Prints runtime suspend status for all PCI endpoints devices for a given root port.
bool i915_is_slpc_enabled_gt (int drm_fd,int gt);
Return: True if SLPC is enabled on a given gt
.
bool
i915_is_slpc_enabled (int drm_fd);
Return: True if SLPC is enabled on the device.
uint64_t
igt_pm_get_runtime_suspended_time (struct pci_device *pci_dev);
Return: The total time in milliseconds that the device has been suspended.
uint64_t
igt_pm_get_runtime_active_time (struct pci_device *pci_dev);
Return: The total time in milliseconds that the device has been active.
int
igt_pm_get_runtime_usage (struct pci_device *pci_dev);
Return: The runtime PM usage count of a device.
bool
igt_pm_has_wakeup_support (struct pci_device *pci_dev);
The power/wakeup* sysfs attributes only exist for devices the PM core
considers wakeup capable, so their presence is the check for whether wakeup
source accounting is available at all for pci_dev
.
void igt_pm_set_wakeup_enabled (struct pci_device *pci_dev,bool enable);
Writes power/wakeup. The original value is saved on the first call and
restored by an exit handler, or explicitly via igt_pm_restore_wakeup().
Enabling wakeup on a device that has it disabled makes the PM core create a new wakeup source, so all power/wakeup_* counters restart from 0. Callers that sample those counters must take a fresh baseline after this call. Enabling it when already enabled keeps the existing wakeup source and its counters.
Callers must gate on igt_pm_has_wakeup_support() first.
void
igt_pm_restore_wakeup (void);
Restores power/wakeup to the value it had before the first
igt_pm_set_wakeup_enabled() call. Does nothing if it was never changed.
As with igt_pm_set_wakeup_enabled(), restoring an enabled value onto a
disabled device restarts the power/wakeup_* counters from 0.
int64_t
igt_pm_get_wakeup_active_count (struct pci_device *pci_dev);
Reads power/wakeup_active_count, the number of times the device's wakeup source was activated. An increment across a runtime suspended window means the resume was signalled by the device, i.e. a PME arrived, rather than initiated by something host side such as HPD polling.
Use this and not power/wakeup_count, which is only incremented under events_check_enabled and so never moves for a runtime resume.
The count only exists while the device has a wakeup source, i.e. while
power/wakeup is enabled, and restarts from 0 each time one is created. See
igt_pm_set_wakeup_enabled().
Return: the wakeup active count, or -1 if the device is not wakeup capable, has power/wakeup disabled, or the count could not be read.
void igt_pm_ignore_slpc_efficient_freq (int i915,int gtfd,bool val);
Ignores/un-ignores SLPC efficient frequency.
bool igt_pm_pci_pme_supported (struct pci_device *pci_dev,enum igt_acpi_d_state state);
Reads the PME_Support field (bits [15:11]) of the PCI Power Management
Capabilities (PMC) register and reports whether the device is able to
generate a Power Management Event from state
.
PME support is advertised per D state, so a device may be able to signal from D3hot but not from D3cold. Query the state the device is expected to suspend into.
int
igt_pm_pci_pme_enabled (struct pci_device *pci_dev);
Reads PME_En (bit 8) of the PCI Power Management Control/Status (PMCS) register, i.e. whether the device is armed to generate PMEs.
The PCI/PM core sets this on suspend if the device can generate a PME from the state it is suspending into, but a driver may also arm PME itself from its own suspend hook, in which case the driver's own conditions apply.
int
igt_pm_pci_pme_status (struct pci_device *pci_dev);
Reads PME_Status (bit 15) of the PCI Power Management Control/Status (PMCS) register, i.e. whether the device has a PME pending.
The bit is write-1-to-clear and the device does not clear it itself. It stays set from the moment the device signals a PME until software acknowledges it, which the PCI/PM core does when it handles the PME. So finding it still set on a device that is still suspended means the device did signal but the platform never delivered the PME, whereas finding it clear means the device never signalled at all.
enum igt_acpi_d_state
igt_pm_pci_get_d_state (struct pci_device *pci_dev);
Reads the PowerState field (bits [1:0]) of the PCI Power Management Control/Status (PMCS) register, i.e. the D state as reported by the device.
PMCS can only express D0-D3hot, and a device in D3cold cannot answer config space reads at all. So if the kernel's power_state attribute reports D3cold, that is returned instead, without touching config space and so without resuming the device.
void
igt_pm_dpms_toggle (igt_output_t *output);
Toggles the DPMS state of output to OFF and then back ON.
uint32_t
igt_get_dc_counter (const char *dc_data);
Returns the counter value as uint32_t
uint32_t igt_read_dc_counter (int debugfs_fd,int dc_flag);
Returns current counter value for the specified DC state
bool igt_dc_state_wait_entry (int debugfs_fd,int dc_flag,int prev_dc_count);
Returns true if DC state entry detected within timeout, false otherwise
const char *
igt_dc_state_name (int dc_flag);
Converts DC state flag constants to readable string names
void igt_require_dc_counter (int debugfs_fd,int dc_flag);
Skips the current test if the requested DC counter is not available on the system.
unsigned int
igt_read_pkgc_counter (int debugfs_root_fd);
Returns PC10 counter value.
int
igt_pm_disable_cpu_deep_sleep (void);
Disables deep CPU idle states (C-states) to prevent IRQ latency spikes during vblank events. This is a system-wide operation that affects all CPUs.
Disables state1 and deeper states while keeping state0 (WFI) unchanged to ensure stable vblank timing.
int
igt_pm_enable_cpu_deep_sleep (void);
Re-enables deep CPU idle states (C-states) that were previously disabled
by igt_pm_disable_cpu_deep_sleep(). This restores power-saving idle states.