Unmappable VRAM patchset V4
Subsystems (6)
Updated patchset, to apply cleanly on top of TTM split no_wait argument. Compile tested for nouveau+vmwgfx, test in progress for radeon.
So with the new change radeon won't wait for bo reserving other bo in fault path but will wait the GPU (hoping it doesn't lockup ;)) This should address concern about the wait/locking issue.
Cheers,
Jerome
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
PATCH 1/9 drm/ttm: ttm_fault callback to allow driver to handle bo placement V2
On fault the driver is given the opportunity to perform any operation it sees fit in order to place the buffer into a CPU visible area of memory. This patch doesn't break TTM users, nouveau, vmwgfx and radeon should keep working properly. Future patch will take advantage of this infrastructure and remove the old path from TTM once driver are converted.
V2 return VM_FAULT_NOPAGE if callback return -EBUSY or -ERESTARTSYS
--- drivers/gpu/drm/ttm/ttm_bo.c | 3 +- drivers/gpu/drm/ttm/ttm_bo_util.c | 92 +++++++++++++++++-------------------- drivers/gpu/drm/ttm/ttm_bo_vm.c | 56 ++++++++++++---------- include/drm/ttm/ttm_bo_api.h | 1 + include/drm/ttm/ttm_bo_driver.h | 30 ++++++++++++ 5 files changed, 105 insertions(+), 77 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +2 -1
@@ -1588,7 +1588,8 @@ void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo)if (!bdev->dev_mapping)return ; - +if (bdev->driver->io_mem_free) + bdev->driver->io_mem_free (bdev, &bo->mem);unmap_mapping_range (bdev->dev_mapping, offset, holelen,1 ); }EXPORT_SYMBOL (ttm_bo_unmap_virtual);
drivers/gpu/drm/ttm/ttm_bo_util.c +42 -50
144 lines not on this page · raw message
drivers/gpu/drm/ttm/ttm_bo_vm.c +30 -26
120 lines not on this page · raw message
include/drm/ttm/ttm_bo_api.h +1 -0
@@ -274,6 +274,7 @@ struct ttm_bo_kmap_obj { ttm_bo_map_kmap =3 , ttm_bo_map_premapped =4 |TTM_BO_MAP_IOMEM_MASK , } bo_kmap_type; +struct ttm_buffer_object *bo; };/**
include/drm/ttm/ttm_bo_driver.h +30 -0
@@ -240,6 +240,23 @@ struct ttm_mem_type_manager { };/** +* struct ttm_bus_placement +* +* @base: bus base address +* @is_iomem: is this io memory ? +* @size: size in byte +* @offset: offset from the base address +* +* Structure indicating the bus placement of an object. +*/ +struct ttm_bus_placement { +unsigned long base; +unsigned long size; +unsigned long offset; +bool is_iomem; +}; + +/** * struct ttm_bo_driver * * @create_ttm_backend_entry: Callback to create a struct ttm_backend.
@@ -359,6 +376,19 @@ struct ttm_bo_driver {* notify the driver that we're about to swap out this bo */ void (*swap_notify) (struct ttm_buffer_object *bo); + +/** +* Driver callback on bo fault, driver is responsible to fill the +* bus placement and has the opportunity to move the buffer into +* visible space. +*/ +int (*fault_reserve)(struct ttm_buffer_object *bo,struct ttm_bus_placement *pl); +/** +* Driver callback on when mapping io memory (for bo_move_memcpy for instance). +* TTM will take care to call io_mem_free whenever the mapping is not use anymore. +*/ +int (*io_mem_reserve)(struct ttm_bo_device *bdev,struct ttm_mem_reg *mem,struct ttm_bus_placement *pl); +void (*io_mem_free)(struct ttm_bo_device *bdev,struct ttm_mem_reg *mem); };/**
Signature · 10 lines
1.6.6 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
PATCH 2/9 drm/radeon/kms: add support for new fault callback V3
This add the support for the new fault callback and also the infrastructure for supporting unmappable VRAM.
V2 validate BO with no_wait = true
V3 don't derefence bo->mem.mm_node as it's not NULL only for
VRAM or GTT
V4 update to splitted no_wait ttm change
--- drivers/gpu/drm/radeon/radeon_ttm.c | 103 ++++++++++++++++++++++++++++++++++- 1 files changed, 102 insertions(+), 1 deletions(-)
drivers/gpu/drm/radeon/radeon_ttm.c +102 -1
@@ -437,10 +437,108 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, memcpy: r =ttm_bo_move_memcpy (bo, evict, no_wait_reserve, no_wait_gpu, new_mem); } -return r; } +static int radeon_ttm_io_mem_reserve (struct ttm_bo_device *bdev,struct ttm_mem_reg *mem,struct ttm_bus_placement *pl) +{ +struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type]; +struct radeon_device *rdev =radeon_get_rdev (bdev); + + pl->offset =0 ; + pl->size = mem->num_pages <<PAGE_SHIFT ; + pl->base =0 ; + pl->is_iomem = false; +if (!(man->flags &TTM_MEMTYPE_FLAG_MAPPABLE )) +return -EINVAL ; +switch (mem->mem_type) { +case TTM_PL_SYSTEM : +/* system memory */ +return 0 ; +case TTM_PL_TT : + pl->offset = mem->mm_node->start <<PAGE_SHIFT ; +#if __OS_HAS_AGP +if (rdev->flags &RADEON_IS_AGP ) { +/* RADEON_IS_AGP is set only if AGP is active */ + pl->base = rdev->mc.agp_base; + pl->is_iomem = true; + } +#endif +return 0 ; +case TTM_PL_VRAM : + pl->offset = mem->mm_node->start <<PAGE_SHIFT ; +/* check if it's visible */ +if ((pl->offset + pl->size) > rdev->mc.visible_vram_size) +return -EINVAL ; + pl->base = rdev->mc.aper_base; + pl->is_iomem = true; +break ; +default : +return -EINVAL ; + } +return 0 ; +} + +static void radeon_ttm_io_mem_free (struct ttm_bo_device *bdev,struct ttm_mem_reg *mem) +{ +/* hopefully will be usefull soon */ +} + +static int radeon_ttm_fault_callback (struct ttm_buffer_object *bo,struct ttm_bus_placement *pl) +{ +struct ttm_mem_type_manager *man = &bo->bdev->man[bo->mem.mem_type]; +struct radeon_bo *rbo; +struct radeon_device *rdev; +int r; + + pl->offset =0 ; + pl->size = bo->mem.num_pages <<PAGE_SHIFT ; + pl->base =0 ; + pl->is_iomem = false; +if (!radeon_ttm_bo_is_radeon_bo (bo)) +/* FIXME should we return 0 ? we don't know about this BO */ +return -EINVAL ; +if (!(man->flags &TTM_MEMTYPE_FLAG_MAPPABLE )) +return -EINVAL ; + rbo = container_of(bo, struct radeon_bo, tbo); + rdev = rbo->rdev; +switch (bo->mem.mem_type) { +case TTM_PL_SYSTEM : +/* System memory */ +return 0 ; +case TTM_PL_TT : + pl->offset = bo->mem.mm_node->start <<PAGE_SHIFT ; +#if __OS_HAS_AGP +if (rdev->flags &RADEON_IS_AGP ) { +/* RADEON_IS_AGP is set only if AGP is active */ + pl->base = rdev->mc.agp_base; + pl->is_iomem = true; + } +#endif +return 0 ; +case TTM_PL_VRAM : + pl->offset = bo->mem.mm_node->start <<PAGE_SHIFT ; +if ((pl->offset + pl->size) > rdev->mc.visible_vram_size) { +/* hurrah the memory is not visible ! */ +radeon_ttm_placement_from_domain (rbo,RADEON_GEM_DOMAIN_VRAM ); + rbo->placement.lpfn = rdev->mc.visible_vram_size >>PAGE_SHIFT ; + r =ttm_bo_validate (bo, &rbo->placement, false, true, false); +if (unlikely (r !=0 )) +return r; + pl->offset = bo->mem.mm_node->start <<PAGE_SHIFT ; +/* this should not happen */ +if ((pl->offset + pl->size) > rdev->mc.visible_vram_size) +return -EINVAL ; + } + pl->base = rdev->mc.aper_base; + pl->is_iomem = true; +break ; +default : +return -EINVAL ; + } +return 0 ; +} +static int radeon_sync_obj_wait (void *sync_obj,void *sync_arg,bool lazy,bool interruptible) {
@@ -481,6 +579,9 @@ static struct ttm_bo_driver radeon_bo_driver = { .sync_obj_ref = &radeon_sync_obj_ref, .move_notify = &radeon_bo_move_notify, .fault_reserve_notify = &radeon_bo_fault_reserve_notify, + .fault_reserve = &radeon_ttm_fault_callback, + .io_mem_reserve = &radeon_ttm_io_mem_reserve, + .io_mem_free = &radeon_ttm_io_mem_free, };int radeon_ttm_init (struct radeon_device *rdev)
Signature · 10 lines
1.6.6 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
PATCH 3/9 drm/nouveau/kms: add support for new TTM fault callback V2
This add the support for the new fault callback, does change anything from driver point of view, thought it should allow nouveau to add support for unmappable VRAM.
Improvement: store the aperture base in a variable so that we don't call a function to get it on each fault.
Patch hasn't been tested on any hw.
V2 don't derefence bo->mem.mm_node as it's not NULL only for
VRAM or GTT
--- drivers/gpu/drm/nouveau/nouveau_bo.c | 46 ++++++++++++++++++++++++++++++++++ 1 files changed, 46 insertions(+), 0 deletions(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +46 -0
@@ -762,6 +762,49 @@ nouveau_bo_verify_access(struct ttm_buffer_object *bo, struct file *filp)return 0 ; } +static int +nouveau_ttm_io_mem_reserve (struct ttm_bo_device *bdev,struct ttm_mem_reg *mem,struct ttm_bus_placement *pl) +{ +struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type]; +struct drm_nouveau_private *dev_priv =nouveau_bdev (bdev); +struct drm_device *dev = dev_priv->dev; + + pl->offset =0 ; + pl->size = mem->num_pages <<PAGE_SHIFT ; + pl->base =0 ; + pl->is_iomem = false; +if (!(man->flags &TTM_MEMTYPE_FLAG_MAPPABLE )) +return -EINVAL ; +switch (mem->mem_type) { +case TTM_PL_SYSTEM : +/* System memory */ +return 0 ; +case TTM_PL_TT : + pl->offset = mem->mm_node->start <<PAGE_SHIFT ; +#if __OS_HAS_AGP +if (dev_priv->gart_info.type ==NOUVEAU_GART_AGP ) { + pl->base = dev_priv->gart_info.aper_base; + pl->is_iomem = true; + } +#endif +return 0 ; +case TTM_PL_VRAM : + pl->offset = mem->mm_node->start <<PAGE_SHIFT ; + pl->base =drm_get_resource_start (dev,1 ); + pl->is_iomem = true; +break ; +default : +return -EINVAL ; + } +return 0 ; +} + +static int +nouveau_ttm_fault (struct ttm_buffer_object *bo,struct ttm_bus_placement *pl) +{ +return nouveau_ttm_io_mem_reserve (bo->bdev, &bo->mem, pl); +} +struct ttm_bo_driver nouveau_bo_driver = { .create_ttm_backend_entry = nouveau_bo_create_ttm_backend_entry, .invalidate_caches = nouveau_bo_invalidate_caches,
@@ -774,5 +817,8 @@ struct ttm_bo_driver nouveau_bo_driver = { .sync_obj_flush = nouveau_fence_flush, .sync_obj_unref = nouveau_fence_unref, .sync_obj_ref = nouveau_fence_ref, + .fault_reserve = &nouveau_ttm_fault, + .io_mem_reserve = &nouveau_ttm_io_mem_reserve, + .io_mem_free = NULL, };
Signature · 10 lines
1.6.6 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
PATCH 4/9 drm/vmwgfx: add support for new TTM fault callback V2
This add the support for the new fault callback, does change anything from driver point of view.
Improvement: store the aperture base in a variable so that we don't call a function to get it on each fault.
Patch hasn't been tested.
V2 don't derefence bo->mem.mm_node as it's not NULL only for
VRAM or GTT
--- drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c | 36 +++++++++++++++++++++++++++++++- 1 files changed, 35 insertions(+), 1 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c +35 -1
@@ -193,6 +193,37 @@ static void vmw_swap_notify(struct ttm_buffer_object *bo)vmw_dmabuf_gmr_unbind (bo); } +static int vmw_ttm_io_mem_reserve (struct ttm_bo_device *bdev,struct ttm_mem_reg *mem,struct ttm_bus_placement *pl) +{ +struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type]; + struct vmw_private *dev_priv = container_of(bdev, struct vmw_private, bdev); + + pl->is_iomem = false; + pl->offset =0 ; + pl->size = mem->num_pages <<PAGE_SHIFT ; + pl->base =0 ; +if (!(man->flags &TTM_MEMTYPE_FLAG_MAPPABLE )) +return -EINVAL ; +switch (mem->mem_type) { +case TTM_PL_SYSTEM : +/* System memory */ +return 0 ; +case TTM_PL_VRAM : + pl->offset = mem->mm_node->start <<PAGE_SHIFT ; + pl->base = dev_priv->vram_start; + pl->is_iomem = true; +break ; +default : +return -EINVAL ; + } +return 0 ; +} + +static int vmw_ttm_fault (struct ttm_buffer_object *bo,struct ttm_bus_placement *pl) +{ +return vmw_ttm_io_mem_reserve (bo->bdev, &bo->mem, pl); +} +/** * FIXME: We're using the old vmware polling method to sync. * Do this with fences instead.
@@ -248,5 +279,8 @@ struct ttm_bo_driver vmw_bo_driver = { .sync_obj_unref = vmw_sync_obj_unref, .sync_obj_ref = vmw_sync_obj_ref, .move_notify = vmw_move_notify, - .swap_notify = vmw_swap_notify + .swap_notify = vmw_swap_notify, + .fault_reserve = vmw_ttm_fault, + .io_mem_reserve = &vmw_ttm_io_mem_reserve, + .io_mem_free = NULL, };
Signature · 10 lines
1.6.6 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
PATCH 5/9 drm/radeon/kms: don't initialize TTM io memory manager field
This isn't needed anymore with the new TTM fault callback
--- drivers/gpu/drm/radeon/radeon_ttm.c | 13 +------------ 1 files changed, 1 insertions(+), 12 deletions(-)
drivers/gpu/drm/radeon/radeon_ttm.c +1 -12
@@ -161,22 +161,14 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, (unsigned)type); return -EINVAL; } - man->io_offset = rdev->mc.agp_base; - man->io_size = rdev->mc.gtt_size; - man->io_addr =NULL ;if (!rdev->ddev->agp->cant_use_aperture) man->flags =TTM_MEMTYPE_FLAG_NEEDS_IOREMAP |TTM_MEMTYPE_FLAG_MAPPABLE ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ; - } else -#endif - { - man->io_offset =0 ; - man->io_size =0 ; - man->io_addr =NULL ; } +#endif break ;case TTM_PL_VRAM :/* "On-card" video ram */
@@ -186,9 +178,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,TTM_MEMTYPE_FLAG_MAPPABLE ; man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ; - man->io_addr =NULL ; - man->io_offset = rdev->mc.aper_base; - man->io_size = rdev->mc.aper_size;break ;default :DRM_ERROR ("Unsupported memory type %u\n" , (unsigned )type);
Signature · 10 lines
1.6.6 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
PATCH 6/9 drm/nouveau/kms: don't initialize TTM io memory manager field
This isn't needed anymore with the new TTM fault callback
--- drivers/gpu/drm/nouveau/nouveau_bo.c | 11 ----------- 1 files changed, 0 insertions(+), 11 deletions(-)
drivers/gpu/drm/nouveau/nouveau_bo.c +0 -11
@@ -391,13 +391,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, man->available_caching =TTM_PL_FLAG_UNCACHED |TTM_PL_FLAG_WC ; man->default_caching =TTM_PL_FLAG_WC ; - - man->io_addr =NULL ; - man->io_offset =drm_get_resource_start (dev,1 ); - man->io_size =drm_get_resource_len (dev,1 ); -if (man->io_size >nouveau_mem_fb_amount (dev)) - man->io_size =nouveau_mem_fb_amount (dev); - man->gpu_offset = dev_priv->vm_vram_base;break ;case TTM_PL_TT :
@@ -419,10 +412,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, dev_priv->gart_info.type);return -EINVAL ; } - - man->io_offset = dev_priv->gart_info.aper_base; - man->io_size = dev_priv->gart_info.aper_size; - man->io_addr =NULL ; man->gpu_offset = dev_priv->vm_gart_base;break ;default :
Signature · 10 lines
1.6.6 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
PATCH 7/9 drm/vmwgfx: don't initialize TTM io memory manager field
This isn't needed anymore with the new TTM fault callback
--- drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c +0 -6
@@ -137,9 +137,6 @@ int vmw_invalidate_caches(struct ttm_bo_device *bdev, uint32_t flags)int vmw_init_mem_type (struct ttm_bo_device *bdev,uint32_t type,struct ttm_mem_type_manager *man) { -struct vmw_private *dev_priv = - container_of(bdev, struct vmw_private, bdev); -switch (type) {case TTM_PL_SYSTEM :/* System memory */
@@ -151,11 +148,8 @@ int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,case TTM_PL_VRAM :/* "On-card" video ram */ man->gpu_offset =0 ; - man->io_offset = dev_priv->vram_start; - man->io_size = dev_priv->vram_size; man->flags =TTM_MEMTYPE_FLAG_FIXED |TTM_MEMTYPE_FLAG_NEEDS_IOREMAP |TTM_MEMTYPE_FLAG_MAPPABLE ; - man->io_addr =NULL ; man->available_caching =TTM_PL_MASK_CACHING ; man->default_caching =TTM_PL_FLAG_WC ;break ;
Signature · 10 lines
1.6.6 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
PATCH 8/9 drm/ttm: remove io_ field from TTM V2
All TTM driver have been converted to new io_mem_reserve/free interface which allow driver to choose and return proper io base, offset to core TTM for ioremapping if necessary. This patch remove what is now deadcode.
V2 adapt to match with change in first patch of the patchset
--- drivers/gpu/drm/ttm/ttm_bo.c | 22 ---------------------- drivers/gpu/drm/ttm/ttm_bo_util.c | 30 +++++++----------------------- drivers/gpu/drm/ttm/ttm_bo_vm.c | 33 ++++++++++++--------------------- include/drm/ttm/ttm_bo_driver.h | 10 ---------- 4 files changed, 19 insertions(+), 76 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -22
@@ -79,8 +79,6 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type) printk(KERN_ERR TTM_PFX " use_type: %d\n", man->use_type); printk(KERN_ERR TTM_PFX " flags: 0x%08X\n", man->flags); printk(KERN_ERR TTM_PFX " gpu_offset: 0x%08lX\n", man->gpu_offset); - printk(KERN_ERR TTM_PFX " io_offset: 0x%08lX\n", man->io_offset); - printk(KERN_ERR TTM_PFX " io_size: %ld\n", man->io_size); printk(KERN_ERR TTM_PFX " size: %llu\n", man->size); printk(KERN_ERR TTM_PFX " available_caching: 0x%08X\n", man->available_caching);
@@ -1560,26 +1558,6 @@ bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)return true; } -int ttm_bo_pci_offset (struct ttm_bo_device *bdev, -struct ttm_mem_reg *mem, -unsigned long *bus_base, -unsigned long *bus_offset,unsigned long *bus_size) -{ -struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type]; - - *bus_size =0 ; -if (!(man->flags &TTM_MEMTYPE_FLAG_MAPPABLE )) -return -EINVAL ; - -if (ttm_mem_reg_is_pci (bdev, mem)) { - *bus_offset = mem->mm_node->start <<PAGE_SHIFT ; - *bus_size = mem->num_pages <<PAGE_SHIFT ; - *bus_base = man->io_offset; - } - -return 0 ; -} -void ttm_bo_unmap_virtual (struct ttm_buffer_object *bo) {struct ttm_bo_device *bdev = bo->bdev;
drivers/gpu/drm/ttm/ttm_bo_util.c +7 -23
@@ -90,17 +90,9 @@ int ttm_mem_reg_ioremap(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem,void *addr; *virtual =NULL ; -if (bdev->driver->io_mem_reserve) { - ret = bdev->driver->io_mem_reserve (bdev, mem, &pl); -if (unlikely (ret !=0 )) { -return ret; - } - }else { - ret =ttm_bo_pci_offset (bdev, mem, &pl.base, &pl.offset, &pl.size); -if (unlikely (ret !=0 ) || pl.size ==0 ) { -return ret; - } - pl.is_iomem = (pl.size !=0 ); + ret = bdev->driver->io_mem_reserve (bdev, mem, &pl); +if (unlikely (ret !=0 )) { +return ret; }if (!(man->flags &TTM_MEMTYPE_FLAG_NEEDS_IOREMAP ))
@@ -393,7 +385,7 @@ static int ttm_bo_ioremap(struct ttm_buffer_object *bo,if (!(man->flags &TTM_MEMTYPE_FLAG_NEEDS_IOREMAP )) { map->bo_kmap_type = ttm_bo_map_premapped; - map->virtual = (void *)(((u8 *) man->io_addr) + bus_offset); + map->virtual = (void *)(bus_base + bus_offset); }else { map->bo_kmap_type = ttm_bo_map_iomap;if (mem->placement &TTM_PL_FLAG_WC )
@@ -468,17 +460,9 @@ int ttm_bo_kmap(struct ttm_buffer_object *bo,if (num_pages >1 && !DRM_SUSER (DRM_CURPROC ))return -EPERM ;#endif -if (bo->bdev->driver->io_mem_reserve) { - ret = bo->bdev->driver->io_mem_reserve (bo->bdev, &bo->mem, &pl); -if (unlikely (ret !=0 )) { -return ret; - } - }else { - ret =ttm_bo_pci_offset (bo->bdev, &bo->mem, &pl.base, &pl.offset, &pl.size); -if (unlikely (ret !=0 )) { -return ret; - } - pl.is_iomem = (pl.size !=0 ); + ret = bo->bdev->driver->io_mem_reserve (bo->bdev, &bo->mem, &pl); +if (unlikely (ret !=0 )) { +return ret; }if (!pl.is_iomem) {return ttm_bo_kmap_ttm (bo, start_page, num_pages, map);
drivers/gpu/drm/ttm/ttm_bo_vm.c +12 -21
@@ -101,27 +101,18 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)if (bdev->driver->fault_reserve_notify) bdev->driver->fault_reserve_notify (bo); -if (bdev->driver->fault_reserve) { - ret = bdev->driver->fault_reserve (bo, &pl); -switch (ret) { -case 0 : -break ; -case -EBUSY : -set_need_resched (); -case -ERESTARTSYS : - retval =VM_FAULT_NOPAGE ; - goto out_unlock; -default : - retval =VM_FAULT_SIGBUS ; - goto out_unlock; - } - }else { - ret =ttm_bo_pci_offset (bdev, &bo->mem, &pl.base, &pl.offset, &pl.size); -if (unlikely (ret !=0 )) { - retval =VM_FAULT_SIGBUS ; - goto out_unlock; - } - pl.is_iomem = (pl.size !=0 ); + ret = bdev->driver->fault_reserve (bo, &pl); +switch (ret) { +case 0 : +break ; +case -EBUSY : +set_need_resched (); +case -ERESTARTSYS : + retval =VM_FAULT_NOPAGE ; + goto out_unlock; +default : + retval =VM_FAULT_SIGBUS ; + goto out_unlock; }/*
include/drm/ttm/ttm_bo_driver.h +0 -10
@@ -190,13 +190,6 @@ struct ttm_tt {* managed by this memory type. * @gpu_offset: If used, the GPU offset of the first managed page of * fixed memory or the first managed location in an aperture. -* @io_offset: The io_offset of the first managed page of IO memory or -* the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA -* memory, this should be set to NULL. -* @io_size: The size of a managed IO region (fixed memory or aperture). -* @io_addr: Virtual kernel address if the io region is pre-mapped. For -* TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and -* @io_addr should be set to NULL. * @size: Size of the managed region. * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, * as defined in ttm_placement_common.h
@@ -222,9 +215,6 @@ struct ttm_mem_type_manager {bool use_type;uint32_t flags;unsigned long gpu_offset; -unsigned long io_offset; -unsigned long io_size; -void *io_addr;uint64_t size;uint32_t available_caching;uint32_t default_caching;
Signature · 10 lines
1.6.6 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
PATCH 9/9 drm/radeon/kms: enable use of unmappable VRAM
This patch enable the use of unmappable VRAM thanks to previous TTM infrastructure change.
--- drivers/gpu/drm/radeon/evergreen.c | 5 ----- drivers/gpu/drm/radeon/r100.c | 5 ----- drivers/gpu/drm/radeon/r600.c | 5 ----- drivers/gpu/drm/radeon/rv770.c | 5 ----- 4 files changed, 0 insertions(+), 20 deletions(-)
drivers/gpu/drm/radeon/evergreen.c +0 -5
@@ -475,11 +475,6 @@ int evergreen_mc_init(struct radeon_device *rdev) rdev->mc.mc_vram_size =RREG32 (CONFIG_MEMSIZE ) *1024 *1024 ; rdev->mc.real_vram_size =RREG32 (CONFIG_MEMSIZE ) *1024 *1024 ; rdev->mc.visible_vram_size = rdev->mc.aper_size; -/* FIXME remove this once we support unmappable VRAM */ -if (rdev->mc.mc_vram_size > rdev->mc.aper_size) { - rdev->mc.mc_vram_size = rdev->mc.aper_size; - rdev->mc.real_vram_size = rdev->mc.aper_size; - }r600_vram_gtt_location (rdev, &rdev->mc);/* FIXME: we should enforce default clock in case GPU is not in * default setup
drivers/gpu/drm/radeon/r100.c +0 -5
@@ -1991,11 +1991,6 @@ void r100_vram_init_sizes(struct radeon_device *rdev)else rdev->mc.mc_vram_size = rdev->mc.real_vram_size; } -/* FIXME remove this once we support unmappable VRAM */ -if (rdev->mc.mc_vram_size > rdev->mc.aper_size) { - rdev->mc.mc_vram_size = rdev->mc.aper_size; - rdev->mc.real_vram_size = rdev->mc.aper_size; - } }void r100_vga_set_state (struct radeon_device *rdev,bool state)
drivers/gpu/drm/radeon/r600.c +0 -5
@@ -715,11 +715,6 @@ int r600_mc_init(struct radeon_device *rdev) rdev->mc.mc_vram_size =RREG32 (CONFIG_MEMSIZE ); rdev->mc.real_vram_size =RREG32 (CONFIG_MEMSIZE ); rdev->mc.visible_vram_size = rdev->mc.aper_size; -/* FIXME remove this once we support unmappable VRAM */ -if (rdev->mc.mc_vram_size > rdev->mc.aper_size) { - rdev->mc.mc_vram_size = rdev->mc.aper_size; - rdev->mc.real_vram_size = rdev->mc.aper_size; - }r600_vram_gtt_location (rdev, &rdev->mc);/* FIXME: we should enforce default clock in case GPU is not in * default setup
drivers/gpu/drm/radeon/rv770.c +0 -5
@@ -902,11 +902,6 @@ int rv770_mc_init(struct radeon_device *rdev) rdev->mc.mc_vram_size =RREG32 (CONFIG_MEMSIZE ); rdev->mc.real_vram_size =RREG32 (CONFIG_MEMSIZE ); rdev->mc.visible_vram_size = rdev->mc.aper_size; -/* FIXME remove this once we support unmappable VRAM */ -if (rdev->mc.mc_vram_size > rdev->mc.aper_size) { - rdev->mc.mc_vram_size = rdev->mc.aper_size; - rdev->mc.real_vram_size = rdev->mc.aper_size; - }r600_vram_gtt_location (rdev, &rdev->mc);/* FIXME: we should enforce default clock in case GPU is not in * default setup
Signature · 10 lines
1.6.6 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev --
Dave Airlie
maintainerQuoted 6 lines · Jerome Glisse
Updated patchset, to apply cleanly on top of TTM split
no_waitargument. Compile tested for nouveau+vmwgfx, test in progress for radeon.So with the new change radeon won't wait for bo reserving other bo in fault path but will wait the GPU (hoping it doesn't lockup ;)) This should address concern about the wait/locking issue.
Thomas any time for this yet? I'd like to pull this in obviously, but it would be nice to know if Jerome has addressed all concerns.
Dave.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
Quoted 10 lines · Dave Airlie
Quoted 7 lines · Jerome Glisse
Updated patchset, to apply cleanly on top of TTM split
no_waitargument. Compile tested for nouveau+vmwgfx, test in progress for radeon.So with the new change radeon won't wait for bo reserving other bo in fault path but will wait the GPU (hoping it doesn't lockup ;)) This should address concern about the wait/locking issue.
Quoted 5 lines
Thomas any time for this yet? I'd like to pull this in obviously, but it would be nice to know if Jerome has addressed all concerns.
Dave.
Hi Dave!
My schedule is currently a bit tight. I think the immediate deadlock concerns are met, but I'd to take a deeper look at some things that look a bit suspicious, but I think the overall approach is ok. I'll hopefully be able to do a review on wednesday.
/Thomas
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
Quoted 16 lines · Thomas Hellstrom
Quoted 10 lines · Dave Airlie
Quoted 7 lines · Jerome Glisse
Updated patchset, to apply cleanly on top of TTM split
no_waitargument. Compile tested for nouveau+vmwgfx, test in progress for radeon.So with the new change radeon won't wait for bo reserving other bo in fault path but will wait the GPU (hoping it doesn't lockup ;)) This should address concern about the wait/locking issue.
Quoted 5 lines
Thomas any time for this yet? I'd like to pull this in obviously, but it would be nice to know if Jerome has addressed all concerns.
Dave.
Quoted 8 lines
Hi Dave!
My schedule is currently a bit tight. I think the immediate deadlock concerns are met, but I'd to take a deeper look at some things that look a bit suspicious, but I think the overall approach is ok. I'll hopefully be able to do a review on wednesday./Thomas
Thomas any chance to review this ? NVidia patch already need update and i would like to avoid having this bitrot too much.
Cheers,
Jerome
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
Quoted 31 lines · Jerome Glisse
Quoted 19 lines · Thomas Hellstrom
Quoted 11 lines · Dave Airlie
Quoted 8 lines · Jerome Glisse
Updated patchset, to apply cleanly on top of TTM split
no_waitargument. Compile tested for nouveau+vmwgfx, test in progress for radeon.So with the new change radeon won't wait for bo reserving other bo in fault path but will wait the GPU (hoping it doesn't lockup ;)) This should address concern about the wait/locking issue.
Quoted 6 lines
Thomas any time for this yet? I'd like to pull this in obviously, but it would be nice to know if Jerome has addressed all concerns.
Dave.
Quoted 9 lines
Hi Dave!
My schedule is currently a bit tight. I think the immediate deadlock concerns are met, but I'd to take a deeper look at some things that look a bit suspicious, but I think the overall approach is ok. I'll hopefully be able to do a review on wednesday./Thomas
Quoted 6 lines
Thomas any chance to review this ? NVidia patch already need update and i would like to avoid having this bitrot too much.
Cheers,
Jerome
Jerome,
I've reviewed the TTM patch, see previous mail. I'll look at the vmware patch and briefly the other ones as soon as we've sorted out how to address the issues raised in the review.
Thanks,
/Thomas
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
Quoted 29 lines · Thomas Hellstrom
Quoted 20 lines · Jerome Glisse
Quoted 19 lines · Thomas Hellstrom
Quoted 11 lines · Dave Airlie
Quoted 6 lines · Jerome Glisse
Updated patchset, to apply cleanly on top of TTM split
no_waitargument. Compile tested for nouveau+vmwgfx, test in progress for radeon.So with the new change radeon won't wait for bo reserving other bo in fault path but will wait the GPU (hoping it doesn't lockup ;)) This should address concern about the wait/locking issue.
Thomas any time for this yet? I'd like to pull this in obviously, but it would be nice to know if Jerome has addressed all concerns.
Dave.
Hi Dave!
My schedule is currently a bit tight. I think the immediate deadlock concerns are met, but I'd to take a deeper look at some things that look a bit suspicious, but I think the overall approach is ok.
I'll hopefully be able to do a review on wednesday.Quoted 8 lines
Quoted 2 lines
/Thomas
Thomas any chance to review this ? NVidia patch already need update and i would like to avoid having this bitrot too much.
Cheers,
Jerome
Quoted 9 lines
Jerome,
I've reviewed the TTM patch, see previous mail. I'll look at the vmware patch and briefly the other ones as soon as we've sorted out how to address the issues raised in the review.
Thanks,
/Thomas
Will redo a patch tomorrow to try to address issue you pointed.
Cheers,
Jerome
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--