Re: [PATCH v9 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-13 Thread Michael S. Tsirkin
On Wed, Jul 14, 2021 at 01:45:39PM +0800, Jason Wang wrote: > > +static int vduse_dev_msg_sync(struct vduse_dev *dev, > > + struct vduse_dev_msg *msg) > > +{ > > + int ret; > > + > > + init_waitqueue_head(>waitq); > > + spin_lock(>msg_lock); > > +

Re: [PATCH v9 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-13 Thread Jason Wang
在 2021/7/13 下午4:46, Xie Yongji 写道: This VDUSE driver enables implementing software-emulated vDPA devices in userspace. The vDPA device is created by ioctl(VDUSE_CREATE_DEV) on /dev/vduse/control. Then a char device interface (/dev/vduse/$NAME) is exported to userspace for device emulation. In

Re: [PATCH 2/5] virtio_mmio: Bind virtio device to device-tree node

2021-07-13 Thread Viresh Kumar
On 13-07-21, 14:26, Arnd Bergmann wrote: > On Tue, Jul 13, 2021 at 12:51 PM Viresh Kumar wrote: > > > > Bind the virtio device with its device protocol's sub-node. This will > > help users of the virtio device to mention their dependencies on the > > device in the DT file itself. Like GPIO pin

Re: [RFC v3 21/29] vhost: Add VhostIOVATree

2021-07-13 Thread Jason Wang
在 2021/6/1 下午4:15, Eugenio Perez Martin 写道: On Mon, May 31, 2021 at 11:40 AM Jason Wang wrote: 在 2021/5/20 上午12:28, Eugenio Pérez 写道: This tree is able to look for a translated address from a IOVA address. At first glance is similar to util/iova-tree. However, SVQ working on devices with

Re: [PATCH v9 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-13 Thread Jason Wang
在 2021/7/13 下午9:27, Dan Carpenter 写道: On Tue, Jul 13, 2021 at 04:46:55PM +0800, Xie Yongji wrote: +static int vduse_dev_init_vdpa(struct vduse_dev *dev, const char *name) +{ + struct vduse_vdpa *vdev; + int ret; + + if (dev->vdev) + return -EEXIST; + +

[PATCH 2/2] virtio_ring: fix error - 'prev' and 'head_flags' may be used uninitialized in this function

2021-07-13 Thread Cai Huoqing
when run "make virtio" in linux/tools, the error: "'prev' and 'head_flags' may be used uninitialized in this function" occurs Signed-off-by: Cai Huoqing --- drivers/virtio/virtio_ring.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_ring.c

[PATCH 1/2] virtio_ring: fix error - unknown type name 'spinlock_t'

2021-07-13 Thread Cai Huoqing
when run "make virtio" in linux/tools, the error: unknown type name 'spinlock_t' occurs Signed-off-by: Cai Huoqing --- include/linux/vringh.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/vringh.h b/include/linux/vringh.h index 84db7b8f912f..ff21c2643792 100644 ---

[PATCH 0/2] virtio_ring: fix errors to make virtio tools

2021-07-13 Thread Cai Huoqing
the errors occurs when run "make virtio" in linux/tools Cai Huoqing (2): virtio_ring: fix error - unknown type name 'spinlock_t' virtio_ring: fix error - 'prev' and 'head_flags' may be used uninitialized in this function drivers/virtio/virtio_ring.c | 6 +++--- include/linux/vringh.h

Re: [PATCH 1/5] dt-bindings: virtio: mmio: Add support for device subnode

2021-07-13 Thread Viresh Kumar
On 13-07-21, 14:32, Arnd Bergmann wrote: > On Tue, Jul 13, 2021 at 12:51 PM Viresh Kumar wrote: > > > + > > +virtio@3200 { > > +compatible = "virtio,mmio"; > > +reg = <0x3200 0x100>; > > +interrupts = <43>; > > + > > +#address-cells = <1>; > > +

Re: [PATCH 1/5] dt-bindings: virtio: mmio: Add support for device subnode

2021-07-13 Thread Viresh Kumar
On 13-07-21, 22:34, Arnd Bergmann wrote: > On Tue, Jul 13, 2021 at 9:35 PM Rob Herring wrote: > > There shouldn't be. We have nodes be multiple providers (e.g clocks > > and resets) already. > > I think this would be a little different, but it can still work. There is in > fact already some

Re: [PATCH 1/5] dt-bindings: virtio: mmio: Add support for device subnode

2021-07-13 Thread Viresh Kumar
On 13-07-21, 13:34, Rob Herring wrote: > On Tue, Jul 13, 2021 at 9:19 AM Viresh Kumar wrote: > > We already do this for linux-event-codes.h and so I thought it is the > > right way of doing it :) > > Humm, maybe it's okay. Please double check then... > > > Else we can create a new copy, which

Re: [PATCH v9 13/17] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-07-13 Thread Jason Wang
在 2021/7/13 下午7:31, Dan Carpenter 写道: On Tue, Jul 13, 2021 at 04:46:52PM +0800, Xie Yongji wrote: @@ -613,37 +618,28 @@ static void vhost_vdpa_unmap(struct vhost_vdpa *v, u64 iova, u64 size) } } -static int vhost_vdpa_process_iotlb_update(struct vhost_vdpa *v, -

Re: [PATCH v14] i2c: virtio: add a virtio i2c frontend driver

2021-07-13 Thread Viresh Kumar
On 13-07-21, 11:38, Michael S. Tsirkin wrote: > I think we should tweak this such that we add multiple buffers but > only make them visible to host after all add commands were successful. > With split this is possible by deffering avail idx update, > with packed by deferring update of the avail

[RFC 2/3] virtio: add poll_source virtqueue polling

2021-07-13 Thread Stefan Hajnoczi
VIRTIO drivers can cheaply disable interrupts by setting RING_EVENT_FLAGS_DISABLE in the packed virtqueues's Driver Event Suppression structure. See "2.7.10 Driver and Device Event Suppression" in the VIRTIO 1.1 specification for details

[RFC 3/3] softirq: participate in cpuidle polling

2021-07-13 Thread Stefan Hajnoczi
Normally softirqs are invoked when exiting irqs. When polling in the cpuidle driver there may be no irq. Therefore pending softirqs go unnoticed and polling continues without invoking them. Add a softirq_poll() function to explicitly check for and invoke softirqs. Signed-off-by: Stefan Hajnoczi

[RFC 1/3] cpuidle: add poll_source API

2021-07-13 Thread Stefan Hajnoczi
Introduce an API for adding cpuidle poll callbacks: struct poll_source_ops { void (*start)(struct poll_source *src); void (*stop)(struct poll_source *src); void (*poll)(struct poll_source *src); }; int poll_source_register(struct poll_source *src); int

[RFC 0/3] cpuidle: add poll_source API and virtio vq polling

2021-07-13 Thread Stefan Hajnoczi
These patches are not polished yet but I would like request feedback on this approach and share performance results with you. Idle CPUs tentatively enter a busy wait loop before halting when the cpuidle haltpoll driver is enabled inside a virtual machine. This reduces wakeup latency for events

Re: [PATCH v14] i2c: virtio: add a virtio i2c frontend driver

2021-07-13 Thread Michael S. Tsirkin
On Fri, Jul 09, 2021 at 10:25:30AM +0800, Jie Deng wrote: > Add an I2C bus driver for virtio para-virtualization. > > The controller can be emulated by the backend driver in > any device model software by following the virtio protocol. > > The device specification can be found on >

Re: [PATCH v14] i2c: virtio: add a virtio i2c frontend driver

2021-07-13 Thread Michael S. Tsirkin
On Fri, Jul 09, 2021 at 09:14:07AM +0530, Viresh Kumar wrote: > On 09-07-21, 10:25, Jie Deng wrote: > > Add an I2C bus driver for virtio para-virtualization. > > > > The controller can be emulated by the backend driver in > > any device model software by following the virtio protocol. > > > >

Re: [PATCH 1/5] dt-bindings: virtio: mmio: Add support for device subnode

2021-07-13 Thread Viresh Kumar
On 13-07-21, 08:43, Rob Herring wrote: > On Tue, Jul 13, 2021 at 4:50 AM Viresh Kumar wrote: > > > > Allow virtio,mmio nodes to contain device specific subnodes. Since each > > virtio,mmio node can represent a single virtio device, each virtio node > > is allowed to contain a maximum of one

Re: [PATCH 5/5] dt-bindings: gpio: Add bindings for gpio-virtio

2021-07-13 Thread Rob Herring
On Tue, 13 Jul 2021 16:20:34 +0530, Viresh Kumar wrote: > gpio-virtio represents a virtio GPIO controller and this patch adds > binding for the same. The gpio-virtio subnode can be part of a > virtio,mmio node and is based on its binding. > > Signed-off-by: Viresh Kumar > --- > Depends on: > >

Re: [PATCH 3/5] dt-bindings: i2c: Add bindings for i2c-virtio

2021-07-13 Thread Rob Herring
On Tue, 13 Jul 2021 16:20:32 +0530, Viresh Kumar wrote: > i2c-virtio represents a virtio I2C device and this patch adds binding > for the same. The i2c-virtio subnode can be part of a virtio,mmio node > and is based on its binding. > > Cc: Wolfram Sang > Signed-off-by: Viresh Kumar > --- >

Re: [PATCH v9 16/17] vduse: Introduce VDUSE - vDPA Device in Userspace

2021-07-13 Thread Dan Carpenter
On Tue, Jul 13, 2021 at 04:46:55PM +0800, Xie Yongji wrote: > +static int vduse_dev_init_vdpa(struct vduse_dev *dev, const char *name) > +{ > + struct vduse_vdpa *vdev; > + int ret; > + > + if (dev->vdev) > + return -EEXIST; > + > + vdev = vdpa_alloc_device(struct

Re: [PATCH v9 13/17] vdpa: factor out vhost_vdpa_pa_map() and vhost_vdpa_pa_unmap()

2021-07-13 Thread Dan Carpenter
On Tue, Jul 13, 2021 at 04:46:52PM +0800, Xie Yongji wrote: > @@ -613,37 +618,28 @@ static void vhost_vdpa_unmap(struct vhost_vdpa *v, u64 > iova, u64 size) > } > } > > -static int vhost_vdpa_process_iotlb_update(struct vhost_vdpa *v, > -struct

Re: [PATCH v9 07/17] virtio: Don't set FAILED status bit on device index allocation failure

2021-07-13 Thread Dan Carpenter
On Tue, Jul 13, 2021 at 04:46:46PM +0800, Xie Yongji wrote: > We don't need to set FAILED status bit on device index allocation > failure since the device initialization hasn't been started yet. The commit message should say what the effect of this change is to the user. Is this a bugfix? Will

[PATCH 5/5] dt-bindings: gpio: Add bindings for gpio-virtio

2021-07-13 Thread Viresh Kumar
gpio-virtio represents a virtio GPIO controller and this patch adds binding for the same. The gpio-virtio subnode can be part of a virtio,mmio node and is based on its binding. Signed-off-by: Viresh Kumar --- Depends on:

[PATCH 4/5] i2c: virtio: Update i2c-adapter's of_node

2021-07-13 Thread Viresh Kumar
Set of_node of the adapter from the virtio device to enable automatic parsing the of the I2C devices present in DT. Cc: Wolfram Sang Signed-off-by: Viresh Kumar --- Depends on: https://lore.kernel.org/linux-i2c/984ebecaf697058eb73389ed14ead9dd6d38fb53.1625796246.git.jie.d...@intel.com/ ---

[PATCH 3/5] dt-bindings: i2c: Add bindings for i2c-virtio

2021-07-13 Thread Viresh Kumar
i2c-virtio represents a virtio I2C device and this patch adds binding for the same. The i2c-virtio subnode can be part of a virtio,mmio node and is based on its binding. Cc: Wolfram Sang Signed-off-by: Viresh Kumar --- .../devicetree/bindings/i2c/i2c-virtio.yaml | 59 +++ 1

[PATCH 2/5] virtio_mmio: Bind virtio device to device-tree node

2021-07-13 Thread Viresh Kumar
Bind the virtio device with its device protocol's sub-node. This will help users of the virtio device to mention their dependencies on the device in the DT file itself. Like GPIO pin users can use the phandle of the device node, or the node may contain more subnodes to add i2c or spi eeproms and

[PATCH 1/5] dt-bindings: virtio: mmio: Add support for device subnode

2021-07-13 Thread Viresh Kumar
Allow virtio,mmio nodes to contain device specific subnodes. Since each virtio,mmio node can represent a single virtio device, each virtio node is allowed to contain a maximum of one device specific subnode. The device subnode must have the "reg" property, and its value must match the virtio

[PATCH 0/5] virtio: Parse virtio-device nodes from DT

2021-07-13 Thread Viresh Kumar
Hi, Currently the DT only provides support for following node types for virtio-mmio nodes: virtio_mmio@a00 { dma-coherent; interrupts = <0x00 0x10 0x01>; reg = <0x00 0xa00 0x00 0x200>; compatible = "virtio,mmio";

[PATCH] uapi: virtio_ids: Add VIRTIO_ID_GPIO from OASIS spec

2021-07-13 Thread Viresh Kumar
Add GPIO's device type ID from the OASIS virtio spec. Signed-off-by: Viresh Kumar --- include/uapi/linux/virtio_ids.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h index 99aa27b100bc..477a0927e329 100644 ---

Re: [Question] virtio-net: About napi_tx

2021-07-13 Thread Willem de Bruijn
On Tue, Jul 13, 2021 at 3:04 AM lma wrote: > > Hi Willem and list, > > The napi_tx of virtio_net is enabled by default by commit 31c03aef. > > and the commit message mentioned: > In the unlikely case of regression, we have landed a credible > runtime > solution. Ethtool can configure it