Message ID | 20220421113813.30796-2-ramalingam.c@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Flat-CCS eviction enhancements | expand |
On Thu, 2022-04-21 at 17:08 +0530, Ramalingam C wrote: > While locating the start of ccs scatterlist in smem scatterlist, that > has > to be the size of lmem obj size + corresponding ccs data size. Report > bug > if scatterlist terminate before that length. > > Signed-off-by: Ramalingam C <ramalingam.c@intel.com> > --- > drivers/gpu/drm/i915/gt/intel_migrate.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c > b/drivers/gpu/drm/i915/gt/intel_migrate.c > index 9d552f30b627..29d761da02c4 100644 > --- a/drivers/gpu/drm/i915/gt/intel_migrate.c > +++ b/drivers/gpu/drm/i915/gt/intel_migrate.c > @@ -687,6 +687,12 @@ static void get_ccs_sg_sgt(struct sgt_dma *it, > u32 bytes_to_cpy) > bytes_to_cpy -= len; > > it->sg = __sg_next(it->sg); If bytes_to_cpy == 0 here, couldn't it->sg be NULL then? > + > + /* > + * scatterlist supposed to be the size of > + * bytes_to_cpy + GET_CCS_BYTES(bytes_to_copy). > + */ > + GEM_BUG_ON(!it->sg); > it->dma = sg_dma_address(it->sg); > it->max = it->dma + sg_dma_len(it->sg); > } while (bytes_to_cpy); /Thomas
On 2022-04-21 at 18:57:59 +0530, Hellstrom, Thomas wrote: > On Thu, 2022-04-21 at 17:08 +0530, Ramalingam C wrote: > > While locating the start of ccs scatterlist in smem scatterlist, that > > has > > to be the size of lmem obj size + corresponding ccs data size. Report > > bug > > if scatterlist terminate before that length. > > > > Signed-off-by: Ramalingam C <ramalingam.c@intel.com> > > --- > > drivers/gpu/drm/i915/gt/intel_migrate.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c > > b/drivers/gpu/drm/i915/gt/intel_migrate.c > > index 9d552f30b627..29d761da02c4 100644 > > --- a/drivers/gpu/drm/i915/gt/intel_migrate.c > > +++ b/drivers/gpu/drm/i915/gt/intel_migrate.c > > @@ -687,6 +687,12 @@ static void get_ccs_sg_sgt(struct sgt_dma *it, > > u32 bytes_to_cpy) > > bytes_to_cpy -= len; > > > > > > it->sg = __sg_next(it->sg); > > If bytes_to_cpy == 0 here, couldn't it->sg be NULL then? Hi, bytes_to_cpy is the lmem size and the scatterlist is the length of bytes_to_cpy + GET_CCS_BYTES(bytes_to_cpy). So this should not be null. when bytes_to_cpy reduces to zero we will be having the start of the scatterlist for ccs. Ram. > > > + > > + /* > > + * scatterlist supposed to be the size of > > + * bytes_to_cpy + GET_CCS_BYTES(bytes_to_copy). > > + */ > > + GEM_BUG_ON(!it->sg); > > it->dma = sg_dma_address(it->sg); > > it->max = it->dma + sg_dma_len(it->sg); > > } while (bytes_to_cpy); > > /Thomas >
diff --git a/drivers/gpu/drm/i915/gt/intel_migrate.c b/drivers/gpu/drm/i915/gt/intel_migrate.c index 9d552f30b627..29d761da02c4 100644 --- a/drivers/gpu/drm/i915/gt/intel_migrate.c +++ b/drivers/gpu/drm/i915/gt/intel_migrate.c @@ -687,6 +687,12 @@ static void get_ccs_sg_sgt(struct sgt_dma *it, u32 bytes_to_cpy) bytes_to_cpy -= len; it->sg = __sg_next(it->sg); + + /* + * scatterlist supposed to be the size of + * bytes_to_cpy + GET_CCS_BYTES(bytes_to_copy). + */ + GEM_BUG_ON(!it->sg); it->dma = sg_dma_address(it->sg); it->max = it->dma + sg_dma_len(it->sg); } while (bytes_to_cpy);
While locating the start of ccs scatterlist in smem scatterlist, that has to be the size of lmem obj size + corresponding ccs data size. Report bug if scatterlist terminate before that length. Signed-off-by: Ramalingam C <ramalingam.c@intel.com> --- drivers/gpu/drm/i915/gt/intel_migrate.c | 6 ++++++ 1 file changed, 6 insertions(+)