[Intel-gfx] [PATCH v2 14/37] drm/i915/selftest: extend coverage to include LMEM huge-pages

Chris Wilson chris at chris-wilson.co.uk
Thu Jun 27 23:42:03 UTC 2019


Quoting Matthew Auld (2019-06-27 21:56:10)
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> ---
>  .../gpu/drm/i915/gem/selftests/huge_pages.c   | 122 +++++++++++++++++-
>  1 file changed, 121 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> index 1862bf06a20f..c81ea9ce289b 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/huge_pages.c
> @@ -981,7 +981,7 @@ static int gpu_write(struct i915_vma *vma,
>                                vma->size >> PAGE_SHIFT, val);
>  }
>  
> -static int cpu_check(struct drm_i915_gem_object *obj, u32 dword, u32 val)
> +static int __cpu_check_shmem(struct drm_i915_gem_object *obj, u32 dword, u32 val)
>  {
>         unsigned int needs_flush;
>         unsigned long n;
> @@ -1013,6 +1013,53 @@ static int cpu_check(struct drm_i915_gem_object *obj, u32 dword, u32 val)
>         return err;
>  }
>  
> +static int __cpu_check_lmem(struct drm_i915_gem_object *obj, u32 dword, u32 val)
> +{
> +       unsigned long n;
> +       int err;
> +
> +       i915_gem_object_lock(obj);
> +       err = i915_gem_object_set_to_wc_domain(obj, false);
> +       i915_gem_object_unlock(obj);
> +       if (err)
> +               return err;
> +
> +       err = i915_gem_object_pin_pages(obj);
> +       if (err)
> +               return err;
> +
> +       for (n = 0; n < obj->base.size >> PAGE_SHIFT; ++n) {
> +               u32 __iomem *base;
> +               u32 read_val;
> +
> +               base = i915_gem_object_lmem_io_map_page(obj, n);
> +
> +               read_val = ioread32(base + dword);
> +               io_mapping_unmap_atomic(base);
> +               if (read_val != val) {
> +                       pr_err("n=%lu base[%u]=%u, val=%u\n",
> +                              n, dword, read_val, val);
> +                       err = -EINVAL;
> +                       break;
> +               }
> +       }
> +
> +       i915_gem_object_unpin_pages(obj);
> +       return err;
> +}
> +
> +static int cpu_check(struct drm_i915_gem_object *obj, u32 dword, u32 val)

We have different meanings of cpu :-p
-Chris


More information about the Intel-gfx mailing list