[PATCH i-g-t v7 5/6] lib/xe/xe_util: Align obj size before bind/unbind

Cavitt, Jonathan jonathan.cavitt at intel.com
Fri Dec 15 21:11:31 UTC 2023


-----Original Message-----
> From: Jahagirdar, Akshata <akshata.jahagirdar at intel.com> 
> Sent: Friday, December 15, 2023 1:10 PM
> Cc: igt-dev at lists.freedesktop.org; Siddiqui, Ayaz A <ayaz.siddiqui at intel.com>; Mishra, Pallavi <pallavi.mishra at intel.com>; akshata.jahagirdar at intel.co; Kempczynski, Zbigniew <zbigniew.kempczynski at intel.com>; Auld, Matthew <matthew.auld at intel.com>; Jahagirdar, Akshata <akshata.jahagirdar at intel.com>
> Subject: [PATCH i-g-t v7 5/6] lib/xe/xe_util: Align obj size before bind/unbind
> 
> Alter the range to default_alignment before vm bind/unbind operation to align the buffer object size with page size.
> 
> Signed-off-by: Akshata Jahagirdar <akshata.jahagirdar at intel.com>
> ---
>  lib/xe/xe_util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/xe/xe_util.c b/lib/xe/xe_util.c index ba8eece71..6321a5729 100644
> --- a/lib/xe/xe_util.c
> +++ b/lib/xe/xe_util.c
> @@ -148,7 +148,7 @@ static struct drm_xe_vm_bind_op *xe_alloc_bind_ops(int xe,
>  		ops->flags = flags;
>  		ops->obj_offset = 0;
>  		ops->addr = obj->offset;
> -		ops->range = obj->size;
> +		ops->range = ALIGN(obj->size, 4096);


Hrmm... I was briefly concerned with us hard-coding the page size here, but it looks like we do so in
a lot of places in the code, so I guess there's precedent.
Acked-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
-Jonathan Cavitt


>  		ops->prefetch_mem_region_instance = 0;
>  		if (obj->pat_index == DEFAULT_PAT_INDEX)
>  			ops->pat_index = intel_get_pat_idx_wb(xe);
> --
> 2.34.1
> 
> 


More information about the igt-dev mailing list