search for: vdpa_index_ida

Displaying 9 results from an estimated 9 matches for "vdpa_index_ida".

Did you mean: vd_index_ida
2020 Feb 10
0
[PATCH V2 3/5] vDPA: introduce vDPA bus
.../ SPDX-License-Identifier: GPL-2.0-only +/* + * vDPA bus. + * + * Copyright (c) 2020, Red Hat. All rights reserved. + * Author: Jason Wang <jasowang at redhat.com> + * + */ + +#include <linux/module.h> +#include <linux/idr.h> +#include <linux/vdpa.h> + +static DEFINE_IDA(vdpa_index_ida); + +static int vdpa_dev_probe(struct device *d) +{ + struct vdpa_device *vdev = dev_to_vdpa(d); + struct vdpa_driver *drv = drv_to_vdpa(vdev->dev.driver); + int ret = 0; + + if (drv && drv->probe) + ret = drv->probe(vdev); + + return ret; +} + +static int vdpa_dev_remove(struct d...
2020 Mar 04
1
[PATCH V5 3/5] vDPA: introduce vDPA bus
...struct vdpa_config_ops *config) > +{ > + struct vdpa_device *vdev; > + int err = -ENOMEM; > + > + if (!parent || !dma_dev || !config) > + goto err; > + > + vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); > + if (!vdev) > + goto err; > + > + err = ida_simple_get(&vdpa_index_ida, 0, 0, GFP_KERNEL); > + if (err < 0) > + goto err_ida; > + > + vdev->dev.bus = &vdpa_bus; > + vdev->dev.parent = parent; > + vdev->dev.release = vdpa_release_dev; > + > + device_initialize(&vdev->dev); > + > + vdev->index = err; > + vdev-&...
2020 Feb 11
2
[PATCH V2 3/5] vDPA: introduce vDPA bus
...tered to vDPA bus > + * > + * Returns an error when fail to add to vDPA bus > + */ > +int vdpa_register_device(struct vdpa_device *vdev) > +{ > + int err = device_add(&vdev->dev); > + > + if (err) { > + put_device(&vdev->dev); > + ida_simple_remove(&vdpa_index_ida, vdev->index); > + } This is a very dangerous construction, I've seen it lead to driver bugs. Better to require the driver to always do the put_device on error unwind The ida_simple_remove should probably be part of the class release function to make everything work right > +/** &gt...
2020 Feb 11
2
[PATCH V2 3/5] vDPA: introduce vDPA bus
...tered to vDPA bus > + * > + * Returns an error when fail to add to vDPA bus > + */ > +int vdpa_register_device(struct vdpa_device *vdev) > +{ > + int err = device_add(&vdev->dev); > + > + if (err) { > + put_device(&vdev->dev); > + ida_simple_remove(&vdpa_index_ida, vdev->index); > + } This is a very dangerous construction, I've seen it lead to driver bugs. Better to require the driver to always do the put_device on error unwind The ida_simple_remove should probably be part of the class release function to make everything work right > +/** &gt...
2020 Feb 20
0
[PATCH V3 3/5] vDPA: introduce vDPA bus
...2.0-only +/* + * vDPA bus. + * + * Copyright (c) 2020, Red Hat. All rights reserved. + * Author: Jason Wang <jasowang at redhat.com> + * + */ + +#include <linux/module.h> +#include <linux/idr.h> +#include <linux/slab.h> +#include <linux/vdpa.h> + +static DEFINE_IDA(vdpa_index_ida); + +static int vdpa_dev_probe(struct device *d) +{ + struct vdpa_device *vdev = dev_to_vdpa(d); + struct vdpa_driver *drv = drv_to_vdpa(vdev->dev.driver); + int ret = 0; + + if (drv && drv->probe) + ret = drv->probe(vdev); + + return ret; +} + +static int vdpa_dev_remove(struct d...
2020 Feb 12
0
[PATCH V2 3/5] vDPA: introduce vDPA bus
...+ * Returns an error when fail to add to vDPA bus >> + */ >> +int vdpa_register_device(struct vdpa_device *vdev) >> +{ >> + int err = device_add(&vdev->dev); >> + >> + if (err) { >> + put_device(&vdev->dev); >> + ida_simple_remove(&vdpa_index_ida, vdev->index); >> + } > This is a very dangerous construction, I've seen it lead to driver > bugs. Better to require the driver to always do the put_device on > error unwind Ok. > > The ida_simple_remove should probably be part of the class release > function to m...
2020 Feb 10
9
[PATCH V2 0/5] vDPA support
Hi all: This is an updated version of kernel support for vDPA device. Various changes were made based on the feedback since last verion. One major change is to drop the sysfs API and leave the management interface for future development, and introudce the incremental DMA bus operations. Please see changelog for more information. The work on vhost, IFCVF (intel VF driver for vDPA) and qemu is
2020 Feb 20
5
[PATCH V4 0/5] vDPA support
Hi all: This is an update version of vDPA support in kernel. vDPA device is a device that uses a datapath which complies with the virtio specifications with vendor specific control path. vDPA devices can be both physically located on the hardware or emulated by software. vDPA hardware devices are usually implemented through PCIE with the following types: - PF (Physical Function) - A single
2020 Feb 20
9
[PATCH V3 0/5] vDPA support
Hi all: This is an update version of vDPA support in kernel. vDPA device is a device that uses a datapath which complies with the virtio specifications with vendor specific control path. vDPA devices can be both physically located on the hardware or emulated by software. vDPA hardware devices are usually implemented through PCIE with the following types: - PF (Physical Function) - A single