[Intel-gfx] [PATCH 2/3] drm/i915/adlp: Fix GEM VM asserts for DPT VMs

Souza, Jose jose.souza at intel.com
Mon May 24 17:59:20 UTC 2021


On Mon, 2021-05-24 at 20:27 +0300, Imre Deak wrote:
> An object mapped via DPT can have remapped and rotated VMA instances
> besides the normal VMA instance, similarly to GGTT VMA instances.
> Adjust the corresponding VMA lookup asserts.
> 
> While at it also check if a DPT VM is passed incorrectly to
> i915_vm_to_ppgtt().
> 

Reviewed-by: José Roberto de Souza <jose.souza at intel.com>

> Signed-off-by: Imre Deak <imre.deak at intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_gtt.h | 3 ++-
>  drivers/gpu/drm/i915/i915_vma.c     | 2 +-
>  drivers/gpu/drm/i915/i915_vma.h     | 2 +-
>  3 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h b/drivers/gpu/drm/i915/gt/intel_gtt.h
> index ca00b45827b74..50a98ce39f74b 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gtt.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gtt.h
> @@ -359,6 +359,7 @@ struct i915_ppgtt {
>  
>  #define i915_is_ggtt(vm) ((vm)->is_ggtt)
>  #define i915_is_dpt(vm) ((vm)->is_dpt)
> +#define i915_is_ggtt_or_dpt(vm) (i915_is_ggtt(vm) || i915_is_dpt(vm))
>  
>  int __must_check
>  i915_vm_lock_objects(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww);
> @@ -393,7 +394,7 @@ static inline struct i915_ppgtt *
>  i915_vm_to_ppgtt(struct i915_address_space *vm)
>  {
>  	BUILD_BUG_ON(offsetof(struct i915_ppgtt, vm));
> -	GEM_BUG_ON(i915_is_ggtt(vm));
> +	GEM_BUG_ON(i915_is_ggtt_or_dpt(vm));
>  	return container_of(vm, struct i915_ppgtt, vm);
>  }
>  
> diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
> index a6cd0fa628477..b319fd3f91cc3 100644
> --- a/drivers/gpu/drm/i915/i915_vma.c
> +++ b/drivers/gpu/drm/i915/i915_vma.c
> @@ -274,7 +274,7 @@ i915_vma_instance(struct drm_i915_gem_object *obj,
>  {
>  	struct i915_vma *vma;
>  
> -	GEM_BUG_ON(view && !i915_is_ggtt(vm));
> +	GEM_BUG_ON(view && !i915_is_ggtt_or_dpt(vm));
>  	GEM_BUG_ON(!atomic_read(&vm->open));
>  
>  	spin_lock(&obj->vma.lock);
> diff --git a/drivers/gpu/drm/i915/i915_vma.h b/drivers/gpu/drm/i915/i915_vma.h
> index 8df784a026d21..2a108e66cd495 100644
> --- a/drivers/gpu/drm/i915/i915_vma.h
> +++ b/drivers/gpu/drm/i915/i915_vma.h
> @@ -158,7 +158,7 @@ i915_vma_compare(struct i915_vma *vma,
>  {
>  	ptrdiff_t cmp;
>  
> -	GEM_BUG_ON(view && !i915_is_ggtt(vm));
> +	GEM_BUG_ON(view && !i915_is_ggtt_or_dpt(vm));
>  
>  	cmp = ptrdiff(vma->vm, vm);
>  	if (cmp)



More information about the Intel-gfx mailing list