drm: add gem ttm helpers
Subsystems (8)
Gerd Hoffmann
maintainerPATCH v3 1/8 scsi: core: fix the dma_max_mapping_size call
In reply to Gerd HoffmannFrom: Christoph Hellwig <[email protected]>
We should only call dma_max_mapping_size for devices that have a DMA mask set, otherwise we can run into a NULL pointer dereference that will crash the system.
Also we need to do right shift to get the sectors from the size in bytes, not a left shift.
--- drivers/scsi/scsi_lib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/scsi_lib.c +4 -2
@@ -1784,8 +1784,10 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)blk_queue_max_integrity_segments (q, shost->sg_prot_tablesize); } - shost->max_sectors = min_t(unsigned int, shost->max_sectors, -dma_max_mapping_size (dev) <<SECTOR_SHIFT ); +if (dev->dma_mask) { + shost->max_sectors = min_t(unsigned int, shost->max_sectors, +dma_max_mapping_size (dev) >>SECTOR_SHIFT ); + }blk_queue_max_hw_sectors (q, shost->max_sectors);if (shost->unchecked_isa_dma)blk_queue_bounce_limit (q,BLK_BOUNCE_ISA );
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v3 2/8 ttm: turn ttm_bo_device.vma_manager into a pointer
In reply to Gerd HoffmannRename the embedded struct vma_offset_manager, it is named _vma_manager now. ttm_bo_device.vma_manager is a pointer now, pointing to the embedded ttm_bo_device._vma_manager by default.
Add ttm_bo_device_init_with_vma_manager() function which allows to initialize ttm with a different vma manager.
--- include/drm/ttm/ttm_bo_driver.h | 11 +++++++++-- drivers/gpu/drm/ttm/ttm_bo.c | 29 +++++++++++++++++++++-------- drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 +++--- 3 files changed, 33 insertions(+), 13 deletions(-)
include/drm/ttm/ttm_bo_driver.h +9 -2
@@ -441,7 +441,8 @@ extern struct ttm_bo_global {* * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver. * @man: An array of mem_type_managers. -* @vma_manager: Address space manager +* @vma_manager: Address space manager (pointer) +* @_vma_manager: Address space manager (enbedded) * lru_lock: Spinlock that protects the buffer+device lru lists and * ddestroy lists. * @dev_mapping: A pointer to the struct address_space representing the
@@ -464,7 +465,8 @@ struct ttm_bo_device {/* * Protected by internal locks. */ -struct drm_vma_offset_manager vma_manager; +struct drm_vma_offset_manager *vma_manager; +struct drm_vma_offset_manager _vma_manager;/* * Protected by the global:lru lock.
@@ -597,6 +599,11 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,struct ttm_bo_driver *driver, struct address_space *mapping, bool need_dma32); +int ttm_bo_device_init_with_vma_manager (struct ttm_bo_device *bdev, +struct ttm_bo_driver *driver, +struct address_space *mapping, +struct drm_vma_offset_manager *vma_manager, +bool need_dma32);/** * ttm_bo_unmap_virtual
drivers/gpu/drm/ttm/ttm_bo.c +21 -8
@@ -672,7 +672,7 @@ static void ttm_bo_release(struct kref *kref)struct ttm_bo_device *bdev = bo->bdev;struct ttm_mem_type_manager *man = &bdev->man[bo->mem.mem_type]; -drm_vma_offset_remove (&bdev->vma_manager, &bo->base.vma_node); +drm_vma_offset_remove (bdev->vma_manager, &bo->base.vma_node);ttm_mem_io_lock (man, false);ttm_mem_io_free_vm (bo);ttm_mem_io_unlock (man);
@@ -1353,7 +1353,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,*/ if (bo->type == ttm_bo_type_device || bo->type == ttm_bo_type_sg) - ret =drm_vma_offset_add (&bdev->vma_manager, &bo->base.vma_node, + ret =drm_vma_offset_add (bdev->vma_manager, &bo->base.vma_node, bo->mem.num_pages);/* passed reservation objects should already be locked,
@@ -1704,7 +1704,7 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev)pr_debug ("Swap list %d was clean\n" , i);spin_unlock (&glob->lru_lock); -drm_vma_offset_manager_destroy (&bdev->vma_manager); +drm_vma_offset_manager_destroy (&bdev->_vma_manager);if (!ret)ttm_bo_global_release ();
@@ -1713,10 +1713,11 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev) }EXPORT_SYMBOL (ttm_bo_device_release); -int ttm_bo_device_init (struct ttm_bo_device *bdev, -struct ttm_bo_driver *driver, -struct address_space *mapping, -bool need_dma32) +int ttm_bo_device_init_with_vma_manager (struct ttm_bo_device *bdev, +struct ttm_bo_driver *driver, +struct address_space *mapping, +struct drm_vma_offset_manager *vma_manager, +bool need_dma32) {struct ttm_bo_global *glob = &ttm_bo_glob;int ret;
@@ -1737,7 +1738,8 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,if (unlikely (ret !=0 )) goto out_no_sys; -drm_vma_offset_manager_init (&bdev->vma_manager, + bdev->vma_manager = vma_manager; +drm_vma_offset_manager_init (&bdev->_vma_manager,DRM_FILE_PAGE_OFFSET_START ,DRM_FILE_PAGE_OFFSET_SIZE );INIT_DELAYED_WORK (&bdev->wq, ttm_bo_delayed_workqueue);
@@ -1754,6 +1756,17 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,ttm_bo_global_release ();return ret; } +EXPORT_SYMBOL (ttm_bo_device_init_with_vma_manager); + +int ttm_bo_device_init (struct ttm_bo_device *bdev, +struct ttm_bo_driver *driver, +struct address_space *mapping, +bool need_dma32) +{ +return ttm_bo_device_init_with_vma_manager (bdev, driver, mapping, + &bdev->_vma_manager, + need_dma32); +}EXPORT_SYMBOL (ttm_bo_device_init);/*
drivers/gpu/drm/ttm/ttm_bo_vm.c +3 -3
@@ -409,16 +409,16 @@ static struct ttm_buffer_object *ttm_bo_vm_lookup(struct ttm_bo_device *bdev,struct drm_vma_offset_node *node;struct ttm_buffer_object *bo =NULL ; -drm_vma_offset_lock_lookup (&bdev->vma_manager); +drm_vma_offset_lock_lookup (bdev->vma_manager); - node =drm_vma_offset_lookup_locked (&bdev->vma_manager, offset, pages); + node =drm_vma_offset_lookup_locked (bdev->vma_manager, offset, pages);if (likely (node)) { bo = container_of(node, struct ttm_buffer_object, base.vma_node); bo =ttm_bo_get_unless_zero (bo); } -drm_vma_offset_unlock_lookup (&bdev->vma_manager); +drm_vma_offset_unlock_lookup (bdev->vma_manager);if (!bo)pr_err ("Could not find buffer object to map\n" );
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v3 5/8 drm/qxl: switch qxl to the new gem_ttm_bo_device_init()
In reply to Gerd Hoffmann--- drivers/gpu/drm/qxl/qxl_drv.h | 4 +--- drivers/gpu/drm/qxl/qxl_object.h | 5 ----- drivers/gpu/drm/qxl/qxl_drv.c | 1 - drivers/gpu/drm/qxl/qxl_dumb.c | 17 ----------------- drivers/gpu/drm/qxl/qxl_ioctl.c | 5 +++-- drivers/gpu/drm/qxl/qxl_ttm.c | 8 ++++---- drivers/gpu/drm/qxl/Kconfig | 1 + 7 files changed, 9 insertions(+), 32 deletions(-)
drivers/gpu/drm/qxl/qxl_drv.h +1 -3
@@ -38,6 +38,7 @@#include <drm/drm_crtc.h> #include <drm/drm_encoder.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_gem_ttm_helper.h> #include <drm/drm_ioctl.h> #include <drm/drm_gem.h> #include <drm/qxl_drm.h>
@@ -347,9 +348,6 @@ int qxl_bo_kmap(struct qxl_bo *bo, void **ptr);int qxl_mode_dumb_create (struct drm_file *file_priv,struct drm_device *dev,struct drm_mode_create_dumb *args); -int qxl_mode_dumb_mmap (struct drm_file *filp, -struct drm_device *dev, -uint32_t handle,uint64_t *offset_p);/* qxl ttm */ int qxl_ttm_init (struct qxl_device *qdev);
drivers/gpu/drm/qxl/qxl_object.h +0 -5
@@ -58,11 +58,6 @@ static inline unsigned long qxl_bo_size(struct qxl_bo *bo)return bo->tbo.num_pages <<PAGE_SHIFT ; } -static inline u64 qxl_bo_mmap_offset (struct qxl_bo *bo) -{ -return drm_vma_node_offset_addr (&bo->tbo.base.vma_node); -} -static inline int qxl_bo_wait (struct qxl_bo *bo,u32 *mem_type,bool no_wait) {
drivers/gpu/drm/qxl/qxl_drv.c +0 -1
@@ -252,7 +252,6 @@ static struct drm_driver qxl_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .dumb_create = qxl_mode_dumb_create, - .dumb_map_offset = qxl_mode_dumb_mmap,#if defined(CONFIG_DEBUG_FS ) .debugfs_init = qxl_debugfs_init,#endif
drivers/gpu/drm/qxl/qxl_dumb.c +0 -17
@@ -69,20 +69,3 @@ int qxl_mode_dumb_create(struct drm_file *file_priv, args->handle = handle;return 0 ; } - -int qxl_mode_dumb_mmap (struct drm_file *file_priv, -struct drm_device *dev, -uint32_t handle,uint64_t *offset_p) -{ -struct drm_gem_object *gobj; -struct qxl_bo *qobj; - -BUG_ON (!offset_p); - gobj =drm_gem_object_lookup (file_priv, handle); -if (gobj ==NULL ) -return -ENOENT ; - qobj =gem_to_qxl_bo (gobj); - *offset_p =qxl_bo_mmap_offset (qobj); -drm_gem_object_put_unlocked (gobj); -return 0 ; -}
drivers/gpu/drm/qxl/qxl_ioctl.c +3 -2
@@ -67,8 +67,9 @@ static int qxl_map_ioctl(struct drm_device *dev, void *data,struct qxl_device *qdev = dev->dev_private;struct drm_qxl_map *qxl_map = data; -return qxl_mode_dumb_mmap (file_priv, &qdev->ddev, qxl_map->handle, - &qxl_map->offset); +return drm_gem_dumb_map_offset (file_priv, &qdev->ddev, + qxl_map->handle, + &qxl_map->offset); }struct qxl_reloc_info {
drivers/gpu/drm/qxl/qxl_ttm.c +4 -4
@@ -322,10 +322,10 @@ int qxl_ttm_init(struct qxl_device *qdev)int num_io_pages;/* != rom->num_io_pages, we include surface0 */ /* No others user of address space so set it to 0 */ - r =ttm_bo_device_init (&qdev->mman.bdev, - &qxl_bo_driver, - qdev->ddev.anon_inode->i_mapping, - false); + r =drm_gem_ttm_bo_device_init (&qdev->ddev, + &qdev->mman.bdev, + &qxl_bo_driver, + false);if (r) {DRM_ERROR ("failed initializing buffer object driver(%d).\n" , r);return r;
drivers/gpu/drm/qxl/Kconfig +1 -0
@@ -3,6 +3,7 @@ config DRM_QXL tristate "QXL virtual GPU" depends on DRM && PCI && MMU select DRM_KMS_HELPER + select DRM_TTM_HELPER select DRM_TTM select CRC32 help
Signature · 6 lines
2.18.1 _______________________________________________ Spice-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/spice-devel
Gerd Hoffmann
maintainerPATCH v3 5/8 drm/qxl: switch qxl to the new gem_ttm_bo_device_init()
In reply to Gerd Hoffmann--- drivers/gpu/drm/qxl/qxl_drv.h | 4 +--- drivers/gpu/drm/qxl/qxl_object.h | 5 ----- drivers/gpu/drm/qxl/qxl_drv.c | 1 - drivers/gpu/drm/qxl/qxl_dumb.c | 17 ----------------- drivers/gpu/drm/qxl/qxl_ioctl.c | 5 +++-- drivers/gpu/drm/qxl/qxl_ttm.c | 8 ++++---- drivers/gpu/drm/qxl/Kconfig | 1 + 7 files changed, 9 insertions(+), 32 deletions(-)
drivers/gpu/drm/qxl/qxl_drv.h +1 -3
@@ -38,6 +38,7 @@#include <drm/drm_crtc.h> #include <drm/drm_encoder.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_gem_ttm_helper.h> #include <drm/drm_ioctl.h> #include <drm/drm_gem.h> #include <drm/qxl_drm.h>
@@ -347,9 +348,6 @@ int qxl_bo_kmap(struct qxl_bo *bo, void **ptr);int qxl_mode_dumb_create (struct drm_file *file_priv,struct drm_device *dev,struct drm_mode_create_dumb *args); -int qxl_mode_dumb_mmap (struct drm_file *filp, -struct drm_device *dev, -uint32_t handle,uint64_t *offset_p);/* qxl ttm */ int qxl_ttm_init (struct qxl_device *qdev);
drivers/gpu/drm/qxl/qxl_object.h +0 -5
@@ -58,11 +58,6 @@ static inline unsigned long qxl_bo_size(struct qxl_bo *bo)return bo->tbo.num_pages <<PAGE_SHIFT ; } -static inline u64 qxl_bo_mmap_offset (struct qxl_bo *bo) -{ -return drm_vma_node_offset_addr (&bo->tbo.base.vma_node); -} -static inline int qxl_bo_wait (struct qxl_bo *bo,u32 *mem_type,bool no_wait) {
drivers/gpu/drm/qxl/qxl_drv.c +0 -1
@@ -252,7 +252,6 @@ static struct drm_driver qxl_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, .dumb_create = qxl_mode_dumb_create, - .dumb_map_offset = qxl_mode_dumb_mmap,#if defined(CONFIG_DEBUG_FS ) .debugfs_init = qxl_debugfs_init,#endif
drivers/gpu/drm/qxl/qxl_dumb.c +0 -17
@@ -69,20 +69,3 @@ int qxl_mode_dumb_create(struct drm_file *file_priv, args->handle = handle;return 0 ; } - -int qxl_mode_dumb_mmap (struct drm_file *file_priv, -struct drm_device *dev, -uint32_t handle,uint64_t *offset_p) -{ -struct drm_gem_object *gobj; -struct qxl_bo *qobj; - -BUG_ON (!offset_p); - gobj =drm_gem_object_lookup (file_priv, handle); -if (gobj ==NULL ) -return -ENOENT ; - qobj =gem_to_qxl_bo (gobj); - *offset_p =qxl_bo_mmap_offset (qobj); -drm_gem_object_put_unlocked (gobj); -return 0 ; -}
drivers/gpu/drm/qxl/qxl_ioctl.c +3 -2
@@ -67,8 +67,9 @@ static int qxl_map_ioctl(struct drm_device *dev, void *data,struct qxl_device *qdev = dev->dev_private;struct drm_qxl_map *qxl_map = data; -return qxl_mode_dumb_mmap (file_priv, &qdev->ddev, qxl_map->handle, - &qxl_map->offset); +return drm_gem_dumb_map_offset (file_priv, &qdev->ddev, + qxl_map->handle, + &qxl_map->offset); }struct qxl_reloc_info {
drivers/gpu/drm/qxl/qxl_ttm.c +4 -4
@@ -322,10 +322,10 @@ int qxl_ttm_init(struct qxl_device *qdev)int num_io_pages;/* != rom->num_io_pages, we include surface0 */ /* No others user of address space so set it to 0 */ - r =ttm_bo_device_init (&qdev->mman.bdev, - &qxl_bo_driver, - qdev->ddev.anon_inode->i_mapping, - false); + r =drm_gem_ttm_bo_device_init (&qdev->ddev, + &qdev->mman.bdev, + &qxl_bo_driver, + false);if (r) {DRM_ERROR ("failed initializing buffer object driver(%d).\n" , r);return r;
drivers/gpu/drm/qxl/Kconfig +1 -0
@@ -3,6 +3,7 @@ config DRM_QXL tristate "QXL virtual GPU" depends on DRM && PCI && MMU select DRM_KMS_HELPER + select DRM_TTM_HELPER select DRM_TTM select CRC32 help
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v3 7/8 gem/vram: use drm_gem_ttm_bo_driver_verify_access()
In reply to Gerd Hoffmann--- include/drm/drm_gem_vram_helper.h | 3 --- drivers/gpu/drm/drm_gem_vram_helper.c | 22 +--------------------- 2 files changed, 1 insertion(+), 24 deletions(-)
include/drm/drm_gem_vram_helper.h +0 -3
@@ -98,9 +98,6 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,void drm_gem_vram_bo_driver_evict_flags (struct ttm_buffer_object *bo,struct ttm_placement *pl); -int drm_gem_vram_bo_driver_verify_access (struct ttm_buffer_object *bo, -struct file *filp); -extern const struct drm_vram_mm_funcs drm_gem_vram_mm_funcs;/*
drivers/gpu/drm/drm_gem_vram_helper.c +1 -21
@@ -415,26 +415,6 @@ void drm_gem_vram_bo_driver_evict_flags(struct ttm_buffer_object *bo, }EXPORT_SYMBOL (drm_gem_vram_bo_driver_evict_flags); -/** -* drm_gem_vram_bo_driver_verify_access() - \ -Implements &struct ttm_bo_driver.verify_access -* @bo: TTM buffer object. Refers to &struct drm_gem_vram_object.bo -* @filp: File pointer. -* -* Returns: -* 0 on success, or -* a negative errno code otherwise. -*/ -int drm_gem_vram_bo_driver_verify_access (struct ttm_buffer_object *bo, -struct file *filp) -{ -struct drm_gem_vram_object *gbo =drm_gem_vram_of_bo (bo); - -return drm_vma_node_verify_access (&gbo->bo.base.vma_node, - filp->private_data); -} -EXPORT_SYMBOL (drm_gem_vram_bo_driver_verify_access); -/* * drm_gem_vram_mm_funcs - Functions for &struct drm_vram_mm *
@@ -444,7 +424,7 @@ EXPORT_SYMBOL(drm_gem_vram_bo_driver_verify_access);*/ const struct drm_vram_mm_funcs drm_gem_vram_mm_funcs = { .evict_flags = drm_gem_vram_bo_driver_evict_flags, - .verify_access = drm_gem_vram_bo_driver_verify_access + .verify_access = drm_gem_ttm_bo_driver_verify_access };EXPORT_SYMBOL (drm_gem_vram_mm_funcs);
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v3 8/8 gem/qxl: use drm_gem_ttm_bo_driver_verify_access()
In reply to Gerd Hoffmann--- drivers/gpu/drm/qxl/qxl_ttm.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/gpu/drm/qxl/qxl_ttm.c +1 -9
@@ -151,14 +151,6 @@ static void qxl_evict_flags(struct ttm_buffer_object *bo, *placement = qbo->placement; } -static int qxl_verify_access (struct ttm_buffer_object *bo,struct file *filp) -{ -struct qxl_bo *qbo =to_qxl_bo (bo); - -return drm_vma_node_verify_access (&qbo->tbo.base.vma_node, - filp->private_data); -} -static int qxl_ttm_io_mem_reserve (struct ttm_bo_device *bdev,struct ttm_mem_reg *mem) {
@@ -310,7 +302,7 @@ static struct ttm_bo_driver qxl_bo_driver = { .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &qxl_evict_flags, .move = &qxl_bo_move, - .verify_access = &qxl_verify_access, + .verify_access = drm_gem_ttm_bo_driver_verify_access, .io_mem_reserve = &qxl_ttm_io_mem_reserve, .io_mem_free = &qxl_ttm_io_mem_free, .move_notify = &qxl_bo_move_notify,
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerPATCH v3 8/8 gem/qxl: use drm_gem_ttm_bo_driver_verify_access()
In reply to Gerd Hoffmann--- drivers/gpu/drm/qxl/qxl_ttm.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/gpu/drm/qxl/qxl_ttm.c +1 -9
@@ -151,14 +151,6 @@ static void qxl_evict_flags(struct ttm_buffer_object *bo, *placement = qbo->placement; } -static int qxl_verify_access (struct ttm_buffer_object *bo,struct file *filp) -{ -struct qxl_bo *qbo =to_qxl_bo (bo); - -return drm_vma_node_verify_access (&qbo->tbo.base.vma_node, - filp->private_data); -} -static int qxl_ttm_io_mem_reserve (struct ttm_bo_device *bdev,struct ttm_mem_reg *mem) {
@@ -310,7 +302,7 @@ static struct ttm_bo_driver qxl_bo_driver = { .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = &qxl_evict_flags, .move = &qxl_bo_move, - .verify_access = &qxl_verify_access, + .verify_access = drm_gem_ttm_bo_driver_verify_access, .io_mem_reserve = &qxl_ttm_io_mem_reserve, .io_mem_free = &qxl_ttm_io_mem_free, .move_notify = &qxl_bo_move_notify,
Signature · 1 line
2.18.1
Gerd Hoffmann
maintainerv3 cover drm: add gem ttm helpers
Christoph Hellwig (1):
scsi: core: fix the dma_max_mapping_size call
Gerd Hoffmann (7):
ttm: turn ttm_bo_device.vma_manager into a pointer drm/ttm: add gem_ttm_bo_device_init()
drm/vram: switch vram helpers to the new gem_ttm_bo_device_init() drm/qxl: switch qxl to the new gem_ttm_bo_device_init() drm/ttm: add drm_gem_ttm_bo_driver_verify_access() gem/vram: use drm_gem_ttm_bo_driver_verify_access() gem/qxl: use drm_gem_ttm_bo_driver_verify_access()
drivers/gpu/drm/qxl/qxl_drv.h | 4 +- drivers/gpu/drm/qxl/qxl_object.h | 5 -- include/drm/drm_gem_ttm_helper.h | 32 +++++++++ include/drm/drm_gem_vram_helper.h | 9 +-- include/drm/ttm/ttm_bo_driver.h | 11 ++- drivers/gpu/drm/drm_gem_ttm_helper.c | 58 +++++++++++++++ drivers/gpu/drm/drm_gem_vram_helper.c | 70 +------------------ drivers/gpu/drm/drm_vram_mm_helper.c | 6 +- .../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 - drivers/gpu/drm/qxl/qxl_drv.c | 1 - drivers/gpu/drm/qxl/qxl_dumb.c | 17 ----- drivers/gpu/drm/qxl/qxl_ioctl.c | 5 +- drivers/gpu/drm/qxl/qxl_ttm.c | 18 ++--- drivers/gpu/drm/ttm/ttm_bo.c | 29 +++++--- drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 +- drivers/scsi/scsi_lib.c | 6 +- Documentation/gpu/drm-mm.rst | 12 ++++ drivers/gpu/drm/Kconfig | 8 +++ drivers/gpu/drm/Makefile | 3 + drivers/gpu/drm/qxl/Kconfig | 1 + 20 files changed, 165 insertions(+), 137 deletions(-) create mode 100644 include/drm/drm_gem_ttm_helper.h create mode 100644 drivers/gpu/drm/drm_gem_ttm_helper.c
Signature · 6 lines
2.18.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerPATCH v3 3/8 drm/ttm: add gem_ttm_bo_device_init()
Now with ttm_buffer_object being a subclass of drm_gem_object we can easily lookup ttm_buffer_object for a given drm_gem_object, which in turm allows to create common helper functions.
This patch starts off with a gem_ttm_bo_device_init() helper function which initializes ttm with the vma offset manager used by gem, to make sure gem and ttm have the same view on vma offsets.
With that in place gem+ttm drivers don't need their private drm_driver.dumb_map_offset implementation any more.
v3:
- complete rewrite
--- include/drm/drm_gem_ttm_helper.h | 30 +++++++++++++++++++++++ drivers/gpu/drm/drm_gem_ttm_helper.c | 36 ++++++++++++++++++++++++++++ Documentation/gpu/drm-mm.rst | 12 ++++++++++ drivers/gpu/drm/Kconfig | 7 ++++++ drivers/gpu/drm/Makefile | 3 +++ 5 files changed, 88 insertions(+) create mode 100644 include/drm/drm_gem_ttm_helper.h create mode 100644 drivers/gpu/drm/drm_gem_ttm_helper.c
include/drm/drm_gem_ttm_helper.h new file +30 -0
@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef DRM_GEM_TTM_HELPER_H +#define DRM_GEM_TTM_HELPER_H + +#include <linux/kernel.h> + +#include <drm/drm_gem.h> +#include <drm/drm_device.h> +#include <drm/ttm/ttm_bo_api.h> +#include <drm/ttm/ttm_bo_driver.h> + +/** +* Returns the container of type &struct ttm_buffer_object +* for field base. +* @gem: the GEM object +* Returns: The containing GEM VRAM object +*/ +static inline struct ttm_buffer_object *drm_gem_ttm_of_gem ( +struct drm_gem_object *gem) +{ + return container_of(gem, struct ttm_buffer_object, base); +} + +int drm_gem_ttm_bo_device_init (struct drm_device *dev, +struct ttm_bo_device *bdev, +struct ttm_bo_driver *driver, +bool need_dma32); + +#endif
drivers/gpu/drm/drm_gem_ttm_helper.c new file +36 -0
@@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include <drm/drm_gem_ttm_helper.h> + +/** +* DOC: overview +* +* This library provides helper functions for gem objects backed by +* ttm. +*/ + +/** +* drm_gem_ttm_bo_device_init - ttm init for devices which use gem+ttm +* +* @dev: A pointer to a struct drm_device. +* @bdev: A pointer to a struct ttm_bo_device to initialize. +* @driver: A pointer to a struct ttm_bo_driver set up by the caller. +* @need_dma32: Whenever the device is limited to 32bit DMA. +* +* This initializes ttm with dev->vma_offset_manager, so gem and ttm +* fuction are working with the same vma_offset_manager. +* +* Returns: +* !0: Failure. +*/ +int drm_gem_ttm_bo_device_init (struct drm_device *dev, +struct ttm_bo_device *bdev, +struct ttm_bo_driver *driver, +bool need_dma32) +{ +return ttm_bo_device_init_with_vma_manager (bdev, driver, + dev->anon_inode->i_mapping, + dev->vma_offset_manager, + need_dma32); +} +EXPORT_SYMBOL (drm_gem_ttm_bo_device_init);
Documentation/gpu/drm-mm.rst +12 -0
@@ -412,6 +412,18 @@ VRAM MM Helper Functions Reference .. kernel-doc:: drivers/gpu/drm/drm_vram_mm_helper.c :export: +GEM TTM Helper Functions Reference +----------------------------------- + +.. kernel-doc:: drivers/gpu/drm/drm_gem_ttm_helper.c + :doc: overview + +.. kernel-doc:: include/drm/drm_gem_ttm_helper.h + :internal: + +.. kernel-doc:: drivers/gpu/drm/drm_gem_ttm_helper.c + :export: + VMA Offset Manager ==================
drivers/gpu/drm/Kconfig +7 -0
@@ -172,6 +172,13 @@ config DRM_VRAM_HELPER help Helpers for VRAM memory management +config DRM_TTM_HELPER + tristate + depends on DRM + select DRM_TTM + help + Helpers for ttm-based gem objects + config DRM_GEM_CMA_HELPER bool depends on DRM
drivers/gpu/drm/Makefile +3 -0
@@ -37,6 +37,9 @@ drm_vram_helper-y := drm_gem_vram_helper.o \ drm_vram_mm_helper.o obj-$(CONFIG_DRM_VRAM_HELPER) += drm_vram_helper.o +drm_ttm_helper-y := drm_gem_ttm_helper.o +obj-$(CONFIG_DRM_TTM_HELPER) += drm_ttm_helper.o + drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_dsc.o drm_probe_helper.o \ drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \ drm_kms_helper_common.o drm_dp_dual_mode_helper.o \
Signature · 6 lines
2.18.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerPATCH v3 4/8 drm/vram: switch vram helpers to the new gem_ttm_bo_device_init()
In reply to Gerd Hoffmann--- include/drm/drm_gem_vram_helper.h | 6 +-- drivers/gpu/drm/drm_gem_vram_helper.c | 48 ------------------- drivers/gpu/drm/drm_vram_mm_helper.c | 6 +-- .../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 - drivers/gpu/drm/Kconfig | 1 + 5 files changed, 5 insertions(+), 57 deletions(-)
include/drm/drm_gem_vram_helper.h +1 -5
@@ -4,6 +4,7 @@#define DRM_GEM_VRAM_HELPER_H #include <drm/drm_gem.h> +#include <drm/drm_gem_ttm_helper.h> #include <drm/ttm/ttm_bo_api.h> #include <drm/ttm/ttm_placement.h> #include <linux/kernel.h> /* for container_of() */
@@ -76,7 +77,6 @@ struct drm_gem_vram_object *drm_gem_vram_create(struct drm_device *dev,unsigned long pg_align, bool interruptible);void drm_gem_vram_put (struct drm_gem_vram_object *gbo); -u64 drm_gem_vram_mmap_offset (struct drm_gem_vram_object *gbo);s64 drm_gem_vram_offset (struct drm_gem_vram_object *gbo);int drm_gem_vram_pin (struct drm_gem_vram_object *gbo,unsigned long pl_flag);int drm_gem_vram_unpin (struct drm_gem_vram_object *gbo);
@@ -110,9 +110,6 @@ extern const struct drm_vram_mm_funcs drm_gem_vram_mm_funcs;int drm_gem_vram_driver_dumb_create (struct drm_file *file,struct drm_device *dev,struct drm_mode_create_dumb *args); -int drm_gem_vram_driver_dumb_mmap_offset (struct drm_file *file, -struct drm_device *dev, -uint32_t handle,uint64_t *offset);/** * define DRM_GEM_VRAM_DRIVER - default callback functions for \
@@ -123,7 +120,6 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file,*/ #define DRM_GEM_VRAM_DRIVER \ .dumb_create = drm_gem_vram_driver_dumb_create, \ - .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset, \ .gem_prime_mmap = drm_gem_prime_mmap#endif
drivers/gpu/drm/drm_gem_vram_helper.c +0 -48
60 lines not on this page · raw message
drivers/gpu/drm/drm_vram_mm_helper.c +3 -3
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0-or-later +#include <drm/drm_gem_ttm_helper.h> #include <drm/drm_device.h> #include <drm/drm_file.h> #include <drm/drm_vram_mm_helper.h>
@@ -170,9 +171,8 @@ int drm_vram_mm_init(struct drm_vram_mm *vmm, struct drm_device *dev, vmm->vram_size = vram_size; vmm->funcs = funcs; - ret =ttm_bo_device_init (&vmm->bdev, &bo_driver, - dev->anon_inode->i_mapping, - true); + ret =drm_gem_ttm_bo_device_init (dev, &vmm->bdev, &bo_driver, + true);if (ret)return ret;
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +0 -1
@@ -59,7 +59,6 @@ static struct drm_driver hibmc_driver = { .major = 1, .minor = 0, .dumb_create = hibmc_dumb_create, - .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset, .gem_prime_mmap = drm_gem_prime_mmap, .irq_handler = hibmc_drm_interrupt, };
drivers/gpu/drm/Kconfig +1 -0
@@ -169,6 +169,7 @@ config DRM_VRAM_HELPER tristate depends on DRM select DRM_TTM + select DRM_TTM_HELPER help Helpers for VRAM memory management
Signature · 6 lines
2.18.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Gerd Hoffmann
maintainerPATCH v3 6/8 drm/ttm: add drm_gem_ttm_bo_driver_verify_access()
In reply to Gerd Hoffmann--- include/drm/drm_gem_ttm_helper.h | 2 ++ drivers/gpu/drm/drm_gem_ttm_helper.c | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+)
include/drm/drm_gem_ttm_helper.h +2 -0
@@ -26,5 +26,7 @@ int drm_gem_ttm_bo_device_init(struct drm_device *dev,struct ttm_bo_device *bdev, struct ttm_bo_driver *driver, bool need_dma32); +int drm_gem_ttm_bo_driver_verify_access (struct ttm_buffer_object *bo, +struct file *filp);#endif
drivers/gpu/drm/drm_gem_ttm_helper.c +22 -0
@@ -34,3 +34,25 @@ int drm_gem_ttm_bo_device_init(struct drm_device *dev, need_dma32); }EXPORT_SYMBOL (drm_gem_ttm_bo_device_init); + +/** +* drm_gem_ttm_bo_driver_verify_access() - \ +Implements &struct ttm_bo_driver.verify_access +* @bo: TTM buffer object. +* @filp: File pointer. +* +* This function assumes filp->private_data refers to the +* corresponding &struct drm_file. +* +* Returns: +* 0 on success, or +* a negative errno code otherwise. +*/ +int drm_gem_ttm_bo_driver_verify_access (struct ttm_buffer_object *bo, +struct file *filp) +{ +struct drm_file *ptr = filp->private_data; + +return drm_vma_node_verify_access (&bo->base.vma_node, ptr); +} +EXPORT_SYMBOL (drm_gem_ttm_bo_driver_verify_access);
Signature · 6 lines
2.18.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v3 2/8] ttm: turn ttm_bo_device.vma_manager into a pointer
In reply to Gerd HoffmannAm 08.08.19 um 11:36 schrieb Gerd Hoffmann:
Quoted 6 lines
Rename the embedded struct
vma_offset_manager, it is named_vma_managernow. ttm_bo_device.vma_manager is a pointer now, pointing to the embedded ttm_bo_device._vma_manager by default.Add
ttm_bo_device_init_with_vma_manager()function which allows to initialize ttm with a different vma manager.
Can't we go down the route of completely removing the vma_manager from TTM? ttm_bo_mmap() would get the BO as parameter instead.
That would also make the verify_access callback completely superfluous and looks like a good step into the right direction of de-midlayering.
Christian.
Quoted 143 lines
Signed-off-by Gerd Hoffmann <[email protected]>--- include/drm/ttm/ttm_bo_driver.h | 11 +++++++++-- drivers/gpu/drm/ttm/ttm_bo.c | 29 +++++++++++++++++++++-------- drivers/gpu/drm/ttm/ttm_bo_vm.c | 6 +++--- 3 files changed, 33 insertions(+), 13 deletions(-)include/drm/ttm/ttm_bo_driver.h +9
-2@@ -441,7 +441,8 @@ extern struct ttm_bo_global {* * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver. * @man: An array of mem_type_managers. -* @vma_manager: Address space manager +* @vma_manager: Address space manager (pointer) +* @_vma_manager: Address space manager (enbedded) * lru_lock: Spinlock that protects the buffer+device lru lists and * ddestroy lists. * @dev_mapping: A pointer to the struct address_space representing the @@ -464,7 +465,8 @@ struct ttm_bo_device {/* * Protected by internal locks. */ -struct drm_vma_offset_manager vma_manager; +struct drm_vma_offset_manager *vma_manager; +struct drm_vma_offset_manager _vma_manager;/* * Protected by the global:lru lock. @@ -597,6 +599,11 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,struct ttm_bo_driver *driver, struct address_space *mapping, bool need_dma32); +int ttm_bo_device_init_with_vma_manager (struct ttm_bo_device *bdev, +struct ttm_bo_driver *driver, +struct address_space *mapping, +struct drm_vma_offset_manager *vma_manager, +bool need_dma32);/** * ttm_bo_unmap_virtual drivers/gpu/drm/ttm/ttm_bo.c +21
-8@@ -672,7 +672,7 @@ static void ttm_bo_release(struct kref *kref)struct ttm_bo_device *bdev = bo->bdev;struct ttm_mem_type_manager *man = &bdev->man[bo->mem.mem_type]; -drm_vma_offset_remove (&bdev->vma_manager, &bo->base.vma_node); +drm_vma_offset_remove (bdev->vma_manager, &bo->base.vma_node);ttm_mem_io_lock (man, false);ttm_mem_io_free_vm (bo);ttm_mem_io_unlock (man);@@ -1353,7 +1353,7 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,*/ if (bo->type == ttm_bo_type_device || bo->type == ttm_bo_type_sg) - ret =drm_vma_offset_add (&bdev->vma_manager, &bo->base.vma_node, + ret =drm_vma_offset_add (bdev->vma_manager, &bo->base.vma_node, bo->mem.num_pages);/* passed reservation objects should already be locked, @@ -1704,7 +1704,7 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev)pr_debug ("Swap list %d was clean\n" , i);spin_unlock (&glob->lru_lock); -drm_vma_offset_manager_destroy (&bdev->vma_manager); +drm_vma_offset_manager_destroy (&bdev->_vma_manager);if (!ret)ttm_bo_global_release ();@@ -1713,10 +1713,11 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev) }EXPORT_SYMBOL (ttm_bo_device_release); -int ttm_bo_device_init (struct ttm_bo_device *bdev, -struct ttm_bo_driver *driver, -struct address_space *mapping, -bool need_dma32) +int ttm_bo_device_init_with_vma_manager (struct ttm_bo_device *bdev, +struct ttm_bo_driver *driver, +struct address_space *mapping, +struct drm_vma_offset_manager *vma_manager, +bool need_dma32) {struct ttm_bo_global *glob = &ttm_bo_glob;int ret;@@ -1737,7 +1738,8 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,if (unlikely (ret !=0 )) goto out_no_sys; -drm_vma_offset_manager_init (&bdev->vma_manager, + bdev->vma_manager = vma_manager; +drm_vma_offset_manager_init (&bdev->_vma_manager,DRM_FILE_PAGE_OFFSET_START ,DRM_FILE_PAGE_OFFSET_SIZE );INIT_DELAYED_WORK (&bdev->wq, ttm_bo_delayed_workqueue);@@ -1754,6 +1756,17 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,ttm_bo_global_release ();return ret; } +EXPORT_SYMBOL (ttm_bo_device_init_with_vma_manager); + +int ttm_bo_device_init (struct ttm_bo_device *bdev, +struct ttm_bo_driver *driver, +struct address_space *mapping, +bool need_dma32) +{ +return ttm_bo_device_init_with_vma_manager (bdev, driver, mapping, + &bdev->_vma_manager, + need_dma32); +}EXPORT_SYMBOL (ttm_bo_device_init);/* drivers/gpu/drm/ttm/ttm_bo_vm.c +3
-3@@ -409,16 +409,16 @@ static struct ttm_buffer_object *ttm_bo_vm_lookup(struct ttm_bo_device *bdev,struct drm_vma_offset_node *node;struct ttm_buffer_object *bo =NULL ; -drm_vma_offset_lock_lookup (&bdev->vma_manager); +drm_vma_offset_lock_lookup (bdev->vma_manager); - node =drm_vma_offset_lookup_locked (&bdev->vma_manager, offset, pages); + node =drm_vma_offset_lookup_locked (bdev->vma_manager, offset, pages);if (likely (node)) { bo = container_of(node, struct ttm_buffer_object, base.vma_node); bo =ttm_bo_get_unless_zero (bo); } -drm_vma_offset_unlock_lookup (&bdev->vma_manager); +drm_vma_offset_unlock_lookup (bdev->vma_manager);if (!bo)pr_err ("Could not find buffer object to map\n" );
Gerd Hoffmann
maintainerRe: [PATCH v3 1/8] scsi: core: fix the dma_max_mapping_size call
In reply to Gerd HoffmannQuoted 8 lines · Gerd Hoffmann
From: Christoph Hellwig <[email protected]>
We should only call
dma_max_mapping_sizefor devices that have a DMA mask set, otherwise we can run into a NULL pointer dereference that will crash the system.Also we need to do right shift to get the sectors from the size in bytes, not a left shift.
Oops, that wasn't meant to be re-sent, sorry.
drm-misc-next maintainers: any chance for a backmerge to pick up this fix, so I don't have to carry it in my branches?
thanks,
Gerd
Gerd Hoffmann
maintainerRe: [PATCH v3 2/8] ttm: turn ttm_bo_device.vma_manager into a pointer
In reply to Koenig, ChristianQuoted 10 lines · Christian
Am 08.08.19 um 11:36 schrieb Gerd Hoffmann:
Quoted 6 lines
Rename the embedded struct
vma_offset_manager, it is named_vma_managernow. ttm_bo_device.vma_manager is a pointer now, pointing to the embedded ttm_bo_device._vma_manager by default.Add
ttm_bo_device_init_with_vma_manager()function which allows to initialize ttm with a different vma manager.Can't we go down the route of completely removing the
vma_managerfrom TTM?ttm_bo_mmap()would get the BO as parameter instead.
It surely makes sense to target that. This patch can be a first step into that direction. It allows gem and ttm to use the same vma_offset_manager (see patch #3), which in turn makes various gem functions work on ttm objects (see patch #4 for vram helpers).
Quoted 2 lines
That would also make the
verify_accesscallback completely superfluous and looks like a good step into the right direction of de-midlayering.
Hmm, right, noticed that too while working on another patch series. Guess I'll try to merge those two and see where I end up ...
cheers,
Gerd
Re: [PATCH v3 2/8] ttm: turn ttm_bo_device.vma_manager into a pointer
Quoted 9 lines · Gerd Hoffmann
Quoted 8 lines · Christian
Am 08.08.19 um 11:36 schrieb Gerd Hoffmann:
Quoted 6 lines
Rename the embedded struct
vma_offset_manager, it is named_vma_managernow. ttm_bo_device.vma_manager is a pointer now, pointing to the embedded ttm_bo_device._vma_manager by default.Add
ttm_bo_device_init_with_vma_manager()function which allows to initialize ttm with a different vma manager.
Quoted 7 lines
Quoted 2 lines
Can't we go down the route of completely removing the
vma_managerfrom TTM?ttm_bo_mmap()would get the BO as parameter instead.It surely makes sense to target that. This patch can be a first step into that direction. It allows gem and ttm to use the same
vma_offset_manager(see patch #3), which in turn makes various gem functions work on ttm objects (see patch #4 for vram helpers).
+1 on cleaning this up for good, at least long-term ...
Quoted 5 lines
Quoted 2 lines
That would also make the
verify_accesscallback completely superfluous and looks like a good step into the right direction of de-midlayering.Hmm, right, noticed that too while working on another patch series. Guess I'll try to merge those two and see where I end up ...
... but if it gets too invasive I'd vote for incremental changes. Even if we completely rip out the vma/mmap lookup stuff from ttm, we still need to keep a copy somewhere for vmwgfx. Or would the evil plan be the vmwgfx would use the gem mmap helpers too?
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [PATCH v3 2/8] ttm: turn ttm_bo_device.vma_manager into a pointer
Quoted 17 lines · Daniel Vetter
Quoted 6 lines · Gerd Hoffmann
Quoted 5 lines · Christian
Am 08.08.19 um 11:36 schrieb Gerd Hoffmann:
Quoted 4 lines
Rename the embedded struct
vma_offset_manager, it is named_vma_managernow. ttm_bo_device.vma_manager is a pointer now, pointing to the embedded ttm_bo_device._vma_manager by default.Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Add
ttm_bo_device_init_with_vma_manager()function which allows to initialize ttm with a different vma manager.Can't we go down the route of completely removing the
vma_managerfrom TTM?ttm_bo_mmap()would get the BO as parameter instead.It surely makes sense to target that. This patch can be a first step into that direction. It allows gem and ttm to use the same
vma_offset_manager(see patch #3), which in turn makes various gem functions work on ttm objects (see patch #4 for vram helpers).+1 on cleaning this up for good, at least long-term ...
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
That would also make the
verify_accesscallback completely superfluous and looks like a good step into the right direction of de-midlayering.Hmm, right, noticed that too while working on another patch series. Guess I'll try to merge those two and see where I end up ...
... but if it gets too invasive I'd vote for incremental changes. Even if we completely rip out the vma/mmap lookup stuff from ttm, we still need to keep a copy somewhere for vmwgfx. Or would the evil plan be the vmwgfx would use the gem mmap helpers too?
I don't think it would be too invasive. We could simply move ttm_bo_vm_lookup into a vmw_mmap.
/Thomas
Quoted 1 line
-Daniel
Re: [PATCH v3 2/8] ttm: turn ttm_bo_device.vma_manager into a pointer
Am 08.08.19 um 14:43 schrieb Thomas Hellström (VMware):
Quoted 30 lines · Daniel Vetter
Quoted 20 lines · Gerd Hoffmann
Quoted 7 lines · Christian
Quoted 6 lines
Am 08.08.19 um 11:36 schrieb Gerd Hoffmann:
Quoted 5 lines
Rename the embedded struct
vma_offset_manager, it is named_vma_manager
now. ttm_bo_device.vma_manager is a pointer now, pointing to the embedded ttm_bo_device._vma_manager by default.Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Add
ttm_bo_device_init_with_vma_manager()function which allows to initialize ttm with a different vma manager.Can't we go down the route of completely removing the
vma_managerfrom TTM?ttm_bo_mmap()would get the BO as parameter instead.It surely makes sense to target that. This patch can be a first step into that direction. It allows gem and ttm to use the same
vma_offset_manager(see patch #3), which in turn makes various gem functions work on ttm objects (see patch #4 for vram helpers).+1 on cleaning this up for good, at least long-term ...
Quoted 2 lines
Quoted 2 lines
That would also make the
verify_accesscallback completely superfluous and looks like a good step into the right direction of de-midlayering.Quoted 8 lines
Quoted 2 lines
Hmm, right, noticed that too while working on another patch series. Guess I'll try to merge those two and see where I end up ...
... but if it gets too invasive I'd vote for incremental changes. Even if
we completely rip out the vma/mmap lookup stuff from ttm, we still need to
keep a copy somewhere for vmwgfx. Or would the evil plan be the vmwgfx would use the gem mmap helpers too?
Quoted 2 lines
I don't think it would be too invasive. We could simply move
ttm_bo_vm_lookupinto avmw_mmap.
Yeah, agree. vmwgfx would just inherit what TTM is currently doing and everybody else would start to use the GEM helpers.
Switching the vma_manager to a pointer might be helpful in the middle of the patch set, but as stand a lone change that looks like a detour to me.
I suggest to start by adding the bo as parameter to ttm_bo_mmap and moving the lockup out of that function.
Christian.
Quoted 9 lines
/Thomas
Quoted 1 line
-Daniel
Gerd Hoffmann
maintainerRe: [PATCH v3 2/8] ttm: turn ttm_bo_device.vma_manager into a pointer
In reply to Daniel VetterHi,
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
That would also make the
verify_accesscallback completely superfluous and looks like a good step into the right direction of de-midlayering.Hmm, right, noticed that too while working on another patch series. Guess I'll try to merge those two and see where I end up ...
... but if it gets too invasive I'd vote for incremental changes.
Yep, this is what I'm up to. Sketching things up with vram helpers and qxl, in a way that we can switch over drivers one by one.
Once all drivers are switched removing ttm_bo_device.vma_manager altogether should be easy.
Quoted 3 lines
Even if
we completely rip out the vma/mmap lookup stuff from ttm, we still need to keep a copy somewhere for vmwgfx.
If vmwgfx is the only user we can probably just move things from ttm to vmwgfx.
Quoted 2 lines
Or would the evil plan be the vmwgfx
would use the gem mmap helpers too?
That would work as well ;)
cheers,
Gerd