All of lore.kernel.org
 help / color / mirror / Atom feed
From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: Riana Tauro <riana.tauro@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 3/8] RFC drm/xe/guc: Expose engine busyness only for supported GuC version
Date: Wed, 20 Dec 2023 16:52:07 -0800	[thread overview]
Message-ID: <ZYOML1pbxg8akc1D@unerlige-ril> (raw)
In-Reply-To: <20231207125802.3730165-4-riana.tauro@intel.com>

On Thu, Dec 07, 2023 at 06:27:57PM +0530, Riana Tauro wrote:
>Guc version numbers are 8 bits only so convert to 32 bit 8.8.8
>to allow version comparisions. use compatibility version
>for the same.
>
>Engine busyness is supported only on GuC versions >= 70.11.1.
>Allow enabling/reading engine busyness only on supported
>GuC versions. Warn once if not supported.
>
>v2: rebase
>    fix guc comparison error (Matthew Brost)
>    add a macro for guc version comparison
>
>Cc: John Harrison <John.C.Harrison@Intel.com>
>Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
>Signed-off-by: Riana Tauro <riana.tauro@intel.com>
>---
> drivers/gpu/drm/xe/xe_guc_engine_busyness.c | 29 +++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
>diff --git a/drivers/gpu/drm/xe/xe_guc_engine_busyness.c b/drivers/gpu/drm/xe/xe_guc_engine_busyness.c
>index 287429e31e6c..431d1ca59d2f 100644
>--- a/drivers/gpu/drm/xe/xe_guc_engine_busyness.c
>+++ b/drivers/gpu/drm/xe/xe_guc_engine_busyness.c
>@@ -23,6 +23,23 @@
>  * engine busyness ticks (ticks_engine) : clock ticks for which engine was active
>  */
>
>+/* GuC version number components are only 8-bit, so converting to a 32bit 8.8.8 */
>+#define GUC_VER(maj, min, pat)	(((maj) << 16) | ((min) << 8) | (pat))
>+
>+static bool guc_engine_busyness_supported(struct xe_guc *guc)
>+{
>+	struct xe_uc_fw *uc_fw = &guc->fw;
>+	struct xe_uc_fw_version *version = &uc_fw->versions.found[XE_UC_FW_VER_COMPATIBILITY];
>+
>+	if (GUC_VER(version->major, version->minor, version->patch) >= GUC_VER(1, 3, 1))
>+		return true;
>+
>+	drm_WARN_ON_ONCE(&guc_to_xe(guc)->drm,
>+			 "Engine busyness not supported in this GuC version\n");
>+
>+	return false;
>+}
>+
> static void guc_engine_busyness_usage_map(struct xe_guc *guc,
> 					  struct xe_hw_engine *hwe,
> 					  struct iosys_map *engine_map)
>@@ -80,6 +97,10 @@ static void guc_engine_busyness_enable_stats(struct xe_guc *guc)
> 	struct xe_device *xe = guc_to_xe(guc);
> 	int ret;
>
>+	/* Engine busyness supported only on GuC >= 70.11.1 */
>+	if (!guc_engine_busyness_supported(guc))
>+		return;
>+
> 	ret = xe_guc_ct_send(&guc->ct, action, ARRAY_SIZE(action), 0, 0);
> 	if (ret)
> 		drm_err(&xe->drm, "Failed to enable usage stats %pe", ERR_PTR(ret));
>@@ -104,6 +125,10 @@ u64 xe_guc_engine_busyness_ticks(struct xe_guc *guc, struct xe_hw_engine *hwe)
> {
> 	u64 ticks_engine;
>
>+	/* Engine busyness supported only on GuC >= 70.11.1 */
>+	if (!guc_engine_busyness_supported(guc))
>+		return 0;
>+
> 	guc_engine_busyness_get_usage(guc, hwe, &ticks_engine);
>
> 	return ticks_engine;
>@@ -127,6 +152,10 @@ int xe_guc_engine_busyness_init(struct xe_guc *guc)
> 	u32 size;
> 	int err;
>
>+	/* Engine busyness supported only on GuC >= 70.11.1 */

I think the comment can reside in the helper function and you can delete 
is here and other places where this is called.

With that, this is
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>


>+	if (!guc_engine_busyness_supported(guc))
>+		return 0;
>+
> 	/* Initialization already done */
> 	if (guc->busy.bo)
> 		return 0;
>-- 
>2.40.0
>

  reply	other threads:[~2023-12-21  0:52 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 12:57 [PATCH v2 0/8] Engine Busyness Riana Tauro
2023-12-07 12:53 ` ✓ CI.Patch_applied: success for Engine Busyness (rev2) Patchwork
2023-12-07 12:53 ` ✗ CI.checkpatch: warning " Patchwork
2023-12-07 12:54 ` ✓ CI.KUnit: success " Patchwork
2023-12-07 12:57 ` [PATCH v2 1/8] RFC drm/xe: Move user engine class mappings to functions Riana Tauro
2023-12-07 12:57 ` [PATCH v2 2/8] RFC drm/xe/guc: Add interface for engine busyness ticks Riana Tauro
2023-12-21  0:49   ` Umesh Nerlige Ramappa
2023-12-21  5:14     ` Riana Tauro
2023-12-07 12:57 ` [PATCH v2 3/8] RFC drm/xe/guc: Expose engine busyness only for supported GuC version Riana Tauro
2023-12-21  0:52   ` Umesh Nerlige Ramappa [this message]
2023-12-21  5:17     ` Riana Tauro
2023-12-07 12:57 ` [PATCH v2 4/8] RFC drm/xe/guc: Add PMU counter for total active ticks Riana Tauro
2023-12-07 12:57 ` [PATCH v2 5/8] RFC drm/xe/uapi: Add configs for Engine busyness Riana Tauro
2023-12-21  2:29   ` Umesh Nerlige Ramappa
2023-12-21  5:26     ` Riana Tauro
2023-12-07 12:58 ` [PATCH v2 6/8] RFC drm/xe/pmu: Add PMU counters for engine busy ticks Riana Tauro
2023-12-07 12:58 ` [PATCH v2 7/8] RFC drm/xe/guc: Dynamically enable/disable engine busyness stats Riana Tauro
2023-12-07 12:58 ` [PATCH v2 8/8] RFC drm/xe/guc: Handle runtime suspend issues for engine busyness Riana Tauro
2023-12-07 13:01 ` ✓ CI.Build: success for Engine Busyness (rev2) Patchwork
2023-12-07 13:02 ` ✓ CI.Hooks: " Patchwork
2023-12-07 13:03 ` ✓ CI.checksparse: " Patchwork
2023-12-07 13:39 ` ✗ CI.BAT: failure " Patchwork
2023-12-07 14:45 ` [PATCH v2 0/8] Engine Busyness Tvrtko Ursulin
2023-12-14  1:56   ` Umesh Nerlige Ramappa
2023-12-14  8:06     ` Tvrtko Ursulin
2023-12-20  5:36       ` Umesh Nerlige Ramappa
2023-12-20  9:00         ` Tvrtko Ursulin
2023-12-20 23:58           ` Umesh Nerlige Ramappa
2023-12-21  9:36             ` Tvrtko Ursulin
2023-12-21 13:17               ` Nerlige Ramappa, Umesh
2023-12-22  9:41                 ` Tvrtko Ursulin

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=ZYOML1pbxg8akc1D@unerlige-ril \
    --to=umesh.nerlige.ramappa@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=riana.tauro@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.