search for: vdpasim_dev

Displaying 20 results from an estimated 20 matches for "vdpasim_dev".

2020 Feb 11
1
[PATCH V2 5/5] vdpasim: vDPA device simulator
...>vqs[0].vring, vdpasim->iommu); > + vringh_set_iotlb(&vdpasim->vqs[1].vring, vdpasim->iommu); > + > + dev = &vdpa->dev; > + dev->coherent_dma_mask = DMA_BIT_MASK(64); > + set_dma_ops(dev, &vdpasim_dma_ops); > + > + ret = vdpa_init_device(vdpa, &vdpasim_dev->dev, dev, > + &vdpasim_net_config_ops); > + if (ret) > + goto err_init; > + > + ret = vdpa_register_device(vdpa); > + if (ret) > + goto err_register; See? This error unwind is now all wrong: > + > + return vdpasim; > + > +err_register: > + pu...
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_addr;...
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
0
[PATCH V3 5/5] vdpasim: vDPA device simulator
..._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 VDPASIM_DEVICE_ID 0x1 +#define VDPASIM_VENDOR_ID 0 +#define VDPASIM_VQ_NUM 0x2 +#define VDPASIM_NAME "vdpasim-netdev" + +static u64 vdpasim_features = (1ULL << VIRTIO_F_ANY_LAYOUT) | + (1ULL << VIRTIO_F_VERSION_1) | + (1ULL << VIRTIO_F_IOMMU_PLATFORM); + +/* State o...
2020 Jul 15
2
[PATCH RFC don't apply] vdpa_sim: endian-ness for config space
...o_cpu(struct vdpasim *vdpasim, __virtio16 val) +{ + return __virtio16_to_cpu(vdpasim_is_little_endian(vdpasim), val); +} + +static inline __virtio16 cpu_to_vdpasim16(struct vdpasim *vdpasim, u16 val) +{ + return __cpu_to_virtio16(vdpasim_is_little_endian(vdpasim), val); +} + static struct vdpasim *vdpasim_dev; static struct vdpasim *vdpa_to_sim(struct vdpa_device *vdpa) @@ -332,8 +350,8 @@ static struct vdpasim *vdpasim_create(void) goto err_iommu; config = &vdpasim->config; - config->mtu = 1500; - config->status = VIRTIO_NET_S_LINK_UP; + config->mtu = cpu_to_vdpasim16(vdpasim,...
2020 Jul 15
2
[PATCH RFC don't apply] vdpa_sim: endian-ness for config space
...o_cpu(struct vdpasim *vdpasim, __virtio16 val) +{ + return __virtio16_to_cpu(vdpasim_is_little_endian(vdpasim), val); +} + +static inline __virtio16 cpu_to_vdpasim16(struct vdpasim *vdpasim, u16 val) +{ + return __cpu_to_virtio16(vdpasim_is_little_endian(vdpasim), val); +} + static struct vdpasim *vdpasim_dev; static struct vdpasim *vdpa_to_sim(struct vdpa_device *vdpa) @@ -332,8 +350,8 @@ static struct vdpasim *vdpasim_create(void) goto err_iommu; config = &vdpasim->config; - config->mtu = 1500; - config->status = VIRTIO_NET_S_LINK_UP; + config->mtu = cpu_to_vdpasim16(vdpasim,...
2020 Aug 05
3
[PATCH v2 22/24] vdpa_sim: fix endian-ness of config space
...+{ > + return __virtio16_to_cpu(vdpasim_is_little_endian(vdpasim), val); > +} > + > +static inline __virtio16 cpu_to_vdpasim16(struct vdpasim *vdpasim, u16 val) > +{ > + return __cpu_to_virtio16(vdpasim_is_little_endian(vdpasim), val); > +} > + > static struct vdpasim *vdpasim_dev; > > static struct vdpasim *vdpa_to_sim(struct vdpa_device *vdpa) > @@ -306,7 +324,6 @@ static const struct vdpa_config_ops vdpasim_net_config_ops; > > static struct vdpasim *vdpasim_create(void) > { > - struct virtio_net_config *config; > struct vdpasim *vdpa...
2020 Aug 05
3
[PATCH v2 22/24] vdpa_sim: fix endian-ness of config space
...+{ > + return __virtio16_to_cpu(vdpasim_is_little_endian(vdpasim), val); > +} > + > +static inline __virtio16 cpu_to_vdpasim16(struct vdpasim *vdpasim, u16 val) > +{ > + return __cpu_to_virtio16(vdpasim_is_little_endian(vdpasim), val); > +} > + > static struct vdpasim *vdpasim_dev; > > static struct vdpasim *vdpa_to_sim(struct vdpa_device *vdpa) > @@ -306,7 +324,6 @@ static const struct vdpa_config_ops vdpasim_net_config_ops; > > static struct vdpasim *vdpasim_create(void) > { > - struct virtio_net_config *config; > struct vdpasim *vdpa...
2020 Jul 16
1
[PATCH RFC don't apply] vdpa_sim: endian-ness for config space
...sim_is_little_endian(vdpasim), val); > > +} > > + > > +static inline __virtio16 cpu_to_vdpasim16(struct vdpasim *vdpasim, u16 val) > > +{ > > + return __cpu_to_virtio16(vdpasim_is_little_endian(vdpasim), val); > > +} > > + > > static struct vdpasim *vdpasim_dev; > > static struct vdpasim *vdpa_to_sim(struct vdpa_device *vdpa) > > @@ -332,8 +350,8 @@ static struct vdpasim *vdpasim_create(void) > > goto err_iommu; > > config = &vdpasim->config; > > - config->mtu = 1500; > > - config->status = VIRTIO_...
2020 Jul 15
0
[PATCH RFC don't apply] vdpa_sim: endian-ness for config space
...+{ > + return __virtio16_to_cpu(vdpasim_is_little_endian(vdpasim), val); > +} > + > +static inline __virtio16 cpu_to_vdpasim16(struct vdpasim *vdpasim, u16 val) > +{ > + return __cpu_to_virtio16(vdpasim_is_little_endian(vdpasim), val); > +} > + > static struct vdpasim *vdpasim_dev; > > static struct vdpasim *vdpa_to_sim(struct vdpa_device *vdpa) > @@ -332,8 +350,8 @@ static struct vdpasim *vdpasim_create(void) > goto err_iommu; > > config = &vdpasim->config; > - config->mtu = 1500; > - config->status = VIRTIO_NET_S_LINK_UP;...
2020 Aug 03
0
[PATCH v2 22/24] vdpa_sim: fix endian-ness of config space
...o_cpu(struct vdpasim *vdpasim, __virtio16 val) +{ + return __virtio16_to_cpu(vdpasim_is_little_endian(vdpasim), val); +} + +static inline __virtio16 cpu_to_vdpasim16(struct vdpasim *vdpasim, u16 val) +{ + return __cpu_to_virtio16(vdpasim_is_little_endian(vdpasim), val); +} + static struct vdpasim *vdpasim_dev; static struct vdpasim *vdpa_to_sim(struct vdpa_device *vdpa) @@ -306,7 +324,6 @@ static const struct vdpa_config_ops vdpasim_net_config_ops; static struct vdpasim *vdpasim_create(void) { - struct virtio_net_config *config; struct vdpasim *vdpasim; struct device *dev; int ret = -ENOMEM...
2020 Aug 05
0
[PATCH v3 22/38] vdpa_sim: fix endian-ness of config space
...o_cpu(struct vdpasim *vdpasim, __virtio16 val) +{ + return __virtio16_to_cpu(vdpasim_is_little_endian(vdpasim), val); +} + +static inline __virtio16 cpu_to_vdpasim16(struct vdpasim *vdpasim, u16 val) +{ + return __cpu_to_virtio16(vdpasim_is_little_endian(vdpasim), val); +} + static struct vdpasim *vdpasim_dev; static struct vdpasim *vdpa_to_sim(struct vdpa_device *vdpa) @@ -306,7 +324,6 @@ static const struct vdpa_config_ops vdpasim_net_config_ops; static struct vdpasim *vdpasim_create(void) { - struct virtio_net_config *config; struct vdpasim *vdpasim; struct device *dev; int ret = -ENOMEM...
2020 Aug 05
0
[PATCH v2 22/24] vdpa_sim: fix endian-ness of config space
...sim_is_little_endian(vdpasim), val); > > +} > > + > > +static inline __virtio16 cpu_to_vdpasim16(struct vdpasim *vdpasim, u16 val) > > +{ > > + return __cpu_to_virtio16(vdpasim_is_little_endian(vdpasim), val); > > +} > > + > > static struct vdpasim *vdpasim_dev; > > static struct vdpasim *vdpa_to_sim(struct vdpa_device *vdpa) > > @@ -306,7 +324,6 @@ static const struct vdpa_config_ops vdpasim_net_config_ops; > > static struct vdpasim *vdpasim_create(void) > > { > > - struct virtio_net_config *config; > > struct...
2020 Jul 31
0
[PATCH] vdpasim: protect concurrent access to iommu iotlb
...index a9bc5e0fb353..5b5725d951ce 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -70,6 +70,8 @@ struct vdpasim { u32 status; u32 generation; u64 features; + /* spinlock to synchronize iommu table */ + spinlock_t iommu_lock; }; static struct vdpasim *vdpasim_dev; @@ -118,7 +120,9 @@ static void vdpasim_reset(struct vdpasim *vdpasim) for (i = 0; i < VDPASIM_VQ_NUM; i++) vdpasim_vq_reset(&vdpasim->vqs[i]); + spin_lock(&vdpasim->iommu_lock); vhost_iotlb_reset(vdpasim->iommu); + spin_unlock(&vdpasim->iommu_lock); vdpasim...
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
2020 Jul 01
5
[PATCH 0/5]
Hi all: This series tries to support batched IOTLB updating vhost-vdpa. Currently vhost-vdpa accepts userspace mapping via IOTLB API, and it can only forward one mapping to IOMMU or device through IOMMU API or dma_map(). Though set_map() is designed to have the capability to pass an rbtree based mapping to vDPA device, it's still be called at least once for each VHOST_IOTLB_UPDATE or
2020 Jun 18
6
[PATCH RFC 0/5] support batched IOTLB updating in vhost-vdpa
Hi all: This series tries to support batched IOTLB updating vhost-vdpa. Currently vhost-vdpa accepts userspace mapping via IOTLB API, and it can only forward one mapping to IOMMU or device through IOMMU API or dma_map(). Though set_map() is deisgend to have the capability to pass an rbtree based mapping to vDPA device, it's still be called at least once for each VHOST_IOTLB_UPDATE or
2020 Aug 03
51
[PATCH v2 00/24] virtio: config space endian-ness cleanup
Config space endian-ness is currently a mess: fields are not tagged with the correct endian-ness so it's easy to make mistakes like instanciating config space in native endian-ness. The following patches adding sparse tagging are currently in my tree. Lightly tested. As a follow-up, I plan to add new APIs that handle modern config space in a more efficient way (bypassing the version check).