@@ -96,8 +96,7 @@ static void dmabuf_gem_object_free(struct kref *kref)
struct intel_vgpu_dmabuf_obj, list);
if (dmabuf_obj == obj) {
intel_gvt_hypervisor_put_vfio_device(vgpu);
- idr_remove(&vgpu->object_idr,
- dmabuf_obj->dmabuf_id);
+ ida_free(&vgpu->object_ids, dmabuf_obj->dmabuf_id);
kfree(dmabuf_obj->info);
kfree(dmabuf_obj);
list_del(pos);
@@ -431,7 +430,7 @@ int intel_vgpu_query_plane(struct intel_vgpu *vgpu, void *args)
dmabuf_obj->vgpu = vgpu;
- ret = idr_alloc(&vgpu->object_idr, dmabuf_obj, 1, 0, GFP_NOWAIT);
+ ret = ida_alloc_min(&vgpu->object_ids, 1, GFP_NOWAIT);
if (ret < 0)
goto out_free_info;
gfx_plane_info->dmabuf_id = ret;
@@ -553,7 +552,7 @@ void intel_vgpu_dmabuf_cleanup(struct intel_vgpu *vgpu)
list);
dmabuf_obj->vgpu = NULL;
- idr_remove(&vgpu->object_idr, dmabuf_obj->dmabuf_id);
+ ida_free(&vgpu->object_ids, dmabuf_obj->dmabuf_id);
intel_gvt_hypervisor_put_vfio_device(vgpu);
list_del(pos);
@@ -231,7 +231,7 @@ struct intel_vgpu {
struct list_head dmabuf_obj_list_head;
struct mutex dmabuf_lock;
- struct idr object_idr;
+ struct ida object_ids;
struct completion vblank_done;
@@ -383,7 +383,7 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
mutex_init(&vgpu->dmabuf_lock);
INIT_LIST_HEAD(&vgpu->dmabuf_obj_list_head);
xa_init(&vgpu->page_track);
- idr_init(&vgpu->object_idr);
+ ida_init(&vgpu->object_ids);
intel_vgpu_init_cfg_space(vgpu, param->primary);
ret = intel_vgpu_init_mmio(vgpu);
I suspect dmabuf_obj_list_head and object_ids should be combined into a single xarray, but that's a job for later. Signed-off-by: Matthew Wilcox <willy@infradead.org> --- drivers/gpu/drm/i915/gvt/dmabuf.c | 7 +++---- drivers/gpu/drm/i915/gvt/gvt.h | 2 +- drivers/gpu/drm/i915/gvt/vgpu.c | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-)