drm/xe: correct the calculation of remaining size
authorFei Yang <fei.yang@intel.com>
Tue, 16 Jan 2024 22:37:09 +0000 (14:37 -0800)
committerMatt Roper <matthew.d.roper@intel.com>
Thu, 18 Jan 2024 22:43:44 +0000 (14:43 -0800)
In function write_pgtable, the calculation of chunk in the do-while
loop is wrong, we should always compare against remaining size instead
of the total size update->qwords.

Signed-off-by: Fei Yang <fei.yang@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240116223709.652585-2-fei.yang@intel.com
drivers/gpu/drm/xe/xe_migrate.c

index 44725f978f3e1e574b883b584a98edaa94a0f87a..d5392cbbdb4910d9847f9ff4dd59063e738b3d09 100644 (file)
@@ -1116,7 +1116,7 @@ static void write_pgtable(struct xe_tile *tile, struct xe_bb *bb, u64 ppgtt_ofs,
        do {
                u64 addr = ppgtt_ofs + ofs * 8;
 
-               chunk = min(update->qwords, MAX_PTE_PER_SDI);
+               chunk = min(size, MAX_PTE_PER_SDI);
 
                /* Ensure populatefn can do memset64 by aligning bb->cs */
                if (!(bb->len & 1))