[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/1] drm/xen-zcopy: Add Xen zero-copy helper DRM driver



On Thu, Mar 29, 2018 at 04:19:31PM +0300, Oleksandr Andrushchenko wrote:
> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> +static int to_refs_grant_foreign_access(struct xen_gem_object *xen_obj)
> +{
> +     grant_ref_t priv_gref_head;
> +     int ret, j, cur_ref, num_pages;
> +     struct sg_page_iter sg_iter;
> +
> +     ret = gnttab_alloc_grant_references(xen_obj->num_pages,
> +                     &priv_gref_head);
> +     if (ret < 0) {
> +             DRM_ERROR("Cannot allocate grant references\n");
> +             return ret;
> +     }
> +
> +     j = 0;
> +     num_pages = xen_obj->num_pages;
> +     for_each_sg_page(xen_obj->sgt->sgl, &sg_iter, xen_obj->sgt->nents, 0) {
> +             struct page *page;
> +
> +             page = sg_page_iter_page(&sg_iter);

Quick drive-by: You can't assume that an sgt is struct page backed.

And you probably want to check this at import/attach time.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.