mirror of https://gitee.com/openkylin/linux.git
drm/ttm: provide a driver-led init path for range mm manager. (v2)
This lets the generic range mm manager be initialised by the driver. v2: add docs. rename api to range_man_init for now. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-15-airlied@gmail.com
This commit is contained in:
parent
747074bb04
commit
3c90424bd7
|
@ -104,7 +104,7 @@ static void ttm_bo_man_put_node(struct ttm_mem_type_manager *man,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ttm_bo_man_init(struct ttm_mem_type_manager *man,
|
static int ttm_bo_man_init_private(struct ttm_mem_type_manager *man,
|
||||||
unsigned long p_size)
|
unsigned long p_size)
|
||||||
{
|
{
|
||||||
struct ttm_range_manager *rman;
|
struct ttm_range_manager *rman;
|
||||||
|
@ -119,6 +119,23 @@ static int ttm_bo_man_init(struct ttm_mem_type_manager *man,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ttm_range_man_init(struct ttm_bo_device *bdev,
|
||||||
|
struct ttm_mem_type_manager *man,
|
||||||
|
unsigned long p_size)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
man->func = &ttm_bo_manager_func;
|
||||||
|
|
||||||
|
ttm_mem_type_manager_init(bdev, man, p_size);
|
||||||
|
ret = ttm_bo_man_init_private(man, p_size);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
ttm_mem_type_manager_set_used(man, true);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(ttm_range_man_init);
|
||||||
|
|
||||||
static int ttm_bo_man_takedown(struct ttm_mem_type_manager *man)
|
static int ttm_bo_man_takedown(struct ttm_mem_type_manager *man)
|
||||||
{
|
{
|
||||||
struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv;
|
struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv;
|
||||||
|
@ -147,7 +164,7 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man,
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
|
const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
|
||||||
.init = ttm_bo_man_init,
|
.init = ttm_bo_man_init_private,
|
||||||
.takedown = ttm_bo_man_takedown,
|
.takedown = ttm_bo_man_takedown,
|
||||||
.get_node = ttm_bo_man_get_node,
|
.get_node = ttm_bo_man_get_node,
|
||||||
.put_node = ttm_bo_man_put_node,
|
.put_node = ttm_bo_man_put_node,
|
||||||
|
|
|
@ -819,6 +819,20 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo);
|
||||||
*/
|
*/
|
||||||
pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
|
pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ttm_range_man_init
|
||||||
|
*
|
||||||
|
* @bdev: ttm device
|
||||||
|
* @man: the manager to initialise with the range manager.
|
||||||
|
* @p_size: size of area to be managed in pages.
|
||||||
|
*
|
||||||
|
* Initialise a generic range manager for the selected memory type.
|
||||||
|
* The range manager is installed for this device in the type slot.
|
||||||
|
*/
|
||||||
|
int ttm_range_man_init(struct ttm_bo_device *bdev,
|
||||||
|
struct ttm_mem_type_manager *man,
|
||||||
|
unsigned long p_size);
|
||||||
|
|
||||||
extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
|
extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue