Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Manszewski, Christoph" <christoph.manszewski@intel.com>
To: Dominik Grzegorzek <dominik.grzegorzek@intel.com>,
	igt-dev@lists.freedesktop.org
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Subject: Re: [PATCH i-g-t 1/2] lib/xe/xe_util: introduce helper for enabling ccs mode
Date: Fri, 17 Jan 2025 14:07:48 +0100	[thread overview]
Message-ID: <e2c35d58-f033-45a9-8d95-1c90ed60d0e7@intel.com> (raw)
In-Reply-To: <20241216131137.50945-1-dominik.grzegorzek@intel.com>

Hi Dominik,

On 16.12.2024 14:11, Dominik Grzegorzek wrote:
> From: Andrzej Hajda <andrzej.hajda@intel.com>
> 
> Multiple tests will require enabled ccs mode. Add special helper to
> avoid code duplication.
> 
> Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
> ---
>   lib/xe/xe_util.c | 31 +++++++++++++++++++++++++++++++
>   lib/xe/xe_util.h |  1 +
>   2 files changed, 32 insertions(+)
> 
> diff --git a/lib/xe/xe_util.c b/lib/xe/xe_util.c
> index 9482819c2..f7ae19f08 100644
> --- a/lib/xe/xe_util.c
> +++ b/lib/xe/xe_util.c
> @@ -302,3 +302,34 @@ int xe_gt_count_engines_by_class(int fd, int gt, int class)
>   
>   	return n;
>   }
> +
> +/**
> + * xe_sysfs_enable_ccs_mode:
> + * @fd: pointer to xe drm fd, can reopened multiple times
> + *
> + * Enables ccs_mode on all GTs, it must succeed for at least one GT.
> + * Since function requires the driver to be closed during ccs_mode change
> + * @fd will be closed then re-opened.
> + */
> +void xe_sysfs_enable_ccs_mode(int *fd)
> +{
> +	int gt, gt_fd, num_slices, ccs_mode, num_gt, enabled_count = 0;
> +
> +	num_gt = xe_number_gt(*fd);
> +
> +	for (gt = 0; gt < num_gt; gt++) {
> +		gt_fd = xe_sysfs_gt_open(*fd, gt);
> +		drm_close_driver(*fd);

Why not outside the loop?

Thanks,
Christoph

> +
> +		if (!igt_debug_on(igt_sysfs_scanf(gt_fd, "num_cslices", "%u", &num_slices) <= 0) &&
> +		    !igt_debug_on(igt_sysfs_printf(gt_fd, "ccs_mode", "%u", num_slices) <= 0) &&
> +		    !igt_debug_on(igt_sysfs_scanf(gt_fd, "ccs_mode", "%u", &ccs_mode) <= 0) &&
> +		    !igt_debug_on(num_slices != ccs_mode))
> +			enabled_count++;
> +		close(gt_fd);
> +		*fd = drm_open_driver(DRIVER_XE);
> +	}
> +
> +	if (!enabled_count)
> +		igt_require_f(0, "Cannot enable ccs mode for any GT\n");
> +}
> diff --git a/lib/xe/xe_util.h b/lib/xe/xe_util.h
> index b9fbfc5cd..a82c44a2a 100644
> --- a/lib/xe/xe_util.h
> +++ b/lib/xe/xe_util.h
> @@ -53,5 +53,6 @@ int xe_gt_fill_engines_by_class(int fd, int gt, int class,
>   				struct drm_xe_engine_class_instance eci[static XE_MAX_ENGINE_INSTANCE]);
>   int xe_gt_count_engines_by_class(int fd, int gt, int class);
>   
> +void xe_sysfs_enable_ccs_mode(int *fd);
>   
>   #endif /* XE_UTIL_H */

  parent reply	other threads:[~2025-01-17 13:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16 13:11 [PATCH i-g-t 1/2] lib/xe/xe_util: introduce helper for enabling ccs mode Dominik Grzegorzek
2024-12-16 13:11 ` [PATCH i-g-t 2/2] tests/xe_eudebug: Use library helper to enable ccs_mode Dominik Grzegorzek
2024-12-17  9:34   ` Hajda, Andrzej
2024-12-16 20:15 ` ✓ i915.CI.BAT: success for series starting with [i-g-t,1/2] lib/xe/xe_util: introduce helper for enabling ccs mode Patchwork
2024-12-16 20:55 ` ✓ Xe.CI.BAT: " Patchwork
2024-12-16 23:06 ` ✗ Xe.CI.Full: failure " Patchwork
2024-12-17  4:32 ` ✗ i915.CI.Full: " Patchwork
2025-01-17 13:07 ` Manszewski, Christoph [this message]
2025-01-17 13:18   ` [PATCH i-g-t 1/2] " Manszewski, Christoph
2025-01-20 12:49     ` Kamil Konieczny

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=e2c35d58-f033-45a9-8d95-1c90ed60d0e7@intel.com \
    --to=christoph.manszewski@intel.com \
    --cc=andrzej.hajda@intel.com \
    --cc=dominik.grzegorzek@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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