diff mbox series

[1/3] drm/i915/guc: Use FAST_REQUEST for non-blocking H2G calls

Message ID 20230526235538.2230780-2-John.C.Harrison@Intel.com (mailing list archive)
State New, archived
Headers show
Series Use FAST_REQUEST mechanism for non-blocking H2G calls | expand

Commit Message

John Harrison May 26, 2023, 11:55 p.m. UTC
From: Michal Wajdeczko <michal.wajdeczko@intel.com>

In addition to the already defined REQUEST HXG message format,
which is used when sender expects some confirmation or data,
HXG protocol includes definition of the FAST REQUEST message,
that may be used when sender does not expect any useful data
to be returned.

Using this instead of GUC_HXG_TYPE_EVENT for non-blocking CTB requests
will allow GuC to send back GUC_HXG_TYPE_RESPONSE_FAILURE in case of
errors.

Note that it is not possible to return such errors to the caller,
since this is for non-blocking calls and the related fence is not
stored. Instead such messages are treated as unexpected, which will
give an indication of potential GuC misprogramming that warrants extra
debugging effort.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
---
 .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h | 30 +++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c     |  6 ++--
 2 files changed, 33 insertions(+), 3 deletions(-)

Comments

John Harrison May 30, 2023, 9:02 p.m. UTC | #1
On 5/26/2023 16:55, John.C.Harrison@Intel.com wrote:
> From: Michal Wajdeczko <michal.wajdeczko@intel.com>
>
> In addition to the already defined REQUEST HXG message format,
> which is used when sender expects some confirmation or data,
> HXG protocol includes definition of the FAST REQUEST message,
> that may be used when sender does not expect any useful data
> to be returned.
>
> Using this instead of GUC_HXG_TYPE_EVENT for non-blocking CTB requests
> will allow GuC to send back GUC_HXG_TYPE_RESPONSE_FAILURE in case of
> errors.
>
> Note that it is not possible to return such errors to the caller,
> since this is for non-blocking calls and the related fence is not
> stored. Instead such messages are treated as unexpected, which will
> give an indication of potential GuC misprogramming that warrants extra
> debugging effort.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com>

> ---
>   .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h | 30 +++++++++++++++++++
>   drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c     |  6 ++--
>   2 files changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h b/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
> index 7d5ba4d97d708..98eb4f46572b9 100644
> --- a/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
> +++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
> @@ -24,6 +24,7 @@
>    *  |   | 30:28 | **TYPE** - message type                                      |
>    *  |   |       |   - _`GUC_HXG_TYPE_REQUEST` = 0                              |
>    *  |   |       |   - _`GUC_HXG_TYPE_EVENT` = 1                                |
> + *  |   |       |   - _`GUC_HXG_TYPE_FAST_REQUEST` = 2                         |
>    *  |   |       |   - _`GUC_HXG_TYPE_NO_RESPONSE_BUSY` = 3                     |
>    *  |   |       |   - _`GUC_HXG_TYPE_NO_RESPONSE_RETRY` = 5                    |
>    *  |   |       |   - _`GUC_HXG_TYPE_RESPONSE_FAILURE` = 6                     |
> @@ -46,6 +47,7 @@
>   #define GUC_HXG_MSG_0_TYPE			(0x7 << 28)
>   #define   GUC_HXG_TYPE_REQUEST			0u
>   #define   GUC_HXG_TYPE_EVENT			1u
> +#define   GUC_HXG_TYPE_FAST_REQUEST		2u
>   #define   GUC_HXG_TYPE_NO_RESPONSE_BUSY		3u
>   #define   GUC_HXG_TYPE_NO_RESPONSE_RETRY	5u
>   #define   GUC_HXG_TYPE_RESPONSE_FAILURE		6u
> @@ -89,6 +91,34 @@
>   #define GUC_HXG_REQUEST_MSG_0_ACTION		(0xffff << 0)
>   #define GUC_HXG_REQUEST_MSG_n_DATAn		GUC_HXG_MSG_n_PAYLOAD
>   
> +/**
> + * DOC: HXG Fast Request
> + *
> + * The `HXG Request`_ message should be used to initiate asynchronous activity
> + * for which confirmation or return data is not expected.
> + *
> + * If confirmation is required then `HXG Request`_ shall be used instead.
> + *
> + * The recipient of this message may only use `HXG Failure`_ message if it was
> + * unable to accept this request (like invalid data).
> + *
> + * Format of `HXG Fast Request`_ message is same as `HXG Request`_ except @TYPE.
> + *
> + *  +---+-------+--------------------------------------------------------------+
> + *  |   | Bits  | Description                                                  |
> + *  +===+=======+==============================================================+
> + *  | 0 |    31 | ORIGIN - see `HXG Message`_                                  |
> + *  |   +-------+--------------------------------------------------------------+
> + *  |   | 30:28 | TYPE = `GUC_HXG_TYPE_FAST_REQUEST`_                          |
> + *  |   +-------+--------------------------------------------------------------+
> + *  |   | 27:16 | DATA0 - see `HXG Request`_                                   |
> + *  |   +-------+--------------------------------------------------------------+
> + *  |   |  15:0 | ACTION - see `HXG Request`_                                  |
> + *  +---+-------+--------------------------------------------------------------+
> + *  |...|       | DATAn - see `HXG Request`_                                   |
> + *  +---+-------+--------------------------------------------------------------+
> + */
> +
>   /**
>    * DOC: HXG Event
>    *
> diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
> index a22e33f37cae6..af52ed4ffc7fb 100644
> --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
> +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
> @@ -426,11 +426,11 @@ static int ct_write(struct intel_guc_ct *ct,
>   		 FIELD_PREP(GUC_CTB_MSG_0_NUM_DWORDS, len) |
>   		 FIELD_PREP(GUC_CTB_MSG_0_FENCE, fence);
>   
> -	type = (flags & INTEL_GUC_CT_SEND_NB) ? GUC_HXG_TYPE_EVENT :
> +	type = (flags & INTEL_GUC_CT_SEND_NB) ? GUC_HXG_TYPE_FAST_REQUEST :
>   		GUC_HXG_TYPE_REQUEST;
>   	hxg = FIELD_PREP(GUC_HXG_MSG_0_TYPE, type) |
> -		FIELD_PREP(GUC_HXG_EVENT_MSG_0_ACTION |
> -			   GUC_HXG_EVENT_MSG_0_DATA0, action[0]);
> +		FIELD_PREP(GUC_HXG_REQUEST_MSG_0_ACTION |
> +			   GUC_HXG_REQUEST_MSG_0_DATA0, action[0]);
>   
>   	CT_DEBUG(ct, "writing (tail %u) %*ph %*ph %*ph\n",
>   		 tail, 4, &header, 4, &hxg, 4 * (len - 1), &action[1]);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h b/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
index 7d5ba4d97d708..98eb4f46572b9 100644
--- a/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
+++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
@@ -24,6 +24,7 @@ 
  *  |   | 30:28 | **TYPE** - message type                                      |
  *  |   |       |   - _`GUC_HXG_TYPE_REQUEST` = 0                              |
  *  |   |       |   - _`GUC_HXG_TYPE_EVENT` = 1                                |
+ *  |   |       |   - _`GUC_HXG_TYPE_FAST_REQUEST` = 2                         |
  *  |   |       |   - _`GUC_HXG_TYPE_NO_RESPONSE_BUSY` = 3                     |
  *  |   |       |   - _`GUC_HXG_TYPE_NO_RESPONSE_RETRY` = 5                    |
  *  |   |       |   - _`GUC_HXG_TYPE_RESPONSE_FAILURE` = 6                     |
@@ -46,6 +47,7 @@ 
 #define GUC_HXG_MSG_0_TYPE			(0x7 << 28)
 #define   GUC_HXG_TYPE_REQUEST			0u
 #define   GUC_HXG_TYPE_EVENT			1u
+#define   GUC_HXG_TYPE_FAST_REQUEST		2u
 #define   GUC_HXG_TYPE_NO_RESPONSE_BUSY		3u
 #define   GUC_HXG_TYPE_NO_RESPONSE_RETRY	5u
 #define   GUC_HXG_TYPE_RESPONSE_FAILURE		6u
@@ -89,6 +91,34 @@ 
 #define GUC_HXG_REQUEST_MSG_0_ACTION		(0xffff << 0)
 #define GUC_HXG_REQUEST_MSG_n_DATAn		GUC_HXG_MSG_n_PAYLOAD
 
+/**
+ * DOC: HXG Fast Request
+ *
+ * The `HXG Request`_ message should be used to initiate asynchronous activity
+ * for which confirmation or return data is not expected.
+ *
+ * If confirmation is required then `HXG Request`_ shall be used instead.
+ *
+ * The recipient of this message may only use `HXG Failure`_ message if it was
+ * unable to accept this request (like invalid data).
+ *
+ * Format of `HXG Fast Request`_ message is same as `HXG Request`_ except @TYPE.
+ *
+ *  +---+-------+--------------------------------------------------------------+
+ *  |   | Bits  | Description                                                  |
+ *  +===+=======+==============================================================+
+ *  | 0 |    31 | ORIGIN - see `HXG Message`_                                  |
+ *  |   +-------+--------------------------------------------------------------+
+ *  |   | 30:28 | TYPE = `GUC_HXG_TYPE_FAST_REQUEST`_                          |
+ *  |   +-------+--------------------------------------------------------------+
+ *  |   | 27:16 | DATA0 - see `HXG Request`_                                   |
+ *  |   +-------+--------------------------------------------------------------+
+ *  |   |  15:0 | ACTION - see `HXG Request`_                                  |
+ *  +---+-------+--------------------------------------------------------------+
+ *  |...|       | DATAn - see `HXG Request`_                                   |
+ *  +---+-------+--------------------------------------------------------------+
+ */
+
 /**
  * DOC: HXG Event
  *
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
index a22e33f37cae6..af52ed4ffc7fb 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c
@@ -426,11 +426,11 @@  static int ct_write(struct intel_guc_ct *ct,
 		 FIELD_PREP(GUC_CTB_MSG_0_NUM_DWORDS, len) |
 		 FIELD_PREP(GUC_CTB_MSG_0_FENCE, fence);
 
-	type = (flags & INTEL_GUC_CT_SEND_NB) ? GUC_HXG_TYPE_EVENT :
+	type = (flags & INTEL_GUC_CT_SEND_NB) ? GUC_HXG_TYPE_FAST_REQUEST :
 		GUC_HXG_TYPE_REQUEST;
 	hxg = FIELD_PREP(GUC_HXG_MSG_0_TYPE, type) |
-		FIELD_PREP(GUC_HXG_EVENT_MSG_0_ACTION |
-			   GUC_HXG_EVENT_MSG_0_DATA0, action[0]);
+		FIELD_PREP(GUC_HXG_REQUEST_MSG_0_ACTION |
+			   GUC_HXG_REQUEST_MSG_0_DATA0, action[0]);
 
 	CT_DEBUG(ct, "writing (tail %u) %*ph %*ph %*ph\n",
 		 tail, 4, &header, 4, &hxg, 4 * (len - 1), &action[1]);