Lines Matching refs:map

312 	struct fastrpc_map *map;
314 map = container_of(ref, struct fastrpc_map, refcount);
316 if (map->table) {
317 if (map->attr & FASTRPC_ATTR_SECUREMAP) {
319 int vmid = map->fl->cctx->vmperms[0].vmid;
325 err = qcom_scm_assign_mem(map->phys, map->size,
328 dev_err(map->fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d",
329 map->phys, map->size, err);
333 dma_buf_unmap_attachment_unlocked(map->attach, map->table,
335 dma_buf_detach(map->buf, map->attach);
336 dma_buf_put(map->buf);
339 if (map->fl) {
340 spin_lock(&map->fl->lock);
341 list_del(&map->node);
342 spin_unlock(&map->fl->lock);
343 map->fl = NULL;
346 kfree(map);
349 static void fastrpc_map_put(struct fastrpc_map *map)
351 if (map)
352 kref_put(&map->refcount, fastrpc_free_map);
355 static int fastrpc_map_get(struct fastrpc_map *map)
357 if (!map)
360 return kref_get_unless_zero(&map->refcount) ? 0 : -ENOENT;
368 struct fastrpc_map *map = NULL;
372 list_for_each_entry(map, &fl->maps, node) {
373 if (map->fd != fd)
377 ret = fastrpc_map_get(map);
379 dev_dbg(sess->dev, "%s: Failed to get map fd=%d ret=%d\n",
385 *ppmap = map;
723 static int fastrpc_vmap(struct dma_buf *dmabuf, struct iosys_map *map)
727 iosys_map_set_vaddr(map, buf->virt);
758 struct fastrpc_map *map = NULL;
765 map = kzalloc(sizeof(*map), GFP_KERNEL);
766 if (!map)
769 INIT_LIST_HEAD(&map->node);
770 kref_init(&map->refcount);
772 map->fl = fl;
773 map->fd = fd;
774 map->buf = dma_buf_get(fd);
775 if (IS_ERR(map->buf)) {
776 err = PTR_ERR(map->buf);
780 map->attach = dma_buf_attach(map->buf, sess->dev);
781 if (IS_ERR(map->attach)) {
783 err = PTR_ERR(map->attach);
787 table = dma_buf_map_attachment_unlocked(map->attach, DMA_BIDIRECTIONAL);
792 map->table = table;
795 map->phys = sg_phys(map->table->sgl);
797 map->phys = sg_dma_address(map->table->sgl);
798 map->phys += ((u64)fl->sctx->sid << 32);
800 map->size = len;
801 map->va = sg_virt(map->table->sgl);
802 map->len = len;
816 map->attr = attr;
817 err = qcom_scm_assign_mem(map->phys, (u64)map->size, &src_perms, dst_perms, 2);
820 map->phys, map->size, err);
825 list_add_tail(&map->node, &fl->maps);
827 *ppmap = map;
832 dma_buf_detach(map->buf, map->attach);
834 dma_buf_put(map->buf);
836 fastrpc_map_put(map);
916 dev_err(dev, "Error Creating map %d\n", err);
1359 struct fastrpc_map *map = NULL;
1405 err = fastrpc_map_create(fl, init.filefd, init.filelen, 0, &map);
1462 fastrpc_map_put(map);
1520 struct fastrpc_map *map, *m;
1538 list_for_each_entry_safe(map, m, &fl->maps, node)
1539 fastrpc_map_put(map);
1955 struct fastrpc_map *map = NULL, *iter, *m;
1964 map = iter;
1971 if (!map) {
1972 dev_err(dev, "map not in list\n");
1977 req_msg.len = map->len;
1978 req_msg.vaddrin = map->raddr;
1979 req_msg.fd = map->fd;
1988 dev_err(dev, "unmmap\tpt fd = %d, 0x%09llx error\n", map->fd, map->raddr);
1991 fastrpc_map_put(map);
2015 struct fastrpc_map *map = NULL;
2023 err = fastrpc_map_create(fl, req.fd, req.length, 0, &map);
2025 dev_err(dev, "failed to map buffer, fd = %d\n", req.fd);
2033 map->va = (void *) (uintptr_t) req.vaddrin;
2041 pages.addr = map->phys;
2042 pages.size = map->size;
2057 req.fd, req.vaddrin, map->size);
2062 map->raddr = rsp_msg.vaddr;
2070 req_unmap.length = map->size;
2078 fastrpc_map_put(map);