search for: vdpasim

Displaying 20 results from an estimated 89 matches for "vdpasim".

2023 Mar 02
1
[PATCH v2 7/8] vdpa_sim: replace the spinlock with a mutex to protect the state
...pa_sim_net.c | 4 ++-- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.h b/drivers/vdpa/vdpa_sim/vdpa_sim.h index ce83f9130a5d..4774292fba8c 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.h +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.h @@ -60,8 +60,8 @@ struct vdpasim { struct kthread_worker *worker; struct kthread_work work; struct vdpasim_dev_attr dev_attr; - /* spinlock to synchronize virtqueue state */ - spinlock_t lock; + /* mutex to synchronize virtqueue state */ + struct mutex mutex; /* virtio config according to device type */ void *config; s...
2023 Mar 21
3
[PATCH v3 5/8] vdpa_sim: make devices agnostic for work management
..._sim_net.c | 6 ++---- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.h b/drivers/vdpa/vdpa_sim/vdpa_sim.h index 144858636c10..acee20faaf6a 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.h +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.h @@ -45,7 +45,7 @@ struct vdpasim_dev_attr { u32 ngroups; u32 nas; - work_func_t work_fn; + void (*work_fn)(struct vdpasim *vdpasim); void (*get_config)(struct vdpasim *vdpasim, void *config); void (*set_config)(struct vdpasim *vdpasim, const void *config); int (*get_stats)(struct vdpasim *vdpasim, u16 idx, @@ -78,6 +78...
2020 Feb 20
0
[PATCH V3 5/5] vdpasim: vDPA device simulator
...<uapi/linux/virtio_config.h> +#include <uapi/linux/virtio_net.h> + +#define DRV_VERSION "0.1" +#define DRV_AUTHOR "Jason Wang <jasowang at redhat.com>" +#define DRV_DESC "vDPA Device Simulator" +#define DRV_LICENSE "GPL v2" + +struct vdpasim_virtqueue { + struct vringh vring; + struct vringh_kiov iov; + unsigned short head; + bool ready; + u64 desc_addr; + u64 device_addr; + u64 driver_addr; + u32 num; + void *private; + irqreturn_t (*cb)(void *data); +}; + +#define VDPASIM_QUEUE_ALIGN PAGE_SIZE +#define VDPASIM_QUEUE_MAX 256 +#define...
2020 Aug 05
3
[PATCH v2 22/24] vdpa_sim: fix endian-ness of config space
...; > #include <linux/vringh.h> > #include <linux/vdpa.h> > +#include <linux/virtio_byteorder.h> > #include <linux/vhost_iotlb.h> > #include <uapi/linux/virtio_config.h> > #include <uapi/linux/virtio_net.h> > @@ -72,6 +73,23 @@ struct vdpasim { > u64 features; > }; > > +/* TODO: cross-endian support */ > +static inline bool vdpasim_is_little_endian(struct vdpasim *vdpasim) > +{ > + return virtio_legacy_is_little_endian() || > + (vdpasim->features & (1ULL << VIRTIO_F_VERSION_1)); > +} >...
2020 Aug 05
3
[PATCH v2 22/24] vdpa_sim: fix endian-ness of config space
...; > #include <linux/vringh.h> > #include <linux/vdpa.h> > +#include <linux/virtio_byteorder.h> > #include <linux/vhost_iotlb.h> > #include <uapi/linux/virtio_config.h> > #include <uapi/linux/virtio_net.h> > @@ -72,6 +73,23 @@ struct vdpasim { > u64 features; > }; > > +/* TODO: cross-endian support */ > +static inline bool vdpasim_is_little_endian(struct vdpasim *vdpasim) > +{ > + return virtio_legacy_is_little_endian() || > + (vdpasim->features & (1ULL << VIRTIO_F_VERSION_1)); > +} >...
2020 Feb 10
0
[PATCH V2 5/5] vdpasim: vDPA device simulator
...<uapi/linux/virtio_config.h> +#include <uapi/linux/virtio_net.h> + +#define DRV_VERSION "0.1" +#define DRV_AUTHOR "Jason Wang <jasowang at redhat.com>" +#define DRV_DESC "vDPA Device Simulator" +#define DRV_LICENSE "GPL v2" + +struct vdpasim_dev { + struct device dev; +}; + +struct vdpasim_dev *vdpasim_dev; + +struct vdpasim_virtqueue { + struct vringh vring; + struct vringh_kiov iov; + unsigned short head; + bool ready; + u64 desc_addr; + u64 device_addr; + u64 driver_addr; + u32 num; + void *private; + irqreturn_t (*cb)(void *data);...
2020 Feb 10
1
[PATCH V2 5/5] vdpasim: vDPA device simulator
...+#include <uapi/linux/virtio_net.h> > + > +#define DRV_VERSION "0.1" > +#define DRV_AUTHOR "Jason Wang <jasowang at redhat.com>" > +#define DRV_DESC "vDPA Device Simulator" > +#define DRV_LICENSE "GPL v2" > + > +struct vdpasim_dev { > + struct device dev; > +}; > + > +struct vdpasim_dev *vdpasim_dev; > + > +struct vdpasim_virtqueue { > + struct vringh vring; > + struct vringh_kiov iov; > + unsigned short head; > + bool ready; > + u64 desc_addr; > + u64 device_addr; > + u64 driver_ad...
2023 Jan 29
1
[PATCH v3 2/2] vdpasim: support doorbell mapping
On Sun, Jan 29, 2023 at 10:51 AM Longpeng(Mike) <longpeng2 at huawei.com> wrote: > > From: Longpeng <longpeng2 at huawei.com> > > Support doorbell mapping for vdpasim devices, then we can test the notify > passthrough feature even if there's no real hardware on hand. > > Allocates a dummy page which is used to emulate the notify page of the device, > all VQs share the same notify register that initiated to 0xffff. A periodic > work will chec...
2023 Apr 07
2
[PATCH 0/2] vdpa_sim_blk: support shared backend
...preparation and moves the buffer allocation into devices, the second patch adds the `shared_buffer_mutex` parameter to vdpa_sim_blk to use the same ramdisk for all devices. Tested with QEMU v8.0.0-rc2 in this way: modprobe vhost_vdpa modprobe vdpa_sim_blk shared_backend=true vdpa dev add mgmtdev vdpasim_blk name blk0 vdpa dev add mgmtdev vdpasim_blk name blk1 qemu-system-x86_64 -m 512M -smp 2 -M q35,accel=kvm,memory-backend=mem \ ?-object memory-backend-file,share=on,id=mem,size="512M",mem-path="/dev/shm" ?... ?-blockdev node-name=drive_src1,driver=virtio-blk-vhost-vdpa,pat...
2023 Mar 02
8
[PATCH v2 0/8] vdpa_sim: add support for user VA
...bout deprecation of kmap_atomic() touched ?by a patch in this series - fix cast warnings when build with W=1 C=1 - added new patch to replace the spinlock with a mutex [Jason] - `use_va` set to true by default [Eugenio] - supported the new unbind_mm callback [Jason] - removed the unbind_mm call in vdpasim_do_reset() [Jason] - avoided to release the lock while call kthread_flush_work() since ?we are now using a mutex to protect the device state RFC v1: https://lore.kernel.org/lkml/20221214163025.103075-1-sgarzare at redhat.com/ This series adds support for the use of user virtual addresses in the...
2023 Apr 04
9
[PATCH v5 0/9] vdpa_sim: add support for user VA
This series adds support for the use of user virtual addresses in the vDPA simulator devices. The main reason for this change is to lift the pinning of all guest memory. Especially with virtio devices implemented in software. The next step would be to generalize the code in vdpa-sim to allow the implementation of in-kernel software devices. Similar to vhost, but using vDPA so we can reuse the
2020 Feb 11
1
[PATCH V2 5/5] vdpasim: vDPA device simulator
On Mon, Feb 10, 2020 at 11:56:08AM +0800, Jason Wang wrote: > + > +static struct vdpasim *vdpasim_create(void) > +{ > + struct vdpasim *vdpasim; > + struct virtio_net_config *config; > + struct vdpa_device *vdpa; > + struct device *dev; > + int ret = -ENOMEM; > + > + vdpasim = kzalloc(sizeof(*vdpasim), GFP_KERNEL); > + if (!vdpasim) > + goto err_vdpa_allo...
2020 Jul 31
0
[PATCH] vdpasim: protect concurrent access to iommu iotlb
...axg at mellanox.com> Iommu iotlb can be accessed by different cores for performing IO using multiple virt queues. Add a spinlock to synchronize iotlb accesses. This could be easily reproduced when using more than 1 pktgen threads to inject traffic to vdpa simulator. Fixes: 2c53d0f64c06f("vdpasim: vDPA device simulator") Cc: stable at vger.kernel.org Signed-off-by: Max Gurtovoy <maxg at mellanox.com> Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)...
2020 Jul 15
2
[PATCH RFC don't apply] vdpa_sim: endian-ness for config space
VDPA sim stores config space as native endian, but that is wrong: modern guests expect LE. I coded up the following to fix it up, but it is wrong too: vdpasim_create is called before guest features are known. So what should we do? New ioctl to specify the interface used? More ideas? Signed-off-by: Michael S. Tsirkin <mst at redhat.com> --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletio...
2020 Jul 15
2
[PATCH RFC don't apply] vdpa_sim: endian-ness for config space
VDPA sim stores config space as native endian, but that is wrong: modern guests expect LE. I coded up the following to fix it up, but it is wrong too: vdpasim_create is called before guest features are known. So what should we do? New ioctl to specify the interface used? More ideas? Signed-off-by: Michael S. Tsirkin <mst at redhat.com> --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletio...
2023 Mar 24
1
[PATCH v3 8/8] vdpa_sim: add support for user VA
...true) is used in > vdpa_alloc_device() to inform the vDPA framework that the device > supports VA. > > vringh is initialized to use VA only when "use_va" is true and the > user's mm has been bound. So, only when the bus supports user VA > (e.g. vhost-vdpa). > > vdpasim_mm_work_fn work is used to serialize the binding to a new > address space when the .bind_mm callback is invoked, and unbinding > when the .unbind_mm callback is invoked. > > Call mmget_not_zero()/kthread_use_mm() inside the worker function > to pin the address space only as long as n...
2020 Aug 03
0
[PATCH v2 22/24] vdpa_sim: fix endian-ness of config space
...@@ #include <linux/etherdevice.h> #include <linux/vringh.h> #include <linux/vdpa.h> +#include <linux/virtio_byteorder.h> #include <linux/vhost_iotlb.h> #include <uapi/linux/virtio_config.h> #include <uapi/linux/virtio_net.h> @@ -72,6 +73,23 @@ struct vdpasim { u64 features; }; +/* TODO: cross-endian support */ +static inline bool vdpasim_is_little_endian(struct vdpasim *vdpasim) +{ + return virtio_legacy_is_little_endian() || + (vdpasim->features & (1ULL << VIRTIO_F_VERSION_1)); +} + +static inline u16 vdpasim16_to_cpu(struct vdpasim...
2023 Mar 14
1
[PATCH v2 8/8] vdpa_sim: add support for user VA
...alse) is used in > vdpa_alloc_device() to inform the vDPA framework that the device > supports VA. > > vringh is initialized to use VA only when "use_va" is true and the > user's mm has been bound. So, only when the bus supports user VA > (e.g. vhost-vdpa). > > vdpasim_mm_work_fn work is used to attach the kthread to the user > address space when the .bind_mm callback is invoked, and to detach > it when the .unbind_mm callback is invoked. > > Signed-off-by: Stefano Garzarella <sgarzare at redhat.com> > --- > > Notes: > v2: >...
2020 Aug 05
0
[PATCH v3 22/38] vdpa_sim: fix endian-ness of config space
...@@ #include <linux/etherdevice.h> #include <linux/vringh.h> #include <linux/vdpa.h> +#include <linux/virtio_byteorder.h> #include <linux/vhost_iotlb.h> #include <uapi/linux/virtio_config.h> #include <uapi/linux/virtio_net.h> @@ -72,6 +73,23 @@ struct vdpasim { u64 features; }; +/* TODO: cross-endian support */ +static inline bool vdpasim_is_little_endian(struct vdpasim *vdpasim) +{ + return virtio_legacy_is_little_endian() || + (vdpasim->features & (1ULL << VIRTIO_F_VERSION_1)); +} + +static inline u16 vdpasim16_to_cpu(struct vdpasim...
2020 Aug 05
0
[PATCH v2 22/24] vdpa_sim: fix endian-ness of config space
...ingh.h> > > #include <linux/vdpa.h> > > +#include <linux/virtio_byteorder.h> > > #include <linux/vhost_iotlb.h> > > #include <uapi/linux/virtio_config.h> > > #include <uapi/linux/virtio_net.h> > > @@ -72,6 +73,23 @@ struct vdpasim { > > u64 features; > > }; > > +/* TODO: cross-endian support */ > > +static inline bool vdpasim_is_little_endian(struct vdpasim *vdpasim) > > +{ > > + return virtio_legacy_is_little_endian() || > > + (vdpasim->features & (1ULL << VIRTIO_...