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

Re: [Xen-devel] [PATCH v2 8/9] xen/gntdev: Implement dma-buf import functionality



On 06/05/2018 01:28 AM, Boris Ostrovsky wrote:
On 06/01/2018 07:41 AM, Oleksandr Andrushchenko wrote:
  /* ------------------------------------------------------------------ */
+static int
+dmabuf_imp_grant_foreign_access(struct page **pages, u32 *refs,
+                               int count, int domid)
+{
+       grant_ref_t priv_gref_head;
+       int i, ret;
+
+       ret = gnttab_alloc_grant_references(count, &priv_gref_head);
+       if (ret < 0) {
+               pr_err("Cannot allocate grant references, ret %d\n", ret);
+               return ret;
+       }
+
+       for (i = 0; i < count; i++) {
+               int cur_ref;
+
+               cur_ref = gnttab_claim_grant_reference(&priv_gref_head);
+               if (cur_ref < 0) {
+                       ret = cur_ref;
+                       pr_err("Cannot claim grant reference, ret %d\n", ret);
+                       goto out;
+               }
+
+               gnttab_grant_foreign_access_ref(cur_ref, domid,
+                                               xen_page_to_gfn(pages[i]), 0);
+               refs[i] = cur_ref;
+       }
+
+       ret = 0;
return 0?
My bad, thank you
+
+out:
+       gnttab_free_grant_references(priv_gref_head);
+       return ret;
+}
+


_______________________________________________
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®.