Pushed to drm-misc-next

On 6/16/25 04:30, Jacek Lawrynowicz wrote:
Hi,

On 6/16/2025 11:14 AM, Lizhi Hou wrote:
The device bo is allocated from the device heap memory. (a trunk of
memory dedicated to device)

Rename amdxdna_gem_insert_node_locked to amdxdna_gem_heap_alloc
and move related sanity checks into it.

Add amdxdna_gem_dev_obj_free and move device bo free code into it.

Calculate the kernel virtual address of device bo by the device
heap memory address and offset.

Signed-off-by: Lizhi Hou <lizhi....@amd.com>
---
  drivers/accel/amdxdna/aie2_ctx.c    |   2 +-
  drivers/accel/amdxdna/amdxdna_gem.c | 193 +++++++++++++++-------------
  drivers/accel/amdxdna/amdxdna_gem.h |   3 +-
  3 files changed, 106 insertions(+), 92 deletions(-)

...

@@ -855,10 +868,12 @@ int amdxdna_drm_sync_bo_ioctl(struct drm_device *dev,
if (is_import_bo(abo))
                drm_clflush_sg(abo->base.sgt);
-       else if (abo->type == AMDXDNA_BO_DEV)
-               drm_clflush_pages(abo->mem.pages, abo->mem.nr_pages);
-       else
+       else if (abo->mem.kva)
+               drm_clflush_virt_range(abo->mem.kva + args->offset, args->size);
+       else if (abo->base.pages)
                drm_clflush_pages(abo->base.pages, gobj->size >> PAGE_SHIFT);
+       else
+               WARN(1, "Can not get flush memory");
drm_WARN() would also give you the device that caused the warning in case there 
may be multiple xdna accels.

Reviewed-by: Jacek Lawrynowicz <jacek.lawrynow...@linux.intel.com>

Regards,
Jacek

Reply via email to