Lines Matching refs:vmw_tt
262 static void vmw_ttm_unmap_from_dma(struct vmw_ttm_tt *vmw_tt) in vmw_ttm_unmap_from_dma() argument
264 struct device *dev = vmw_tt->dev_priv->drm.dev; in vmw_ttm_unmap_from_dma()
266 dma_unmap_sgtable(dev, &vmw_tt->sgt, DMA_BIDIRECTIONAL, 0); in vmw_ttm_unmap_from_dma()
267 vmw_tt->sgt.nents = vmw_tt->sgt.orig_nents; in vmw_ttm_unmap_from_dma()
283 static int vmw_ttm_map_for_dma(struct vmw_ttm_tt *vmw_tt) in vmw_ttm_map_for_dma() argument
285 struct device *dev = vmw_tt->dev_priv->drm.dev; in vmw_ttm_map_for_dma()
287 return dma_map_sgtable(dev, &vmw_tt->sgt, DMA_BIDIRECTIONAL, 0); in vmw_ttm_map_for_dma()
300 static int vmw_ttm_map_dma(struct vmw_ttm_tt *vmw_tt) in vmw_ttm_map_dma() argument
302 struct vmw_private *dev_priv = vmw_tt->dev_priv; in vmw_ttm_map_dma()
304 struct vmw_sg_table *vsgt = &vmw_tt->vsgt; in vmw_ttm_map_dma()
315 if (vmw_tt->mapped) in vmw_ttm_map_dma()
319 vsgt->pages = vmw_tt->dma_ttm.pages; in vmw_ttm_map_dma()
320 vsgt->num_pages = vmw_tt->dma_ttm.num_pages; in vmw_ttm_map_dma()
321 vsgt->addrs = vmw_tt->dma_ttm.dma_address; in vmw_ttm_map_dma()
322 vsgt->sgt = &vmw_tt->sgt; in vmw_ttm_map_dma()
331 vmw_tt->sg_alloc_size = sgt_size + sgl_size * vsgt->num_pages; in vmw_ttm_map_dma()
332 ret = ttm_mem_global_alloc(glob, vmw_tt->sg_alloc_size, &ctx); in vmw_ttm_map_dma()
337 &vmw_tt->sgt, vsgt->pages, vsgt->num_pages, 0, in vmw_ttm_map_dma()
343 if (vsgt->num_pages > vmw_tt->sgt.orig_nents) { in vmw_ttm_map_dma()
346 vmw_tt->sgt.orig_nents); in vmw_ttm_map_dma()
349 vmw_tt->sg_alloc_size -= over_alloc; in vmw_ttm_map_dma()
352 ret = vmw_ttm_map_for_dma(vmw_tt); in vmw_ttm_map_dma()
362 vmw_tt->vsgt.num_regions = 0; in vmw_ttm_map_dma()
367 vmw_tt->vsgt.num_regions++; in vmw_ttm_map_dma()
371 vmw_tt->mapped = true; in vmw_ttm_map_dma()
375 sg_free_table(vmw_tt->vsgt.sgt); in vmw_ttm_map_dma()
376 vmw_tt->vsgt.sgt = NULL; in vmw_ttm_map_dma()
378 ttm_mem_global_free(glob, vmw_tt->sg_alloc_size); in vmw_ttm_map_dma()
391 static void vmw_ttm_unmap_dma(struct vmw_ttm_tt *vmw_tt) in vmw_ttm_unmap_dma() argument
393 struct vmw_private *dev_priv = vmw_tt->dev_priv; in vmw_ttm_unmap_dma()
395 if (!vmw_tt->vsgt.sgt) in vmw_ttm_unmap_dma()
401 vmw_ttm_unmap_from_dma(vmw_tt); in vmw_ttm_unmap_dma()
402 sg_free_table(vmw_tt->vsgt.sgt); in vmw_ttm_unmap_dma()
403 vmw_tt->vsgt.sgt = NULL; in vmw_ttm_unmap_dma()
405 vmw_tt->sg_alloc_size); in vmw_ttm_unmap_dma()
410 vmw_tt->mapped = false; in vmw_ttm_unmap_dma()
426 struct vmw_ttm_tt *vmw_tt = in vmw_bo_sg_table() local
429 return &vmw_tt->vsgt; in vmw_bo_sg_table()
561 struct vmw_ttm_tt *vmw_tt = container_of(ttm, struct vmw_ttm_tt, in vmw_ttm_unpopulate() local
565 if (vmw_tt->mob) { in vmw_ttm_unpopulate()
566 vmw_mob_destroy(vmw_tt->mob); in vmw_ttm_unpopulate()
567 vmw_tt->mob = NULL; in vmw_ttm_unpopulate()
570 vmw_ttm_unmap_dma(vmw_tt); in vmw_ttm_unpopulate()
746 struct vmw_ttm_tt *vmw_tt = in vmw_bo_create_and_populate() local
748 ret = vmw_ttm_map_dma(vmw_tt); in vmw_bo_create_and_populate()