]> www.infradead.org Git - users/willy/xarray.git/commitdiff
drm/i915: Convert object_idr to IDA
authorMatthew Wilcox <willy@infradead.org>
Mon, 18 Feb 2019 16:04:18 +0000 (11:04 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Thu, 8 Aug 2019 03:39:33 +0000 (23:39 -0400)
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
drivers/gpu/drm/i915/gvt/gvt.h
drivers/gpu/drm/i915/gvt/vgpu.c

index 41c8ebc60c63b301680e8f1881fc452567111e33..0dc72478b6fb1e9aae001c10297cee9dd5435221 100644 (file)
@@ -97,8 +97,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);
@@ -424,7 +423,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;
@@ -546,7 +545,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);
 
index 7886e4cf88ea8219b1b3dec8bf3e148000389f47..274a6b10fce758b6bae9f70b86fc1bce8141fb4c 100644 (file)
@@ -224,7 +224,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;
 
index 2084a531d7ef740b768af21613d3045adaa4767b..c07a1689d8f9ba0f58ca6c92fe3f6bfca8d05a8f 100644 (file)
@@ -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);