Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Anirban, Sk" <sk.anirban@intel.com>
To: Vinay Belgaumkar <vinay.belgaumkar@intel.com>,
	<intel-gfx@lists.freedesktop.org>,
	<igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH v2 i-g-t 1/2] lib/xe_gt: Add function to toggle efficient freq
Date: Thu, 3 Dec 2026 23:08:27 +0530	[thread overview]
Message-ID: <eaadf3ef-9dc3-4536-86e8-2641366e955d@intel.com> (raw)
In-Reply-To: <20261113021149.3941522-3-vinay.belgaumkar@intel.com>

Hi Vinay,

On 13-11-2026 07:41, Vinay Belgaumkar wrote:
> This writes to the use_rpe sysfs interface to toggle the use
> of GT efficient frequency. The KMD patch that introduces this
> sysfs is at: https://patchwork.freedesktop.org/series/178352/
>
> v2: Address review comments (Anirban)
>
> Cc: Sk Anirban <sk.anirban@intel.com>
> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> ---
>   lib/xe/xe_gt.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++
>   lib/xe/xe_gt.h |  2 ++
>   2 files changed, 61 insertions(+)
>
> diff --git a/lib/xe/xe_gt.c b/lib/xe/xe_gt.c
> index 1f0b77986..6f33df890 100644
> --- a/lib/xe/xe_gt.c
> +++ b/lib/xe/xe_gt.c
> @@ -345,6 +345,65 @@ int xe_gt_set_freq(int fd, int gt_id, const char *freq_name, uint32_t freq)
>   	return ret;
>   }
>   
> +/**
> + * xe_gt_set_use_rpe:
> + * @fd: pointer to xe drm fd
The Xe DRM file descriptor.
> + * @gt_id: GT id
> + * @val: Value to set use_rpe
> + *
> + * Set use_rpe. Function will assert if the sysfs node is
> + * not found.
There is no assert for the sysfs node operation in the set function.
> + *
> + * Return: success or failure
> + */
> +int xe_gt_set_use_rpe(int fd, int gt_id, uint32_t val)
> +{
> +	int ret = -EAGAIN;
> +	int gt_fd;
> +
> +	gt_fd = xe_sysfs_gt_open(fd, gt_id);
> +	igt_assert_lte(0, gt_fd);
> +
> +	while (ret == -EAGAIN)
> +		ret = igt_sysfs_printf(gt_fd, "freq0/use_rpe", "%u", val);
Better if we limit the retry limit here.
> +
> +	close(gt_fd);
> +
> +	return ret;
> +}
> +
> +/**
> + * xe_gt_get_use_rpe:
> + * @fd: pointer to xe drm fd
same
> + * @gt_id: GT id
> + *
> + * Get use_rpe. Function will assert if the sysfs node is
> + * not found.
> + *
> + * Return: use_rpe value
> + */
> +uint32_t xe_gt_get_use_rpe(int fd, int gt_id)
> +{
> +	int err = -EAGAIN;
> +	int gt_fd;
> +	uint32_t use_rpe;
> +
> +	igt_debug("Opening attr: %s\n", "freq0/rpe");
It should be freq0/use_rpe also I feel sassing a fixed string through %s 
is not required.
> +	gt_fd = xe_sysfs_gt_open(fd, gt_id);
> +	igt_assert_lte(0, gt_fd);
> +
> +	while (err == -EAGAIN)
> +		err = igt_sysfs_scanf(gt_fd, "freq0/use_rpe", "%u", &use_rpe);

igt_sysfs_scanf never returns -EAGAIN so the loop will be executed only 
once in all the cases.

Thanks,
Anirban

> +
> +	igt_assert_eq(err, 1);
> +
> +	igt_debug("gt%d: use_rpe %u\n", gt_id, use_rpe);
> +
> +	close(gt_fd);
> +
> +	return use_rpe;
> +}
> +
>   /**
>    * xe_gt_get_freq:
>    * @fd: pointer to xe drm fd
> diff --git a/lib/xe/xe_gt.h b/lib/xe/xe_gt.h
> index 9ef15d7dd..7f824ca63 100644
> --- a/lib/xe/xe_gt.h
> +++ b/lib/xe/xe_gt.h
> @@ -29,4 +29,6 @@ int xe_gt_count_engines_by_class(int fd, int gt, int class);
>   
>   int xe_gt_set_freq(int fd, int gt_id, const char *freq_name, uint32_t freq);
>   uint32_t xe_gt_get_freq(int fd, int gt_id, const char *freq_name);
> +uint32_t xe_gt_get_use_rpe(int fd, int gt_id);
> +int xe_gt_set_use_rpe(int fd, int gt_id, uint32_t val);
>   #endif

  parent reply	other threads:[~2026-12-03 17:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  2:11 [PATCH v2 i-g-t 1/2] lib/xe_gt: Add function to toggle efficient freq Vinay Belgaumkar
2026-11-13  2:11 ` [PATCH v2 i-g-t 2/2] tests/xe_gt_freq: Disable efficient freq using sysfs Vinay Belgaumkar
2026-12-03 18:02   ` Anirban, Sk
2026-11-13  3:38 ` ✓ Xe.CI.BAT: success for series starting with [v2,i-g-t,1/2] lib/xe_gt: Add function to toggle efficient freq Patchwork
2026-11-13  3:57 ` ✓ i915.CI.BAT: " Patchwork
2026-11-13 16:44 ` ✓ Xe.CI.FULL: " Patchwork
2026-11-14  8:06 ` ✗ i915.CI.Full: failure " Patchwork
2026-11-17 14:19 ` [PATCH v2 i-g-t 1/2] " Kamil Konieczny
2026-11-19  0:15   ` Belgaumkar, Vinay
2026-12-03 17:38 ` Anirban, Sk [this message]
2026-12-03 22:37   ` Belgaumkar, Vinay

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=eaadf3ef-9dc3-4536-86e8-2641366e955d@intel.com \
    --to=sk.anirban@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=vinay.belgaumkar@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