Skip to contentSkip to conversation

drm/xe/guc: Return the lower part of blocking H2G message

PATCH In review Matthew Brost 3 participants 3 messages Oct 23, 2023 – Oct 31, 2023

Subsystems (2)
lore
Share & tools
lore

Matthew Brost

author maintainer
#0 lore raw

PATCH 1/1 drm/xe/guc: Return the lower part of blocking H2G message

The upper layers may need this data, an example of this is allocating DIST doorbell.

v2 (Michal): Drop change of checking the return value.

---
 drivers/gpu/drm/xe/xe_guc_ct.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_guc_ct.c +5 -1
index 8b686c8b3339..092a9563f80a 100644
@@ -26,6 +26,7 @@
 struct g2h_fence {
 	u32 *response_buffer;
 	u32 seqno;
+	u32 status;
 	u16 response_len;
 	u16 error;
 	u16 hint;
@@ -749,7 +750,7 @@ static int guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
 		ret = -EIO;
 	}
 
-	return ret > 0 ? 0 : ret;
+	return ret > 0 ? g2h_fence.status : ret;
 }
 
 int xe_guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
@@ -815,6 +816,9 @@ static int parse_g2h_response(struct xe_guc_ct *ct, u32 *msg, u32 len)
 		g2h_fence->response_len = response_len;
 		memcpy(g2h_fence->response_buffer, msg + GUC_CTB_MSG_MIN_LEN,
 		       response_len * sizeof(u32));
+	} else {
+		g2h_fence->status =
+			FIELD_GET(GUC_HXG_RESPONSE_MSG_0_DATA0, msg[1]);
 	}
 
 	g2h_release_space(ct, GUC_CTB_HXG_MSG_MAX_LEN);
Signature · 1 line
2.34.1
#1 lore raw

[Intel-xe] ✗ CI.Patch_applied: failure for drm/xe/guc: Return the lower part of blocking H2G message

== Series Details ==

== Series Details ==

Series: drm/xe/guc: Return the lower part of blocking H2G message
URL : https://patchwork.freedesktop.org/series/125483/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: 4354e27ef drm/xe: Simplify xe_res_get_buddy() === git am output follows ===
Applying: drm/xe/guc: Return the lower part of blocking H2G message

#2 lore raw
In reply to Matthew Brost
Quoted 15 lines · Matthew Brost

The upper layers may need this data, an example of this is allocating DIST doorbell.

v2 (Michal): Drop change of checking the return value.

---
 drivers/gpu/drm/xe/xe_guc_ct.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_guc_ct.c +0 -0
index 8b686c8b3339..092a9563f80a 100644

drivers/gpu/drm/xe/xe_guc_ct.c line 29

Quoted 4 lines
drivers/gpu/drm/xe/xe_guc_ct.c +1 -0
@@ -26,6 +26,7 @@
 struct g2h_fence {
 	u32 *response_buffer;
 	u32 seqno;
+	u32 status;

this name might be misleading, as in response message we don't expect 'status', but rather generic 'data' from GUC_HXG_RESPONSE_MSG_0_DATA0

drivers/gpu/drm/xe/xe_guc_ct.c static int guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len, · line 753

Quoted 9 lines
drivers/gpu/drm/xe/xe_guc_ct.c +1 -1
 	u16 response_len;
 	u16 error;
 	u16 hint;
@@ -749,7 +750,7 @@ static int guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
 		ret = -EIO;
 	}
 
-	return ret > 0 ? 0 : ret;
+	return ret > 0 ? g2h_fence.status : ret;

while this helps for cases when all returned data is in data0, and likely caller didn't even provide buffer for the response, but it still wont solve the problems with flexible size G2H responses, as caller, who had provided buffer for the response, still doesn't know how many dwords were copied into it

can we have similar logic as in i915 where we return response_len if there was buffer provided, and response_data if not ?

Quoted 13 lines
drivers/gpu/drm/xe/xe_guc_ct.c +3 -0
 }
 
 int xe_guc_ct_send_recv(struct xe_guc_ct *ct, const u32 *action, u32 len,
@@ -815,6 +816,9 @@ static int parse_g2h_response(struct xe_guc_ct *ct, u32 *msg, u32 len)
 		g2h_fence->response_len = response_len;
 		memcpy(g2h_fence->response_buffer, msg + GUC_CTB_MSG_MIN_LEN,
 		       response_len * sizeof(u32));
+	} else {
+		g2h_fence->status =
+			FIELD_GET(GUC_HXG_RESPONSE_MSG_0_DATA0, msg[1]);
 	}
 
 	g2h_release_space(ct, GUC_CTB_HXG_MSG_MAX_LEN);