Skip to content

Commit 882be6e

Browse files
mwajdeczdanvet
authored andcommitted
drm/i915/guc: Stop using fence/status from CTB descriptor
Stop using fence/status from CTB descriptor as future GuC ABI will no longer support replies over CTB descriptor. Signed-off-by: Michal Wajdeczko <[email protected]> Signed-off-by: Matthew Brost <[email protected]> Reviewed-by: Matthew Brost <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent ded32d3 commit 882be6e

File tree

2 files changed

+6
-70
lines changed

2 files changed

+6
-70
lines changed

drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ struct guc_ct_buffer_desc {
7171
u32 head; /* offset updated by GuC*/
7272
u32 tail; /* offset updated by owner */
7373
u32 is_in_error; /* error indicator */
74-
u32 fence; /* fence updated by GuC */
75-
u32 status; /* status updated by GuC */
74+
u32 reserved1;
75+
u32 reserved2;
7676
u32 owner; /* id of the channel owner */
7777
u32 owner_sub_id; /* owner-defined field for extra tracking */
7878
u32 reserved[5];

drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c

Lines changed: 4 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,6 @@ static void guc_ct_buffer_desc_init(struct guc_ct_buffer_desc *desc,
9090
desc->owner = CTB_OWNER_HOST;
9191
}
9292

93-
static void guc_ct_buffer_desc_reset(struct guc_ct_buffer_desc *desc)
94-
{
95-
desc->head = 0;
96-
desc->tail = 0;
97-
desc->is_in_error = 0;
98-
}
99-
10093
static int guc_action_register_ct_buffer(struct intel_guc *guc,
10194
u32 desc_addr,
10295
u32 type)
@@ -315,8 +308,7 @@ static u32 ct_get_next_fence(struct intel_guc_ct *ct)
315308
static int ct_write(struct intel_guc_ct *ct,
316309
const u32 *action,
317310
u32 len /* in dwords */,
318-
u32 fence,
319-
bool want_response)
311+
u32 fence)
320312
{
321313
struct intel_guc_ct_buffer *ctb = &ct->ctbs[CTB_SEND];
322314
struct guc_ct_buffer_desc *desc = ctb->desc;
@@ -360,8 +352,7 @@ static int ct_write(struct intel_guc_ct *ct,
360352
* DW2+: action data
361353
*/
362354
header = (len << GUC_CT_MSG_LEN_SHIFT) |
363-
(GUC_CT_MSG_WRITE_FENCE_TO_DESC) |
364-
(want_response ? GUC_CT_MSG_SEND_STATUS : 0) |
355+
GUC_CT_MSG_SEND_STATUS |
365356
(action[0] << GUC_CT_MSG_ACTION_SHIFT);
366357

367358
CT_DEBUG(ct, "writing %*ph %*ph %*ph\n",
@@ -390,56 +381,6 @@ static int ct_write(struct intel_guc_ct *ct,
390381
return -EPIPE;
391382
}
392383

393-
/**
394-
* wait_for_ctb_desc_update - Wait for the CT buffer descriptor update.
395-
* @desc: buffer descriptor
396-
* @fence: response fence
397-
* @status: placeholder for status
398-
*
399-
* Guc will update CT buffer descriptor with new fence and status
400-
* after processing the command identified by the fence. Wait for
401-
* specified fence and then read from the descriptor status of the
402-
* command.
403-
*
404-
* Return:
405-
* * 0 response received (status is valid)
406-
* * -ETIMEDOUT no response within hardcoded timeout
407-
* * -EPROTO no response, CT buffer is in error
408-
*/
409-
static int wait_for_ctb_desc_update(struct guc_ct_buffer_desc *desc,
410-
u32 fence,
411-
u32 *status)
412-
{
413-
int err;
414-
415-
/*
416-
* Fast commands should complete in less than 10us, so sample quickly
417-
* up to that length of time, then switch to a slower sleep-wait loop.
418-
* No GuC command should ever take longer than 10ms.
419-
*/
420-
#define done (READ_ONCE(desc->fence) == fence)
421-
err = wait_for_us(done, 10);
422-
if (err)
423-
err = wait_for(done, 10);
424-
#undef done
425-
426-
if (unlikely(err)) {
427-
DRM_ERROR("CT: fence %u failed; reported fence=%u\n",
428-
fence, desc->fence);
429-
430-
if (WARN_ON(desc->is_in_error)) {
431-
/* Something went wrong with the messaging, try to reset
432-
* the buffer and hope for the best
433-
*/
434-
guc_ct_buffer_desc_reset(desc);
435-
err = -EPROTO;
436-
}
437-
}
438-
439-
*status = desc->status;
440-
return err;
441-
}
442-
443384
/**
444385
* wait_for_ct_request_update - Wait for CT request state update.
445386
* @req: pointer to pending request
@@ -483,8 +424,6 @@ static int ct_send(struct intel_guc_ct *ct,
483424
u32 response_buf_size,
484425
u32 *status)
485426
{
486-
struct intel_guc_ct_buffer *ctb = &ct->ctbs[CTB_SEND];
487-
struct guc_ct_buffer_desc *desc = ctb->desc;
488427
struct ct_request request;
489428
unsigned long flags;
490429
u32 fence;
@@ -505,16 +444,13 @@ static int ct_send(struct intel_guc_ct *ct,
505444
list_add_tail(&request.link, &ct->requests.pending);
506445
spin_unlock_irqrestore(&ct->requests.lock, flags);
507446

508-
err = ct_write(ct, action, len, fence, !!response_buf);
447+
err = ct_write(ct, action, len, fence);
509448
if (unlikely(err))
510449
goto unlink;
511450

512451
intel_guc_notify(ct_to_guc(ct));
513452

514-
if (response_buf)
515-
err = wait_for_ct_request_update(&request, status);
516-
else
517-
err = wait_for_ctb_desc_update(desc, fence, status);
453+
err = wait_for_ct_request_update(&request, status);
518454
if (unlikely(err))
519455
goto unlink;
520456

0 commit comments

Comments
 (0)