On Thu, May 06, 2021 at 12:13:38PM -0700, Matthew Brost wrote: > From: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx> > > Once CTB descriptor is found in error state, either set by GuC > or us, there is no need continue checking descriptor any more, > we can rely on our internal flag. > > Signed-off-by: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx> > Signed-off-by: Matthew Brost <matthew.brost@xxxxxxxxx> Reviewed-by: Matthew Brost <matthew.brost@xxxxxxxxx> > Cc: Piotr Piórkowski <piotr.piorkowski@xxxxxxxxx> > --- > drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 13 +++++++++++-- > drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 2 ++ > 2 files changed, 13 insertions(+), 2 deletions(-) > > 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 1afdeac683b5..178f73ab2c96 100644 > --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c > +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c > @@ -123,6 +123,7 @@ static void guc_ct_buffer_desc_init(struct guc_ct_buffer_desc *desc, > > static void guc_ct_buffer_reset(struct intel_guc_ct_buffer *ctb, u32 cmds_addr) > { > + ctb->broken = false; > guc_ct_buffer_desc_init(ctb->desc, cmds_addr, ctb->size); > } > > @@ -365,9 +366,12 @@ static int ct_write(struct intel_guc_ct *ct, > u32 *cmds = ctb->cmds; > unsigned int i; > > - if (unlikely(desc->is_in_error)) > + if (unlikely(ctb->broken)) > return -EPIPE; > > + if (unlikely(desc->is_in_error)) > + goto corrupted; > + > if (unlikely(!IS_ALIGNED(head | tail, 4) || > (tail | head) >= size)) > goto corrupted; > @@ -423,6 +427,7 @@ static int ct_write(struct intel_guc_ct *ct, > CT_ERROR(ct, "Corrupted descriptor addr=%#x head=%u tail=%u size=%u\n", > desc->addr, desc->head, desc->tail, desc->size); > desc->is_in_error = 1; > + ctb->broken = true; > return -EPIPE; > } > > @@ -608,9 +613,12 @@ static int ct_read(struct intel_guc_ct *ct, struct ct_incoming_msg **msg) > unsigned int i; > u32 header; > > - if (unlikely(desc->is_in_error)) > + if (unlikely(ctb->broken)) > return -EPIPE; > > + if (unlikely(desc->is_in_error)) > + goto corrupted; > + > if (unlikely(!IS_ALIGNED(head | tail, 4) || > (tail | head) >= size)) > goto corrupted; > @@ -674,6 +682,7 @@ static int ct_read(struct intel_guc_ct *ct, struct ct_incoming_msg **msg) > CT_ERROR(ct, "Corrupted descriptor addr=%#x head=%u tail=%u size=%u\n", > desc->addr, desc->head, desc->tail, desc->size); > desc->is_in_error = 1; > + ctb->broken = true; > return -EPIPE; > } > > diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h > index cb222f202301..7d3cd375d6a7 100644 > --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h > +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h > @@ -32,12 +32,14 @@ struct intel_guc; > * @desc: pointer to the buffer descriptor > * @cmds: pointer to the commands buffer > * @size: size of the commands buffer > + * @broken: flag to indicate if descriptor data is broken > */ > struct intel_guc_ct_buffer { > spinlock_t lock; > struct guc_ct_buffer_desc *desc; > u32 *cmds; > u32 size; > + bool broken; > }; > > > -- > 2.28.0 > _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx