From: "Bernatowicz, Marcin" <marcin.bernatowicz@linux.intel.com>
To: Jakub Kolakowski <jakub1.kolakowski@intel.com>,
igt-dev@lists.freedesktop.org
Cc: Adam Miszczak <adam.miszczak@linux.intel.com>,
Lukasz Laguna <lukasz.laguna@intel.com>
Subject: Re: [PATCH i-g-t v2 1/2] lib/igt_pm: Introduce helper to check for PM capability
Date: Mon, 17 Mar 2025 10:12:41 +0100 [thread overview]
Message-ID: <9529ca23-b281-4178-b31e-fc70be6c848f@linux.intel.com> (raw)
In-Reply-To: <20250314112732.795523-2-jakub1.kolakowski@intel.com>
On 3/14/2025 12:27 PM, Jakub Kolakowski wrote:
> Introduce igt_has_pci_pm_capability(), a helper function to check
> whether a PCI device supports the PCI Power Management (PM) capability.
> With this helper one can make sure the capability is present on device
> under test before proceeding with any actions related to PM.
>
> Cc: Adam Miszczak <adam.miszczak@linux.intel.com>
> Cc: Lukasz Laguna <lukasz.laguna@intel.com>
> Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
> Signed-off-by: Jakub Kolakowski <jakub1.kolakowski@intel.com>
> ---
> lib/igt_pm.c | 18 ++++++++++++++++++
> lib/igt_pm.h | 1 +
> 2 files changed, 19 insertions(+)
>
> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
> index 1a5d9c42b..dd37f20f6 100644
> --- a/lib/igt_pm.c
> +++ b/lib/igt_pm.c
> @@ -45,6 +45,7 @@
> #include "igt_pm.h"
> #include "igt_aux.h"
> #include "igt_sysfs.h"
> +#include "igt_pci.h"
>
> /**
> * SECTION:igt_pm
> @@ -81,6 +82,7 @@ enum {
> #define MAX_POLICY_STRLEN strlen(MAX_PERFORMANCE_STR)
> /* Root Port bus can have max 32 dev and each dev can have max 8 func */
> #define MAX_PCI_DEVICES 256
> +#define PCI_PM_CAP_ID 0x01
> int8_t *__sata_pm_policies;
> int __scsi_host_cnt;
>
> @@ -1470,3 +1472,19 @@ void igt_pm_ignore_slpc_efficient_freq(int i915, int gtfd, bool val)
> igt_require(igt_sysfs_has_attr(gtfd, "slpc_ignore_eff_freq"));
> igt_sysfs_set_u32(gtfd, "slpc_ignore_eff_freq", val);
> }
> +
> +
> +/**
> + * igt_has_pci_pm_capability:
> + * @dev: pci device
The function uses pci_dev as the parameter name, but the documentation
refers to it as @dev, make it consistent.
> + *
> + * Returns: true if the device has PCI Power Management capability, false otherwise.
> + */
> +bool igt_has_pci_pm_capability(struct pci_device *pci_dev)
> +{
> + int offset;
> +
> + offset = find_pci_cap_offset(pci_dev, PCI_PM_CAP_ID);
> +
trailing whitespace
> + return (offset > 0);
> +}
> \ No newline at end of file
> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
> index 6b428f53e..c73972f2a 100644
> --- a/lib/igt_pm.h
> +++ b/lib/igt_pm.h
> @@ -97,5 +97,6 @@ uint64_t 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);
> +bool igt_has_pci_pm_capability(struct pci_device *pci_dev);
>
> #endif /* IGT_PM_H */
With documentation updated and trailing whitespace removed,
Reviewed-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
next prev parent reply other threads:[~2025-03-17 9:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 11:27 [PATCH i-g-t v2 0/2] Add a check for power management PCI capability Jakub Kolakowski
2025-03-14 11:27 ` [PATCH i-g-t v2 1/2] lib/igt_pm: Introduce helper to check for PM capability Jakub Kolakowski
2025-03-17 9:12 ` Bernatowicz, Marcin [this message]
2025-03-17 16:56 ` Kamil Konieczny
2025-03-14 11:27 ` [PATCH i-g-t v2 2/2] tests/intel/xe_pm: Add a check for power management capability Jakub Kolakowski
2025-03-17 9:17 ` Bernatowicz, Marcin
2025-03-14 22:49 ` ✓ Xe.CI.BAT: success for Add a check for power management PCI capability (rev3) Patchwork
2025-03-14 23:15 ` ✓ i915.CI.BAT: " Patchwork
2025-03-15 7:30 ` ✗ Xe.CI.Full: failure " Patchwork
2025-03-15 10:38 ` ✗ i915.CI.Full: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9529ca23-b281-4178-b31e-fc70be6c848f@linux.intel.com \
--to=marcin.bernatowicz@linux.intel.com \
--cc=adam.miszczak@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jakub1.kolakowski@intel.com \
--cc=lukasz.laguna@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox