Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t v4 3/8] lib/igt_pm: Add a helper to query the runtime_usage.
Date: Tue, 7 Mar 2023 10:18:03 +0100	[thread overview]
Message-ID: <20230307101803.3a10b251@maurocar-mobl2> (raw)
In-Reply-To: <20230302110947.548610-4-zbigniew.kempczynski@intel.com>

On Thu,  2 Mar 2023 12:09:42 +0100
Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> wrote:

> From: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> It will be useful so the tests can assert the expected
> usage counter movement depending on the operation.
> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>

Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org>

> ---
>  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 6c84e94f63..704acf7d14 100644
> --- a/lib/igt_pm.c
> +++ b/lib/igt_pm.c
> @@ -1363,3 +1363,21 @@ int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
>  
>  	return -1;
>  }
> +
> +/**
> + * igt_pm_get_runtime_usage:
> + * @pci_dev: pci device
> + *
> + * Reports the runtime PM usage count of a device.
> + */
> +int igt_pm_get_runtime_usage(struct pci_device *pci_dev)
> +{
> +	char usage_str[64];
> +	int usage, fd;
> +
> +	fd = igt_pm_get_power_attr_fd_rdonly(pci_dev, "runtime_usage");
> +	if (igt_pm_read_power_attr(fd, usage_str, 64, true))
> +		igt_assert(sscanf(usage_str, "%d", &usage) > 0);
> +
> +	return usage;
> +}
> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
> index f65b960c38..d0d6d673e8 100644
> --- a/lib/igt_pm.h
> +++ b/lib/igt_pm.h
> @@ -86,5 +86,6 @@ void igt_pm_restore_pci_card_runtime_pm(void);
>  void igt_pm_print_pci_card_runtime_status(void);
>  bool i915_is_slpc_enabled(int fd);
>  int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
> +int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
>  
>  #endif /* IGT_PM_H */

  reply	other threads:[~2023-03-07  9:18 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 11:09 [igt-dev] [PATCH i-g-t v4 0/8] Initial Xe test suite Zbigniew Kempczyński
2023-03-02 11:09 ` [igt-dev] [PATCH i-g-t v4 1/8] drm-uapi/xe_drm: Add Xe uAPI Zbigniew Kempczyński
2023-03-07  9:16   ` Mauro Carvalho Chehab
2023-03-07  9:21     ` Mauro Carvalho Chehab
2023-03-02 11:09 ` [igt-dev] [PATCH i-g-t v4 2/8] lib/xe: Introduce Xe library Zbigniew Kempczyński
2023-03-07  9:17   ` Mauro Carvalho Chehab
2023-03-02 11:09 ` [igt-dev] [PATCH i-g-t v4 3/8] lib/igt_pm: Add a helper to query the runtime_usage Zbigniew Kempczyński
2023-03-07  9:18   ` Mauro Carvalho Chehab [this message]
2023-03-02 11:09 ` [igt-dev] [PATCH i-g-t v4 4/8] tests/xe: Add Xe IGT tests Zbigniew Kempczyński
2023-03-02 11:09 ` [igt-dev] [PATCH i-g-t v4 5/8] tools/xe_reg: Add Xe register read/write tool Zbigniew Kempczyński
2023-03-02 11:09 ` [igt-dev] [PATCH i-g-t v4 6/8] intel-ci/xe-fast-feedback: Introduce xe-fast-feedback list Zbigniew Kempczyński
2023-03-02 11:09 ` [igt-dev] [PATCH i-g-t v4 7/8] docs/testplan: Introduce new way for documenting IGT Zbigniew Kempczyński
2023-03-07  9:18   ` Mauro Carvalho Chehab
2023-03-02 11:09 ` [igt-dev] [PATCH i-g-t v4 8/8] runner/job_list: return error on crashes while running --list-subtests Zbigniew Kempczyński
2023-03-07  9:19   ` Mauro Carvalho Chehab
2023-03-02 11:26 ` [igt-dev] ✗ GitLab.Pipeline: warning for Initial Xe test suite (rev4) Patchwork
2023-03-02 11:39 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-03-06  9:33 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20230307101803.3a10b251@maurocar-mobl2 \
    --to=mauro.chehab@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=zbigniew.kempczynski@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