* TODO: assign a notifyid for rvdev updates as well
* TODO: support predefined notifyids (via resource table)
*/
- ret = idr_alloc(&rproc->notifyids, rvring, 0, 0, GFP_KERNEL);
+ ret = xa_alloc(&rproc->notifyids, ¬ifyid, rvring, xa_limit_32b,
+ GFP_KERNEL);
if (ret < 0) {
- dev_err(dev, "idr_alloc failed: %d\n", ret);
+ dev_err(dev, "id allocation failed: %d\n", ret);
return ret;
}
- notifyid = ret;
/* Potentially bump max_notifyid */
if (notifyid > rproc->max_notifyid)
int idx = rvring->rvdev->vring - rvring;
struct fw_rsc_vdev *rsc;
- idr_remove(&rproc->notifyids, rvring->notifyid);
+ xa_erase(&rproc->notifyids, rvring->notifyid);
/* reset resource entry info */
rsc = (void *)rproc->table_ptr + rvring->rvdev->rsc_offset;
dev_info(&rproc->dev, "releasing %s\n", rproc->name);
- idr_destroy(&rproc->notifyids);
-
if (rproc->index >= 0)
ida_simple_remove(&rproc_dev_index, rproc->index);
mutex_init(&rproc->lock);
- idr_init(&rproc->notifyids);
+ xa_init_flags(&rproc->notifyids, XA_FLAGS_ALLOC);
INIT_LIST_HEAD(&rproc->carveouts);
INIT_LIST_HEAD(&rproc->mappings);
dev_dbg(&rproc->dev, "vq index %d is interrupted\n", notifyid);
- rvring = idr_find(&rproc->notifyids, notifyid);
+ rvring = xa_load(&rproc->notifyids, notifyid);
if (!rvring || !rvring->vq)
return IRQ_NONE;
* @bootaddr: address of first instruction to boot rproc with (optional)
* @rvdevs: list of remote virtio devices
* @subdevs: list of subdevices, to following the running state
- * @notifyids: idr for dynamically assigning rproc-wide unique notify ids
+ * @notifyids: used for dynamically assigning rproc-wide unique notify ids
* @index: index of this rproc device
* @crash_handler: workqueue for handling a crash
* @crash_cnt: crash counter
u32 bootaddr;
struct list_head rvdevs;
struct list_head subdevs;
- struct idr notifyids;
+ struct xarray notifyids;
int index;
struct work_struct crash_handler;
unsigned int crash_cnt;