[Intel-xe] [PATCH] drm/xe: Adjust tile_present mask when skipping rebinds

Thomas Hellström thomas.hellstrom at linux.intel.com
Wed Nov 1 16:40:51 UTC 2023


On Tue, 2023-10-31 at 11:50 -0700, Matthew Brost wrote:
> If a rebind is skipped the tile_present mask needs to be updated for
> the
> newly created vma to properly reflect the state of the vma.
> 
> Reported-by: <christoph.manszewski at intel.com>
> Signed-off-by: Matthew Brost <matthew.brost at intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>

> ---
>  drivers/gpu/drm/xe/xe_vm.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 498c0b3e1d73..d26c90f0d702 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -2340,6 +2340,10 @@ static int xe_vma_op_commit(struct xe_vm *vm,
> struct xe_vma_op *op)
>                         op->flags |= XE_VMA_OP_COMMITTED;
>                 break;
>         case DRM_GPUVA_OP_REMAP:
> +       {
> +               u8 tile_present =
> +                       gpuva_to_vma(op->base.remap.unmap->va)-
> >tile_present;
> +
>                 prep_vma_destroy(vm, gpuva_to_vma(op-
> >base.remap.unmap->va),
>                                  true);
>                 op->flags |= XE_VMA_OP_COMMITTED;
> @@ -2348,15 +2352,21 @@ static int xe_vma_op_commit(struct xe_vm *vm,
> struct xe_vma_op *op)
>                         err |= xe_vm_insert_vma(vm, op->remap.prev);
>                         if (!err)
>                                 op->flags |=
> XE_VMA_OP_PREV_COMMITTED;
> -                       if (!err && op->remap.skip_prev)
> +                       if (!err && op->remap.skip_prev) {
> +                               op->remap.prev->tile_present =
> +                                       tile_present;
>                                 op->remap.prev = NULL;
> +                       }
>                 }
>                 if (op->remap.next) {
>                         err |= xe_vm_insert_vma(vm, op->remap.next);
>                         if (!err)
>                                 op->flags |=
> XE_VMA_OP_NEXT_COMMITTED;
> -                       if (!err && op->remap.skip_next)
> +                       if (!err && op->remap.skip_next) {
> +                               op->remap.next->tile_present =
> +                                       tile_present;
>                                 op->remap.next = NULL;
> +                       }
>                 }
>  
>                 /* Adjust for partial unbind after removin VMA from
> VM */
> @@ -2365,6 +2375,7 @@ static int xe_vma_op_commit(struct xe_vm *vm,
> struct xe_vma_op *op)
>                         op->base.remap.unmap->va->va.range = op-
> >remap.range;
>                 }
>                 break;
> +       }
>         case DRM_GPUVA_OP_UNMAP:
>                 prep_vma_destroy(vm, gpuva_to_vma(op->base.unmap.va),
> true);
>                 op->flags |= XE_VMA_OP_COMMITTED;



More information about the Intel-xe mailing list