[PATCH V3 0/7] mdev based hardware virtio offloading support

2019-10-11 Thread Jason Wang
Hi all: There are hardware that can do virtio datapath offloading while having its own control path. This path tries to implement a mdev based unified API to support using kernel virtio driver to drive those devices. This is done by introducing a new mdev transport for virtio (virtio_mdev) and

[PATCH V3 1/7] mdev: class id support

2019-10-11 Thread Jason Wang
Mdev bus only supports vfio driver right now, so it doesn't implement match method. But in the future, we may add drivers other than vfio, the first driver could be virtio-mdev. This means we need to add device class id support in bus match method to pair the mdev device and mdev driver correctly.

[PATCH V3 4/7] mdev: introduce device specific ops

2019-10-11 Thread Jason Wang
Currently, except for the create and remove, the rest of mdev_parent_ops is designed for vfio-mdev driver only and may not help for kernel mdev driver. With the help of class id, this patch introduces device specific callbacks inside mdev_device structure. This allows different set of callback to

[PATCH V3 3/7] modpost: add support for mdev class id

2019-10-11 Thread Jason Wang
Add support to parse mdev class id table. Signed-off-by: Jason Wang --- drivers/vfio/mdev/vfio_mdev.c | 2 ++ scripts/mod/devicetable-offsets.c | 3 +++ scripts/mod/file2alias.c | 10 ++ 3 files changed, 15 insertions(+) diff --git a/drivers/vfio/mdev/vfio_mdev.c

[PATCH V3 5/7] mdev: introduce virtio device and its device ops

2019-10-11 Thread Jason Wang
This patch implements basic support for mdev driver that supports virtio transport for kernel virtio driver. Signed-off-by: Jason Wang --- include/linux/mdev.h| 1 + include/linux/virtio_mdev.h | 148 2 files changed, 149 insertions(+) create mode

[PATCH V3 2/7] mdev: bus uevent support

2019-10-11 Thread Jason Wang
This patch adds bus uevent support for mdev bus in order to allow cooperation with userspace. Signed-off-by: Jason Wang --- drivers/vfio/mdev/mdev_driver.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/vfio/mdev/mdev_driver.c b/drivers/vfio/mdev/mdev_driver.c index

[PATCH V3 6/7] virtio: introduce a mdev based transport

2019-10-11 Thread Jason Wang
This patch introduces a new mdev transport for virtio. This is used to use kernel virtio driver to drive the mediated device that is capable of populating virtqueue directly. A new virtio-mdev driver will be registered to the mdev bus, when a new virtio-mdev device is probed, it will register the

[PATCH V3 7/7] docs: sample driver to demonstrate how to implement virtio-mdev framework

2019-10-11 Thread Jason Wang
This sample driver creates mdev device that simulate virtio net device over virtio mdev transport. The device is implemented through vringh and workqueue. A device specific dma ops is to make sure HVA is used directly as the IOVA. This should be sufficient for kernel virtio driver to work. Only

Re: [RFC PATCH 07/13] vsock: handle buffer_size sockopts in the core

2019-10-11 Thread Stefan Hajnoczi
On Thu, Oct 10, 2019 at 11:32:54AM +0200, Stefano Garzarella wrote: > On Wed, Oct 09, 2019 at 01:30:26PM +0100, Stefan Hajnoczi wrote: > > On Fri, Sep 27, 2019 at 01:26:57PM +0200, Stefano Garzarella wrote: > > Another issue is that this patch drops the VIRTIO_VSOCK_MAX_BUF_SIZE > > limit that

Re: [RFC PATCH 07/13] vsock: handle buffer_size sockopts in the core

2019-10-11 Thread Stefano Garzarella
On Fri, Oct 11, 2019 at 09:27:14AM +0100, Stefan Hajnoczi wrote: > On Thu, Oct 10, 2019 at 11:32:54AM +0200, Stefano Garzarella wrote: > > On Wed, Oct 09, 2019 at 01:30:26PM +0100, Stefan Hajnoczi wrote: > > > On Fri, Sep 27, 2019 at 01:26:57PM +0200, Stefano Garzarella wrote: > > > Another issue

[vhost:vhost 6/6] drivers/vhost/vhost.c:2672:9: error: 'desc' undeclared

2019-10-11 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git vhost head: 2b91e7f7cb5a6f12a2f43b200cb2d65a218237ed commit: 2b91e7f7cb5a6f12a2f43b200cb2d65a218237ed [6/6] vhost: batching fetches config: mips-allmodconfig (attached as .config) compiler: mips-linux-gcc (GCC) 7.4.0

Re: [PATCH net 0/2] vsock: don't allow half-closed socket in the host transports

2019-10-11 Thread Stefano Garzarella
On Fri, Oct 11, 2019 at 10:19:13AM -0400, Michael S. Tsirkin wrote: > On Fri, Oct 11, 2019 at 03:07:56PM +0200, Stefano Garzarella wrote: > > We are implementing a test suite for the VSOCK sockets and we discovered > > that vmci_transport never allowed half-closed socket on the host side. > > > >

Re: [PATCH net 2/2] vhost/vsock: don't allow half-closed socket in the host

2019-10-11 Thread Stefano Garzarella
On Fri, Oct 11, 2019 at 10:26:34AM -0400, Michael S. Tsirkin wrote: > On Fri, Oct 11, 2019 at 03:07:58PM +0200, Stefano Garzarella wrote: > > vmci_transport never allowed half-closed socket on the host side. > > In order to provide the same behaviour, we changed the > >

Re: [PATCH net 1/2] vsock: add half-closed socket details in the implementation notes

2019-10-11 Thread Stefano Garzarella
On Fri, Oct 11, 2019 at 10:22:30AM -0400, Michael S. Tsirkin wrote: > On Fri, Oct 11, 2019 at 03:07:57PM +0200, Stefano Garzarella wrote: > > vmci_transport never allowed half-closed socket on the host side. > > Since we want to have the same behaviour across all transports, we > > add a section

Re: [PATCH net 1/2] vsock: add half-closed socket details in the implementation notes

2019-10-11 Thread Michael S. Tsirkin
On Fri, Oct 11, 2019 at 03:07:57PM +0200, Stefano Garzarella wrote: > vmci_transport never allowed half-closed socket on the host side. > Since we want to have the same behaviour across all transports, we > add a section in the "Implementation notes". > > Cc: Jorgen Hansen > Cc: Adit Ranadive >

Re: [PATCH v4 1/5] vsock/virtio: limit the memory used per-socket

2019-10-11 Thread Stefano Garzarella
On Fri, Oct 11, 2019 at 10:11:19AM -0400, Michael S. Tsirkin wrote: > On Fri, Oct 11, 2019 at 03:40:48PM +0200, Stefano Garzarella wrote: > > On Sun, Sep 1, 2019 at 8:56 AM Michael S. Tsirkin wrote: > > > On Fri, Aug 30, 2019 at 11:40:59AM +0200, Stefano Garzarella wrote: > > > > On Mon, Jul 29,

Re: [PATCH net 2/2] vhost/vsock: don't allow half-closed socket in the host

2019-10-11 Thread Michael S. Tsirkin
On Fri, Oct 11, 2019 at 03:07:58PM +0200, Stefano Garzarella wrote: > vmci_transport never allowed half-closed socket on the host side. > In order to provide the same behaviour, we changed the > vhost_transport_stream_has_data() to return 0 (no data available) > if the peer (guest) closed the

[vhost:vhost 6/6] drivers/vhost/vhost.c:2672:9: error: 'desc' undeclared; did you mean 'rdtsc'?

2019-10-11 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git vhost head: 2b91e7f7cb5a6f12a2f43b200cb2d65a218237ed commit: 2b91e7f7cb5a6f12a2f43b200cb2d65a218237ed [6/6] vhost: batching fetches config: x86_64-allmodconfig (attached as .config) compiler: gcc-7 (Debian 7.4.0-13) 7.4.0

[PATCH 2/2] virtio_ring: Use DMA API if memory is encrypted

2019-10-11 Thread Ram Pai
From: Thiago Jung Bauermann Normally, virtio enables DMA API with VIRTIO_F_IOMMU_PLATFORM, which must be set by both device and guest driver. However, as a hack, when DMA API returns physical addresses, guest driver can use the DMA API; even though device does not set VIRTIO_F_IOMMU_PLATFORM and

[PATCH 1/2] dma-mapping: Add dma_addr_is_phys_addr()

2019-10-11 Thread Ram Pai
From: Thiago Jung Bauermann In order to safely use the DMA API, virtio needs to know whether DMA addresses are in fact physical addresses and for that purpose, dma_addr_is_phys_addr() is introduced. cc: Benjamin Herrenschmidt cc: David Gibson cc: Michael Ellerman cc: Paul Mackerras cc:

[PATCH 0/2] virtio: Support encrypted memory on powerpc secure guests

2019-10-11 Thread Ram Pai
**We would like the patches to be merged through the virtio tree. Please review, and ack merging the DMA mapping change through that tree. Thanks!** The memory of powerpc secure guests can't be accessed by the hypervisor / virtio device except for a few memory regions designated as 'shared'.

Re: [PATCH 0/2] virtio: Support encrypted memory on powerpc secure guests

2019-10-11 Thread Ram Pai
Hmm.. git-send-email forgot to CC Michael Tsirkin, and Thiago; the original author, who is on vacation. Adding them now. RP On Fri, Oct 11, 2019 at 06:25:17PM -0700, Ram Pai wrote: > **We would like the patches to be merged through the virtio tree. Please > review, and ack merging the DMA

Re: [PATCH v4 1/5] vsock/virtio: limit the memory used per-socket

2019-10-11 Thread Stefano Garzarella
On Sun, Sep 1, 2019 at 8:56 AM Michael S. Tsirkin wrote: > On Fri, Aug 30, 2019 at 11:40:59AM +0200, Stefano Garzarella wrote: > > On Mon, Jul 29, 2019 at 10:04:29AM -0400, Michael S. Tsirkin wrote: > > > On Wed, Jul 17, 2019 at 01:30:26PM +0200, Stefano Garzarella wrote: > > > > Since

[PATCH RFC v1 2/2] vhost: batching fetches

2019-10-11 Thread Michael S. Tsirkin
With this patch applied, new and old code perform identically. Lots of extra optimizations are now possible, e.g. we can fetch multiple heads with copy_from/to_user now. We can get rid of maintaining the log array. Etc etc. Signed-off-by: Michael S. Tsirkin --- drivers/vhost/test.c | 2 +-

[PATCH RFC v1 0/2] vhost: ring format independence

2019-10-11 Thread Michael S. Tsirkin
So the idea is as follows: we convert descriptors to an independent format first, and process that converting to iov later. The point is that we have a tight loop that fetches descriptors, which is good for cache utilization. This will also allow all kind of batching tricks - e.g. it seems

[PATCH RFC v1 1/2] vhost: option to fetch descriptors through an independent struct

2019-10-11 Thread Michael S. Tsirkin
The idea is to support multiple ring formats by converting to a format-independent array of descriptors. This costs extra cycles, but we gain in ability to fetch a batch of descriptors in one go, which is good for code cache locality. To simplify benchmarking, I kept the old code around so one

Re: [PATCH net 0/2] vsock: don't allow half-closed socket in the host transports

2019-10-11 Thread Michael S. Tsirkin
On Fri, Oct 11, 2019 at 03:07:56PM +0200, Stefano Garzarella wrote: > We are implementing a test suite for the VSOCK sockets and we discovered > that vmci_transport never allowed half-closed socket on the host side. > > As Jorgen explained [1] this is due to the implementation of VMCI. > > Since

[PATCH net 1/2] vsock: add half-closed socket details in the implementation notes

2019-10-11 Thread Stefano Garzarella
vmci_transport never allowed half-closed socket on the host side. Since we want to have the same behaviour across all transports, we add a section in the "Implementation notes". Cc: Jorgen Hansen Cc: Adit Ranadive Signed-off-by: Stefano Garzarella --- net/vmw_vsock/af_vsock.c | 4 1 file

[PATCH net 0/2] vsock: don't allow half-closed socket in the host transports

2019-10-11 Thread Stefano Garzarella
We are implementing a test suite for the VSOCK sockets and we discovered that vmci_transport never allowed half-closed socket on the host side. As Jorgen explained [1] this is due to the implementation of VMCI. Since we want to have the same behaviour across all transports, this series adds a

[PATCH net 2/2] vhost/vsock: don't allow half-closed socket in the host

2019-10-11 Thread Stefano Garzarella
vmci_transport never allowed half-closed socket on the host side. In order to provide the same behaviour, we changed the vhost_transport_stream_has_data() to return 0 (no data available) if the peer (guest) closed the connection. Signed-off-by: Stefano Garzarella --- drivers/vhost/vsock.c | 17

Re: [PATCH v4 1/5] vsock/virtio: limit the memory used per-socket

2019-10-11 Thread Michael S. Tsirkin
On Fri, Oct 11, 2019 at 03:40:48PM +0200, Stefano Garzarella wrote: > On Sun, Sep 1, 2019 at 8:56 AM Michael S. Tsirkin wrote: > > On Fri, Aug 30, 2019 at 11:40:59AM +0200, Stefano Garzarella wrote: > > > On Mon, Jul 29, 2019 at 10:04:29AM -0400, Michael S. Tsirkin wrote: > > > > On Wed, Jul 17,