drm/qxl: don't use ttm bo->offset
authorNirmoy Das <nirmoy.aiemd@gmail.com>
Wed, 24 Jun 2020 18:26:45 +0000 (20:26 +0200)
committerChristian König <christian.koenig@amd.com>
Thu, 25 Jun 2020 09:59:02 +0000 (11:59 +0200)
This patch removes slot->gpu_offset which is not required as
VRAM and PRIV slot are in separate PCI bar.

This patch also removes unused qxl_bo_gpu_offset()

Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/372934/
drivers/gpu/drm/qxl/qxl_drv.h
drivers/gpu/drm/qxl/qxl_kms.c
drivers/gpu/drm/qxl/qxl_object.h
drivers/gpu/drm/qxl/qxl_ttm.c

index 31e35f787df2c2a7bf23f54de16f7ac60b36a4b5..9691449aefdb463b1cda576f96f9fb423f874a1e 100644 (file)
@@ -134,7 +134,6 @@ struct qxl_memslot {
        uint64_t        start_phys_addr;
        uint64_t        size;
        uint64_t        high_bits;
-       uint64_t        gpu_offset;
 };
 
 enum {
@@ -307,10 +306,9 @@ qxl_bo_physical_address(struct qxl_device *qdev, struct qxl_bo *bo,
                (bo->tbo.mem.mem_type == TTM_PL_VRAM)
                ? &qdev->main_slot : &qdev->surfaces_slot;
 
-       WARN_ON_ONCE((bo->tbo.offset & slot->gpu_offset) != slot->gpu_offset);
+       /* TODO - need to hold one of the locks to read bo->tbo.mem.start */
 
-       /* TODO - need to hold one of the locks to read tbo.offset */
-       return slot->high_bits | (bo->tbo.offset - slot->gpu_offset + offset);
+       return slot->high_bits | ((bo->tbo.mem.start << PAGE_SHIFT) + offset);
 }
 
 /* qxl_display.c */
index a6d873052cd409729dfadbeaaf0a104999b72395..dc5b3850a4d4bb509cbf2514606d8fe66ea0f07b 100644 (file)
@@ -87,11 +87,10 @@ static void setup_slot(struct qxl_device *qdev,
        high_bits <<= (64 - (qdev->rom->slot_gen_bits + qdev->rom->slot_id_bits));
        slot->high_bits = high_bits;
 
-       DRM_INFO("slot %d (%s): base 0x%08lx, size 0x%08lx, gpu_offset 0x%lx\n",
+       DRM_INFO("slot %d (%s): base 0x%08lx, size 0x%08lx\n",
                 slot->index, slot->name,
                 (unsigned long)slot->start_phys_addr,
-                (unsigned long)slot->size,
-                (unsigned long)slot->gpu_offset);
+                (unsigned long)slot->size);
 }
 
 void qxl_reinit_memslots(struct qxl_device *qdev)
index 8ae54ba7857c1a2117737b39c1405061f9fe6e25..21fa81048f4f3e76427615f2a29e65734534e400 100644 (file)
@@ -48,11 +48,6 @@ static inline void qxl_bo_unreserve(struct qxl_bo *bo)
        ttm_bo_unreserve(&bo->tbo);
 }
 
-static inline u64 qxl_bo_gpu_offset(struct qxl_bo *bo)
-{
-       return bo->tbo.offset;
-}
-
 static inline unsigned long qxl_bo_size(struct qxl_bo *bo)
 {
        return bo->tbo.num_pages << PAGE_SHIFT;
index f09a712b1ed2fa2489a4210a4903467b23f4335a..52eaa2d22745170d6fd64912217a4d25abdb27d4 100644 (file)
@@ -51,11 +51,6 @@ static struct qxl_device *qxl_get_qdev(struct ttm_bo_device *bdev)
 static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
                             struct ttm_mem_type_manager *man)
 {
-       struct qxl_device *qdev = qxl_get_qdev(bdev);
-       unsigned int gpu_offset_shift =
-               64 - (qdev->rom->slot_gen_bits + qdev->rom->slot_id_bits + 8);
-       struct qxl_memslot *slot;
-
        switch (type) {
        case TTM_PL_SYSTEM:
                /* System memory */
@@ -66,11 +61,7 @@ static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
        case TTM_PL_VRAM:
        case TTM_PL_PRIV:
                /* "On-card" video ram */
-               slot = (type == TTM_PL_VRAM) ?
-                       &qdev->main_slot : &qdev->surfaces_slot;
-               slot->gpu_offset = (uint64_t)type << gpu_offset_shift;
                man->func = &ttm_bo_manager_func;
-               man->gpu_offset = slot->gpu_offset;
                man->flags = TTM_MEMTYPE_FLAG_FIXED |
                             TTM_MEMTYPE_FLAG_MAPPABLE;
                man->available_caching = TTM_PL_MASK_CACHING;