Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: "Souza, Jose" <jose.souza@intel.com>,
	"joonas.lahtinen@linux.intel.com"
	<joonas.lahtinen@linux.intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Cc: "Ursulin, Tvrtko" <tvrtko.ursulin@intel.com>,
	"Nikula, Jani" <jani.nikula@intel.com>,
	"kenneth@whitecape.org" <kenneth@whitecape.org>,
	"Vivi, Rodrigo" <rodrigo.vivi@intel.com>,
	"Zanoni, Paulo R" <paulo.r.zanoni@intel.com>,
	"Ghuge, Sagar" <sagar.ghuge@intel.com>
Subject: Re: [RFC PATCH] drm/i915: Add GETPARAM for GuC submission version
Date: Tue, 6 Feb 2024 16:33:48 +0000	[thread overview]
Message-ID: <531ad2c0-445a-4fdc-bdb7-d50bf70d5c69@linux.intel.com> (raw)
In-Reply-To: <fe98dc0052a87bf4b916f34813233d7fa69752a1.camel@intel.com>


On 01/02/2024 18:25, Souza, Jose wrote:
> On Wed, 2024-01-24 at 08:55 +0000, Tvrtko Ursulin wrote:
>> On 24/01/2024 08:19, Joonas Lahtinen wrote:
>>> Add reporting of the GuC submissio/VF interface version via GETPARAM
>>> properties. Mesa intends to use this information to check for old
>>> firmware versions with known bugs before enabling features like async
>>> compute.
>>
>> There was
>> https://patchwork.freedesktop.org/patch/560704/?series=124592&rev=1
>> which does everything in one go so would be my preference.
> 
> IMO Joonas version brings less burden to be maintained(no new struct).
> But both versions works, please just get into some agreement so we can move this forward.

So I would really prefer the query. Simplified version would do like the compile tested only:

diff --git a/drivers/gpu/drm/i915/i915_query.c b/drivers/gpu/drm/i915/i915_query.c
index 00871ef99792..999687f6a3d4 100644
--- a/drivers/gpu/drm/i915/i915_query.c
+++ b/drivers/gpu/drm/i915/i915_query.c
@@ -551,6 +551,37 @@ static int query_hwconfig_blob(struct drm_i915_private *i915,
         return hwconfig->size;
  }
  
+static int
+query_guc_submission_version(struct drm_i915_private *i915,
+                            struct drm_i915_query_item *query)
+{
+       struct drm_i915_query_guc_submission_version __user *query_ptr =
+                                           u64_to_user_ptr(query->data_ptr);
+       struct drm_i915_query_guc_submission_version ver;
+       struct intel_guc *guc = &to_gt(i915)->uc.guc;
+       const size_t size = sizeof(ver);
+       int ret;
+
+       if (!intel_uc_uses_guc_submission(&to_gt(i915)->uc))
+               return -ENODEV;
+
+       ret = copy_query_item(&ver, size, size, query);
+       if (ret != 0)
+               return ret;
+
+       if (ver.major || ver.minor || ver.patch)
+               return -EINVAL;
+
+       ver.major = guc->submission_version.major;
+       ver.minor = guc->submission_version.minor;
+       ver.patch = guc->submission_version.patch;
+
+       if (copy_to_user(query_ptr, &ver, size))
+               return -EFAULT;
+
+       return 0;
+}
+
  static int (* const i915_query_funcs[])(struct drm_i915_private *dev_priv,
                                         struct drm_i915_query_item *query_item) = {
         query_topology_info,
@@ -559,6 +590,7 @@ static int (* const i915_query_funcs[])(struct drm_i915_private *dev_priv,
         query_memregion_info,
         query_hwconfig_blob,
         query_geometry_subslices,
+       query_guc_submission_version,
  };
  
  int i915_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 550c496ce76d..d80d9b5e1eda 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -3038,6 +3038,7 @@ struct drm_i915_query_item {
          *  - %DRM_I915_QUERY_MEMORY_REGIONS (see struct drm_i915_query_memory_regions)
          *  - %DRM_I915_QUERY_HWCONFIG_BLOB (see `GuC HWCONFIG blob uAPI`)
          *  - %DRM_I915_QUERY_GEOMETRY_SUBSLICES (see struct drm_i915_query_topology_info)
+        *  - %DRM_I915_QUERY_GUC_SUBMISSION_VERSION (see struct drm_i915_query_guc_submission_version)
          */
         __u64 query_id;
  #define DRM_I915_QUERY_TOPOLOGY_INFO           1
@@ -3046,6 +3047,7 @@ struct drm_i915_query_item {
  #define DRM_I915_QUERY_MEMORY_REGIONS          4
  #define DRM_I915_QUERY_HWCONFIG_BLOB           5
  #define DRM_I915_QUERY_GEOMETRY_SUBSLICES      6
+#define DRM_I915_QUERY_GUC_SUBMISSION_VERSION  7
  /* Must be kept compact -- no holes and well documented */
  
         /**
@@ -3591,6 +3593,15 @@ struct drm_i915_query_memory_regions {
         struct drm_i915_memory_region_info regions[];
  };
  
+/**
+* struct drm_i915_query_guc_submission_version - query GuC submission interface version
+*/
+struct drm_i915_query_guc_submission_version {
+       __u64 major;
+       __u64 minor;
+       __u64 patch;
+};
+
  /**
   * DOC: GuC HWCONFIG blob uAPI
   *

It is not that much bigger that the triple get param and IMO nicer.

But if there is no motivation to do it properly then feel free to proceed with this, I will not block it.

Regards,

Tvrtko

P.S.
Probably still make sure to remove the reference to SR-IOV.

> 
>>
>> During the time of that patch there was discussion whether firmware
>> version or submission version was better. I vaguely remember someone
>> raised an issue with the latter. Adding John in case he remembers.
>>
>>> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>>> Cc: Kenneth Graunke <kenneth@whitecape.org>
>>> Cc: Jose Souza <jose.souza@intel.com>
>>> Cc: Sagar Ghuge <sagar.ghuge@intel.com>
>>> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
>>> Cc: John Harrison <John.C.Harrison@Intel.com>
>>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>> Cc: Jani Nikula <jani.nikula@intel.com>
>>> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>> ---
>>>    drivers/gpu/drm/i915/i915_getparam.c | 12 ++++++++++++
>>>    include/uapi/drm/i915_drm.h          | 13 +++++++++++++
>>>    2 files changed, 25 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_getparam.c b/drivers/gpu/drm/i915/i915_getparam.c
>>> index 5c3fec63cb4c1..f176372debc54 100644
>>> --- a/drivers/gpu/drm/i915/i915_getparam.c
>>> +++ b/drivers/gpu/drm/i915/i915_getparam.c
>>> @@ -113,6 +113,18 @@ int i915_getparam_ioctl(struct drm_device *dev, void *data,
>>>    		if (value < 0)
>>>    			return value;
>>>    		break;
>>> +	case I915_PARAM_GUC_SUBMISSION_VERSION_MAJOR:
>>> +	case I915_PARAM_GUC_SUBMISSION_VERSION_MINOR:
>>> +	case I915_PARAM_GUC_SUBMISSION_VERSION_PATCH:
>>> +		if (!intel_uc_uses_guc_submission(&to_gt(i915)->uc))
>>> +			return -ENODEV;
>>> +		if (param->param == I915_PARAM_GUC_SUBMISSION_VERSION_MAJOR)
>>> +			value = to_gt(i915)->uc.guc.submission_version.major;
>>> +		else if (param->param == I915_PARAM_GUC_SUBMISSION_VERSION_MINOR)
>>> +			value = to_gt(i915)->uc.guc.submission_version.minor;
>>> +		else
>>> +			value = to_gt(i915)->uc.guc.submission_version.patch;
>>> +		break;
>>>    	case I915_PARAM_MMAP_GTT_VERSION:
>>>    		/* Though we've started our numbering from 1, and so class all
>>>    		 * earlier versions as 0, in effect their value is undefined as
>>> diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
>>> index fd4f9574d177a..7d5a47f182542 100644
>>> --- a/include/uapi/drm/i915_drm.h
>>> +++ b/include/uapi/drm/i915_drm.h
>>> @@ -806,6 +806,19 @@ typedef struct drm_i915_irq_wait {
>>>     */
>>>    #define I915_PARAM_PXP_STATUS		 58
>>>    
>>> +/*
>>> + * Query for the GuC submission/VF interface version number
>>
>> What is this VF you speak of? :/
>>
>> Regards,
>>
>> Tvrtko
>>
>>> + *
>>> + * -ENODEV is returned if GuC submission is not used
>>> + *
>>> + * On success, returns the respective GuC submission/VF interface major,
>>> + * minor or patch version as per the requested parameter.
>>> + *
>>> + */
>>> +#define I915_PARAM_GUC_SUBMISSION_VERSION_MAJOR 59
>>> +#define I915_PARAM_GUC_SUBMISSION_VERSION_MINOR 60
>>> +#define I915_PARAM_GUC_SUBMISSION_VERSION_PATCH 61
>>> +
>>>    /* Must be kept compact -- no holes and well documented */
>>>    
>>>    /**
> 

  reply	other threads:[~2024-02-06 16:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24  8:19 [RFC PATCH] drm/i915: Add GETPARAM for GuC submission version Joonas Lahtinen
2024-01-24  8:43 ` ✗ Fi.CI.SPARSE: warning for " Patchwork
2024-01-24  8:49 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-01-24  8:55 ` [RFC PATCH] " Tvrtko Ursulin
2024-01-24 19:55   ` John Harrison
2024-01-24 22:42   ` Kenneth Graunke
2024-02-01 18:25   ` Souza, Jose
2024-02-06 16:33     ` Tvrtko Ursulin [this message]
2024-02-06 20:42       ` John Harrison
2024-02-06 20:51         ` Souza, Jose
2024-02-07  8:44           ` Tvrtko Ursulin
2024-02-07 11:36             ` Joonas Lahtinen
2024-02-07 17:58               ` John Harrison
2024-02-07 18:02               ` Souza, Jose
2024-01-24 13:35 ` Souza, Jose

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=531ad2c0-445a-4fdc-bdb7-d50bf70d5c69@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=jose.souza@intel.com \
    --cc=kenneth@whitecape.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sagar.ghuge@intel.com \
    --cc=tvrtko.ursulin@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