Skip to contentSkip to conversation

Clean up TTM mmap offsets

PATCH In review Thomas Zimmermann 10 participants 20 messages Feb 7, 2019 – Mar 11, 2019 5 messages not in the archive

Subsystems (13)
lore
Share & tools
lore
#0 lore raw

cover Clean up TTM mmap offsets

Almost all TTM-based drivers use the same values for the mmap-able range of BO addresses. Each driver therefore duplicates the DRM_FILE_PAGE_OFFSET constant. OTOH, the mmap range's size is not configurable by drivers.

This patch set replaces driver-specific configuration with a single setup. All code is located within TTM. TTM and GEM share the same range for mmap-able BOs.

Thomas Zimmermann (5):
staging/vboxvideo: Use same BO mmap offset as other drivers drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init() drm/ttm: Quick-test mmap offset in ttm_bo_mmap()
drm: Use the same mmap-range offset and size for GEM and TTM

 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 12 ++----------
 drivers/gpu/drm/ast/ast_drv.h               |  2 --
 drivers/gpu/drm/ast/ast_ttm.c               | 10 ++--------
 drivers/gpu/drm/bochs/bochs.h               |  2 --
 drivers/gpu/drm/bochs/bochs_mm.c            | 10 ++--------
 drivers/gpu/drm/cirrus/cirrus_drv.h         |  1 -
 drivers/gpu/drm/cirrus/cirrus_ttm.c         | 10 ++--------
 drivers/gpu/drm/drm_gem.c                   | 17 -----------------
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 12 ++----------
 drivers/gpu/drm/mgag200/mgag200_drv.h       |  1 -
 drivers/gpu/drm/mgag200/mgag200_ttm.c       | 10 ++--------
 drivers/gpu/drm/nouveau/nouveau_drv.h       |  2 --
 drivers/gpu/drm/nouveau/nouveau_ttm.c       |  4 ----
 drivers/gpu/drm/qxl/qxl_drv.h               |  3 ---
 drivers/gpu/drm/qxl/qxl_ttm.c               | 11 +++--------
 drivers/gpu/drm/radeon/radeon_ttm.c         | 13 ++-----------
 drivers/gpu/drm/ttm/ttm_bo.c                |  6 +++---
 drivers/gpu/drm/ttm/ttm_bo_vm.c             |  3 +++
 drivers/gpu/drm/virtio/virtgpu_ttm.c        |  4 +---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c         |  1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h         |  1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c    | 11 ++---------
 drivers/staging/vboxvideo/vbox_drv.h        |  2 --
 drivers/staging/vboxvideo/vbox_ttm.c        | 12 +++---------
 include/drm/drm_vma_manager.h               | 12 ++++++++++++
 include/drm/ttm/ttm_bo_driver.h             |  2 +-
 26 files changed, 42 insertions(+), 132 deletions(-)
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 1/5 staging/vboxvideo: Use same BO mmap offset as other drivers

The vboxvideo driver mmaps BOs at 0x10000000 or higher. Changing the offset to 0x100000000 aligns the driver with all other DRM drivers.

---
 drivers/staging/vboxvideo/vbox_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vboxvideo/vbox_drv.h +1 -1
index aa40e5cc2861..eba5a8bc9cea 100644
@@ -209,7 +209,7 @@ int vbox_dumb_mmap_offset(struct drm_file *file,
 			  struct drm_device *dev,
 			  u32 handle, u64 *offset);
 
-#define DRM_FILE_PAGE_OFFSET (0x10000000ULL >> PAGE_SHIFT)
+#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
 
 int vbox_mm_init(struct vbox_private *vbox);
 void vbox_mm_fini(struct vbox_private *vbox);
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

PATCH 2/5 drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant

In reply to a message not in the archive

Most TTM drivers define the constant DRM_FILE_PAGE_OFFSET of the same value. The only exception is vboxvideo, which is being converted to the new offset by this patch. Unifying the constants in a single place simplifies the driver code.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 2 --
 drivers/gpu/drm/ast/ast_drv.h               | 2 --
 drivers/gpu/drm/bochs/bochs.h               | 2 --
 drivers/gpu/drm/cirrus/cirrus_drv.h         | 1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 --
 drivers/gpu/drm/mgag200/mgag200_drv.h       | 1 -
 drivers/gpu/drm/nouveau/nouveau_drv.h       | 2 --
 drivers/gpu/drm/qxl/qxl_drv.h               | 3 ---
 drivers/gpu/drm/radeon/radeon_ttm.c         | 2 --
 drivers/gpu/drm/virtio/virtgpu_ttm.c        | 2 --
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c         | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h         | 1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c    | 2 +-
 drivers/staging/vboxvideo/vbox_drv.h        | 2 --
 include/drm/ttm/ttm_bo_driver.h             | 2 ++
 15 files changed, 4 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -2
index b852abb9db0f..447960b3334a 100644
@@ -50,8 +50,6 @@
 #include "amdgpu_sdma.h"
 #include "bif/bif_4_1_d.h"
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 static int amdgpu_map_buffer(struct ttm_buffer_object *bo,
 			     struct ttm_mem_reg *mem, unsigned num_pages,
 			     uint64_t offset, unsigned window,
drivers/gpu/drm/ast/ast_drv.h +0 -2
index bfc65040dfcb..c43b927f73af 100644
@@ -353,8 +353,6 @@ extern int ast_dumb_mmap_offset(struct drm_file *file,
 				uint32_t handle,
 				uint64_t *offset);
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 int ast_mm_init(struct ast_private *ast);
 void ast_mm_fini(struct ast_private *ast);
 
drivers/gpu/drm/bochs/bochs.h +0 -2
index 03711394f1ed..7425d083b944 100644
@@ -101,8 +101,6 @@ static inline struct bochs_bo *gem_to_bochs_bo(struct drm_gem_object *gem)
 	return container_of(gem, struct bochs_bo, gem);
 }
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 static inline u64 bochs_bo_mmap_offset(struct bochs_bo *bo)
 {
 	return drm_vma_node_offset_addr(&bo->bo.vma_node);
drivers/gpu/drm/cirrus/cirrus_drv.h +0 -1
index f2b2e0d169fa..ba77507e9bad 100644
@@ -169,7 +169,6 @@ cirrus_bo(struct ttm_buffer_object *bo)
 
 
 #define to_cirrus_obj(x) container_of(x, struct cirrus_gem_object, base)
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
 
 				/* cirrus_main.c */
 int cirrus_device_init(struct cirrus_device *cdev,
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c +0 -2
index dd383267884c..a06725c2bbfa 100644
@@ -21,8 +21,6 @@
 
 #include "hibmc_drm_drv.h"
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 static inline struct hibmc_drm_private *
 hibmc_bdev(struct ttm_bo_device *bd)
 {
drivers/gpu/drm/mgag200/mgag200_drv.h +0 -1
index 0aaedc554879..706c902aad2d 100644
@@ -269,7 +269,6 @@ mgag200_dumb_mmap_offset(struct drm_file *file,
 struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev);
 void mgag200_i2c_destroy(struct mga_i2c_chan *i2c);
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
 void mgag200_ttm_placement(struct mgag200_bo *bo, int domain);
 
 static inline int mgag200_bo_reserve(struct mgag200_bo *bo, bool no_wait)
drivers/gpu/drm/nouveau/nouveau_drv.h +0 -2
index d20b9ba4b1c1..c144bc79e872 100644
@@ -60,8 +60,6 @@
 struct nouveau_channel;
 struct platform_device;
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 #include "nouveau_fence.h"
 #include "nouveau_bios.h"
 #include "nouveau_vmm.h"
drivers/gpu/drm/qxl/qxl_drv.h +0 -3
index 4a0331b3ff7d..2896bb6fdbf4 100644
@@ -65,9 +65,6 @@
 extern int qxl_num_crtc;
 extern int qxl_max_ioctls;
 
-#define DRM_FILE_OFFSET 0x100000000ULL
-#define DRM_FILE_PAGE_OFFSET (DRM_FILE_OFFSET >> PAGE_SHIFT)
-
 #define QXL_INTERRUPT_MASK (\
 	QXL_INTERRUPT_DISPLAY |\
 	QXL_INTERRUPT_CURSOR |\
drivers/gpu/drm/radeon/radeon_ttm.c +0 -2
index 9920a6fc11bf..071a872e5b02 100644
@@ -45,8 +45,6 @@
 #include "radeon_reg.h"
 #include "radeon.h"
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 static int radeon_ttm_debugfs_init(struct radeon_device *rdev);
 static void radeon_ttm_debugfs_fini(struct radeon_device *rdev);
 
drivers/gpu/drm/virtio/virtgpu_ttm.c +0 -2
index 4bfbf25fabff..64f5b8dec3e9 100644
@@ -37,8 +37,6 @@
 
 #include <linux/delay.h>
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 static struct
 virtio_gpu_device *virtio_gpu_get_vgdev(struct ttm_bo_device *bdev)
 {
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +1 -1
index 4638f6791cda..e72edc68255d 100644
@@ -868,7 +868,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
 	ret = ttm_bo_device_init(&dev_priv->bdev,
 				 &vmw_bo_driver,
 				 dev->anon_inode->i_mapping,
-				 VMWGFX_FILE_PAGE_OFFSET,
+				 DRM_FILE_PAGE_OFFSET,
 				 false);
 	if (unlikely(ret != 0)) {
 		DRM_ERROR("Failed initializing TTM buffer object driver.\n");
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +0 -1
index accb2fafe2f1..6302c12c2298 100644
@@ -48,7 +48,6 @@
 #define VMWGFX_DRIVER_MAJOR 2
 #define VMWGFX_DRIVER_MINOR 15
 #define VMWGFX_DRIVER_PATCHLEVEL 0
-#define VMWGFX_FILE_PAGE_OFFSET 0x00100000
 #define VMWGFX_FIFO_STATIC_SIZE (1024*1024)
 #define VMWGFX_MAX_RELOCATIONS 2048
 #define VMWGFX_MAX_VALIDATIONS 2048
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c +1 -1
index e6d75e377dd8..ec5b4b237f2c 100644
@@ -33,7 +33,7 @@ int vmw_mmap(struct file *filp, struct vm_area_struct *vma)
 	struct drm_file *file_priv;
 	struct vmw_private *dev_priv;
 
-	if (unlikely(vma->vm_pgoff < VMWGFX_FILE_PAGE_OFFSET)) {
+	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) {
 		DRM_ERROR("Illegal attempt to mmap old fifo space.\n");
 		return -EINVAL;
 	}
drivers/staging/vboxvideo/vbox_drv.h +0 -2
index eba5a8bc9cea..77f2a4e9000e 100644
@@ -209,8 +209,6 @@ int vbox_dumb_mmap_offset(struct drm_file *file,
 			  struct drm_device *dev,
 			  u32 handle, u64 *offset);
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 int vbox_mm_init(struct vbox_private *vbox);
 void vbox_mm_fini(struct vbox_private *vbox);
 
include/drm/ttm/ttm_bo_driver.h +2 -0
index cbf3180cb612..c0bed72492f3 100644
@@ -49,6 +49,8 @@
 #define TTM_MEMTYPE_FLAG_MAPPABLE      (1 << 1)	/* Memory mappable */
 #define TTM_MEMTYPE_FLAG_CMA           (1 << 3)	/* Can't map aperture */
 
+#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
+
 struct ttm_mem_type_manager;
 
 struct ttm_mem_type_manager_func {
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#4 lore raw

Re: [PATCH 2/5] drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant

Hi

Am 07.02.19 um 09:59 schrieb Thomas Zimmermann:

Quoted 4 lines

Most TTM drivers define the constant DRM_FILE_PAGE_OFFSET of the same value. The only exception is vboxvideo, which is being converted to the new offset by this patch. Unifying the constants in a single place simplifies the driver code.

Just a quick note: I just realized that the description is slightly incorrect. vboxvideo got fixed in patch [01]. If it matters, remove the second sentence before merging. (Or ping me to provide an updated patch.)

Best regards
Thomas

Quoted 214 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 2 --
 drivers/gpu/drm/ast/ast_drv.h               | 2 --
 drivers/gpu/drm/bochs/bochs.h               | 2 --
 drivers/gpu/drm/cirrus/cirrus_drv.h         | 1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 --
 drivers/gpu/drm/mgag200/mgag200_drv.h       | 1 -
 drivers/gpu/drm/nouveau/nouveau_drv.h       | 2 --
 drivers/gpu/drm/qxl/qxl_drv.h               | 3 ---
 drivers/gpu/drm/radeon/radeon_ttm.c         | 2 --
 drivers/gpu/drm/virtio/virtgpu_ttm.c        | 2 --
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c         | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h         | 1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c    | 2 +-
 drivers/staging/vboxvideo/vbox_drv.h        | 2 --
 include/drm/ttm/ttm_bo_driver.h             | 2 ++
 15 files changed, 4 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -2
index b852abb9db0f..447960b3334a 100644
@@ -50,8 +50,6 @@
 #include "amdgpu_sdma.h"
 #include "bif/bif_4_1_d.h"
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 static int amdgpu_map_buffer(struct ttm_buffer_object *bo,
 			     struct ttm_mem_reg *mem, unsigned num_pages,
 			     uint64_t offset, unsigned window,
drivers/gpu/drm/ast/ast_drv.h +0 -2
index bfc65040dfcb..c43b927f73af 100644
@@ -353,8 +353,6 @@ extern int ast_dumb_mmap_offset(struct drm_file *file,
 				uint32_t handle,
 				uint64_t *offset);
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 int ast_mm_init(struct ast_private *ast);
 void ast_mm_fini(struct ast_private *ast);
 
drivers/gpu/drm/bochs/bochs.h +0 -2
index 03711394f1ed..7425d083b944 100644
@@ -101,8 +101,6 @@ static inline struct bochs_bo *gem_to_bochs_bo(struct drm_gem_object *gem)
 	return container_of(gem, struct bochs_bo, gem);
 }
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 static inline u64 bochs_bo_mmap_offset(struct bochs_bo *bo)
 {
 	return drm_vma_node_offset_addr(&bo->bo.vma_node);
drivers/gpu/drm/cirrus/cirrus_drv.h +0 -1
index f2b2e0d169fa..ba77507e9bad 100644
@@ -169,7 +169,6 @@ cirrus_bo(struct ttm_buffer_object *bo)
 
 
 #define to_cirrus_obj(x) container_of(x, struct cirrus_gem_object, base)
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
 
 				/* cirrus_main.c */
 int cirrus_device_init(struct cirrus_device *cdev,
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c +0 -2
index dd383267884c..a06725c2bbfa 100644
@@ -21,8 +21,6 @@
 
 #include "hibmc_drm_drv.h"
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 static inline struct hibmc_drm_private *
 hibmc_bdev(struct ttm_bo_device *bd)
 {
drivers/gpu/drm/mgag200/mgag200_drv.h +0 -1
index 0aaedc554879..706c902aad2d 100644
@@ -269,7 +269,6 @@ mgag200_dumb_mmap_offset(struct drm_file *file,
 struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev);
 void mgag200_i2c_destroy(struct mga_i2c_chan *i2c);
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
 void mgag200_ttm_placement(struct mgag200_bo *bo, int domain);
 
 static inline int mgag200_bo_reserve(struct mgag200_bo *bo, bool no_wait)
drivers/gpu/drm/nouveau/nouveau_drv.h +0 -2
index d20b9ba4b1c1..c144bc79e872 100644
@@ -60,8 +60,6 @@
 struct nouveau_channel;
 struct platform_device;
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 #include "nouveau_fence.h"
 #include "nouveau_bios.h"
 #include "nouveau_vmm.h"
drivers/gpu/drm/qxl/qxl_drv.h +0 -3
index 4a0331b3ff7d..2896bb6fdbf4 100644
@@ -65,9 +65,6 @@
 extern int qxl_num_crtc;
 extern int qxl_max_ioctls;
 
-#define DRM_FILE_OFFSET 0x100000000ULL
-#define DRM_FILE_PAGE_OFFSET (DRM_FILE_OFFSET >> PAGE_SHIFT)
-
 #define QXL_INTERRUPT_MASK (\
 	QXL_INTERRUPT_DISPLAY |\
 	QXL_INTERRUPT_CURSOR |\
drivers/gpu/drm/radeon/radeon_ttm.c +0 -2
index 9920a6fc11bf..071a872e5b02 100644
@@ -45,8 +45,6 @@
 #include "radeon_reg.h"
 #include "radeon.h"
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 static int radeon_ttm_debugfs_init(struct radeon_device *rdev);
 static void radeon_ttm_debugfs_fini(struct radeon_device *rdev);
 
drivers/gpu/drm/virtio/virtgpu_ttm.c +0 -2
index 4bfbf25fabff..64f5b8dec3e9 100644
@@ -37,8 +37,6 @@
 
 #include <linux/delay.h>
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 static struct
 virtio_gpu_device *virtio_gpu_get_vgdev(struct ttm_bo_device *bdev)
 {
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +1 -1
index 4638f6791cda..e72edc68255d 100644
@@ -868,7 +868,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
 	ret = ttm_bo_device_init(&dev_priv->bdev,
 				 &vmw_bo_driver,
 				 dev->anon_inode->i_mapping,
-				 VMWGFX_FILE_PAGE_OFFSET,
+				 DRM_FILE_PAGE_OFFSET,
 				 false);
 	if (unlikely(ret != 0)) {
 		DRM_ERROR("Failed initializing TTM buffer object driver.\n");
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +0 -1
index accb2fafe2f1..6302c12c2298 100644
@@ -48,7 +48,6 @@
 #define VMWGFX_DRIVER_MAJOR 2
 #define VMWGFX_DRIVER_MINOR 15
 #define VMWGFX_DRIVER_PATCHLEVEL 0
-#define VMWGFX_FILE_PAGE_OFFSET 0x00100000
 #define VMWGFX_FIFO_STATIC_SIZE (1024*1024)
 #define VMWGFX_MAX_RELOCATIONS 2048
 #define VMWGFX_MAX_VALIDATIONS 2048
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c +1 -1
index e6d75e377dd8..ec5b4b237f2c 100644
@@ -33,7 +33,7 @@ int vmw_mmap(struct file *filp, struct vm_area_struct *vma)
 	struct drm_file *file_priv;
 	struct vmw_private *dev_priv;
 
-	if (unlikely(vma->vm_pgoff < VMWGFX_FILE_PAGE_OFFSET)) {
+	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) {
 		DRM_ERROR("Illegal attempt to mmap old fifo space.\n");
 		return -EINVAL;
 	}
drivers/staging/vboxvideo/vbox_drv.h +0 -2
index eba5a8bc9cea..77f2a4e9000e 100644
@@ -209,8 +209,6 @@ int vbox_dumb_mmap_offset(struct drm_file *file,
 			  struct drm_device *dev,
 			  u32 handle, u64 *offset);
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 int vbox_mm_init(struct vbox_private *vbox);
 void vbox_mm_fini(struct vbox_private *vbox);
 
include/drm/ttm/ttm_bo_driver.h +2 -0
index cbf3180cb612..c0bed72492f3 100644
@@ -49,6 +49,8 @@
 #define TTM_MEMTYPE_FLAG_MAPPABLE      (1 << 1)	/* Memory mappable */
 #define TTM_MEMTYPE_FLAG_CMA           (1 << 3)	/* Can't map aperture */
 
+#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
+
 struct ttm_mem_type_manager;
 
 struct ttm_mem_type_manager_func {
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstr. 5, D-90409 Nürnberg
Tel: +49-911-74053-0; Fax: +49-911-7417755;  https://www.suse.com/
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard,
Graham Norton, HRB 21284 (AG Nürnberg)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [PATCH 2/5] drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant

Quoted 26 lines · Thomas Zimmermann

Most TTM drivers define the constant DRM_FILE_PAGE_OFFSET of the same value. The only exception is vboxvideo, which is being converted to the
new offset by this patch. Unifying the constants in a single place simplifies the driver code.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 2 --
 drivers/gpu/drm/ast/ast_drv.h               | 2 --
 drivers/gpu/drm/bochs/bochs.h               | 2 --
 drivers/gpu/drm/cirrus/cirrus_drv.h         | 1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 --
 drivers/gpu/drm/mgag200/mgag200_drv.h       | 1 -
 drivers/gpu/drm/nouveau/nouveau_drv.h       | 2 --
 drivers/gpu/drm/qxl/qxl_drv.h               | 3 ---
 drivers/gpu/drm/radeon/radeon_ttm.c         | 2 --
 drivers/gpu/drm/virtio/virtgpu_ttm.c        | 2 --
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c         | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h         | 1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c    | 2 +-
 drivers/staging/vboxvideo/vbox_drv.h        | 2 --
 include/drm/ttm/ttm_bo_driver.h             | 2 ++
 15 files changed, 4 insertions(+), 24 deletions(-)

...

include/drm/ttm/ttm_bo_driver.h line 53

Quoted 13 lines
include/drm/ttm/ttm_bo_driver.h +0 -0
index cbf3180cb612..c0bed72492f3 100644
@@ -49,6 +49,8 @@
 #define TTM_MEMTYPE_FLAG_MAPPABLE      (1 << 1)	/* Memory

mappable */
#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map
aperture */

include/drm/ttm/ttm_bo_driver.h +2 -0
+#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
+

IMO strictly, the place in the drm file address space where a driver chooses to insert the TTM bo address space is to be determined by DRM, (as also the define indicates) rather than TTM. So I think the right place for this define is a drm header, not a ttm header.

Thanks,
Thomas

Quoted 3 lines

struct ttm_mem_type_manager;

struct ttm_mem_type_manager_func {

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#7 lore raw

Re: [PATCH 2/5] drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant

Hi

Am 07.02.19 um 20:07 schrieb Thomas Hellstrom:

Quoted 12 lines
Quoted 12 lines
include/drm/ttm/ttm_bo_driver.h +0 -0
index cbf3180cb612..c0bed72492f3 100644
@@ -49,6 +49,8 @@
 #define TTM_MEMTYPE_FLAG_MAPPABLE      (1 << 1)	/* Memory

mappable */
#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map
aperture */

Quoted 7 lines

include/drm/ttm/ttm_bo_driver.h line 53

Quoted 2 lines
include/drm/ttm/ttm_bo_driver.h +2 -0
+#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
+

IMO strictly, the place in the drm file address space where a driver chooses to insert the TTM bo address space is to be determined by DRM, (as also the define indicates) rather than TTM. So I think the right place for this define is a drm header, not a ttm header.

I put this here temporarily for the cleanup. But it gets fixed by patch [05], which moves the constants into drm_vma_manager.h

Best regards
Thomas

Quoted 13 lines

Thanks,
Thomas

Quoted 3 lines

struct ttm_mem_type_manager;

struct ttm_mem_type_manager_func {

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstr. 5, D-90409 Nürnberg
Tel: +49-911-74053-0; Fax: +49-911-7417755;  https://www.suse.com/
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard,
Graham Norton, HRB 21284 (AG Nürnberg)

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

Re: [PATCH 2/5] drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant

In reply to Thomas Zimmermann
Quoted 26 lines · Thomas Zimmermann

Most TTM drivers define the constant DRM_FILE_PAGE_OFFSET of the same value. The only exception is vboxvideo, which is being converted to the
new offset by this patch. Unifying the constants in a single place simplifies the driver code.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 2 --
 drivers/gpu/drm/ast/ast_drv.h               | 2 --
 drivers/gpu/drm/bochs/bochs.h               | 2 --
 drivers/gpu/drm/cirrus/cirrus_drv.h         | 1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 2 --
 drivers/gpu/drm/mgag200/mgag200_drv.h       | 1 -
 drivers/gpu/drm/nouveau/nouveau_drv.h       | 2 --
 drivers/gpu/drm/qxl/qxl_drv.h               | 3 ---
 drivers/gpu/drm/radeon/radeon_ttm.c         | 2 --
 drivers/gpu/drm/virtio/virtgpu_ttm.c        | 2 --
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c         | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h         | 1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c    | 2 +-
 drivers/staging/vboxvideo/vbox_drv.h        | 2 --
 include/drm/ttm/ttm_bo_driver.h             | 2 ++
 15 files changed, 4 insertions(+), 24 deletions(-)

...

include/drm/ttm/ttm_bo_driver.h line 53

Quoted 13 lines
include/drm/ttm/ttm_bo_driver.h +0 -0
index cbf3180cb612..c0bed72492f3 100644
@@ -49,6 +49,8 @@
 #define TTM_MEMTYPE_FLAG_MAPPABLE      (1 << 1)	/* Memory

mappable */
#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map
aperture */

include/drm/ttm/ttm_bo_driver.h +2 -0
+#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
+

IMO strictly, the place in the drm file address space where a driver chooses to insert the TTM bo address space is to be determined by DRM, (as also the define indicates) rather than TTM. So I think the right place for this define is a drm header, not a ttm header.

Thanks,
Thomas

Quoted 3 lines

struct ttm_mem_type_manager;

struct ttm_mem_type_manager_func {

#9 lore raw

PATCH 3/5 drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init()

In reply to a message not in the archive

The parameter file_page_offset is a constant shared by all drivers. Just replace it with the constant itself.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 1 -
 drivers/gpu/drm/ast/ast_ttm.c               | 1 -
 drivers/gpu/drm/bochs/bochs_mm.c            | 1 -
 drivers/gpu/drm/cirrus/cirrus_ttm.c         | 1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 1 -
 drivers/gpu/drm/mgag200/mgag200_ttm.c       | 1 -
 drivers/gpu/drm/nouveau/nouveau_ttm.c       | 1 -
 drivers/gpu/drm/qxl/qxl_ttm.c               | 2 +-
 drivers/gpu/drm/radeon/radeon_ttm.c         | 1 -
 drivers/gpu/drm/ttm/ttm_bo.c                | 4 ++--
 drivers/gpu/drm/virtio/virtgpu_ttm.c        | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c         | 1 -
 drivers/staging/vboxvideo/vbox_ttm.c        | 2 +-
 include/drm/ttm/ttm_bo_driver.h             | 2 +-
 14 files changed, 6 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -1
index 447960b3334a..5755ac428fd0 100644
@@ -1669,7 +1669,6 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 	r = ttm_bo_device_init(&adev->mman.bdev,
 			       &amdgpu_bo_driver,
 			       adev->ddev->anon_inode->i_mapping,
-			       DRM_FILE_PAGE_OFFSET,
 			       adev->need_dma32);
 	if (r) {
 		DRM_ERROR("failed initializing buffer object driver(%d).\n", r);
drivers/gpu/drm/ast/ast_ttm.c +0 -1
index c168d62fe8f9..c410804a5e2c 100644
@@ -178,7 +178,6 @@ int ast_mm_init(struct ast_private *ast)
 	ret = ttm_bo_device_init(&ast->ttm.bdev,
 				 &ast_bo_driver,
 				 dev->anon_inode->i_mapping,
-				 DRM_FILE_PAGE_OFFSET,
 				 true);
 	if (ret) {
 		DRM_ERROR("Error initialising bo driver; %d\n", ret);
drivers/gpu/drm/bochs/bochs_mm.c +0 -1
index 49463348a07a..ebc9dbd94923 100644
@@ -156,7 +156,6 @@ int bochs_mm_init(struct bochs_device *bochs)
 	ret = ttm_bo_device_init(&bochs->ttm.bdev,
 				 &bochs_bo_driver,
 				 bochs->dev->anon_inode->i_mapping,
-				 DRM_FILE_PAGE_OFFSET,
 				 true);
 	if (ret) {
 		DRM_ERROR("Error initialising bo driver; %d\n", ret);
drivers/gpu/drm/cirrus/cirrus_ttm.c +0 -1
index e075810b4bd4..223a75ba77a8 100644
@@ -178,7 +178,6 @@ int cirrus_mm_init(struct cirrus_device *cirrus)
 	ret = ttm_bo_device_init(&cirrus->ttm.bdev,
 				 &cirrus_bo_driver,
 				 dev->anon_inode->i_mapping,
-				 DRM_FILE_PAGE_OFFSET,
 				 true);
 	if (ret) {
 		DRM_ERROR("Error initialising bo driver; %d\n", ret);
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c +0 -1
index a06725c2bbfa..845488922865 100644
@@ -189,7 +189,6 @@ int hibmc_mm_init(struct hibmc_drm_private *hibmc)
 	ret = ttm_bo_device_init(&hibmc->bdev,
 				 &hibmc_bo_driver,
 				 dev->anon_inode->i_mapping,
-				 DRM_FILE_PAGE_OFFSET,
 				 true);
 	if (ret) {
 		DRM_ERROR("error initializing bo driver: %d\n", ret);
drivers/gpu/drm/mgag200/mgag200_ttm.c +0 -1
index d96a9b32455e..ce739da5161d 100644
@@ -178,7 +178,6 @@ int mgag200_mm_init(struct mga_device *mdev)
 	ret = ttm_bo_device_init(&mdev->ttm.bdev,
 				 &mgag200_bo_driver,
 				 dev->anon_inode->i_mapping,
-				 DRM_FILE_PAGE_OFFSET,
 				 true);
 	if (ret) {
 		DRM_ERROR("Error initialising bo driver; %d\n", ret);
drivers/gpu/drm/nouveau/nouveau_ttm.c +0 -1
index 1543c2f8d3d3..c66467232604 100644
@@ -239,7 +239,6 @@ nouveau_ttm_init(struct nouveau_drm *drm)
 	ret = ttm_bo_device_init(&drm->ttm.bdev,
 				  &nouveau_bo_driver,
 				  dev->anon_inode->i_mapping,
-				  DRM_FILE_PAGE_OFFSET,
 				  drm->client.mmu.dmabits <= 32 ? true : false);
 	if (ret) {
 		NV_ERROR(drm, "error initialising bo driver, %d\n", ret);
drivers/gpu/drm/qxl/qxl_ttm.c +1 -1
index 92f5db5b296f..6b3b92d1f17f 100644
@@ -328,7 +328,7 @@ int qxl_ttm_init(struct qxl_device *qdev)
 	r = ttm_bo_device_init(&qdev->mman.bdev,
 			       &qxl_bo_driver,
 			       qdev->ddev.anon_inode->i_mapping,
-			       DRM_FILE_PAGE_OFFSET, 0);
+			       false);
 	if (r) {
 		DRM_ERROR("failed initializing buffer object driver(%d).\n", r);
 		return r;
drivers/gpu/drm/radeon/radeon_ttm.c +0 -1
index 071a872e5b02..7c10e1560780 100644
@@ -790,7 +790,6 @@ int radeon_ttm_init(struct radeon_device *rdev)
 	r = ttm_bo_device_init(&rdev->mman.bdev,
 			       &radeon_bo_driver,
 			       rdev->ddev->anon_inode->i_mapping,
-			       DRM_FILE_PAGE_OFFSET,
 			       rdev->need_dma32);
 	if (r) {
 		DRM_ERROR("failed initializing buffer object driver(%d).\n", r);
drivers/gpu/drm/ttm/ttm_bo.c +2 -2
index 3f56647cdb35..e1b65775f3ee 100644
@@ -1624,7 +1624,6 @@ 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,
-		       uint64_t file_page_offset,
 		       bool need_dma32)
 {
 	struct ttm_bo_global *glob = &ttm_bo_glob;
@@ -1646,7 +1645,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, file_page_offset,
+	drm_vma_offset_manager_init(&bdev->vma_manager,
+				    DRM_FILE_PAGE_OFFSET,
 				    0x10000000);
 	INIT_DELAYED_WORK(&bdev->wq, ttm_bo_delayed_workqueue);
 	INIT_LIST_HEAD(&bdev->ddestroy);
drivers/gpu/drm/virtio/virtgpu_ttm.c +1 -1
index 64f5b8dec3e9..d6225ba20b30 100644
@@ -328,7 +328,7 @@ int virtio_gpu_ttm_init(struct virtio_gpu_device *vgdev)
 	r = ttm_bo_device_init(&vgdev->mman.bdev,
 			       &virtio_gpu_bo_driver,
 			       vgdev->ddev->anon_inode->i_mapping,
-			       DRM_FILE_PAGE_OFFSET, 0);
+			       false);
 	if (r) {
 		DRM_ERROR("failed initializing buffer object driver(%d).\n", r);
 		goto err_dev_init;
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +0 -1
index e72edc68255d..b41faf061678 100644
@@ -868,7 +868,6 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
 	ret = ttm_bo_device_init(&dev_priv->bdev,
 				 &vmw_bo_driver,
 				 dev->anon_inode->i_mapping,
-				 DRM_FILE_PAGE_OFFSET,
 				 false);
 	if (unlikely(ret != 0)) {
 		DRM_ERROR("Failed initializing TTM buffer object driver.\n");
drivers/staging/vboxvideo/vbox_ttm.c +1 -1
index 30f270027acf..b7db7a7952d4 100644
@@ -156,7 +156,7 @@ int vbox_mm_init(struct vbox_private *vbox)
 	ret = ttm_bo_device_init(&vbox->ttm.bdev,
 				 &vbox_bo_driver,
 				 dev->anon_inode->i_mapping,
-				 DRM_FILE_PAGE_OFFSET, true);
+				 true);
 	if (ret) {
 		DRM_ERROR("Error initialising bo driver; %d\n", ret);
 		return ret;
include/drm/ttm/ttm_bo_driver.h +1 -1
index c0bed72492f3..ff0ec43fce7f 100644
@@ -599,7 +599,7 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev);
 int ttm_bo_device_init(struct ttm_bo_device *bdev,
 		       struct ttm_bo_driver *driver,
 		       struct address_space *mapping,
-		       uint64_t file_page_offset, bool need_dma32);
+		       bool need_dma32);
 
 /**
  * ttm_bo_unmap_virtual
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#10 lore raw

PATCH 5/5 drm: Use the same mmap-range offset and size for GEM and TTM

In reply to a message not in the archive

GEM defines DRM_FILE_PAGE_OFFSET_{START,SIZE} constants for the mmap-able range of addresses. TTM can use them as well.

---
 drivers/gpu/drm/drm_gem.c       | 17 -----------------
 drivers/gpu/drm/ttm/ttm_bo.c    |  4 ++--
 drivers/gpu/drm/ttm/ttm_bo_vm.c |  2 +-
 include/drm/drm_vma_manager.h   | 12 ++++++++++++
 include/drm/ttm/ttm_bo_driver.h |  2 --
 5 files changed, 15 insertions(+), 22 deletions(-)
drivers/gpu/drm/drm_gem.c +0 -17
index d0b9f6a9953f..ea988509ae8f 100644
@@ -72,23 +72,6 @@
  * up at a later date, and as our interface with shmfs for memory allocation.
  */
 
-/*
- * We make up offsets for buffer objects so we can recognize them at
- * mmap time.
- */
-
-/* pgoff in mmap is an unsigned long, so we need to make sure that
- * the faked up offset will fit
- */
-
-#if BITS_PER_LONG == 64
-#define DRM_FILE_PAGE_OFFSET_START ((0xFFFFFFFFUL >> PAGE_SHIFT) + 1)
-#define DRM_FILE_PAGE_OFFSET_SIZE ((0xFFFFFFFFUL >> PAGE_SHIFT) * 16)
-#else
-#define DRM_FILE_PAGE_OFFSET_START ((0xFFFFFFFUL >> PAGE_SHIFT) + 1)
-#define DRM_FILE_PAGE_OFFSET_SIZE ((0xFFFFFFFUL >> PAGE_SHIFT) * 16)
-#endif
-
 /**
  * drm_gem_init - Initialize the GEM device fields
  * @dev: drm_devic structure to initialize
drivers/gpu/drm/ttm/ttm_bo.c +2 -2
index e1b65775f3ee..988416fb8a0b 100644
@@ -1646,8 +1646,8 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,
 		goto out_no_sys;
 
 	drm_vma_offset_manager_init(&bdev->vma_manager,
-				    DRM_FILE_PAGE_OFFSET,
-				    0x10000000);
+				    DRM_FILE_PAGE_OFFSET_START,
+				    DRM_FILE_PAGE_OFFSET_SIZE);
 	INIT_DELAYED_WORK(&bdev->wq, ttm_bo_delayed_workqueue);
 	INIT_LIST_HEAD(&bdev->ddestroy);
 	bdev->dev_mapping = mapping;
drivers/gpu/drm/ttm/ttm_bo_vm.c +1 -1
index e94c2ab3718a..6dacff49c1cc 100644
@@ -432,7 +432,7 @@ int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
 	struct ttm_buffer_object *bo;
 	int ret;
 
-	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
+	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET_START))
 		return -EINVAL;
 
 	bo = ttm_bo_vm_lookup(bdev, vma->vm_pgoff, vma_pages(vma));
include/drm/drm_vma_manager.h +12 -0
index c7987daeaed0..f4f8ff1cdeec 100644
@@ -29,6 +29,18 @@
 #include <linux/spinlock.h>
 #include <linux/types.h>
 
+/* We make up offsets for buffer objects so we can recognize them at
+ * mmap time. pgoff in mmap is an unsigned long, so we need to make sure
+ * that the faked up offset will fit
+ */
+#if BITS_PER_LONG == 64
+#define DRM_FILE_PAGE_OFFSET_START ((0xFFFFFFFFUL >> PAGE_SHIFT) + 1)
+#define DRM_FILE_PAGE_OFFSET_SIZE ((0xFFFFFFFFUL >> PAGE_SHIFT) * 16)
+#else
+#define DRM_FILE_PAGE_OFFSET_START ((0xFFFFFFFUL >> PAGE_SHIFT) + 1)
+#define DRM_FILE_PAGE_OFFSET_SIZE ((0xFFFFFFFUL >> PAGE_SHIFT) * 16)
+#endif
+
 struct drm_file;
 
 struct drm_vma_offset_file {
include/drm/ttm/ttm_bo_driver.h +0 -2
index ff0ec43fce7f..61b80ec78e80 100644
@@ -49,8 +49,6 @@
 #define TTM_MEMTYPE_FLAG_MAPPABLE      (1 << 1)	/* Memory mappable */
 #define TTM_MEMTYPE_FLAG_CMA           (1 << 3)	/* Can't map aperture */
 
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
-
 struct ttm_mem_type_manager;
 
 struct ttm_mem_type_manager_func {
Signature · 6 lines
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by Christian König
#11 lore raw
In reply to a message not in the archive

Am 07.02.19 um 09:59 schrieb Thomas Zimmermann:

Quoted 9 lines

Almost all TTM-based drivers use the same values for the mmap-able range of BO addresses. Each driver therefore duplicates the DRM_FILE_PAGE_OFFSET constant. OTOH, the mmap range's size is not configurable by drivers.

This patch set replaces driver-specific configuration with a single setup. All code is located within TTM. TTM and GEM share the same range for mmap-able BOs.

Quoted 6 lines

Thomas Zimmermann (5):
staging/vboxvideo: Use same BO mmap offset as other drivers drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init() drm/ttm: Quick-test mmap offset in ttm_bo_mmap()
drm: Use the same mmap-range offset and size for GEM and TTM

series.

Nice cleanup! Thanks,
Christian.

Quoted 20 lines
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 12 ++----------
  drivers/gpu/drm/ast/ast_drv.h               |  2 --
  drivers/gpu/drm/ast/ast_ttm.c               | 10 ++--------
  drivers/gpu/drm/bochs/bochs.h               |  2 --
  drivers/gpu/drm/bochs/bochs_mm.c            | 10 ++--------
  drivers/gpu/drm/cirrus/cirrus_drv.h         |  1 -
  drivers/gpu/drm/cirrus/cirrus_ttm.c         | 10 ++--------
  drivers/gpu/drm/drm_gem.c                   | 17 -----------------
  drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 12 ++----------
  drivers/gpu/drm/mgag200/mgag200_drv.h       |  1 -
  drivers/gpu/drm/mgag200/mgag200_ttm.c       | 10 ++--------
  drivers/gpu/drm/nouveau/nouveau_drv.h       |  2 --
  drivers/gpu/drm/nouveau/nouveau_ttm.c       |  4 ----
  drivers/gpu/drm/qxl/qxl_drv.h               |  3 ---
  drivers/gpu/drm/qxl/qxl_ttm.c               | 11 +++--------
  drivers/gpu/drm/radeon/radeon_ttm.c         | 13 ++-----------
  drivers/gpu/drm/ttm/ttm_bo.c                |  6 +++---
  drivers/gpu/drm/ttm/ttm_bo_vm.c             |  3 +++
  drivers/gpu/drm/virtio/virtgpu_ttm.c        |  4 +---
Quoted 9 lines
  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c         |  1 -
  drivers/gpu/drm/vmwgfx/vmwgfx_drv.h         |  1 -
  drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c    | 11 ++---------
  drivers/staging/vboxvideo/vbox_drv.h        |  2 --
  drivers/staging/vboxvideo/vbox_ttm.c        | 12 +++---------
  include/drm/drm_vma_manager.h               | 12 ++++++++++++
  include/drm/ttm/ttm_bo_driver.h             |  2 +-
  26 files changed, 42 insertions(+), 132 deletions(-)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): e03e4cff-557b-9d50-dba8-94835e768743-5C7GfCeVMHo@public.gmane.org

#13 lore raw

Am 07.02.19 um 10:36 schrieb Koenig, Christian:

Quoted 17 lines

Am 07.02.19 um 09:59 schrieb Thomas Zimmermann:

Quoted 9 lines

Almost all TTM-based drivers use the same values for the mmap-able range of BO addresses. Each driver therefore duplicates the DRM_FILE_PAGE_OFFSET constant. OTOH, the mmap range's size is not configurable by drivers.

This patch set replaces driver-specific configuration with a single setup. All code is located within TTM. TTM and GEM share the same range for mmap-able BOs.

Quoted 6 lines

Thomas Zimmermann (5):
staging/vboxvideo: Use same BO mmap offset as other drivers drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init() drm/ttm: Quick-test mmap offset in ttm_bo_mmap()
drm: Use the same mmap-range offset and size for GEM and TTM

Quoted 2 lines

series.

That was quick! Thank you.

Quoted 39 lines

Nice cleanup! Thanks,
Christian.

Quoted 20 lines
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 12 ++----------
  drivers/gpu/drm/ast/ast_drv.h               |  2 --
  drivers/gpu/drm/ast/ast_ttm.c               | 10 ++--------
  drivers/gpu/drm/bochs/bochs.h               |  2 --
  drivers/gpu/drm/bochs/bochs_mm.c            | 10 ++--------
  drivers/gpu/drm/cirrus/cirrus_drv.h         |  1 -
  drivers/gpu/drm/cirrus/cirrus_ttm.c         | 10 ++--------
  drivers/gpu/drm/drm_gem.c                   | 17 -----------------
  drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 12 ++----------
  drivers/gpu/drm/mgag200/mgag200_drv.h       |  1 -
  drivers/gpu/drm/mgag200/mgag200_ttm.c       | 10 ++--------
  drivers/gpu/drm/nouveau/nouveau_drv.h       |  2 --
  drivers/gpu/drm/nouveau/nouveau_ttm.c       |  4 ----
  drivers/gpu/drm/qxl/qxl_drv.h               |  3 ---
  drivers/gpu/drm/qxl/qxl_ttm.c               | 11 +++--------
  drivers/gpu/drm/radeon/radeon_ttm.c         | 13 ++-----------
  drivers/gpu/drm/ttm/ttm_bo.c                |  6 +++---
  drivers/gpu/drm/ttm/ttm_bo_vm.c             |  3 +++
  drivers/gpu/drm/virtio/virtgpu_ttm.c        |  4 +---
Quoted 9 lines
  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c         |  1 -
  drivers/gpu/drm/vmwgfx/vmwgfx_drv.h         |  1 -
  drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c    | 11 ++---------
  drivers/staging/vboxvideo/vbox_drv.h        |  2 --
  drivers/staging/vboxvideo/vbox_ttm.c        | 12 +++---------
  include/drm/drm_vma_manager.h               | 12 ++++++++++++
  include/drm/ttm/ttm_bo_driver.h             |  2 +-
  26 files changed, 42 insertions(+), 132 deletions(-)

_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstr. 5, D-90409 Nürnberg
Tel: +49-911-74053-0; Fax: +49-911-7417755;  https://www.suse.com/
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard,
Graham Norton, HRB 21284 (AG Nürnberg)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 552aa321-98d4-344d-eda2-8441940b5811-l3A5Bk7waGM@public.gmane.org

#15 lore raw

Am 07.02.19 um 10:45 schrieb Thomas Zimmermann:

Quoted 17 lines

Am 07.02.19 um 10:36 schrieb Koenig, Christian:

Quoted 16 lines

Am 07.02.19 um 09:59 schrieb Thomas Zimmermann:

Quoted 15 lines

Almost all TTM-based drivers use the same values for the mmap-able range of BO addresses. Each driver therefore duplicates the DRM_FILE_PAGE_OFFSET constant. OTOH, the mmap range's size is not configurable by drivers.

This patch set replaces driver-specific configuration with a single setup. All code is located within TTM. TTM and GEM share the same range for mmap-able BOs.

Thomas Zimmermann (5):
staging/vboxvideo: Use same BO mmap offset as other drivers drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init() drm/ttm: Quick-test mmap offset in ttm_bo_mmap()
drm: Use the same mmap-range offset and size for GEM and TTM

Quoted 3 lines
Quoted 2 lines

series.

That was quick! Thank you.

FYI I just pushed this series into our internal branch for upstreaming.

Regards,
Christian.

Quoted 38 lines
Quoted 32 lines

Nice cleanup! Thanks,
Christian.

Quoted 19 lines
   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 12 ++----------
   drivers/gpu/drm/ast/ast_drv.h               |  2 --
   drivers/gpu/drm/ast/ast_ttm.c               | 10 ++--------
   drivers/gpu/drm/bochs/bochs.h               |  2 --
   drivers/gpu/drm/bochs/bochs_mm.c            | 10 ++--------
   drivers/gpu/drm/cirrus/cirrus_drv.h         |  1 -
   drivers/gpu/drm/cirrus/cirrus_ttm.c         | 10 ++--------
   drivers/gpu/drm/drm_gem.c                   | 17 -----------------
   drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 12 ++----------
   drivers/gpu/drm/mgag200/mgag200_drv.h       |  1 -
   drivers/gpu/drm/mgag200/mgag200_ttm.c       | 10 ++--------
   drivers/gpu/drm/nouveau/nouveau_drv.h       |  2 --
   drivers/gpu/drm/nouveau/nouveau_ttm.c       |  4 ----
   drivers/gpu/drm/qxl/qxl_drv.h               |  3 ---
   drivers/gpu/drm/qxl/qxl_ttm.c               | 11 +++--------
   drivers/gpu/drm/radeon/radeon_ttm.c         | 13 ++-----------
   drivers/gpu/drm/ttm/ttm_bo.c                |  6 +++---
   drivers/gpu/drm/ttm/ttm_bo_vm.c             |  3 +++
   drivers/gpu/drm/virtio/virtgpu_ttm.c        |  4 +---
Quoted 9 lines
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.c         |  1 -
   drivers/gpu/drm/vmwgfx/vmwgfx_drv.h         |  1 -
   drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c    | 11 ++---------
   drivers/staging/vboxvideo/vbox_drv.h        |  2 --
   drivers/staging/vboxvideo/vbox_ttm.c        | 12 +++---------
   include/drm/drm_vma_manager.h               | 12 ++++++++++++
   include/drm/ttm/ttm_bo_driver.h             |  2 +-
   26 files changed, 42 insertions(+), 132 deletions(-)
Quoted 5 lines

_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Quoted 4 lines

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#16 lore raw

PATCH 4/5 drm/ttm: Quick-test mmap offset in ttm_bo_mmap()

In reply to Thomas Zimmermann

A BO's address has to be at least the minimum offset. Sharing this test in ttm_bo_mmap() removes code from drivers. A full buffer-address validation is still done within drm_vma_offset_lockup_locked().

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     |  9 ++-------
 drivers/gpu/drm/ast/ast_ttm.c               |  9 ++-------
 drivers/gpu/drm/bochs/bochs_mm.c            |  9 ++-------
 drivers/gpu/drm/cirrus/cirrus_ttm.c         |  9 ++-------
 drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c |  9 ++-------
 drivers/gpu/drm/mgag200/mgag200_ttm.c       |  9 ++-------
 drivers/gpu/drm/nouveau/nouveau_ttm.c       |  3 ---
 drivers/gpu/drm/qxl/qxl_ttm.c               |  9 ++-------
 drivers/gpu/drm/radeon/radeon_ttm.c         | 10 ++--------
 drivers/gpu/drm/ttm/ttm_bo_vm.c             |  3 +++
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c    | 11 ++---------
 drivers/staging/vboxvideo/vbox_ttm.c        | 10 ++--------
 12 files changed, 23 insertions(+), 77 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -7
index 5755ac428fd0..a8cd1e0ae4b3 100644
@@ -1874,14 +1874,9 @@ void amdgpu_ttm_set_buffer_funcs_status(struct amdgpu_device *adev, bool enable)
 
 int amdgpu_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-	struct drm_file *file_priv;
-	struct amdgpu_device *adev;
-
-	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
-		return -EINVAL;
+	struct drm_file *file_priv = filp->private_data;
+	struct amdgpu_device *adev = file_priv->minor->dev->dev_private;
 
-	file_priv = filp->private_data;
-	adev = file_priv->minor->dev->dev_private;
 	if (adev == NULL)
 		return -EINVAL;
 
drivers/gpu/drm/ast/ast_ttm.c +2 -7
index c410804a5e2c..75d477b37854 100644
@@ -343,13 +343,8 @@ int ast_bo_push_sysram(struct ast_bo *bo)
 
 int ast_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-	struct drm_file *file_priv;
-	struct ast_private *ast;
+	struct drm_file *file_priv = filp->private_data;
+	struct ast_private *ast = file_priv->minor->dev->dev_private;
 
-	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
-		return -EINVAL;
-
-	file_priv = filp->private_data;
-	ast = file_priv->minor->dev->dev_private;
 	return ttm_bo_mmap(filp, vma, &ast->ttm.bdev);
 }
drivers/gpu/drm/bochs/bochs_mm.c +2 -7
index ebc9dbd94923..4a40308169c4 100644
@@ -263,14 +263,9 @@ int bochs_bo_unpin(struct bochs_bo *bo)
 
 int bochs_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-	struct drm_file *file_priv;
-	struct bochs_device *bochs;
+	struct drm_file *file_priv = filp->private_data;
+	struct bochs_device *bochs = file_priv->minor->dev->dev_private;
 
-	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
-		return -EINVAL;
-
-	file_priv = filp->private_data;
-	bochs = file_priv->minor->dev->dev_private;
 	return ttm_bo_mmap(filp, vma, &bochs->ttm.bdev);
 }
 
drivers/gpu/drm/cirrus/cirrus_ttm.c +2 -7
index 223a75ba77a8..e6b98467a428 100644
@@ -330,13 +330,8 @@ int cirrus_bo_push_sysram(struct cirrus_bo *bo)
 
 int cirrus_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-	struct drm_file *file_priv;
-	struct cirrus_device *cirrus;
+	struct drm_file *file_priv = filp->private_data;
+	struct cirrus_device *cirrus = file_priv->minor->dev->dev_private;
 
-	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
-		return -EINVAL;
-
-	file_priv = filp->private_data;
-	cirrus = file_priv->minor->dev->dev_private;
 	return ttm_bo_mmap(filp, vma, &cirrus->ttm.bdev);
 }
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c +2 -7
index 845488922865..6093c421daff 100644
@@ -319,14 +319,9 @@ int hibmc_bo_unpin(struct hibmc_bo *bo)
 
 int hibmc_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-	struct drm_file *file_priv;
-	struct hibmc_drm_private *hibmc;
+	struct drm_file *file_priv = filp->private_data;
+	struct hibmc_drm_private *hibmc = file_priv->minor->dev->dev_private;
 
-	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
-		return -EINVAL;
-
-	file_priv = filp->private_data;
-	hibmc = file_priv->minor->dev->dev_private;
 	return ttm_bo_mmap(filp, vma, &hibmc->bdev);
 }
 
drivers/gpu/drm/mgag200/mgag200_ttm.c +2 -7
index ce739da5161d..bd42365a8aa8 100644
@@ -344,13 +344,8 @@ int mgag200_bo_push_sysram(struct mgag200_bo *bo)
 
 int mgag200_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-	struct drm_file *file_priv;
-	struct mga_device *mdev;
+	struct drm_file *file_priv = filp->private_data;
+	struct mga_device *mdev = file_priv->minor->dev->dev_private;
 
-	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
-		return -EINVAL;
-
-	file_priv = filp->private_data;
-	mdev = file_priv->minor->dev->dev_private;
 	return ttm_bo_mmap(filp, vma, &mdev->ttm.bdev);
 }
drivers/gpu/drm/nouveau/nouveau_ttm.c +0 -3
index c66467232604..f0daf958e03a 100644
@@ -168,9 +168,6 @@ nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma)
 	struct drm_file *file_priv = filp->private_data;
 	struct nouveau_drm *drm = nouveau_drm(file_priv->minor->dev);
 
-	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
-		return drm_legacy_mmap(filp, vma);
-
 	return ttm_bo_mmap(filp, vma, &drm->ttm.bdev);
 }
 
drivers/gpu/drm/qxl/qxl_ttm.c +2 -7
index 6b3b92d1f17f..0234f8556ada 100644
@@ -63,15 +63,10 @@ static vm_fault_t qxl_ttm_fault(struct vm_fault *vmf)
 
 int qxl_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-	struct drm_file *file_priv;
-	struct qxl_device *qdev;
 	int r;
+	struct drm_file *file_priv = filp->private_data;
+	struct qxl_device *qdev = file_priv->minor->dev->dev_private;
 
-	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
-		return -EINVAL;
-
-	file_priv = filp->private_data;
-	qdev = file_priv->minor->dev->dev_private;
 	if (qdev == NULL) {
 		DRM_ERROR(
 		 "filp->private_data->minor->dev->dev_private == NULL\n");
drivers/gpu/drm/radeon/radeon_ttm.c +2 -8
index 7c10e1560780..557bdd7a2fc8 100644
@@ -898,16 +898,10 @@ static vm_fault_t radeon_ttm_fault(struct vm_fault *vmf)
 
 int radeon_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-	struct drm_file *file_priv;
-	struct radeon_device *rdev;
 	int r;
+	struct drm_file *file_priv = filp->private_data;
+	struct radeon_device *rdev = file_priv->minor->dev->dev_private;
 
-	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) {
-		return -EINVAL;
-	}
-
-	file_priv = filp->private_data;
-	rdev = file_priv->minor->dev->dev_private;
 	if (rdev == NULL) {
 		return -EINVAL;
 	}
drivers/gpu/drm/ttm/ttm_bo_vm.c +3 -0
index e86a29a1e51f..e94c2ab3718a 100644
@@ -432,6 +432,9 @@ int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
 	struct ttm_buffer_object *bo;
 	int ret;
 
+	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
+		return -EINVAL;
+
 	bo = ttm_bo_vm_lookup(bdev, vma->vm_pgoff, vma_pages(vma));
 	if (unlikely(!bo))
 		return -EINVAL;
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c +2 -9
index ec5b4b237f2c..8bafa6eac5a8 100644
@@ -30,16 +30,9 @@
 
 int vmw_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-	struct drm_file *file_priv;
-	struct vmw_private *dev_priv;
+	struct drm_file *file_priv = filp->private_data;
+	struct vmw_private *dev_priv = vmw_priv(file_priv->minor->dev);
 
-	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET)) {
-		DRM_ERROR("Illegal attempt to mmap old fifo space.\n");
-		return -EINVAL;
-	}
-
-	file_priv = filp->private_data;
-	dev_priv = vmw_priv(file_priv->minor->dev);
 	return ttm_bo_mmap(filp, vma, &dev_priv->bdev);
 }
 
drivers/staging/vboxvideo/vbox_ttm.c +2 -8
index b7db7a7952d4..9d78438c2877 100644
@@ -357,14 +357,8 @@ int vbox_bo_push_sysram(struct vbox_bo *bo)
 
 int vbox_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-	struct drm_file *file_priv;
-	struct vbox_private *vbox;
-
-	if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
-		return -EINVAL;
-
-	file_priv = filp->private_data;
-	vbox = file_priv->minor->dev->dev_private;
+	struct drm_file *file_priv = filp->private_data;
+	struct vbox_private *vbox = file_priv->minor->dev->dev_private;
 
 	return ttm_bo_mmap(filp, vma, &vbox->ttm.bdev);
 }
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on the v1 series
#17 lore raw
In reply to Thomas Zimmermann

Am 07.02.19 um 09:59 schrieb Thomas Zimmermann:

Quoted 9 lines

Almost all TTM-based drivers use the same values for the mmap-able range of BO addresses. Each driver therefore duplicates the DRM_FILE_PAGE_OFFSET constant. OTOH, the mmap range's size is not configurable by drivers.

This patch set replaces driver-specific configuration with a single setup. All code is located within TTM. TTM and GEM share the same range for mmap-able BOs.

Quoted 6 lines

Thomas Zimmermann (5):
staging/vboxvideo: Use same BO mmap offset as other drivers drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init() drm/ttm: Quick-test mmap offset in ttm_bo_mmap()
drm: Use the same mmap-range offset and size for GEM and TTM

series.

Nice cleanup! Thanks,
Christian.

Quoted 20 lines
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c     | 12 ++----------
  drivers/gpu/drm/ast/ast_drv.h               |  2 --
  drivers/gpu/drm/ast/ast_ttm.c               | 10 ++--------
  drivers/gpu/drm/bochs/bochs.h               |  2 --
  drivers/gpu/drm/bochs/bochs_mm.c            | 10 ++--------
  drivers/gpu/drm/cirrus/cirrus_drv.h         |  1 -
  drivers/gpu/drm/cirrus/cirrus_ttm.c         | 10 ++--------
  drivers/gpu/drm/drm_gem.c                   | 17 -----------------
  drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c | 12 ++----------
  drivers/gpu/drm/mgag200/mgag200_drv.h       |  1 -
  drivers/gpu/drm/mgag200/mgag200_ttm.c       | 10 ++--------
  drivers/gpu/drm/nouveau/nouveau_drv.h       |  2 --
  drivers/gpu/drm/nouveau/nouveau_ttm.c       |  4 ----
  drivers/gpu/drm/qxl/qxl_drv.h               |  3 ---
  drivers/gpu/drm/qxl/qxl_ttm.c               | 11 +++--------
  drivers/gpu/drm/radeon/radeon_ttm.c         | 13 ++-----------
  drivers/gpu/drm/ttm/ttm_bo.c                |  6 +++---
  drivers/gpu/drm/ttm/ttm_bo_vm.c             |  3 +++
  drivers/gpu/drm/virtio/virtgpu_ttm.c        |  4 +---
Quoted 9 lines
  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c         |  1 -
  drivers/gpu/drm/vmwgfx/vmwgfx_drv.h         |  1 -
  drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c    | 11 ++---------
  drivers/staging/vboxvideo/vbox_drv.h        |  2 --
  drivers/staging/vboxvideo/vbox_ttm.c        | 12 +++---------
  include/drm/drm_vma_manager.h               | 12 ++++++++++++
  include/drm/ttm/ttm_bo_driver.h             |  2 +-
  26 files changed, 42 insertions(+), 132 deletions(-)

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reviewed-by Hans de Goede Acked-by Hans de Goede on the v1 series
#18 lore raw
In reply to Thomas Zimmermann

Hi,

Quoted 9 lines · Thomas Zimmermann

Almost all TTM-based drivers use the same values for the mmap-able range of BO addresses. Each driver therefore duplicates the DRM_FILE_PAGE_OFFSET constant. OTOH, the mmap range's size is not configurable by drivers.

This patch set replaces driver-specific configuration with a single setup. All code is located within TTM. TTM and GEM share the same range for mmap-able BOs.

Quoted 6 lines

Thomas Zimmermann (5):
staging/vboxvideo: Use same BO mmap offset as other drivers drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init() drm/ttm: Quick-test mmap offset in ttm_bo_mmap()
drm: Use the same mmap-range offset and size for GEM and TTM

The first patch looks good to me:

The vboxvideo bits in the other patches look good to me to:

For the other patches in the series.

Regards,

Hans

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by Acked-by on the v1 series
#19 lore raw
In reply to Thomas Zimmermann

Hi,

Quoted 9 lines · Thomas Zimmermann

Almost all TTM-based drivers use the same values for the mmap-able range of BO addresses. Each driver therefore duplicates the DRM_FILE_PAGE_OFFSET constant. OTOH, the mmap range's size is not configurable by drivers.

This patch set replaces driver-specific configuration with a single setup. All code is located within TTM. TTM and GEM share the same range for mmap-able BOs.

Quoted 6 lines

Thomas Zimmermann (5):
staging/vboxvideo: Use same BO mmap offset as other drivers drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init() drm/ttm: Quick-test mmap offset in ttm_bo_mmap()
drm: Use the same mmap-range offset and size for GEM and TTM

The first patch looks good to me:

The vboxvideo bits in the other patches look good to me to:

For the other patches in the series.

Regards,

Hans

#20 lore raw
In reply to Thomas Zimmermann

Hi,

Quoted 9 lines · Thomas Zimmermann

Almost all TTM-based drivers use the same values for the mmap-able range of BO addresses. Each driver therefore duplicates the DRM_FILE_PAGE_OFFSET constant. OTOH, the mmap range's size is not configurable by drivers.

This patch set replaces driver-specific configuration with a single setup. All code is located within TTM. TTM and GEM share the same range for mmap-able BOs.

Quoted 6 lines

Thomas Zimmermann (5):
staging/vboxvideo: Use same BO mmap offset as other drivers drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init() drm/ttm: Quick-test mmap offset in ttm_bo_mmap()
drm: Use the same mmap-range offset and size for GEM and TTM

Note I'm about to push a patch-series to drm-misc-next which moves vboxvideo out of staging and I see that this series has not landed in drm-misc-next yet, so it will needs to be rebased.

Regards,

Hans

A message that is not in the archive (sent off-list or not yet received): 2509b876-8335-4be6-b33b-bbf11a73145f-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#22 lore raw

Am 11.03.19 um 17:39 schrieb Hans de Goede:

Quoted 19 lines

Hi,

Quoted 9 lines · Thomas Zimmermann

Almost all TTM-based drivers use the same values for the mmap-able range of BO addresses. Each driver therefore duplicates the DRM_FILE_PAGE_OFFSET constant. OTOH, the mmap range's size is not configurable by drivers.

This patch set replaces driver-specific configuration with a single setup. All code is located within TTM. TTM and GEM share the same range for mmap-able BOs.

Quoted 6 lines

Thomas Zimmermann (5):
   staging/vboxvideo: Use same BO mmap offset as other drivers drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init() drm/ttm: Quick-test mmap offset in ttm_bo_mmap()
   drm: Use the same mmap-range offset and size for GEM and TTM

Quoted 3 lines

Note I'm about to push a patch-series to drm-misc-next which moves vboxvideo out of staging and I see that this series has not landed in drm-misc-next yet, so it will needs to be rebased.

Mhm, TTM is usually not pushed upstream through drm-misc-next, so that will certainly collide with the next TTM pull request.

So can you wait with that or should I make an exception and merge this change though drm-misc-next?

Christian.

Quoted 9 lines

Regards,

Hans

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#23 lore raw

Hi,

Quoted 20 lines · Christian König

Am 11.03.19 um 17:39 schrieb Hans de Goede:

Quoted 19 lines

Hi,

Quoted 15 lines · Thomas Zimmermann

Almost all TTM-based drivers use the same values for the mmap-able range of BO addresses. Each driver therefore duplicates the DRM_FILE_PAGE_OFFSET constant. OTOH, the mmap range's size is not configurable by drivers.

This patch set replaces driver-specific configuration with a single setup. All code is located within TTM. TTM and GEM share the same range for mmap-able BOs.

Thomas Zimmermann (5):
   staging/vboxvideo: Use same BO mmap offset as other drivers drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init() drm/ttm: Quick-test mmap offset in ttm_bo_mmap()
   drm: Use the same mmap-range offset and size for GEM and TTM

Quoted 5 lines
Quoted 3 lines

Note I'm about to push a patch-series to drm-misc-next which moves vboxvideo out of staging and I see that this series has not landed in drm-misc-next yet, so it will needs to be rebased.

Mhm, TTM is usually not pushed upstream through drm-misc-next, so that will certainly collide with the next TTM pull request.

Ugh, I didn't realize that this series would not be going through drm-misc-next.

Quoted 1 line

So can you wait with that or should I make an exception and merge this change though drm-misc-next?

I've already pushed it now :| My mail was more intended as a headsup then that I expected an objection, sorry.

I see 2 possible solutions:

1) Merge drm-misc-next into the ttm tree (probably the cleanest)
2) Push your series through drm-misc-next

Regards,

Hans
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#24 lore raw
In reply to Christian König
Quoted 24 lines · Christian König

Am 11.03.19 um 17:39 schrieb Hans de Goede:

Quoted 19 lines

Hi,

Quoted 9 lines · Thomas Zimmermann

Almost all TTM-based drivers use the same values for the mmap-able range of BO addresses. Each driver therefore duplicates the DRM_FILE_PAGE_OFFSET constant. OTOH, the mmap range's size is not configurable by drivers.

This patch set replaces driver-specific configuration with a single setup. All code is located within TTM. TTM and GEM share the same range for mmap-able BOs.

Quoted 6 lines

Thomas Zimmermann (5):
   staging/vboxvideo: Use same BO mmap offset as other drivers drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant drm/ttm: Remove file_page_offset parameter from ttm_bo_device_init() drm/ttm: Quick-test mmap offset in ttm_bo_mmap()
   drm: Use the same mmap-range offset and size for GEM and TTM

Quoted 3 lines

Note I'm about to push a patch-series to drm-misc-next which moves vboxvideo out of staging and I see that this series has not landed in drm-misc-next yet, so it will needs to be rebased.

Quoted 5 lines

Mhm, TTM is usually not pushed upstream through drm-misc-next, so that will certainly collide with the next TTM pull request.

So can you wait with that or should I make an exception and merge this change though drm-misc-next?

Other options:
- Get amdgpu added to drm-tip and linux-next so we have a heads-up about the conflict. That's usually good enough to avoid the broken merge conflict.
- Do a topic branch, pull it into both trees.
- Really stuff ttm into a shared tree if it's meant to be shared infrastructure :-P

Waiting+rebasing is imo the worst option, and usually not needed. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch