diff options
author | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2024-05-22 10:33:25 -0400 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2024-05-22 12:40:16 -0400 |
commit | ead9b5f8a4aba5b7556c0e1d9e0871fa07a065c7 (patch) | |
tree | 097863fc8590c91d753367825c6bd8f46e37117d /lib | |
parent | fb027c7a11b77ea2bc9747f5d796cb123d383a23 (diff) |
tests/intel/xe_pm: Update runtime pm conditions
Xe is no longer holding a runtime pm reference for the life
of a VM or exec_queue.
Also, IGT changes autosuspend time to a minimal time, so we
cannot guarantee that rpm is still suspended after the execution
has finished.
So, the reference usage is not a reliable reference.
Hence, start using runtime_active_time as the indicator
that runtime_pm resumed upon our actions.
v2: Usage of runtime_active_pm and inclusion of mmap tests.
v3: Add doc for the exported lib function (Kamil)
v4: Use uint64_t for active_time, which is a big number in
milliseconds. (Kamil)
v5: Used PRInt macros instead of %ld (Kamil)
Tell what unit of time is returned. (Kamil)
v6: s/miliseconds/millisenconds (Francois)
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: Badal Nilawar <badal.nilawar@intel.com>
Cc: Anshuman Gupta <anshuman.gupta@intel.com>
Cc: Francois Dugast <francois.dugast@intel.com>
Reviewed-by: Francois Dugast <francois.dugast@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_pm.c | 25 | ||||
-rw-r--r-- | lib/igt_pm.h | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/igt_pm.c b/lib/igt_pm.c index fe7692960..cb18a88b9 100644 --- a/lib/igt_pm.c +++ b/lib/igt_pm.c @@ -1413,6 +1413,31 @@ int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev) } /** + * igt_pm_get_runtime_active_time: + * @pci_dev: PCI device struct + * + * Return: The total time in milliseconds that the device has been active. + */ +uint64_t igt_pm_get_runtime_active_time(struct pci_device *pci_dev) +{ + char time_str[64]; + int time_fd; + uint64_t time; + + time_fd = igt_pm_get_power_attr_fd_rdonly(pci_dev, "runtime_active_time"); + if (igt_pm_read_power_attr(time_fd, time_str, 64, false)) { + igt_assert(sscanf(time_str, "%ld", &time) > 0); + + igt_debug("runtime active time for PCI '%04x:%02x:%02x.%01x' = %" PRIu64 "\n", + pci_dev->domain, pci_dev->bus, pci_dev->dev, pci_dev->func, time); + + return time; + } + + return -1; +} + +/** * igt_pm_get_runtime_usage: * @pci_dev: pci device * diff --git a/lib/igt_pm.h b/lib/igt_pm.h index 91ee05cd1..15e301533 100644 --- a/lib/igt_pm.h +++ b/lib/igt_pm.h @@ -94,6 +94,7 @@ void igt_pm_print_pci_card_runtime_status(void); bool i915_is_slpc_enabled_gt(int drm_fd, int gt); bool i915_is_slpc_enabled(int drm_fd); int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev); +uint64_t igt_pm_get_runtime_active_time(struct pci_device *pci_dev); int igt_pm_get_runtime_usage(struct pci_device *pci_dev); void igt_pm_ignore_slpc_efficient_freq(int i915, int gtfd, bool val); |