]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/ttm: Define a single DRM_FILE_PAGE_OFFSET constant
authorThomas Zimmermann <tzimmermann@suse.de>
Thu, 7 Feb 2019 08:59:28 +0000 (09:59 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 19 Mar 2019 20:03:53 +0000 (15:03 -0500)
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.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
15 files changed:
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/ast/ast_drv.h
drivers/gpu/drm/bochs/bochs.h
drivers/gpu/drm/cirrus/cirrus_drv.h
drivers/gpu/drm/hisilicon/hibmc/hibmc_ttm.c
drivers/gpu/drm/mgag200/mgag200_drv.h
drivers/gpu/drm/nouveau/nouveau_drv.h
drivers/gpu/drm/qxl/qxl_drv.h
drivers/gpu/drm/radeon/radeon_ttm.c
drivers/gpu/drm/virtio/virtgpu_ttm.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
drivers/staging/vboxvideo/vbox_drv.h
include/drm/ttm/ttm_bo_driver.h

index fee73ff00153ceea7a42a21ba9cf87032a99b256..d5349c631ffc2b750b9fbf72abd7bf99c5722d39 100644 (file)
@@ -51,8 +51,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,
index bfc65040dfcbf702c4420f75105cce38be77254a..c43b927f73affe179c83112945e8f3770b427f3a 100644 (file)
@@ -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);
 
index 03711394f1eda3315e1695b7dfa7e05e7b55effc..7425d083b944610759931663e6f62a151a8c410b 100644 (file)
@@ -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);
index f2b2e0d169fabb73a8c55a6ab459720799a682cf..ba77507e9bad70085124c81a01725dbeb0b3bd4a 100644 (file)
@@ -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,
index dd383267884cfe46fd00f5149464dc0efbff59c6..a06725c2bbfa70446c541463dc42379df6b120d5 100644 (file)
@@ -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)
 {
index 0aaedc5548798ec32dd7133e3041ee8651cd3270..706c902aad2d16e688ba19c2e44fe5bca6c5312e 100644 (file)
@@ -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)
index da847244479dc3f617e02980655e7c382b2f325d..35ff0ca01a3b81fce5ae22973bcf89e2c4db30dd 100644 (file)
@@ -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"
index 4a0331b3ff7d078205f59a7f4fa5a0f1912c6670..2896bb6fdbf4c929be54143bb5cc5d4cd9a1cb3c 100644 (file)
@@ -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 |\
index 9920a6fc11bf3446f1e1858414d8c25fc9cc2f07..071a872e5b02291230b43648491f628e1b3994e4 100644 (file)
@@ -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);
 
index 4bfbf25fabff8091cab1518f5fc4302a0e4dfd56..64f5b8dec3e9f2ad645d76ef2398b80edea23767 100644 (file)
@@ -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)
 {
index 6165fe2c4504de07d0626c92892293db75d7354c..a31d38e2216f85cfb1b9c370d8b26d583c966465 100644 (file)
@@ -851,7 +851,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");
index accb2fafe2f13ea4c940d950d18adf57d77d2f7a..6302c12c2298ea8a30465ff5c268c795eed2262c 100644 (file)
@@ -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
index e6d75e377dd8b0b827cf758c9e05d8a29c5f20d1..ec5b4b237f2c9722296376be40e3deb4188e463b 100644 (file)
@@ -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;
        }
index eba5a8bc9cea9be690dd707752d93da64a2ab176..77f2a4e9000e3a5dfbe9eedbd4d442fd7c591e43 100644 (file)
@@ -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);
 
index cbf3180cb612ed7e54b9aecf79b2690c5a48aed6..c0bed72492f3afec026c97cd449c3a821137f328 100644 (file)
@@ -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 {