return ttm_tt_create(bo, false);
}
- evict_mem = bo->mem;
- evict_mem.mm_node = NULL;
- evict_mem.bus.offset = 0;
- evict_mem.bus.addr = NULL;
-
ret = ttm_bo_mem_space(bo, &placement, &evict_mem, ctx);
if (ret) {
if (ret != -ERESTARTSYS) {
struct ttm_place *hop)
{
struct ttm_placement hop_placement;
+ struct ttm_resource hop_mem;
int ret;
- struct ttm_resource hop_mem = *mem;
-
- hop_mem.mm_node = NULL;
- hop_mem.mem_type = TTM_PL_SYSTEM;
- hop_mem.placement = 0;
hop_placement.num_placement = hop_placement.num_busy_placement = 1;
hop_placement.placement = hop_placement.busy_placement = hop;
struct ttm_placement *placement,
struct ttm_operation_ctx *ctx)
{
- int ret = 0;
struct ttm_place hop;
struct ttm_resource mem;
+ int ret;
dma_resv_assert_held(bo->base.resv);
memset(&hop, 0, sizeof(hop));
- mem.num_pages = PAGE_ALIGN(bo->base.size) >> PAGE_SHIFT;
- mem.bus.offset = 0;
- mem.bus.addr = NULL;
- mem.mm_node = NULL;
-
/*
* Determine where to move the buffer.
*
struct dma_resv *resv,
void (*destroy) (struct ttm_buffer_object *))
{
+ static const struct ttm_place sys_mem = { .mem_type = TTM_PL_SYSTEM };
bool locked;
int ret = 0;
bo->bdev = bdev;
bo->type = type;
bo->page_alignment = page_alignment;
- bo->mem.mem_type = TTM_PL_SYSTEM;
- bo->mem.num_pages = PAGE_ALIGN(size) >> PAGE_SHIFT;
- bo->mem.mm_node = NULL;
- bo->mem.bus.offset = 0;
- bo->mem.bus.addr = NULL;
+ ttm_resource_alloc(bo, &sys_mem, &bo->mem);
bo->moving = NULL;
- bo->mem.placement = 0;
bo->pin_count = 0;
bo->sg = sg;
if (resv) {
int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
{
+ static const struct ttm_place sys_mem = { .mem_type = TTM_PL_SYSTEM };
struct ttm_buffer_object *ghost;
int ret;
if (ret)
ttm_bo_wait(bo, false, false);
- memset(&bo->mem, 0, sizeof(bo->mem));
- bo->mem.mem_type = TTM_PL_SYSTEM;
+ ttm_resource_alloc(bo, &sys_mem, &bo->mem);
bo->ttm = NULL;
dma_resv_unlock(&ghost->base._resv);
struct ttm_resource *res)
{
struct ttm_resource_manager *man =
- ttm_manager_type(bo->bdev, res->mem_type);
+ ttm_manager_type(bo->bdev, place->mem_type);
res->mm_node = NULL;
+ res->start = 0;
+ res->num_pages = PFN_UP(bo->base.size);
+ res->mem_type = place->mem_type;
+ res->placement = place->flags;
+ res->bus.addr = NULL;
+ res->bus.offset = 0;
+ res->bus.is_iomem = false;
+ res->bus.caching = ttm_cached;
+
return man->func->alloc(man, bo, place, res);
}