gntdev_dmabuf 65 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *gntdev_dmabuf; gntdev_dmabuf 99 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *gntdev_dmabuf) gntdev_dmabuf 108 drivers/xen/gntdev-dmabuf.c obj->gntdev_dmabuf = gntdev_dmabuf; gntdev_dmabuf 113 drivers/xen/gntdev-dmabuf.c kref_put(&gntdev_dmabuf->u.exp.refcount, dmabuf_exp_release); gntdev_dmabuf 138 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *gntdev_dmabuf) gntdev_dmabuf 143 drivers/xen/gntdev-dmabuf.c if (obj->gntdev_dmabuf == gntdev_dmabuf) { gntdev_dmabuf 150 drivers/xen/gntdev-dmabuf.c static struct gntdev_dmabuf * gntdev_dmabuf 153 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *gntdev_dmabuf, *ret = ERR_PTR(-ENOENT); gntdev_dmabuf 156 drivers/xen/gntdev-dmabuf.c list_for_each_entry(gntdev_dmabuf, &priv->exp_list, next) gntdev_dmabuf 157 drivers/xen/gntdev-dmabuf.c if (gntdev_dmabuf->fd == fd) { gntdev_dmabuf 159 drivers/xen/gntdev-dmabuf.c kref_get(&gntdev_dmabuf->u.exp.refcount); gntdev_dmabuf 160 drivers/xen/gntdev-dmabuf.c ret = gntdev_dmabuf; gntdev_dmabuf 170 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *gntdev_dmabuf; gntdev_dmabuf 180 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf = dmabuf_exp_wait_obj_get_dmabuf(priv, fd); gntdev_dmabuf 181 drivers/xen/gntdev-dmabuf.c if (IS_ERR(gntdev_dmabuf)) gntdev_dmabuf 182 drivers/xen/gntdev-dmabuf.c return PTR_ERR(gntdev_dmabuf); gntdev_dmabuf 189 drivers/xen/gntdev-dmabuf.c obj = dmabuf_exp_wait_obj_new(priv, gntdev_dmabuf); gntdev_dmabuf 268 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *gntdev_dmabuf = attach->dmabuf->priv; gntdev_dmabuf 271 drivers/xen/gntdev-dmabuf.c pr_debug("Mapping %d pages for dev %p\n", gntdev_dmabuf->nr_pages, gntdev_dmabuf 288 drivers/xen/gntdev-dmabuf.c sgt = dmabuf_pages_to_sgt(gntdev_dmabuf->pages, gntdev_dmabuf 289 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->nr_pages); gntdev_dmabuf 315 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *gntdev_dmabuf = gntdev_dmabuf 316 drivers/xen/gntdev-dmabuf.c container_of(kref, struct gntdev_dmabuf, u.exp.refcount); gntdev_dmabuf 318 drivers/xen/gntdev-dmabuf.c dmabuf_exp_wait_obj_signal(gntdev_dmabuf->priv, gntdev_dmabuf); gntdev_dmabuf 319 drivers/xen/gntdev-dmabuf.c list_del(&gntdev_dmabuf->next); gntdev_dmabuf 320 drivers/xen/gntdev-dmabuf.c fput(gntdev_dmabuf->priv->filp); gntdev_dmabuf 321 drivers/xen/gntdev-dmabuf.c kfree(gntdev_dmabuf); gntdev_dmabuf 335 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *gntdev_dmabuf = dma_buf->priv; gntdev_dmabuf 336 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf_priv *priv = gntdev_dmabuf->priv; gntdev_dmabuf 338 drivers/xen/gntdev-dmabuf.c dmabuf_exp_remove_map(gntdev_dmabuf->u.exp.priv, gntdev_dmabuf 339 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->u.exp.map); gntdev_dmabuf 341 drivers/xen/gntdev-dmabuf.c kref_put(&gntdev_dmabuf->u.exp.refcount, dmabuf_exp_release); gntdev_dmabuf 389 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *gntdev_dmabuf; gntdev_dmabuf 392 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf = kzalloc(sizeof(*gntdev_dmabuf), GFP_KERNEL); gntdev_dmabuf 393 drivers/xen/gntdev-dmabuf.c if (!gntdev_dmabuf) gntdev_dmabuf 396 drivers/xen/gntdev-dmabuf.c kref_init(&gntdev_dmabuf->u.exp.refcount); gntdev_dmabuf 398 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->priv = args->dmabuf_priv; gntdev_dmabuf 399 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->nr_pages = args->count; gntdev_dmabuf 400 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->pages = args->pages; gntdev_dmabuf 401 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->u.exp.priv = args->priv; gntdev_dmabuf 402 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->u.exp.map = args->map; gntdev_dmabuf 412 drivers/xen/gntdev-dmabuf.c exp_info.priv = gntdev_dmabuf; gntdev_dmabuf 414 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->dmabuf = dma_buf_export(&exp_info); gntdev_dmabuf 415 drivers/xen/gntdev-dmabuf.c if (IS_ERR(gntdev_dmabuf->dmabuf)) { gntdev_dmabuf 416 drivers/xen/gntdev-dmabuf.c ret = PTR_ERR(gntdev_dmabuf->dmabuf); gntdev_dmabuf 417 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->dmabuf = NULL; gntdev_dmabuf 421 drivers/xen/gntdev-dmabuf.c ret = dma_buf_fd(gntdev_dmabuf->dmabuf, O_CLOEXEC); gntdev_dmabuf 425 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->fd = ret; gntdev_dmabuf 431 drivers/xen/gntdev-dmabuf.c list_add(&gntdev_dmabuf->next, &args->dmabuf_priv->exp_list); gntdev_dmabuf 433 drivers/xen/gntdev-dmabuf.c get_file(gntdev_dmabuf->priv->filp); gntdev_dmabuf 437 drivers/xen/gntdev-dmabuf.c if (gntdev_dmabuf->dmabuf) gntdev_dmabuf 438 drivers/xen/gntdev-dmabuf.c dma_buf_put(gntdev_dmabuf->dmabuf); gntdev_dmabuf 439 drivers/xen/gntdev-dmabuf.c kfree(gntdev_dmabuf); gntdev_dmabuf 565 drivers/xen/gntdev-dmabuf.c static void dmabuf_imp_free_storage(struct gntdev_dmabuf *gntdev_dmabuf) gntdev_dmabuf 567 drivers/xen/gntdev-dmabuf.c kfree(gntdev_dmabuf->pages); gntdev_dmabuf 568 drivers/xen/gntdev-dmabuf.c kfree(gntdev_dmabuf->u.imp.refs); gntdev_dmabuf 569 drivers/xen/gntdev-dmabuf.c kfree(gntdev_dmabuf); gntdev_dmabuf 572 drivers/xen/gntdev-dmabuf.c static struct gntdev_dmabuf *dmabuf_imp_alloc_storage(int count) gntdev_dmabuf 574 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *gntdev_dmabuf; gntdev_dmabuf 577 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf = kzalloc(sizeof(*gntdev_dmabuf), GFP_KERNEL); gntdev_dmabuf 578 drivers/xen/gntdev-dmabuf.c if (!gntdev_dmabuf) gntdev_dmabuf 581 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->u.imp.refs = kcalloc(count, gntdev_dmabuf 582 drivers/xen/gntdev-dmabuf.c sizeof(gntdev_dmabuf->u.imp.refs[0]), gntdev_dmabuf 584 drivers/xen/gntdev-dmabuf.c if (!gntdev_dmabuf->u.imp.refs) gntdev_dmabuf 587 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->pages = kcalloc(count, gntdev_dmabuf 588 drivers/xen/gntdev-dmabuf.c sizeof(gntdev_dmabuf->pages[0]), gntdev_dmabuf 590 drivers/xen/gntdev-dmabuf.c if (!gntdev_dmabuf->pages) gntdev_dmabuf 593 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->nr_pages = count; gntdev_dmabuf 596 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->u.imp.refs[i] = GRANT_INVALID_REF; gntdev_dmabuf 598 drivers/xen/gntdev-dmabuf.c return gntdev_dmabuf; gntdev_dmabuf 601 drivers/xen/gntdev-dmabuf.c dmabuf_imp_free_storage(gntdev_dmabuf); gntdev_dmabuf 606 drivers/xen/gntdev-dmabuf.c static struct gntdev_dmabuf * gntdev_dmabuf 610 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *gntdev_dmabuf, *ret; gntdev_dmabuf 621 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf = dmabuf_imp_alloc_storage(count); gntdev_dmabuf 622 drivers/xen/gntdev-dmabuf.c if (IS_ERR(gntdev_dmabuf)) { gntdev_dmabuf 623 drivers/xen/gntdev-dmabuf.c ret = gntdev_dmabuf; gntdev_dmabuf 627 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->priv = priv; gntdev_dmabuf 628 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->fd = fd; gntdev_dmabuf 636 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->u.imp.attach = attach; gntdev_dmabuf 645 drivers/xen/gntdev-dmabuf.c if (attach->dmabuf->size != gntdev_dmabuf->nr_pages << PAGE_SHIFT) { gntdev_dmabuf 648 drivers/xen/gntdev-dmabuf.c attach->dmabuf->size, gntdev_dmabuf->nr_pages); gntdev_dmabuf 652 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->u.imp.sgt = sgt; gntdev_dmabuf 668 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->pages[i++] = page; gntdev_dmabuf 671 drivers/xen/gntdev-dmabuf.c ret = ERR_PTR(dmabuf_imp_grant_foreign_access(gntdev_dmabuf->pages, gntdev_dmabuf 672 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->u.imp.refs, gntdev_dmabuf 680 drivers/xen/gntdev-dmabuf.c list_add(&gntdev_dmabuf->next, &priv->imp_list); gntdev_dmabuf 683 drivers/xen/gntdev-dmabuf.c return gntdev_dmabuf; gntdev_dmabuf 686 drivers/xen/gntdev-dmabuf.c dmabuf_imp_end_foreign_access(gntdev_dmabuf->u.imp.refs, count); gntdev_dmabuf 692 drivers/xen/gntdev-dmabuf.c dmabuf_imp_free_storage(gntdev_dmabuf); gntdev_dmabuf 702 drivers/xen/gntdev-dmabuf.c static struct gntdev_dmabuf * gntdev_dmabuf 705 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *q, *gntdev_dmabuf, *ret = ERR_PTR(-ENOENT); gntdev_dmabuf 708 drivers/xen/gntdev-dmabuf.c list_for_each_entry_safe(gntdev_dmabuf, q, &priv->imp_list, next) { gntdev_dmabuf 709 drivers/xen/gntdev-dmabuf.c if (gntdev_dmabuf->fd == fd) { gntdev_dmabuf 711 drivers/xen/gntdev-dmabuf.c ret = gntdev_dmabuf; gntdev_dmabuf 712 drivers/xen/gntdev-dmabuf.c list_del(&gntdev_dmabuf->next); gntdev_dmabuf 722 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *gntdev_dmabuf; gntdev_dmabuf 726 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf = dmabuf_imp_find_unlink(priv, fd); gntdev_dmabuf 727 drivers/xen/gntdev-dmabuf.c if (IS_ERR(gntdev_dmabuf)) gntdev_dmabuf 728 drivers/xen/gntdev-dmabuf.c return PTR_ERR(gntdev_dmabuf); gntdev_dmabuf 732 drivers/xen/gntdev-dmabuf.c dmabuf_imp_end_foreign_access(gntdev_dmabuf->u.imp.refs, gntdev_dmabuf 733 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf->nr_pages); gntdev_dmabuf 735 drivers/xen/gntdev-dmabuf.c attach = gntdev_dmabuf->u.imp.attach; gntdev_dmabuf 737 drivers/xen/gntdev-dmabuf.c if (gntdev_dmabuf->u.imp.sgt) gntdev_dmabuf 738 drivers/xen/gntdev-dmabuf.c dma_buf_unmap_attachment(attach, gntdev_dmabuf->u.imp.sgt, gntdev_dmabuf 744 drivers/xen/gntdev-dmabuf.c dmabuf_imp_free_storage(gntdev_dmabuf); gntdev_dmabuf 750 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *q, *gntdev_dmabuf; gntdev_dmabuf 752 drivers/xen/gntdev-dmabuf.c list_for_each_entry_safe(gntdev_dmabuf, q, &priv->imp_list, next) gntdev_dmabuf 753 drivers/xen/gntdev-dmabuf.c dmabuf_imp_release(priv, gntdev_dmabuf->fd); gntdev_dmabuf 815 drivers/xen/gntdev-dmabuf.c struct gntdev_dmabuf *gntdev_dmabuf; gntdev_dmabuf 824 drivers/xen/gntdev-dmabuf.c gntdev_dmabuf = dmabuf_imp_to_refs(priv->dmabuf_priv, gntdev_dmabuf 827 drivers/xen/gntdev-dmabuf.c if (IS_ERR(gntdev_dmabuf)) gntdev_dmabuf 828 drivers/xen/gntdev-dmabuf.c return PTR_ERR(gntdev_dmabuf); gntdev_dmabuf 830 drivers/xen/gntdev-dmabuf.c if (copy_to_user(u->refs, gntdev_dmabuf->u.imp.refs,