mirror of https://gitee.com/openkylin/linux.git
drm/ttm: nuke old page allocator
Not used any more. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Madhav Chauhan <madhav.chauhan@amd.com> Tested-by: Huang Rui <ray.huang@amd.com> Link: https://patchwork.freedesktop.org/patch/397087/?series=83051&rev=1
This commit is contained in:
parent
fbf1c39cab
commit
256dd44bd8
|
@ -182,13 +182,6 @@ config DRM_TTM
|
|||
GPU memory types. Will be enabled automatically if a device driver
|
||||
uses it.
|
||||
|
||||
config DRM_TTM_DMA_PAGE_POOL
|
||||
bool
|
||||
depends on DRM_TTM && (SWIOTLB || INTEL_IOMMU)
|
||||
default y
|
||||
help
|
||||
Choose this if you need the TTM dma page pool
|
||||
|
||||
config DRM_VRAM_HELPER
|
||||
tristate
|
||||
depends on DRM
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
|
||||
ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
|
||||
ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
|
||||
ttm_execbuf_util.o ttm_page_alloc.o ttm_range_manager.o \
|
||||
ttm_execbuf_util.o ttm_range_manager.o \
|
||||
ttm_resource.o ttm_pool.o
|
||||
ttm-$(CONFIG_AGP) += ttm_agp_backend.o
|
||||
ttm-$(CONFIG_DRM_TTM_DMA_PAGE_POOL) += ttm_page_alloc_dma.o
|
||||
|
||||
obj-$(CONFIG_DRM_TTM) += ttm.o
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include <drm/ttm/ttm_module.h>
|
||||
#include <drm/ttm/ttm_bo_driver.h>
|
||||
#include <drm/ttm/ttm_page_alloc.h>
|
||||
#include <drm/ttm/ttm_placement.h>
|
||||
#include <linux/agp_backend.h>
|
||||
#include <linux/module.h>
|
||||
|
|
|
@ -1333,7 +1333,6 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,
|
|||
INIT_DELAYED_WORK(&bdev->wq, ttm_bo_delayed_workqueue);
|
||||
INIT_LIST_HEAD(&bdev->ddestroy);
|
||||
bdev->dev_mapping = mapping;
|
||||
bdev->need_dma32 = use_dma32;
|
||||
mutex_lock(&ttm_global_mutex);
|
||||
list_add_tail(&bdev->device_list, &glob->device_list);
|
||||
mutex_unlock(&ttm_global_mutex);
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include <drm/ttm/ttm_memory.h>
|
||||
#include <drm/ttm/ttm_module.h>
|
||||
#include <drm/ttm/ttm_page_alloc.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/wait.h>
|
||||
|
@ -452,9 +451,7 @@ int ttm_mem_global_init(struct ttm_mem_global *glob)
|
|||
pr_info("Zone %7s: Available graphics memory: %llu KiB\n",
|
||||
zone->name, (unsigned long long)zone->max_mem >> 10);
|
||||
}
|
||||
ttm_page_alloc_init(glob, glob->zone_kernel->max_mem/(2*PAGE_SIZE));
|
||||
ttm_dma_page_alloc_init(glob, glob->zone_kernel->max_mem/(2*PAGE_SIZE));
|
||||
ttm_pool_mgr_init(glob->zone_kernel->max_mem / (2 * PAGE_SIZE));
|
||||
ttm_pool_mgr_init(glob->zone_kernel->max_mem/(2*PAGE_SIZE));
|
||||
return 0;
|
||||
out_no_zone:
|
||||
ttm_mem_global_release(glob);
|
||||
|
@ -467,8 +464,6 @@ void ttm_mem_global_release(struct ttm_mem_global *glob)
|
|||
unsigned int i;
|
||||
|
||||
/* let the page allocator first stop the shrink work. */
|
||||
ttm_page_alloc_fini();
|
||||
ttm_dma_page_alloc_fini();
|
||||
ttm_pool_mgr_fini();
|
||||
|
||||
flush_workqueue(glob->swap_queue);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,84 +0,0 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright (c) 2018 Advanced Micro Devices, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
/*
|
||||
* Authors: Huang Rui <ray.huang@amd.com>
|
||||
*/
|
||||
|
||||
#ifndef TTM_SET_MEMORY
|
||||
#define TTM_SET_MEMORY
|
||||
|
||||
#include <linux/mm.h>
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
|
||||
#include <asm/set_memory.h>
|
||||
|
||||
static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray)
|
||||
{
|
||||
return set_pages_array_wb(pages, addrinarray);
|
||||
}
|
||||
|
||||
static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray)
|
||||
{
|
||||
return set_pages_array_wc(pages, addrinarray);
|
||||
}
|
||||
|
||||
static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray)
|
||||
{
|
||||
return set_pages_array_uc(pages, addrinarray);
|
||||
}
|
||||
|
||||
static inline int ttm_set_pages_wb(struct page *page, int numpages)
|
||||
{
|
||||
return set_pages_wb(page, numpages);
|
||||
}
|
||||
|
||||
#else /* for CONFIG_X86 */
|
||||
|
||||
static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ttm_set_pages_wb(struct page *page, int numpages)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* for CONFIG_X86 */
|
||||
|
||||
#endif
|
|
@ -51,9 +51,6 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc)
|
|||
if (bo->ttm)
|
||||
return 0;
|
||||
|
||||
if (bdev->need_dma32)
|
||||
page_flags |= TTM_PAGE_FLAG_DMA32;
|
||||
|
||||
if (bdev->no_retry)
|
||||
page_flags |= TTM_PAGE_FLAG_NO_RETRY;
|
||||
|
||||
|
@ -141,7 +138,6 @@ static void ttm_tt_init_fields(struct ttm_tt *ttm,
|
|||
ttm->dma_address = NULL;
|
||||
ttm->swap_storage = NULL;
|
||||
ttm->sg = bo->sg;
|
||||
INIT_LIST_HEAD(&ttm->pages_list);
|
||||
ttm->caching = caching;
|
||||
}
|
||||
|
||||
|
|
|
@ -315,8 +315,6 @@ struct ttm_bo_device {
|
|||
|
||||
struct delayed_work wq;
|
||||
|
||||
bool need_dma32;
|
||||
|
||||
bool no_retry;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Red Hat Inc.
|
||||
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Authors: Dave Airlie <airlied@redhat.com>
|
||||
* Jerome Glisse <jglisse@redhat.com>
|
||||
*/
|
||||
#ifndef TTM_PAGE_ALLOC
|
||||
#define TTM_PAGE_ALLOC
|
||||
|
||||
#include <drm/ttm/ttm_bo_driver.h>
|
||||
#include <drm/ttm/ttm_memory.h>
|
||||
|
||||
struct device;
|
||||
|
||||
/**
|
||||
* Initialize pool allocator.
|
||||
*/
|
||||
int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
|
||||
/**
|
||||
* Free pool allocator.
|
||||
*/
|
||||
void ttm_page_alloc_fini(void);
|
||||
|
||||
/**
|
||||
* ttm_pool_populate:
|
||||
*
|
||||
* @ttm: The struct ttm_tt to contain the backing pages.
|
||||
*
|
||||
* Add backing pages to all of @ttm
|
||||
*/
|
||||
int ttm_pool_populate(struct ttm_tt *ttm, struct ttm_operation_ctx *ctx);
|
||||
|
||||
/**
|
||||
* ttm_pool_unpopulate:
|
||||
*
|
||||
* @ttm: The struct ttm_tt which to free backing pages.
|
||||
*
|
||||
* Free all pages of @ttm
|
||||
*/
|
||||
void ttm_pool_unpopulate(struct ttm_tt *ttm);
|
||||
|
||||
/**
|
||||
* Populates and DMA maps pages to fullfil a ttm_dma_populate() request
|
||||
*/
|
||||
int ttm_populate_and_map_pages(struct device *dev, struct ttm_tt *tt,
|
||||
struct ttm_operation_ctx *ctx);
|
||||
|
||||
/**
|
||||
* Unpopulates and DMA unmaps pages as part of a
|
||||
* ttm_dma_unpopulate() request */
|
||||
void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_tt *tt);
|
||||
|
||||
/**
|
||||
* Output the state of pools to debugfs file
|
||||
*/
|
||||
int ttm_page_alloc_debugfs(struct seq_file *m, void *data);
|
||||
|
||||
#if defined(CONFIG_DRM_TTM_DMA_PAGE_POOL)
|
||||
/**
|
||||
* Initialize pool allocator.
|
||||
*/
|
||||
int ttm_dma_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);
|
||||
|
||||
/**
|
||||
* Free pool allocator.
|
||||
*/
|
||||
void ttm_dma_page_alloc_fini(void);
|
||||
|
||||
/**
|
||||
* Output the state of pools to debugfs file
|
||||
*/
|
||||
int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data);
|
||||
|
||||
int ttm_dma_populate(struct ttm_tt *ttm_dma, struct device *dev,
|
||||
struct ttm_operation_ctx *ctx);
|
||||
void ttm_dma_unpopulate(struct ttm_tt *ttm_dma, struct device *dev);
|
||||
|
||||
#else
|
||||
static inline int ttm_dma_page_alloc_init(struct ttm_mem_global *glob,
|
||||
unsigned max_pages)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline void ttm_dma_page_alloc_fini(void) { return; }
|
||||
|
||||
static inline int ttm_dma_page_alloc_debugfs(struct seq_file *m, void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int ttm_dma_populate(struct ttm_tt *ttm_dma,
|
||||
struct device *dev,
|
||||
struct ttm_operation_ctx *ctx)
|
||||
{
|
||||
return -ENOMEM;
|
||||
}
|
||||
static inline void ttm_dma_unpopulate(struct ttm_tt *ttm_dma,
|
||||
struct device *dev)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -37,7 +37,6 @@ struct ttm_operation_ctx;
|
|||
|
||||
#define TTM_PAGE_FLAG_SWAPPED (1 << 4)
|
||||
#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)
|
||||
#define TTM_PAGE_FLAG_DMA32 (1 << 7)
|
||||
#define TTM_PAGE_FLAG_SG (1 << 8)
|
||||
#define TTM_PAGE_FLAG_NO_RETRY (1 << 9)
|
||||
|
||||
|
@ -66,7 +65,6 @@ struct ttm_tt {
|
|||
struct sg_table *sg;
|
||||
dma_addr_t *dma_address;
|
||||
struct file *swap_storage;
|
||||
struct list_head pages_list;
|
||||
enum ttm_caching caching;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue