[Intel-gfx] [PATCH v3 1/4] drm/ttm: Clean up page shift operation
Christian König
christian.koenig at amd.com
Wed Jan 11 09:13:49 UTC 2023
This needs to be squashed together with patch #3 and #4, otherwise you
would break the drivers in between.
What you can do is to separate the GDS/GWS/OA changes out of patch #3.
Christian.
Am 11.01.23 um 07:35 schrieb Somalapuram Amaranath:
> Remove page shift operations as ttm_resource moved
> from num_pages to size_t size in bytes.
> v1 -> v2: fix missing page shift to fpfn and lpfn
> v2 -> v3: separate patch’s based on driver module
>
> Signed-off-by: Somalapuram Amaranath <Amaranath.Somalapuram at amd.com>
> ---
> drivers/gpu/drm/ttm/ttm_range_manager.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_range_manager.c b/drivers/gpu/drm/ttm/ttm_range_manager.c
> index ae11d07eb63a..3703cbc6d368 100644
> --- a/drivers/gpu/drm/ttm/ttm_range_manager.c
> +++ b/drivers/gpu/drm/ttm/ttm_range_manager.c
> @@ -83,9 +83,10 @@ static int ttm_range_man_alloc(struct ttm_resource_manager *man,
>
> spin_lock(&rman->lock);
> ret = drm_mm_insert_node_in_range(mm, &node->mm_nodes[0],
> - PFN_UP(node->base.size),
> + node->base.size,
> bo->page_alignment, 0,
> - place->fpfn, lpfn, mode);
> + place->fpfn << PAGE_SHIFT,
> + lpfn << PAGE_SHIFT, mode);
> spin_unlock(&rman->lock);
>
> if (unlikely(ret)) {
> @@ -119,11 +120,10 @@ static bool ttm_range_man_intersects(struct ttm_resource_manager *man,
> size_t size)
> {
> struct drm_mm_node *node = &to_ttm_range_mgr_node(res)->mm_nodes[0];
> - u32 num_pages = PFN_UP(size);
>
> /* Don't evict BOs outside of the requested placement range */
> - if (place->fpfn >= (node->start + num_pages) ||
> - (place->lpfn && place->lpfn <= node->start))
> + if ((place->fpfn << PAGE_SHIFT) >= (node->start + size) ||
> + (place->lpfn && (place->lpfn << PAGE_SHIFT) <= node->start))
> return false;
>
> return true;
> @@ -135,10 +135,9 @@ static bool ttm_range_man_compatible(struct ttm_resource_manager *man,
> size_t size)
> {
> struct drm_mm_node *node = &to_ttm_range_mgr_node(res)->mm_nodes[0];
> - u32 num_pages = PFN_UP(size);
>
> if (node->start < place->fpfn ||
> - (place->lpfn && (node->start + num_pages) > place->lpfn))
> + (place->lpfn && (node->start + size) > place->lpfn << PAGE_SHIFT))
> return false;
>
> return true;
More information about the Intel-gfx
mailing list