Re: [RFC PATCH 29/42] drm/i915: Set correct vmf source pages for gem objects

Chris Wilson
2019-02-14T16:02:20Z

Quoting Matthew Auld (2019-02-14 14:57:27)
> +int i915_gem_vmf_fill_pages_cpu(struct drm_i915_gem_object *obj,
> + struct vm_fault *vmf,
> + pgoff_t page_offset)
> +{
> + struct vm_area_struct *area = vmf->vma;
> + struct drm_device *dev = obj->base.dev;
> + struct drm_i915_private *dev_priv = to_i915(dev);
> + struct page *page;
> + unsigned long pfn;
> + vm_fault_t vmf_ret;
> + pgoff_t pg_off = (vmf->address - area->vm_start) >> PAGE_SHIFT;
> +
> + if (HAS_MAPPABLE_APERTURE(dev_priv))
> + return __vmf_fill_pages_gtt(obj, vmf, page_offset);
> +
> + page = i915_gem_object_get_page(obj, pg_off);
> + pfn = page_to_pfn(page);
> +
> + vmf_ret = vmf_insert_mixed(area, vmf->address,
> + __pfn_to_pfn_t(pfn, PFN_DEV));
> + if (vmf_ret & VM_FAULT_ERROR)
> + return vm_fault_to_errno(vmf_ret, 0);
> +
> + if (!obj->userfault_count++)
> + list_add(&obj->userfault_link, &dev_priv->mm.userfault_list);
> +
> + GEM_BUG_ON(!obj->userfault_count);

What are you using the GGTT fence tracking for?
-Chris