Re: [PATCH v2 08/17] vdpa_sim: add supported_features field in vdpasim_dev_attr

2020-11-29 Thread Jason Wang
their features. Co-developed-by: Max Gurtovoy Signed-off-by: Max Gurtovoy Signed-off-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 29 ++--- 1 file changed, 18 insertions(+), 11 deletions(-) Acked-by: Jason Wang diff --git a/drivers/vdpa/vdpa_sim

Re: [PATCH v2 09/17] vdpa_sim: add work_fn in vdpasim_dev_attr

2020-11-29 Thread Jason Wang
changed, 5 insertions(+), 2 deletions(-) Acked-by: Jason Wang diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index 36677fc3631b..b84d9acd130c 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -60,6 +60,8 @@ struct

Re: [PATCH v2 07/17] vdpa_sim: add device id field in vdpasim_dev_attr

2020-11-29 Thread Jason Wang
-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) Acked-by: Jason Wang diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index f98262add0e1..393b54a9f0e4 100644 --- a/drivers/vdpa

Re: [PATCH v2 06/17] vdpa_sim: add struct vdpasim_dev_attr for device attributes

2020-11-29 Thread Jason Wang
parameter. Co-developed-by: Max Gurtovoy Signed-off-by: Max Gurtovoy Signed-off-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) Acked-by: Jason Wang diff --git a/drivers/vdpa/vdpa_sim

Re: [PATCH v2 05/17] vdpa_sim: rename vdpasim_config_ops variables

2020-11-29 Thread Jason Wang
/vdpa_sim.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) Acked-by: Jason Wang diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index 40664d87f303..62204e064841 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim

Re: [PATCH v2 04/17] vdpa_sim: remove the limit of IOTLB entries

2020-11-29 Thread Jason Wang
On 2020/11/26 下午10:49, Stefano Garzarella wrote: 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

Re: [PATCH v2 03/17] vdpa_sim: remove hard-coded virtq count

2020-11-29 Thread Jason Wang
Acked-by: Jason Wang --- v1: - use kcalloc() instead of kmalloc_array() since some function expects variables initialized to zero --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b

Re: [PATCH v2 02/17] vdpa_sim: remove unnecessary headers inclusion

2020-11-29 Thread Jason Wang
On 2020/11/26 下午10:49, Stefano Garzarella wrote: Some headers are not necessary, so let's remove them to do some cleaning. Signed-off-by: Stefano Garzarella --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 13 - 1 file changed, 13 deletions(-) diff --git

Re: [PATCH v2 01/17] vdpa: remove unnecessary 'default n' in Kconfig entries

2020-11-29 Thread Jason Wang
On 2020/11/26 下午10:49, Stefano Garzarella wrote: 'default n' is not necessary since it is already the default when nothing is specified. Suggested-by: Jason Wang Signed-off-by: Stefano Garzarella Acked-by: Jason Wang --- drivers/vdpa/Kconfig | 3 --- 1 file changed, 3 deletions

Re: [PATCH] vdpa: ifcvf: Use dma_set_mask_and_coherent to simplify code

2020-11-29 Thread Jason Wang
--- Acked-by: Jason Wang drivers/vdpa/ifcvf/ifcvf_main.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c index 8b4028556cb6..fa1af301cf55 100644 --- a/drivers/vdpa/ifcvf/ifcvf_main.c +++ b/drivers

Re: [PATCH v4] vdpa: mlx5: fix vdpa/vhost dependencies

2020-11-29 Thread Jason Wang
c: Parav Pandit Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: virtualizat...@lists.linux-foundation.org Cc: Saeed Mahameed Cc: Leon Romanovsky Cc: net...@vger.kernel.org --- v2: change from select to depends on VHOST (Saeed) v3: change to depends on VHOST_IOTLB (Jason) v4: use select V

Re: [PATCH V2 02/14] virtio-pci: switch to use devres for modern devices

2020-11-26 Thread Jason Wang
On 2020/11/26 下午9:57, Michael S. Tsirkin wrote: On Thu, Nov 26, 2020 at 05:25:52PM +0800, Jason Wang wrote: This patch tries to convert the modern device to use devres to manage its resources (iomaps). Before this patch the IO address is mapped individually according to the capability. After

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

2020-11-26 Thread Jason Wang
On 2020/11/26 下午9:46, Michael S. Tsirkin wrote: On Thu, Nov 26, 2020 at 05:25:51PM +0800, Jason Wang wrote: Instead of accessing iomem via virito_pci_device directly. Add an indirect level well this patch does not add any indirection it's just refactoring. which is ok of course let's just

[PATCH V2 06/14] virtio-pci-modern: introduce vp_modern_queue_address()

2020-11-26 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 b/drivers/virtio

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

2020-11-26 Thread Jason Wang
-by: Jason Wang --- drivers/vdpa/Kconfig | 6 + drivers/vdpa/Makefile | 1 + drivers/vdpa/virtio_pci/Makefile | 2 + drivers/vdpa/virtio_pci/vp_vdpa.c | 450 ++ 4 files changed, 459 insertions(+) create mode 100644 drivers/vdpa/virtio_pci

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

2020-11-26 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 b/drivers/virtio

[PATCH V2 11/14] virtio-pci: introduce modern device module

2020-11-26 Thread Jason Wang
currently. We can do that in the future if necessary. Signed-off-by: Jason Wang --- drivers/virtio/Kconfig | 10 +- drivers/virtio/Makefile| 1 + drivers/virtio/virtio_pci_common.h | 28 +- drivers/virtio/virtio_pci_modern.c | 462

[PATCH V2 12/14] vdpa: set the virtqueue num during register

2020-11-26 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 ++--- drivers/vdpa

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

2020-11-26 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 09/14] virtio-pci-modern: introduce helper for getting queue nums

2020-11-26 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 08/14] virtio-pci-modern: introduce helper for setting/geting queue size

2020-11-26 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 b/drivers

[PATCH V2 04/14] virtio-pci: move the notification sanity check to vp_modern_probe()

2020-11-26 Thread Jason Wang
This patch moves the notification sanity check to vp_modern_probe(). This can make sure the logic could be reused by modules other than virtio-pci. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 34 +++--- 1 file changed, 22 insertions(+), 12

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

2020-11-26 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 b/drivers/virtio

[PATCH V2 05/14] virtio-pci-modern: introduce vp_modern_set_queue_vector()

2020-11-26 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, 24 insertions(+), 11 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio

[PATCH V2 03/14] virtio-pci: split out modern device

2020-11-26 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 02/14] virtio-pci: switch to use devres for modern devices

2020-11-26 Thread Jason Wang
into an separate module. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_common.c | 10 -- drivers/virtio/virtio_pci_common.h | 2 + drivers/virtio/virtio_pci_legacy.c | 13 ++- drivers/virtio/virtio_pci_modern.c | 141 + 4 files changed, 54 insertions(+), 112 deletions

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

2020-11-26 Thread Jason Wang
Instead of accessing iomem via virito_pci_device directly. Add an indirect level to ease the life of splitting out modern virito-pci logic. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 76 ++ 1 file changed, 46 insertions(+), 30 deletions

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

2020-11-26 Thread Jason Wang
- Use dynamic id in order to be less confusing with virtio-pci driver - No feature whitelist, supporting any features (mq, config etc) Thanks Jason Wang (14): virtio-pci: do not access iomem via virtio_pci_device directly virtio-pci: switch to use devres for modern devices virtio-pci: split

Re: [PATCH RFC 02/12] vdpa: split vdpasim to core and net modules

2020-11-18 Thread Jason Wang
On 2020/11/18 下午9:14, Stefano Garzarella wrote: Hi Jason, I just discovered that I missed the other questions in this email, sorry for that! No problem :) On Mon, Nov 16, 2020 at 12:00:11PM +0800, Jason Wang wrote: On 2020/11/13 下午9:47, Stefano Garzarella wrote: From: Max Gurtovoy

Re: [PATCH] vringh: fix vringh_iov_push_*() documentation

2020-11-16 Thread Jason Wang
On 2020/11/17 上午12:16, Stefano Garzarella wrote: vringh_iov_push_*() functions don't have 'dst' parameter, but have the 'src' parameter. Replace 'dst' description with 'src' description. Signed-off-by: Stefano Garzarella Acked-by: Jason Wang --- drivers/vhost/vringh.c | 6

Re: [PATCH RFC 12/12] vdpa_sim_blk: implement ramdisk behaviour

2020-11-15 Thread Jason Wang
On 2020/11/13 下午9:47, Stefano Garzarella wrote: The previous implementation wrote only the status of each request. This patch implements a more accurate block device simulator, providing a ramdisk-like behavior. Also handle VIRTIO_BLK_T_GET_ID request, always answering the "vdpa_blk_sim"

Re: [PATCH RFC 11/12] vringh: allow vringh_iov_xfer() to skip bytes when ptr is NULL

2020-11-15 Thread Jason Wang
On 2020/11/13 下午9:47, Stefano Garzarella wrote: In some cases, it may be useful to provide a way to skip a number of bytes in a vringh_iov. In order to keep vringh_iov consistent, let's reuse vringh_iov_xfer() logic and skip bytes when the ptr is NULL. Signed-off-by: Stefano Garzarella ---

Re: [PATCH RFC 10/12] vdpa_sim: split vdpasim_virtqueue's iov field in riov and wiov

2020-11-15 Thread Jason Wang
them with vringh_getdesc_iotlb(). Signed-off-by: Stefano Garzarella Acked-by: Jason Wang --- drivers/vdpa/vdpa_sim/vdpa_sim.h | 3 ++- drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 6 +++--- drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 8 3 files changed, 9 insertions(+), 8 deletions

Re: [PATCH RFC 09/12] vdpa_sim: make vdpasim->buffer size configurable

2020-11-15 Thread Jason Wang
On 2020/11/13 下午9:47, Stefano Garzarella wrote: Allow each device to specify the size of the buffer allocated in vdpa_sim. Signed-off-by: Stefano Garzarella Acked-by: Jason Wang --- drivers/vdpa/vdpa_sim/vdpa_sim.h | 1 + drivers/vdpa/vdpa_sim/vdpa_sim.c | 2 +- drivers

Re: [PATCH RFC 07/12] vdpa_sim: move config management outside of the core

2020-11-15 Thread Jason Wang
/vdpa_sim/vdpa_sim.h +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.h @@ -10,8 +10,6 @@ #include #include #include -#include -#include #define DRV_VERSION "0.1" #define DRV_AUTHOR "Jason Wang " @@ -42,8 +40,11 @@ struct vdpasim_virtqueue { struct vdpasim_d

Re: [PATCH RFC 08/12] vdpa_sim: use kvmalloc to allocate vdpasim->buffer

2020-11-15 Thread Jason Wang
On 2020/11/13 下午9:47, Stefano Garzarella wrote: 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(). Signed-off-by: Stefano Garzarella Acked-by: Jason Wang Thanks --- drivers

Re: [PATCH RFC 05/12] vdpa_sim: remove the limit of IOTLB entries

2020-11-15 Thread Jason Wang
On 2020/11/13 下午9:47, Stefano Garzarella wrote: 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 Signed-off

Re: [PATCH RFC 06/12] vdpa_sim: add struct vdpasim_device to store device properties

2020-11-15 Thread Jason Wang
On 2020/11/13 下午9:47, Stefano Garzarella wrote: Move device properties used during the entire life cycle in a new structure to simplify the copy of these fields during the vdpasim initialization. Signed-off-by: Stefano Garzarella It would be better to do it before patch 2. ---

Re: [PATCH RFC 04/12] vdpa: add vdpa simulator for block device

2020-11-15 Thread Jason Wang
On 2020/11/13 下午9:47, Stefano Garzarella wrote: From: Max Gurtovoy This will allow running vDPA for virtio block protocol. Signed-off-by: Max Gurtovoy [sgarzare: various cleanups/fixes] Signed-off-by: Stefano Garzarella --- v1: - Removed unused headers - Used cpu_to_vdpasim*() to store

Re: [PATCH RFC 03/12] vdpa_sim: remove hard-coded virtq count

2020-11-15 Thread Jason Wang
On 2020/11/13 下午9:47, Stefano Garzarella wrote: 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()] Signed-off-by: Stefano Garzarella --- v1:

Re: [PATCH RFC 02/12] vdpa: split vdpasim to core and net modules

2020-11-15 Thread Jason Wang
_VDPA_SIM_H + +#include +#include +#include +#include +#include +#include + +#define DRV_VERSION "0.1" +#define DRV_AUTHOR "Jason Wang " +#define DRV_LICENSE "GPL v2" + +#define VDPASIM_QUEUE_ALIGN PAGE_SIZE +#define VDPASIM_QUEUE_MAX 256 +#define VDPASIM_VENDOR_ID

Re: [PATCH RFC 00/12] vdpa: generalize vdpa simulator and add block device

2020-11-15 Thread Jason Wang
On 2020/11/13 下午9:47, Stefano Garzarella wrote: Thanks to Max that started this work! I took his patches, and extended the block simulator a bit. 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,

Re: [PATCH v3] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-09 Thread Jason Wang
_pfn check to a WARN_ON() (Jason) Changes in v2: - Drop the reversion patch - Fix unhandled page leak towards the end of page_list Acked-by: Jason Wang Thanks drivers/vhost/vdpa.c | 80 1 file changed, 62 insertions(+), 18 deletions(-)

Re: [PATCH v2] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-09 Thread Jason Wang
On 2020/11/10 上午7:56, si-wei liu wrote: On 11/9/2020 2:42 PM, Michael S. Tsirkin wrote: On Mon, Nov 09, 2020 at 01:44:03PM -0800, si-wei liu wrote: On 11/8/2020 7:21 PM, Jason Wang wrote: On 2020/11/6 上午6:57, si-wei liu wrote: On 11/4/2020 7:26 PM, Jason Wang wrote: On 2020/11/5 上午7:33

Re: [PATCH virtio] virtio: virtio_console: fix DMA memory allocation for rproc serial

2020-11-08 Thread Jason Wang
On 2020/11/5 下午8:22, Alexander Lobakin wrote: From: Jason Wang Date: Thu, 5 Nov 2020 11:10:24 +0800 Hi Jason, On 2020/11/4 下午11:31, Alexander Lobakin wrote: Since commit 086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool"), every remoteproc has a DMA

Re: [PATCH v2] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-08 Thread Jason Wang
On 2020/11/6 上午6:57, si-wei liu wrote: On 11/4/2020 7:26 PM, Jason Wang wrote: On 2020/11/5 上午7:33, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages for the error path. The memory usage

Re: [PATCH v2] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-04 Thread Jason Wang
On 2020/11/5 上午7:33, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages for the error path. The memory usage for bookkeeping pinned pages is reverted to what it was before: only one single free page

Re: [PATCH 2/2] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-04 Thread Jason Wang
On 2020/11/5 上午7:40, si-wei liu wrote: On 11/3/2020 6:42 PM, Jason Wang wrote: On 2020/10/30 下午3:45, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages for the error path. The memory usage

Re: [PATCH virtio] virtio: virtio_console: fix DMA memory allocation for rproc serial

2020-11-04 Thread Jason Wang
On 2020/11/4 下午11:31, Alexander Lobakin wrote: Since commit 086d08725d34 ("remoteproc: create vdev subdevice with specific dma memory pool"), every remoteproc has a DMA subdevice ("remoteprocX#vdevYbuffer") for each virtio device, which inherits DMA capabilities from the corresponding platform

Re: [PATCH 2/2] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-03 Thread Jason Wang
On 2020/10/30 下午3:45, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages for the error path. The memory usage for bookkeeping pinned pages is reverted to what it was before: only one single free page

Re: [PATCH 2/2] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-03 Thread Jason Wang
On 2020/11/4 上午9:08, si-wei liu wrote: On 11/3/2020 5:06 PM, si-wei liu wrote: On 11/3/2020 5:00 AM, Jason Wang wrote: On 2020/10/30 下午3:45, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages

Re: [PATCH 2/2] vhost-vdpa: fix page pinning leakage in error path (rework)

2020-11-03 Thread Jason Wang
On 2020/10/30 下午3:45, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages for the error path. The memory usage for bookkeeping pinned pages is reverted to what it was before: only one single free page

Re: [PATCH] vhost/vsock: add IOTLB API support

2020-11-03 Thread Jason Wang
On 2020/11/3 上午1:11, Stefano Garzarella wrote: On Fri, Oct 30, 2020 at 07:44:43PM +0800, Jason Wang wrote: On 2020/10/30 下午6:54, Stefano Garzarella wrote: On Fri, Oct 30, 2020 at 06:02:18PM +0800, Jason Wang wrote: On 2020/10/30 上午1:43, Stefano Garzarella wrote: This patch enables

Re: [PATCH 1/2] Revert "vhost-vdpa: fix page pinning leakage in error path"

2020-11-03 Thread Jason Wang
On 2020/10/30 下午3:45, Si-Wei Liu wrote: This reverts commit 7ed9e3d97c32d969caded2dfb6e67c1a2cc5a0b1. Signed-off-by: Si-Wei Liu --- drivers/vhost/vdpa.c | 119 +-- 1 file changed, 48 insertions(+), 71 deletions(-) I saw this has been

Re: [PATCH] vhost/vsock: add IOTLB API support

2020-10-30 Thread Jason Wang
On 2020/10/30 下午6:54, Stefano Garzarella wrote: On Fri, Oct 30, 2020 at 06:02:18PM +0800, Jason Wang wrote: On 2020/10/30 上午1:43, Stefano Garzarella wrote: This patch enables the IOTLB API support for vhost-vsock devices, allowing the userspace to emulate an IOMMU for the guest

Re: [PATCH] vhost/vsock: add IOTLB API support

2020-10-30 Thread Jason Wang
On 2020/10/30 上午1:43, Stefano Garzarella wrote: This patch enables the IOTLB API support for vhost-vsock devices, allowing the userspace to emulate an IOMMU for the guest. These changes were made following vhost-net, in details this patch: - exposes VIRTIO_F_ACCESS_PLATFORM feature and inits

Re: [PATCH 0/2] vdpasim: allow to set MAC address

2020-10-29 Thread Jason Wang
/vdpa_sim.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) Acked-by: Jason Wang

Re: [PATCH] vdpa_sim: Fix DMA mask

2020-10-28 Thread Jason Wang
- dev->coherent_dma_mask = DMA_BIT_MASK(64); + dev->dma_mask = >coherent_dma_mask; + if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64))) + goto err_iommu; set_dma_ops(dev, _dma_ops); vdpasim->iommu = vhost_iotlb_alloc(2048, 0); Acked-by: Jason Wang

Re: [PATCH] vdpa/mlx5: Fix error return in map_direct_mr()

2020-10-26 Thread Jason Wang
- if (!ret) + err = dma_map_sg_attrs(dma, mr->sg_head.sgl, mr->nsg, DMA_BIDIRECTIONAL, 0); + if (!err) goto err_map; err = create_direct_mr(mvdev, mr); Acked-by: Jason Wang

[PATCH V4 3/3] vdpa_sim: implement get_iova_range()

2020-10-23 Thread Jason Wang
This implements a sample get_iova_range() for the simulator which advertise [0, ULLONG_MAX] as the valid range. Signed-off-by: Jason Wang --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa

[PATCH V4 0/3] vDPA: API for reporting IOVA range

2020-10-23 Thread Jason Wang
own DMA translation logic and assume a [0, ULLONG_MAX] range - mandate IOVA range only for IOMMU that forcing aperture - forbid the map which is out of the IOVA range in vhost-vDPA Jason Wang (3): vdpa: introduce config op to get valid iova range vhost: vdpa: report iova range vdpa_sim

[PATCH V4 2/3] vhost: vdpa: report iova range

2020-10-23 Thread Jason Wang
DOMAIN_ATTR_GEOMETRY, otherwise [0, ULLONG_MAX] is assumed. For safety, this patch also rules out the map request which is not in the valid range. Signed-off-by: Jason Wang --- drivers/vhost/vdpa.c | 41 include/uapi/linux/vhost.h | 4 include/uapi/linux

[PATCH V4 1/3] vdpa: introduce config op to get valid iova range

2020-10-23 Thread Jason Wang
This patch introduce a config op to get valid iova range from the vDPA device. Signed-off-by: Jason Wang --- include/linux/vdpa.h | 15 +++ 1 file changed, 15 insertions(+) diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index eae0bfd87d91..30bc7a7223bb 100644

Re: [PATCH V3 2/3] vhost: vdpa: report iova range

2020-10-23 Thread Jason Wang
, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Jason-Wang/vDPA-API-for-reporting-IOVA-range/20201023-102708 base: https://git.kernel.org/pub/scm/linux

[PATCH V3 2/3] vhost: vdpa: report iova range

2020-10-22 Thread Jason Wang
DOMAIN_ATTR_GEOMETRY, otherwise [0, ULLONG_MAX] is assumed. For safety, this patch also rules out the map request which is not in the valid range. Signed-off-by: Jason Wang --- drivers/vhost/vdpa.c | 40 include/uapi/linux/vhost.h | 4 include/uapi/linux

[PATCH V3 3/3] vdpa_sim: implement get_iova_range()

2020-10-22 Thread Jason Wang
This implements a sample get_iova_range() for the simulator which advertise [0, ULLONG_MAX] as the valid range. Signed-off-by: Jason Wang --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa

[PATCH V3 0/3] vDPA: API for reporting IOVA range

2020-10-22 Thread Jason Wang
, ULLONG_MAX] range - mandate IOVA range only for IOMMU that forcing aperture - forbid the map which is out of the IOVA range in vhost-vDPA Jason Wang (3): vdpa: introduce config op to get valid iova range vhost: vdpa: report iova range vdpa_sim: implement get_iova_range() drivers/vdpa/vdpa_sim

[PATCH V3 1/3] vdpa: introduce config op to get valid iova range

2020-10-22 Thread Jason Wang
This patch introduce a config op to get valid iova range from the vDPA device. Signed-off-by: Jason Wang --- include/linux/vdpa.h | 15 +++ 1 file changed, 15 insertions(+) diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h index eae0bfd87d91..30bc7a7223bb 100644

Re: [PATCH 0/4] vDPA: API for reporting IOVA range

2020-10-21 Thread Jason Wang
On 2020/10/21 下午10:45, Michael S. Tsirkin wrote: On Wed, Jun 17, 2020 at 11:29:43AM +0800, Jason Wang wrote: Hi All: This series introduces API for reporing IOVA range. This is a must for userspace to work correclty: - for the process that uses vhost-vDPA directly to properly allocate

Re: [PATCH v4] Revert "virtio-net: ethtool configurable RXCSUM"

2020-10-21 Thread Jason Wang
t have a control vq, everything breaks. Revert the original commit for now. Cc: Tonghao Zhang Cc: Willem de Bruijn Fixes: 3618ad2a7c0e7 ("virtio-net: ethtool configurable RXCSUM") Reported-by: kernel test robot Signed-off-by: Michael S. Tsirkin --- Acked-by: Jason Wang Same patch

Re: [PATCH 2/2] KVM: not link irqfd with a fake IRQ bypass producer

2020-10-20 Thread Jason Wang
On 2020/10/19 下午5:06, Zhenzhong Duan wrote: In case failure to setup Post interrupt for an IRQ, it make no sense to assign irqfd->producer to the producer. This change makes code more robust. It's better to describe what issue we will get without this patch. Thanks Signed-off-by:

Re: [PATCH 1/2] KVM: not register a IRQ bypass producer if unsupported or disabled

2020-10-20 Thread Jason Wang
On 2020/10/19 下午5:06, Zhenzhong Duan wrote: If Post interrupt is disabled due to hardware limit or forcely disabled by "intremap=nopost" parameter, return -EINVAL so that the legacy mode IRQ isn't registered as IRQ bypass producer. Is there any side effect if it was still registered?

Re: [PATCH net v2] Revert "virtio-net: ethtool configurable RXCSUM"

2020-10-20 Thread Jason Wang
On 2020/10/20 上午1:32, Michael S. Tsirkin wrote: This reverts commit 3618ad2a7c0e78e4258386394d5d5f92a3dbccf8. When the device does not have a control vq (e.g. when using a version of QEMU based on upstream v0.10 or older, or when specifying

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

2020-10-15 Thread Jason Wang
On 2020/10/14 下午4:37, Jie Deng wrote: On 2020/10/13 16:00, Jason Wang wrote: + +    virtqueue_kick(vq); + +    time_left = wait_for_completion_timeout(>completion, adap->timeout); +    if (!time_left) { +    dev_err(>dev, "msg[%d]: addr=0x%x timeout.

Re: [PATCH v3 2/2] vhost-vdpa: fix page pinning leakage in error path

2020-10-15 Thread Jason Wang
On 2020/10/14 上午7:42, si-wei liu wrote: So what I suggest is to fix the pinning leakage first and do the possible optimization on top (which is still questionable to me). OK. Unfortunately, this was picked and got merged in upstream. So I will post a follow up patch set to 1) revert the

Re: [PATCH v3 2/2] vhost-vdpa: fix page pinning leakage in error path

2020-10-14 Thread Jason Wang
On 2020/10/14 下午2:52, Michael S. Tsirkin wrote: On Tue, Oct 13, 2020 at 04:42:59PM -0700, si-wei liu wrote: On 10/9/2020 7:27 PM, Jason Wang wrote: On 2020/10/3 下午1:02, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up

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

2020-10-13 Thread Jason Wang
On 2020/10/13 下午3:16, Jie Deng wrote: On 2020/10/12 11:43, Jason Wang wrote: On 2020/10/12 上午10:45, Jie Deng wrote: On 2020/10/10 11:14, Jason Wang wrote: + +    virtqueue_kick(vq); + +    time_left = wait_for_completion_timeout(>completion, adap->t

Re: [RFC PATCH 10/24] vdpa: introduce config operations for associating ASID to a virtqueue group

2020-10-12 Thread Jason Wang
On 2020/10/12 下午4:17, Eli Cohen wrote: On Mon, Oct 12, 2020 at 03:45:10PM +0800, Jason Wang wrote: So in theory we can have several asid's (for different virtqueues), each one should be followed by a specific set_map call. If this is so, how do I know if I met all the conditions run my driver

Re: [RFC PATCH 10/24] vdpa: introduce config operations for associating ASID to a virtqueue group

2020-10-12 Thread Jason Wang
On 2020/10/12 下午2:59, Eli Cohen wrote: On Fri, Oct 09, 2020 at 11:56:45AM +0800, Jason Wang wrote: On 2020/10/1 下午9:29, Eli Cohen wrote: On Thu, Sep 24, 2020 at 11:21:11AM +0800, Jason Wang wrote: This patch introduces a new bus operation to allow the vDPA bus driver to associate an ASID

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

2020-10-11 Thread Jason Wang
On 2020/10/12 上午10:45, Jie Deng wrote: On 2020/10/10 11:14, Jason Wang wrote: + +    virtqueue_kick(vq); + +    time_left = wait_for_completion_timeout(>completion, adap->timeout); +    if (!time_left) { +    dev_err(>dev, "msg[%d]: addr=0x%x timeout.\

Re: [PATCH] vdpa/mlx5: should keep avail_index despite device status

2020-10-10 Thread Jason Wang
device be able to get to vq's avail_index, regardless of vDPA device status. Save the index that was last seen when virtq was stopped, so that userspace doesn't complain. Signed-off-by: Si-Wei Liu Acked-by: Jason Wang --- drivers/vdpa/mlx5/net/mlx5_vnet.c | 20 ++-- 1

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

2020-10-09 Thread Jason Wang
On 2020/9/22 上午10:58, 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. This driver communicates with the backend driver through a virtio I2C message

Re: [PATCH v3 3/3] vhost: Don't call log_access_ok() when using IOTLB

2020-10-09 Thread Jason Wang
that only checks accesses to the log for the used structure when there isn't an IOTLB device around. Signed-off-by: Greg Kurz Acked-by: Jason Wang In the future, we may consider to deprecate log_guest_addr since in any case regardless of IOTLB ennoblement we can get GPA from either IOTLB or

Re: [PATCH v3 2/3] vhost: Use vhost_get_used_size() in vhost_vring_set_addr()

2020-10-09 Thread Jason Wang
um * sizeof *vq->used->ring)) + vhost_get_used_size(vq, vq->num))) return -EINVAL; } Acked-by: Jason Wang

Re: [PATCH v3 2/2] vhost-vdpa: fix page pinning leakage in error path

2020-10-09 Thread Jason Wang
On 2020/10/3 下午1:02, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages for the error path. As the inflight pinned pages, specifically for memory region that strides across multiple chunks, would need

Re: [PATCH v3 1/2] vhost-vdpa: fix vhost_vdpa_map() on error condition

2020-10-09 Thread Jason Wang
flags(perm)); } + if (r) + vhost_iotlb_del_range(dev->iotlb, iova, iova + size - 1); + return r; } Acked-by: Jason Wang

Re: [PATCH v2] vringh: fix __vringh_iov() when riov and wiov are different

2020-10-08 Thread Jason Wang
On 2020/10/9 上午4:42, Stefano Garzarella wrote: If riov and wiov are both defined and they point to different objects, only riov is initialized. If the wiov is not initialized by the caller, the function fails returning -EINVAL and printing "Readable desc 0x... after writable" error message.

Re: [RFC PATCH 18/24] vhost-vdpa: support ASID based IOTLB API

2020-10-08 Thread Jason Wang
On 2020/9/28 下午11:44, Eugenio Perez Martin wrote: -u64 iova, u64 size) +static int vhost_vdpa_unmap(struct vhost_vdpa *v, + struct vhost_iotlb *iotlb, + u64 iova, u64 size) { struct vdpa_device *vdpa =

Re: [RFC PATCH 10/24] vdpa: introduce config operations for associating ASID to a virtqueue group

2020-10-08 Thread Jason Wang
On 2020/10/1 下午9:29, Eli Cohen wrote: On Thu, Sep 24, 2020 at 11:21:11AM +0800, Jason Wang wrote: This patch introduces a new bus operation to allow the vDPA bus driver to associate an ASID to a virtqueue group. So in case of virtio_net, I would expect that all the data virtqueues

Re: [RFC PATCH 09/24] vdpa: multiple address spaces support

2020-10-08 Thread Jason Wang
On 2020/10/1 下午9:23, Eli Cohen wrote: + /* Only support 1 address space */ + if (vdpa->ngroups != 1) + return -ENOTSUPP; Checkpatch warning: prefer EOPNOTSUPP Will fix. Thanks

Re: [RFC PATCH 09/24] vdpa: multiple address spaces support

2020-10-08 Thread Jason Wang
On 2020/10/1 下午9:21, Eli Cohen wrote: On Thu, Sep 24, 2020 at 11:21:10AM +0800, Jason Wang wrote: This patches introduces the multiple address spaces support for vDPA device. This idea is to identify a specific address space via an dedicated identifier - ASID. During vDPA device allocation

Re: [RFC PATCH 08/24] vdpa: introduce virtqueue groups

2020-10-08 Thread Jason Wang
On 2020/9/28 下午11:44, Eugenio Perez Martin wrote: On Thu, Sep 24, 2020 at 5:23 AM Jason Wang wrote: This patch introduces virtqueue groups to vDPA device. The virtqueue group is the minimal set of virtqueues that must share an address space. And the adddress space identifier could only

Re: [RFC PATCH 06/24] vhost-vdpa: switch to use vhost-vdpa specific IOTLB

2020-10-08 Thread Jason Wang
On 2020/9/30 下午8:02, Eli Cohen wrote: On Thu, Sep 24, 2020 at 11:21:07AM +0800, Jason Wang wrote: To ease the implementation of per group ASID support for vDPA device. This patch switches to use a vhost-vdpa specific IOTLB to avoid the unnecessary refactoring of the vhost core. Signed-off

Re: [RFC PATCH 05/24] vhost-vdpa: passing iotlb to IOMMU mapping helpers

2020-10-08 Thread Jason Wang
On 2020/9/30 下午7:26, Eli Cohen wrote: On Thu, Sep 24, 2020 at 11:21:06AM +0800, Jason Wang wrote: To prepare for the ASID support for vhost-vdpa, try to pass IOTLB object to dma helpers. Maybe it's worth mentioning here that this patch does not change any functionality and is presented

Re: [PATCH] vhost-vdpa: fix page pinning leakage in error path

2020-10-02 Thread Jason Wang
On 2020/10/2 上午4:23, Si-Wei Liu wrote: Pinned pages are not properly accounted particularly when mapping error occurs on IOTLB update. Clean up dangling pinned pages for the error path. As the inflight pinned pages, specifically for memory region that strides across multiple chunks, would need

Re: [RFC PATCH 02/24] vhost-vdpa: fix vqs leak in vhost_vdpa_open()

2020-09-25 Thread Jason Wang
On 2020/9/24 下午3:48, Eli Cohen wrote: On Thu, Sep 24, 2020 at 11:21:03AM +0800, Jason Wang wrote: We need to free vqs during the err path after it has been allocated since vhost won't do that for us. Signed-off-by: Jason Wang --- drivers/vhost/vdpa.c | 11 --- 1 file changed, 8

Re: [RFC PATCH 00/24] Control VQ support in vDPA

2020-09-25 Thread Jason Wang
On 2020/9/24 下午6:17, Stefan Hajnoczi wrote: On Thu, Sep 24, 2020 at 11:21:01AM +0800, Jason Wang wrote: This series tries to add the support for control virtqueue in vDPA. Please include documentation for both driver authors and vhost-vdpa ioctl users. vhost-vdpa ioctls are only documented

Re: [PATCH v3 -next] vdpa: mlx5: change Kconfig depends to fix build errors

2020-09-25 Thread Jason Wang
On 2020/9/25 下午6:19, Michael S. Tsirkin wrote: On Fri, Sep 25, 2020 at 10:20:05AM +0300, Leon Romanovsky wrote: On Thu, Sep 24, 2020 at 12:02:43PM -0400, Michael S. Tsirkin wrote: On Thu, Sep 24, 2020 at 08:47:05AM -0700, Randy Dunlap wrote: On 9/24/20 3:24 AM, Eli Cohen wrote: On Thu, Sep

Re: [RFC PATCH 02/24] vhost-vdpa: fix vqs leak in vhost_vdpa_open()

2020-09-25 Thread Jason Wang
On 2020/9/24 下午5:31, Michael S. Tsirkin wrote: On Thu, Sep 24, 2020 at 11:21:03AM +0800, Jason Wang wrote: We need to free vqs during the err path after it has been allocated since vhost won't do that for us. Signed-off-by: Jason Wang This is a bugfix too right? I don't see it posted

Re: [RFC PATCH 01/24] vhost-vdpa: fix backend feature ioctls

2020-09-24 Thread Jason Wang
On 2020/9/24 下午3:50, Michael S. Tsirkin wrote: On Thu, Sep 24, 2020 at 11:21:02AM +0800, Jason Wang wrote: Commit 653055b9acd4 ("vhost-vdpa: support get/set backend features") introduces two malfunction backend features ioctls: 1) the ioctls was blindly added to vring ioctl inste

<    1   2   3   4   5   6   7   8   9   10   >