Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Riana Tauro <riana.tauro@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <anshuman.gupta@intel.com>,
	<umesh.nerlige.ramappa@intel.com>, <vinay.belgaumkar@intel.com>,
	<aravind.iddamsetty@intel.com>, <john.c.harrison@intel.com>,
	<ashutosh.dixit@intel.com>, <soham.purkait@intel.com>
Subject: Re: [PATCH 4/7] drm/xe: add function to convert xe hw engine class to user class
Date: Thu, 14 Nov 2024 12:46:31 -0500	[thread overview]
Message-ID: <ZzY3d-NLOzlOsS5E@intel.com> (raw)
In-Reply-To: <20241113045549.2390980-5-riana.tauro@intel.com>

On Wed, Nov 13, 2024 at 10:25:46AM +0530, Riana Tauro wrote:
> add a function to convert xe hw engine class to
> user engine class

a bit of why would be desired here.

I noticed that it is now used by patch 7 on PMU, but some words
here would be better.

> 
> Signed-off-by: Riana Tauro <riana.tauro@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_hw_engine.c | 25 +++++++++++++++++++++++++
>  drivers/gpu/drm/xe/xe_hw_engine.h |  1 +
>  drivers/gpu/drm/xe/xe_query.c     | 12 ++----------
>  3 files changed, 28 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
> index 1557acee3523..ba40f2692f34 100644
> --- a/drivers/gpu/drm/xe/xe_hw_engine.c
> +++ b/drivers/gpu/drm/xe/xe_hw_engine.c
> @@ -981,6 +981,31 @@ const char *xe_hw_engine_class_to_str(enum xe_engine_class class)
>  	return NULL;
>  }
>  
> +/**
> + * xe_hw_engine_to_user_class - converts xe hw engine to user engine class
> + * @engine_class: hw engine class
> + *
> + * Returns: user engine class on success, -1 on error
> + */
> +u16 xe_hw_engine_to_user_class(enum xe_engine_class engine_class)
> +{
> +	switch (engine_class) {
> +	case XE_ENGINE_CLASS_RENDER:
> +		return DRM_XE_ENGINE_CLASS_RENDER;
> +	case XE_ENGINE_CLASS_COPY:
> +		return DRM_XE_ENGINE_CLASS_COPY;
> +	case XE_ENGINE_CLASS_VIDEO_DECODE:
> +		return DRM_XE_ENGINE_CLASS_VIDEO_DECODE;
> +	case XE_ENGINE_CLASS_VIDEO_ENHANCE:
> +		return DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE;
> +	case XE_ENGINE_CLASS_COMPUTE:
> +		return DRM_XE_ENGINE_CLASS_COMPUTE;
> +	default:
> +		XE_WARN_ON(engine_class);
> +		return -1;
> +	}
> +}
> +
>  u64 xe_hw_engine_read_timestamp(struct xe_hw_engine *hwe)
>  {
>  	return xe_mmio_read64_2x32(&hwe->gt->mmio, RING_TIMESTAMP(hwe->mmio_base));
> diff --git a/drivers/gpu/drm/xe/xe_hw_engine.h b/drivers/gpu/drm/xe/xe_hw_engine.h
> index da0a6922a26f..3aca7751a482 100644
> --- a/drivers/gpu/drm/xe/xe_hw_engine.h
> +++ b/drivers/gpu/drm/xe/xe_hw_engine.h
> @@ -74,6 +74,7 @@ static inline bool xe_hw_engine_is_valid(struct xe_hw_engine *hwe)
>  
>  const char *xe_hw_engine_class_to_str(enum xe_engine_class class);
>  u64 xe_hw_engine_read_timestamp(struct xe_hw_engine *hwe);
> +u16 xe_hw_engine_to_user_class(enum xe_engine_class engine_class);
>  enum xe_force_wake_domains xe_hw_engine_to_fw_domain(struct xe_hw_engine *hwe);
>  
>  void xe_hw_engine_mmio_write32(struct xe_hw_engine *hwe, struct xe_reg reg, u32 val);
> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
> index 170ae72d1a7b..98b036678eee 100644
> --- a/drivers/gpu/drm/xe/xe_query.c
> +++ b/drivers/gpu/drm/xe/xe_query.c
> @@ -26,14 +26,6 @@
>  #include "xe_ttm_vram_mgr.h"
>  #include "xe_wa.h"
>  
> -static const u16 xe_to_user_engine_class[] = {
> -	[XE_ENGINE_CLASS_RENDER] = DRM_XE_ENGINE_CLASS_RENDER,
> -	[XE_ENGINE_CLASS_COPY] = DRM_XE_ENGINE_CLASS_COPY,
> -	[XE_ENGINE_CLASS_VIDEO_DECODE] = DRM_XE_ENGINE_CLASS_VIDEO_DECODE,
> -	[XE_ENGINE_CLASS_VIDEO_ENHANCE] = DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE,
> -	[XE_ENGINE_CLASS_COMPUTE] = DRM_XE_ENGINE_CLASS_COMPUTE,
> -};
> -
>  static const enum xe_engine_class user_to_xe_engine_class[] = {
>  	[DRM_XE_ENGINE_CLASS_RENDER] = XE_ENGINE_CLASS_RENDER,
>  	[DRM_XE_ENGINE_CLASS_COPY] = XE_ENGINE_CLASS_COPY,
> @@ -206,7 +198,7 @@ static int query_engines(struct xe_device *xe,
>  				continue;
>  
>  			engines->engines[i].instance.engine_class =
> -				xe_to_user_engine_class[hwe->class];
> +				xe_hw_engine_to_user_class(hwe->class);
>  			engines->engines[i].instance.engine_instance =
>  				hwe->logical_instance;
>  			engines->engines[i].instance.gt_id = gt->info.id;
> @@ -677,7 +669,7 @@ static int query_oa_units(struct xe_device *xe,
>  				if (!xe_hw_engine_is_reserved(hwe) &&
>  				    xe_oa_unit_id(hwe) == u->oa_unit_id) {
>  					du->eci[j].engine_class =
> -						xe_to_user_engine_class[hwe->class];
> +						xe_hw_engine_to_user_class(hwe->class);
>  					du->eci[j].engine_instance = hwe->logical_instance;
>  					du->eci[j].gt_id = gt->info.id;
>  					j++;
> -- 
> 2.40.0
> 

  parent reply	other threads:[~2024-11-14 17:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-13  4:55 [PATCH 0/7] Add PMU support for single engine busyness Riana Tauro
2024-11-13  4:55 ` [PATCH 1/7] [DO NOT REVIEW] drm/xe/pmu: Enable PMU interface Riana Tauro
2024-11-13  4:55 ` [PATCH 2/7] [DO NOT REVIEW] drm/xe/pmu: Add GT C6 events Riana Tauro
2024-11-13  4:55 ` [PATCH 3/7] [DO NOT REVIEW] drm/xe/pmu: Add GT frequency events Riana Tauro
2024-11-13  4:55 ` [PATCH 4/7] drm/xe: add function to convert xe hw engine class to user class Riana Tauro
2024-11-14 16:14   ` Umesh Nerlige Ramappa
2024-11-15  7:18     ` Riana Tauro
2024-11-14 17:46   ` Rodrigo Vivi [this message]
2024-11-15  7:21     ` Riana Tauro
2024-11-13  4:55 ` [PATCH 5/7] drm/xe: Add single engine busyness support Riana Tauro
2024-11-15  0:08   ` Umesh Nerlige Ramappa
2024-11-18  7:33     ` Riana Tauro
2024-11-13  4:55 ` [PATCH 6/7] drm/xe/guc: Expose engine busyness only for supported GuC version Riana Tauro
2024-11-14 21:12   ` Umesh Nerlige Ramappa
2024-11-15  0:12   ` Umesh Nerlige Ramappa
2024-11-18  7:37     ` Riana Tauro
2024-11-18 23:32       ` Umesh Nerlige Ramappa
2024-11-13  4:55 ` [PATCH 7/7] drm/xe/pmu: Add PMU support for engine busyness Riana Tauro
2024-11-13 14:41 ` ✓ CI.Patch_applied: success for Add PMU support for single " Patchwork
2024-11-13 14:42 ` ✗ CI.checkpatch: warning " Patchwork
2024-11-13 14:43 ` ✓ CI.KUnit: success " Patchwork
2024-11-13 14:55 ` ✓ CI.Build: " Patchwork
2024-11-13 14:57 ` ✗ CI.Hooks: failure " Patchwork
2024-11-13 14:59 ` ✓ CI.checksparse: success " Patchwork
2024-11-13 15:19 ` ✗ CI.BAT: failure " Patchwork
2024-11-13 21:22 ` ✓ CI.FULL: success " 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=ZzY3d-NLOzlOsS5E@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=aravind.iddamsetty@intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=john.c.harrison@intel.com \
    --cc=riana.tauro@intel.com \
    --cc=soham.purkait@intel.com \
    --cc=umesh.nerlige.ramappa@intel.com \
    --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