Commit 687c7d0f authored by Matthew Auld's avatar Matthew Auld

drm/i915/ttm: remove node usage in our naming

Now that ttm_resource_manager just returns a generic ttm_resource we
don't need to reference the mm_node stuff anymore which mostly only
makes sense for drm_mm_node. In the next few patches we want switch over
to the ttm_buddy_man which is just another type of ttm_resource so
reflect that in the naming.
Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210616152501.394518-5-matthew.auld@intel.com
parent beb6a229
...@@ -265,9 +265,10 @@ struct drm_i915_gem_object { ...@@ -265,9 +265,10 @@ struct drm_i915_gem_object {
struct intel_memory_region *region; struct intel_memory_region *region;
/** /**
* Memory manager node allocated for this object. * Memory manager resource allocated for this object. Only
* needed for the mock region.
*/ */
void *st_mm_node; struct ttm_resource *res;
/** /**
* Element within memory_region->objects or region->purgeable * Element within memory_region->objects or region->purgeable
......
...@@ -327,7 +327,7 @@ i915_ttm_resource_get_st(struct drm_i915_gem_object *obj, ...@@ -327,7 +327,7 @@ i915_ttm_resource_get_st(struct drm_i915_gem_object *obj,
if (man->use_tt) if (man->use_tt)
return i915_ttm_tt_get_st(bo->ttm); return i915_ttm_tt_get_st(bo->ttm);
return intel_region_ttm_node_to_st(obj->mm.region, res); return intel_region_ttm_resource_to_st(obj->mm.region, res);
} }
static int i915_ttm_move(struct ttm_buffer_object *bo, bool evict, static int i915_ttm_move(struct ttm_buffer_object *bo, bool evict,
......
...@@ -68,7 +68,7 @@ int intel_region_to_ttm_type(const struct intel_memory_region *mem) ...@@ -68,7 +68,7 @@ int intel_region_to_ttm_type(const struct intel_memory_region *mem)
} }
static struct ttm_resource * static struct ttm_resource *
intel_region_ttm_node_reserve(struct intel_memory_region *mem, intel_region_ttm_resource_reserve(struct intel_memory_region *mem,
resource_size_t offset, resource_size_t offset,
resource_size_t size) resource_size_t size)
{ {
...@@ -100,12 +100,12 @@ intel_region_ttm_node_reserve(struct intel_memory_region *mem, ...@@ -100,12 +100,12 @@ intel_region_ttm_node_reserve(struct intel_memory_region *mem,
} }
/** /**
* intel_region_ttm_node_free - Free a node allocated from a resource manager * intel_region_ttm_resource_free - Free a resource allocated from a resource manager
* @mem: The region the node was allocated from. * @mem: The region the resource was allocated from.
* @node: The opaque node representing an allocation. * @res: The opaque resource representing an allocation.
*/ */
void intel_region_ttm_node_free(struct intel_memory_region *mem, void intel_region_ttm_resource_free(struct intel_memory_region *mem,
struct ttm_resource *res) struct ttm_resource *res)
{ {
struct ttm_resource_manager *man = mem->region_private; struct ttm_resource_manager *man = mem->region_private;
...@@ -113,8 +113,8 @@ void intel_region_ttm_node_free(struct intel_memory_region *mem, ...@@ -113,8 +113,8 @@ void intel_region_ttm_node_free(struct intel_memory_region *mem,
} }
static const struct intel_memory_region_private_ops priv_ops = { static const struct intel_memory_region_private_ops priv_ops = {
.reserve = intel_region_ttm_node_reserve, .reserve = intel_region_ttm_resource_reserve,
.free = intel_region_ttm_node_free, .free = intel_region_ttm_resource_free,
}; };
int intel_region_ttm_init(struct intel_memory_region *mem) int intel_region_ttm_init(struct intel_memory_region *mem)
...@@ -157,10 +157,10 @@ void intel_region_ttm_fini(struct intel_memory_region *mem) ...@@ -157,10 +157,10 @@ void intel_region_ttm_fini(struct intel_memory_region *mem)
} }
/** /**
* intel_region_ttm_node_to_st - Convert an opaque TTM resource manager node * intel_region_ttm_resource_to_st - Convert an opaque TTM resource manager resource
* to an sg_table. * to an sg_table.
* @mem: The memory region. * @mem: The memory region.
* @node: The resource manager node obtained from the TTM resource manager. * @res: The resource manager resource obtained from the TTM resource manager.
* *
* The gem backends typically use sg-tables for operations on the underlying * The gem backends typically use sg-tables for operations on the underlying
* io_memory. So provide a way for the backends to translate the * io_memory. So provide a way for the backends to translate the
...@@ -168,8 +168,8 @@ void intel_region_ttm_fini(struct intel_memory_region *mem) ...@@ -168,8 +168,8 @@ void intel_region_ttm_fini(struct intel_memory_region *mem)
* *
* Return: A malloced sg_table on success, an error pointer on failure. * Return: A malloced sg_table on success, an error pointer on failure.
*/ */
struct sg_table *intel_region_ttm_node_to_st(struct intel_memory_region *mem, struct sg_table *intel_region_ttm_resource_to_st(struct intel_memory_region *mem,
struct ttm_resource *res) struct ttm_resource *res)
{ {
struct ttm_range_mgr_node *range_node = struct ttm_range_mgr_node *range_node =
container_of(res, typeof(*range_node), base); container_of(res, typeof(*range_node), base);
...@@ -196,9 +196,9 @@ struct sg_table *intel_region_ttm_node_to_st(struct intel_memory_region *mem, ...@@ -196,9 +196,9 @@ struct sg_table *intel_region_ttm_node_to_st(struct intel_memory_region *mem,
* Return: A valid pointer on success, an error pointer on failure. * Return: A valid pointer on success, an error pointer on failure.
*/ */
struct ttm_resource * struct ttm_resource *
intel_region_ttm_node_alloc(struct intel_memory_region *mem, intel_region_ttm_resource_alloc(struct intel_memory_region *mem,
resource_size_t size, resource_size_t size,
unsigned int flags) unsigned int flags)
{ {
struct ttm_resource_manager *man = mem->region_private; struct ttm_resource_manager *man = mem->region_private;
struct ttm_place place = {}; struct ttm_place place = {};
......
...@@ -22,11 +22,11 @@ int intel_region_ttm_init(struct intel_memory_region *mem); ...@@ -22,11 +22,11 @@ int intel_region_ttm_init(struct intel_memory_region *mem);
void intel_region_ttm_fini(struct intel_memory_region *mem); void intel_region_ttm_fini(struct intel_memory_region *mem);
struct sg_table *intel_region_ttm_node_to_st(struct intel_memory_region *mem, struct sg_table *intel_region_ttm_resource_to_st(struct intel_memory_region *mem,
struct ttm_resource *res); struct ttm_resource *res);
void intel_region_ttm_node_free(struct intel_memory_region *mem, void intel_region_ttm_resource_free(struct intel_memory_region *mem,
struct ttm_resource *node); struct ttm_resource *res);
int intel_region_to_ttm_type(const struct intel_memory_region *mem); int intel_region_to_ttm_type(const struct intel_memory_region *mem);
...@@ -34,8 +34,8 @@ struct ttm_device_funcs *i915_ttm_driver(void); ...@@ -34,8 +34,8 @@ struct ttm_device_funcs *i915_ttm_driver(void);
#ifdef CONFIG_DRM_I915_SELFTEST #ifdef CONFIG_DRM_I915_SELFTEST
struct ttm_resource * struct ttm_resource *
intel_region_ttm_node_alloc(struct intel_memory_region *mem, intel_region_ttm_resource_alloc(struct intel_memory_region *mem,
resource_size_t size, resource_size_t size,
unsigned int flags); unsigned int flags);
#endif #endif
#endif /* _INTEL_REGION_TTM_H_ */ #endif /* _INTEL_REGION_TTM_H_ */
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
static void mock_region_put_pages(struct drm_i915_gem_object *obj, static void mock_region_put_pages(struct drm_i915_gem_object *obj,
struct sg_table *pages) struct sg_table *pages)
{ {
intel_region_ttm_node_free(obj->mm.region, obj->mm.st_mm_node); intel_region_ttm_resource_free(obj->mm.region, obj->mm.res);
sg_free_table(pages); sg_free_table(pages);
kfree(pages); kfree(pages);
} }
...@@ -30,15 +30,15 @@ static int mock_region_get_pages(struct drm_i915_gem_object *obj) ...@@ -30,15 +30,15 @@ static int mock_region_get_pages(struct drm_i915_gem_object *obj)
if (obj->flags & I915_BO_ALLOC_CONTIGUOUS) if (obj->flags & I915_BO_ALLOC_CONTIGUOUS)
flags |= I915_ALLOC_CONTIGUOUS; flags |= I915_ALLOC_CONTIGUOUS;
obj->mm.st_mm_node = intel_region_ttm_node_alloc(obj->mm.region, obj->mm.res = intel_region_ttm_resource_alloc(obj->mm.region,
obj->base.size, obj->base.size,
flags); flags);
if (IS_ERR(obj->mm.st_mm_node)) if (IS_ERR(obj->mm.res))
return PTR_ERR(obj->mm.st_mm_node); return PTR_ERR(obj->mm.res);
pages = intel_region_ttm_node_to_st(obj->mm.region, obj->mm.st_mm_node); pages = intel_region_ttm_resource_to_st(obj->mm.region, obj->mm.res);
if (IS_ERR(pages)) { if (IS_ERR(pages)) {
intel_region_ttm_node_free(obj->mm.region, obj->mm.st_mm_node); intel_region_ttm_resource_free(obj->mm.region, obj->mm.res);
return PTR_ERR(pages); return PTR_ERR(pages);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment