Re: [PATCH v3 02/19] vdpa_sim: remove unnecessary headers inclusion

2020-12-03 Thread Stefano Garzarella
Hi Randy, On Thu, Dec 03, 2020 at 09:37:48AM -0800, Randy Dunlap wrote: On 12/3/20 9:04 AM, Stefano Garzarella wrote: Some headers are not necessary, so let's remove them to do some cleaning. Signed-off-by: Stefano Garzarella Hi, What makes you say that some of these are unnecessary?

Re: [PATCH v3 19/19] vdpa: split vdpasim to core and net modules

2020-12-03 Thread Stefano Garzarella
On Thu, Dec 03, 2020 at 09:25:52AM -0800, Randy Dunlap wrote: Hi, On 12/3/20 9:05 AM, Stefano Garzarella wrote: diff --git a/drivers/vdpa/Kconfig b/drivers/vdpa/Kconfig index 2c892e890b9e..b0f91ad8eb47 100644 --- a/drivers/vdpa/Kconfig +++ b/drivers/vdpa/Kconfig @@ -9,15 +9,20 @@ menuconfig

Re: [PATCH net-next] tun: fix ubuf refcount incorrectly on error path

2020-12-03 Thread Jason Wang
On 2020/12/3 下午4:00, wangyunjian wrote: From: Yunjian Wang After setting callback for ubuf_info of skb, the callback (vhost_net_zerocopy_callback) will be called to decrease the refcount when freeing skb. But when an exception occurs afterwards, the error handling in vhost handle_tx() will

[PATCH V2 19/19] vdpa: introduce virtio pci driver

2020-12-03 Thread Jason Wang
This patch introduce a vDPA driver for virtio-pci device. It bridges the virtio-pci control command to the vDPA bus. This will be used for features prototyping and testing. Note that get/restore virtqueue state is not supported which needs extension on the virtio specification. Signed-off-by:

[PATCH V2 18/19] virtio_vdpa: don't warn when fail to disable vq

2020-12-03 Thread Jason Wang
There's no guarantee that the device can disable a specific virtqueue through set_vq_ready(). One example is the modern virtio-pci device. So this patch removes the warning. Signed-off-by: Jason Wang --- drivers/virtio/virtio_vdpa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff

[PATCH V2 17/19] vdpa: set the virtqueue num during register

2020-12-03 Thread Jason Wang
This patch delay the queue number setting to vDPA device registering. This allows us to probe the virtqueue numbers between device allocation and registering. Signed-off-by: Jason Wang --- drivers/vdpa/ifcvf/ifcvf_main.c | 5 ++--- drivers/vdpa/mlx5/net/mlx5_vnet.c | 5 ++---

[PATCH V2 16/19] virtio-pci: introduce modern device module

2020-12-03 Thread Jason Wang
Signed-off-by: Jason Wang --- drivers/virtio/Kconfig | 10 +- drivers/virtio/Makefile| 1 + drivers/virtio/virtio_pci_common.h | 27 +- drivers/virtio/virtio_pci_modern.c | 617 - drivers/virtio/virtio_pci_modern_dev.c | 599

[PATCH V2 15/19] virito-pci-modern: rename map_capability() to vp_modern_map_capability()

2020-12-03 Thread Jason Wang
To ease the split, map_capability() was renamed to vp_modern_map_capability(). While at it, add the comments for the arguments and switch to use virtio_pci_modern_device as the first parameter. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 46 +++---

[PATCH V2 14/19] virtio-pci-modern: introduce helper to get notification offset

2020-12-03 Thread Jason Wang
This patch introduces help to get notification offset of modern device. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 21 - 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c

[PATCH V2 13/19] virtio-pci-modern: introduce helper for getting queue nums

2020-12-03 Thread Jason Wang
This patch introduces helper for getting queue num of modern device. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index

[PATCH V2 12/19] virtio-pci-modern: introduce helper for setting/geting queue size

2020-12-03 Thread Jason Wang
This patch introduces helper for setting/getting queue size for modern device. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 34 -- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c

[PATCH V2 11/19] virtio-pci-modern: introduce helper to set/get queue_enable

2020-12-03 Thread Jason Wang
This patch introduces a helper to set/get queue_enable for modern device. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 37 +- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c

[PATCH V2 10/19] virtio-pci-modern: introduce vp_modern_queue_address()

2020-12-03 Thread Jason Wang
This patch introduce a helper to set virtqueue address for modern address. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 33 -- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c

[PATCH V2 09/19] virtio-pci-modern: introduce vp_modern_set_queue_vector()

2020-12-03 Thread Jason Wang
This patch introduces a helper to set virtqueue MSI vector. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 35 -- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c

[PATCH V2 08/19] virtio-pci-modern: introduce vp_modern_generation()

2020-12-03 Thread Jason Wang
This patch introduces vp_modern_generation() to get device generation. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c

[PATCH V2 07/19] virtio-pci-modern: introduce helpers for setting and getting features

2020-12-03 Thread Jason Wang
This patch introduces helpers for setting and getting features. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 43 +++--- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c

[PATCH V2 06/19] virtio-pci-modern: introduce helpers for setting and getting status

2020-12-03 Thread Jason Wang
This patch introduces helpers to allow set and get device status. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 37 +++--- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c

[PATCH V2 05/19] virtio-pci-modern: introduce helper to set config vector

2020-12-03 Thread Jason Wang
This patch introduces vp_modern_config_vector() for setting config vector. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c

[PATCH V2 02/19] virtio-pci: split out modern device

2020-12-03 Thread Jason Wang
This patch splits out the virtio-pci modern device only attributes into another structure. While at it, a dedicated probe method for modern only attributes is introduced. This may help for split the logic into a dedicated module. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_common.h

[PATCH V2 04/19] virtio-pci-modern: introduce vp_modern_remove()

2020-12-03 Thread Jason Wang
This patch introduces vp_modern_remove() doing device resources cleanup to make it can be used. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c

[PATCH V2 01/19] virtio-pci: do not access iomem via struct virtio_pci_device directly

2020-12-03 Thread Jason Wang
Instead of accessing iomem via struct virito_pci_device directly, tweak to call the io accessors through the iomem structure. This will ease the splitting of modern virtio device logic. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 76 ++ 1 file

[PATCH V2 03/19] virtio-pci-modern: factor out modern device initialization logic

2020-12-03 Thread Jason Wang
This patch factors out the modern device initialization logic into a helper. Note that it still depends on the caller to enable pci device which allows the caller to use e.g devres. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 50 +- 1 file

[PATCH V2 00/19] vDPA driver for virtio-pci device

2020-12-03 Thread Jason Wang
Hi all: This series tries to implement a vDPA driver for virtio-pci device which will bridge between vDPA bus and virtio-pci device. This could be used for future feature prototyping and testing. Please review Changes from V2: - don't try to use devres for virtio-pci core - tweak the commit

Re: [PATCH v2 2/2] drivers: gpio: add virtio-gpio guest driver

2020-12-03 Thread Jason Wang
On 2020/12/4 上午3:11, Enrico Weigelt, metux IT consult wrote: Introducing new gpio driver for virtual GPIO devices via virtio. The driver allows routing gpio control into VM guests, eg. brigding virtual gpios to specific host gpios, or attaching simulators for automatic application testing.

Re: [PATCH] vdpa/mlx5: Use random MAC for the vdpa net instance

2020-12-03 Thread Jason Wang
On 2020/12/3 下午8:24, Eli Cohen wrote: It is mentioned in Parav's patchset that this will be coming in a subsequent patch to his vdpa tool. So I think kernel has two options: - require a mac when device is created, we supply it to guest Yes, the driver should always set VIRTIO_NET_F_MAC and

Re: [PATCH v3 02/19] vdpa_sim: remove unnecessary headers inclusion

2020-12-03 Thread Randy Dunlap
On 12/3/20 9:04 AM, Stefano Garzarella wrote: > Some headers are not necessary, so let's remove them to do > some cleaning. > > Signed-off-by: Stefano Garzarella Hi, What makes you say that some of these are unnecessary? Please use Rule #1 from Documentation/process/submit-checklist.rst: 1)

Re: [PATCH v3 19/19] vdpa: split vdpasim to core and net modules

2020-12-03 Thread Randy Dunlap
Hi, On 12/3/20 9:05 AM, Stefano Garzarella wrote: > diff --git a/drivers/vdpa/Kconfig b/drivers/vdpa/Kconfig > index 2c892e890b9e..b0f91ad8eb47 100644 > --- a/drivers/vdpa/Kconfig > +++ b/drivers/vdpa/Kconfig > @@ -9,15 +9,20 @@ menuconfig VDPA > if VDPA > > config VDPA_SIM > - tristate

[PATCH v3 19/19] vdpa: split vdpasim to core and net modules

2020-12-03 Thread Stefano Garzarella
From: Max Gurtovoy Introduce new vdpa_sim_net and vdpa_sim (core) drivers. This is a preparation for adding a vdpa simulator module for block devices. Signed-off-by: Max Gurtovoy [sgarzare: various cleanups/fixes] Signed-off-by: Stefano Garzarella --- v2: - Fixed "warning: variable 'dev' is

[PATCH v3 18/19] vdpa_sim: split vdpasim_virtqueue's iov field in out_iov and in_iov

2020-12-03 Thread Stefano Garzarella
vringh_getdesc_iotlb() manages 2 iovs for writable and readable descriptors. This is very useful for the block device, where for each request we have both types of descriptor. Let's split the vdpasim_virtqueue's iov field in out_iov and in_iov to use them with vringh_getdesc_iotlb(). We are

[PATCH v3 17/19] vdpa_sim: make vdpasim->buffer size configurable

2020-12-03 Thread Stefano Garzarella
Allow each device to specify the size of the buffer allocated in vdpa_sim. Acked-by: Jason Wang Signed-off-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c

[PATCH v3 16/19] vdpa_sim: use kvmalloc to allocate vdpasim->buffer

2020-12-03 Thread Stefano Garzarella
The next patch will make the buffer size configurable from each device. Since the buffer could be larger than a page, we use kvmalloc() instead of kmalloc(). Acked-by: Jason Wang Signed-off-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 4 ++-- 1 file changed, 2 insertions(+), 2

[PATCH v3 15/19] vdpa_sim: set vringh notify callback

2020-12-03 Thread Stefano Garzarella
Instead of calling the vq callback directly, we can leverage the vringh_notify() function, adding vdpasim_vq_notify() and setting it in the vringh notify callback. Suggested-by: Jason Wang Signed-off-by: Stefano Garzarella --- v3: - cleared notify during reset [Jason] ---

[PATCH v3 14/19] vdpa_sim: add set_config callback in vdpasim_dev_attr

2020-12-03 Thread Stefano Garzarella
The set_config callback can be used by the device to parse the config structure modified by the driver. The callback will be invoked, if set, in vdpasim_set_config() after copying bytes from caller buffer into vdpasim->config buffer. Signed-off-by: Stefano Garzarella ---

[PATCH v3 13/19] vdpa_sim: add get_config callback in vdpasim_dev_attr

2020-12-03 Thread Stefano Garzarella
The get_config callback can be used by the device to fill the config structure. The callback will be invoked in vdpasim_get_config() before copying bytes into caller buffer. Move vDPA-net config updates from vdpasim_set_features() in the new vdpasim_net_get_config() callback. Signed-off-by:

[PATCH v3 12/19] vdpa_sim: make 'config' generic and usable for any device type

2020-12-03 Thread Stefano Garzarella
Add new 'config_size' attribute in 'vdpasim_dev_attr' and allocates 'config' dynamically to support any device types. Signed-off-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git

[PATCH v3 11/19] vdpa_sim: store parsed MAC address in a buffer

2020-12-03 Thread Stefano Garzarella
As preparation for the next patches, we store the MAC address, parsed during the vdpasim_create(), in a buffer that will be used to fill 'config' together with other configurations. Acked-by: Jason Wang Signed-off-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 10 +++--- 1

[PATCH v3 08/19] vdpa_sim: add device id field in vdpasim_dev_attr

2020-12-03 Thread Stefano Garzarella
Remove VDPASIM_DEVICE_ID macro and add 'id' field in vdpasim_dev_attr, that will be returned by vdpasim_get_device_id(). Use VIRTIO_ID_NET for vDPA-net simulator device id. Co-developed-by: Max Gurtovoy Signed-off-by: Max Gurtovoy Acked-by: Jason Wang Signed-off-by: Stefano Garzarella ---

[PATCH v3 10/19] vdpa_sim: add work_fn in vdpasim_dev_attr

2020-12-03 Thread Stefano Garzarella
Rename vdpasim_work() in vdpasim_net_work() and add it to the vdpasim_dev_attr structure. Co-developed-by: Max Gurtovoy Signed-off-by: Max Gurtovoy Acked-by: Jason Wang Signed-off-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 7 +-- 1 file changed, 5 insertions(+), 2

[PATCH v3 09/19] vdpa_sim: add supported_features field in vdpasim_dev_attr

2020-12-03 Thread Stefano Garzarella
Introduce a new VDPASIM_FEATURES macro with the generic features supported by the vDPA simulator, and VDPASIM_NET_FEATURES macro with vDPA-net features. Add 'supported_features' field in vdpasim_dev_attr, to allow devices to specify their features. Co-developed-by: Max Gurtovoy Signed-off-by:

[PATCH v3 07/19] vdpa_sim: add struct vdpasim_dev_attr for device attributes

2020-12-03 Thread Stefano Garzarella
vdpasim_dev_attr will contain device specific attributes. We starting moving the number of virtqueues (i.e. nvqs) to vdpasim_dev_attr. vdpasim_create() creates a new vDPA simulator following the device attributes defined in the vdpasim_dev_attr parameter. Co-developed-by: Max Gurtovoy

[PATCH v3 06/19] vdpa_sim: rename vdpasim_config_ops variables

2020-12-03 Thread Stefano Garzarella
These variables store generic callbacks used by the vDPA simulator core, so we can remove the 'net' word in their names. Co-developed-by: Max Gurtovoy Signed-off-by: Max Gurtovoy Acked-by: Jason Wang Signed-off-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 12 ++-- 1

[PATCH v3 05/19] vdpa_sim: remove the limit of IOTLB entries

2020-12-03 Thread Stefano Garzarella
The simulated devices can support multiple queues, so this limit should be defined according to the number of queues supported by the device. Since we are in a simulator, let's simply remove that limit. Suggested-by: Jason Wang Acked-by: Jason Wang Signed-off-by: Stefano Garzarella --- v3: -

[PATCH v3 04/19] vhost/iotlb: add VHOST_IOTLB_UNLIMITED macro

2020-12-03 Thread Stefano Garzarella
It's possible to allocate an unlimited IOTLB calling vhost_iotlb_alloc() with 'limit' = 0. Add a new macro (VHOST_IOTLB_UNLIMITED) for this case and document it in the vhost_iotlb_alloc() documentation block. Suggested-by: Jason Wang Signed-off-by: Stefano Garzarella ---

[PATCH v3 03/19] vdpa_sim: remove hard-coded virtq count

2020-12-03 Thread Stefano Garzarella
From: Max Gurtovoy Add a new attribute that will define the number of virt queues to be created for the vdpasim device. Signed-off-by: Max Gurtovoy [sgarzare: replace kmalloc_array() with kcalloc()] Acked-by: Jason Wang Signed-off-by: Stefano Garzarella --- v1: - use kcalloc() instead of

[PATCH v3 01/19] vdpa: remove unnecessary 'default n' in Kconfig entries

2020-12-03 Thread Stefano Garzarella
'default n' is not necessary since it is already the default when nothing is specified. Suggested-by: Jason Wang Acked-by: Jason Wang Signed-off-by: Stefano Garzarella --- drivers/vdpa/Kconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/vdpa/Kconfig b/drivers/vdpa/Kconfig

[PATCH v3 02/19] vdpa_sim: remove unnecessary headers inclusion

2020-12-03 Thread Stefano Garzarella
Some headers are not necessary, so let's remove them to do some cleaning. Signed-off-by: Stefano Garzarella --- v3: - avoided to remove some headers with structures and functions directly used (device.h, slab.h, virtio_byteorder.h)[Jason] --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 10 --

[PATCH v3 00/19] vdpa: generalize vdpa simulator

2020-12-03 Thread Stefano Garzarella
This series moves the network device simulator in a new module (vdpa_sim_net) and leaves the generic functions in the vdpa_sim core module, allowing the possibility to add new vDPA device simulators. For now I removed the vdpa-blk simulator patches, since I'm still working on them and debugging

Re: [PATCH 14/15] drm/vmwgfx: Remove references to struct drm_device.pdev

2020-12-03 Thread Daniel Vetter
On Thu, Dec 03, 2020 at 03:06:20AM +, Zack Rusin wrote: > > > > On Dec 2, 2020, at 11:03, Daniel Vetter wrote: > > > > On Wed, Dec 2, 2020 at 4:37 PM Zack Rusin wrote: > >> > >> > >> > >>> On Dec 2, 2020, at 09:27, Thomas Zimmermann wrote: > >>> > >>> Hi > >>> > >>> Am 02.12.20 um

Re: [PATCH] vdpa/mlx5: Use random MAC for the vdpa net instance

2020-12-03 Thread Michael S. Tsirkin
On Thu, Dec 03, 2020 at 02:09:29PM +0200, Eli Cohen wrote: > On Thu, Dec 03, 2020 at 05:44:17AM -0500, Michael S. Tsirkin wrote: > > On Thu, Dec 03, 2020 at 08:49:28AM +0200, Eli Cohen wrote: > > > On Wed, Dec 02, 2020 at 05:00:22PM -0500, Michael S. Tsirkin wrote: > > > > On Wed, Dec 02, 2020 at

Re: [PATCH] vdpa/mlx5: Use random MAC for the vdpa net instance

2020-12-03 Thread Michael S. Tsirkin
On Thu, Dec 03, 2020 at 08:49:28AM +0200, Eli Cohen wrote: > On Wed, Dec 02, 2020 at 05:00:22PM -0500, Michael S. Tsirkin wrote: > > On Wed, Dec 02, 2020 at 09:48:25PM +0800, Jason Wang wrote: > > > > > > On 2020/12/2 下午5:23, Michael S. Tsirkin wrote: > > > > On Wed, Dec 02, 2020 at 07:57:14AM