[PATCH V3 09/11] vhost-scsi: flush IO vqs then send TMF rsp

2021-10-21 Thread Mike Christie
With one worker we will always send the scsi cmd responses then send the TMF rsp, because LIO will always complete the scsi cmds first then call into us to send the TMF response. With multiple workers, one of the IO vq threads could be run after the TMF is queued, so this has us flush all the IO

[PATCH V3 11/11] vhost: allow userspace to create workers

2021-10-21 Thread Mike Christie
This patch allows userspace to create workers and bind them to vqs. You can have N workers per dev and also share N workers with M vqs. Signed-off-by: Mike Christie --- drivers/vhost/vhost.c| 99 drivers/vhost/vhost.h| 2 +-

[PATCH V3 07/11] vhost-scsi: make SCSI cmd completion per vq

2021-10-21 Thread Mike Christie
This patch separates the scsi cmd completion code paths so we can complete cmds based on their vq instead of having all cmds complete on the same worker/CPU. This will be useful with the next patches that allow us to create mulitple worker threads and bind them to different vqs, so we can have

[PATCH V3 10/11] vhost: remove device wide queu/flushing helpers

2021-10-21 Thread Mike Christie
vhost_work_queue and vhost_work_dev_flush are no longer used, so drop them. Signed-off-by: Mike Christie --- drivers/vhost/vhost.c | 12 drivers/vhost/vhost.h | 2 -- 2 files changed, 14 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index

[PATCH V3 08/11] vhost-scsi: convert to vq helpers

2021-10-21 Thread Mike Christie
Convert from vhost dev based helpers to vq ones. Signed-off-by: Mike Christie --- drivers/vhost/scsi.c | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 0d85ddb68420..08beba73ada4 100644 ---

[PATCH V3 06/11] vhost-sock: convert to vq helpers

2021-10-21 Thread Mike Christie
Convert from vhost dev based helpers to vq ones. Signed-off-by: Mike Christie --- drivers/vhost/vsock.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 938aefbc75ec..c50c60d0955e 100644 --- a/drivers/vhost/vsock.c

[PATCH V3 04/11] vhost: take worker or vq instead of dev for flushing

2021-10-21 Thread Mike Christie
This patch has the core work flush function take a worker for when we support multiple workers. It also adds a helper that takes a vq during flushing so modules can control which vq/worker to flush. This temp leaves vhost_work_dev_flush. It will be removed when the drivers are converted in the

[PATCH V3 03/11] vhost: take worker or vq instead of dev for queueing

2021-10-21 Thread Mike Christie
This patch has the core work queueing function take a worker for when we support multiple workers. It also adds a helper that takes a vq during queueing so modules can control which vq/worker to queue work on. This temp leaves vhost_work_queue. It will be removed when the drivers are converted in

[PATCH V3 02/11] vhost, vhost-net: add helper to check if vq has work

2021-10-21 Thread Mike Christie
This adds a helper to check if a vq has work pending and converts vhost-net to use it. Signed-off-by: Mike Christie --- drivers/vhost/net.c | 2 +- drivers/vhost/vhost.c | 6 +++--- drivers/vhost/vhost.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git

[PATCH V3 05/11] vhost: convert poll work to be vq based

2021-10-21 Thread Mike Christie
This has the drivers pass in their poll to vq mapping and then converts the core poll code to use the vq based helpers. Signed-off-by: Mike Christie --- drivers/vhost/net.c | 6 -- drivers/vhost/vhost.c | 10 ++ drivers/vhost/vhost.h | 4 +++- 3 files changed, 13 insertions(+),

[PATCH V3 00/11] vhost: multiple worker support

2021-10-21 Thread Mike Christie
The following patches apply over linus's tree and this patchset https://lore.kernel.org/all/20211007214448.6282-1-michael.chris...@oracle.com/ which allows us to check the vhost owner thread's RLIMITs: It looks like that patchset has been ok'd by all the major parties and just needs a small

[PATCH] QEMU vhost-scsi: add support for VHOST_SET_VRING_WORKER

2021-10-21 Thread Mike Christie
This patch adds support for the proposed ioctl that allows userspace to create virtqueue workers. For vhost-scsi you can set virtqueue_workers to: 0: default behavior where we have 1 worker for all vqs. -1: create a worker per vq. >0: create N workers and allow the vqs to share them. TODO: -

[PATCH V3 01/11] vhost: add vhost_worker pointer to vhost_virtqueue

2021-10-21 Thread Mike Christie
This patchset allows userspace to map vqs to different workers. This patch adds a worker pointer to the vq so we can store that info. Signed-off-by: Mike Christie --- drivers/vhost/vhost.c | 24 +--- drivers/vhost/vhost.h | 1 + 2 files changed, 14 insertions(+), 11

Re: drm/virtio: not pin pages on demand

2021-10-21 Thread Chia-I Wu
On Thu, Oct 21, 2021 at 4:52 AM Gerd Hoffmann wrote: > > On Thu, Oct 21, 2021 at 11:55:47AM +0200, Maksym Wezdecki wrote: > > I get your point. However, we need to make resource_create ioctl, > > in order to create corresponding resource on the host. > > That used to be the case but isn't true

[PATCH linux-next v4 8/8] vdpa/mlx5: Forward only packets with allowed MAC address

2021-10-21 Thread Parav Pandit via Virtualization
From: Eli Cohen Add rules to forward packets to the net device's TIR only if the destination MAC is equal to the configured MAC. This is required to prevent the netdevice from receiving traffic not destined to its configured MAC. Signed-off-by: Eli Cohen Reviewed-by: Parav Pandit ---

[PATCH linux-next v4 6/8] vdpa/mlx5: Fix clearing of VIRTIO_NET_F_MAC feature bit

2021-10-21 Thread Parav Pandit via Virtualization
Cited patch in the fixes tag clears the features bit during reset. mlx5 vdpa device feature bits are static decided by device capabilities. Clearing features bit cleared the VIRTIO_NET_F_MAC. Due to this MAC address provided by the device is not honored. Fix it by not clearing the static feature

[PATCH linux-next v4 7/8] vdpa/mlx5: Support configuration of MAC

2021-10-21 Thread Parav Pandit via Virtualization
From: Eli Cohen Add code to accept MAC configuration through vdpa tool. The MAC is written into the config struct and later can be retrieved through get_config(). Examples: 1. Configure MAC while adding a device: $ vdpa dev add mgmtdev pci/:06:00.2 name vdpa0 mac 00:11:22:33:44:55 2. Show

[PATCH linux-next v4 5/8] vdpa_sim_net: Enable user to set mac address and mtu

2021-10-21 Thread Parav Pandit via Virtualization
Enable user to set the mac address and mtu so that each vdpa device can have its own user specified mac address and mtu. This is done by implementing the management device's configuration layout fields setting callback routine. Now that user is enabled to set the mac address, remove the module

[PATCH linux-next v4 4/8] vdpa: Enable user to set mac and mtu of vdpa device

2021-10-21 Thread Parav Pandit via Virtualization
$ vdpa dev add name bar mgmtdev vdpasim_net mac 00:11:22:33:44:55 mtu 9000 $ vdpa dev config show bar: mac 00:11:22:33:44:55 link up link_announce false mtu 9000 $ vdpa dev config show -jp { "config": { "bar": { "mac": "00:11:22:33:44:55", "link ": "up",

[PATCH linux-next v4 3/8] vdpa: Use kernel coding style for structure comments

2021-10-21 Thread Parav Pandit via Virtualization
As subsequent patch adds new structure field with comment, move the structure comment to follow kernel coding style. Signed-off-by: Parav Pandit Reviewed-by: Eli Cohen --- include/linux/vdpa.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/vdpa.h

[PATCH linux-next v4 2/8] vdpa: Introduce query of device config layout

2021-10-21 Thread Parav Pandit via Virtualization
Introduce a command to query a device config layout. An example query of network vdpa device: $ vdpa dev add name bar mgmtdev vdpasim_net $ vdpa dev config show bar: mac 00:35:09:19:48:05 link up link_announce false mtu 1500 $ vdpa dev config show -jp { "config": { "bar": {

[PATCH linux-next v4 0/8] vdpa: enable user to set mac, mtu

2021-10-21 Thread Parav Pandit via Virtualization
Currently user cannot view the vdpa device config space. Also user cannot set the mac address and mtu of the vdpa device. This patchset enables users to set the mac address and mtu of the vdpa device once the device is created. If a vendor driver supports such configuration user can set it

[PATCH linux-next v4 1/8] vdpa: Introduce and use vdpa device get, set config helpers

2021-10-21 Thread Parav Pandit via Virtualization
Subsequent patches enable get and set configuration either via management device or via vdpa device' config ops. This requires synchronization between multiple callers to get and set config callbacks. Features setting also influence the layout of the configuration fields endianness. To avoid

Re: [PATCH] virtio-blk: fixup coccinelle warnings

2021-10-21 Thread Stefano Garzarella
On Thu, Oct 21, 2021 at 06:51:11AM +, cgel@gmail.com wrote: From: Ye Guojin coccicheck complains about the use of snprintf() in sysfs show functions: WARNING use scnprintf or sprintf Use sysfs_emit instead of scnprintf or sprintf makes more sense. Reported-by: Zeal Robot

Re: drm/virtio: not pin pages on demand

2021-10-21 Thread Gerd Hoffmann
On Thu, Oct 21, 2021 at 11:55:47AM +0200, Maksym Wezdecki wrote: > I get your point. However, we need to make resource_create ioctl, > in order to create corresponding resource on the host. That used to be the case but isn't true any more with the new blob resources. virglrenderer allows to

[PATCH V7] gpio: virtio: Add IRQ support

2021-10-21 Thread Viresh Kumar
This patch adds IRQ support for the virtio GPIO driver. Note that this uses the irq_bus_lock/unlock() callbacks, since those operations over virtio may sleep. Reviewed-by: Linus Walleij Signed-off-by: Viresh Kumar --- Bartosz, The spec changes are close to merging now, I will let you know once

Re: [PATCH V6] gpio: virtio: Add IRQ support

2021-10-21 Thread Viresh Kumar
On 21-10-21, 13:02, Geert Uytterhoeven wrote: > Exactly. And on CRIS (no longer supported by Linux), there won't > be any padding. > > So I recommend to always add explicit padding, to make sure all > members are aligned naturally on all systems. Right. -- viresh

Re: [PATCH V6] gpio: virtio: Add IRQ support

2021-10-21 Thread Geert Uytterhoeven
Hi Viresh, On Thu, Oct 21, 2021 at 12:49 PM Viresh Kumar wrote: > On 21-10-21, 12:07, Geert Uytterhoeven wrote: > > On Thu, Oct 21, 2021 at 11:52 AM Viresh Kumar > > wrote: > > > The structure will get aligned to the size of largest element and each > > > element will be aligned to itself. I

Re: [PATCH V6] gpio: virtio: Add IRQ support

2021-10-21 Thread Viresh Kumar
On 21-10-21, 12:07, Geert Uytterhoeven wrote: > On Thu, Oct 21, 2021 at 11:52 AM Viresh Kumar wrote: > > The structure will get aligned to the size of largest element and each > > element will be aligned to itself. I don't see how this will break > > even in case of 32/64 bit communication. > >

Re: [PATCH V6] gpio: virtio: Add IRQ support

2021-10-21 Thread Geert Uytterhoeven
Hi Viresh, On Thu, Oct 21, 2021 at 11:52 AM Viresh Kumar wrote: > The structure will get aligned to the size of largest element and each > element will be aligned to itself. I don't see how this will break > even in case of 32/64 bit communication. Structures are not aligned to the size of the

Re: [PATCH V6] gpio: virtio: Add IRQ support

2021-10-21 Thread Viresh Kumar
On 21-10-21, 12:58, Andy Shevchenko wrote: > I admit I haven't looked into the specification, but in the past we > had had quite an issue exactly in GPIO on kernel side because of this > kind of design mistake. > The problem here if in the future one wants to > supply more than one item at a

Re: [PATCH V6] gpio: virtio: Add IRQ support

2021-10-21 Thread Andy Shevchenko
On Thu, Oct 21, 2021 at 12:52 PM Viresh Kumar wrote: > On 21-10-21, 12:42, Andy Shevchenko wrote: > > On Thu, Oct 21, 2021 at 7:34 AM Viresh Kumar > > wrote: > > > On 20-10-21, 18:10, Andy Shevchenko wrote: ... > > > > > struct virtio_gpio_config { > > > > > __le16 ngpio; > > > > >

Re: [PATCH V6] gpio: virtio: Add IRQ support

2021-10-21 Thread Viresh Kumar
On 21-10-21, 12:42, Andy Shevchenko wrote: > On Thu, Oct 21, 2021 at 7:34 AM Viresh Kumar wrote: > > On 20-10-21, 18:10, Andy Shevchenko wrote: > > > IIRC you add dead code. IRQ framework never calls this if type is not set. > > > > Yes, but it is allowed to call > > > > irq_set_irq_type(irq,

[PATCH] i2c: virtio: Add support for zero-length requests

2021-10-21 Thread Viresh Kumar
The virtio specification received a new mandatory feature (VIRTIO_I2C_F_ZERO_LENGTH_REQUEST) for zero length requests. Fail if the feature isn't offered by the device. For each read-request, set the VIRTIO_I2C_FLAGS_M_RD flag, as required by the VIRTIO_I2C_F_ZERO_LENGTH_REQUEST feature. This

Re: [PATCH V6] gpio: virtio: Add IRQ support

2021-10-21 Thread Andy Shevchenko
On Thu, Oct 21, 2021 at 7:34 AM Viresh Kumar wrote: > On 20-10-21, 18:10, Andy Shevchenko wrote: > > On Wednesday, October 20, 2021, Viresh Kumar > > wrote: ... > > > + case IRQ_TYPE_NONE: > > > + type = VIRTIO_GPIO_IRQ_TYPE_NONE; > > > + break; > > > > IIRC

Re: [PATCH] virtio-blk: fixup coccinelle warnings

2021-10-21 Thread Joe Perches
On Thu, 2021-10-21 at 06:51 +, cgel@gmail.com wrote: > From: Ye Guojin > > coccicheck complains about the use of snprintf() in sysfs show > functions: > WARNING use scnprintf or sprintf > > Use sysfs_emit instead of scnprintf or sprintf makes more sense. [] > diff --git

Re: drm/virtio: not pin pages on demand

2021-10-21 Thread Gerd Hoffmann
On Thu, Oct 21, 2021 at 09:44:45AM +0200, Maksym Wezdecki wrote: > From: mwezdeck > > The idea behind the commit: > 1. when resource is created, let user space decide > if resource should be pinned or not > 2. transfer_*_host needs pinned memory. If it is not > pinned, then pin it.

Re: [PATCH] virtio-blk: fixup coccinelle warnings

2021-10-21 Thread Stefan Hajnoczi
On Thu, Oct 21, 2021 at 12:08:23AM -0700, Joe Perches wrote: > On Thu, 2021-10-21 at 06:51 +, cgel@gmail.com wrote: > > From: Ye Guojin > > > > coccicheck complains about the use of snprintf() in sysfs show > > functions: > > WARNING use scnprintf or sprintf > > > > Use sysfs_emit

Re: [PATCH] virtio-blk: fixup coccinelle warnings

2021-10-21 Thread Stefan Hajnoczi
On Thu, Oct 21, 2021 at 06:51:11AM +, cgel@gmail.com wrote: > From: Ye Guojin > > coccicheck complains about the use of snprintf() in sysfs show > functions: > WARNING use scnprintf or sprintf > > Use sysfs_emit instead of scnprintf or sprintf makes more sense. > > Reported-by: Zeal

[PATCH] vhost: Make use of the helper macro kthread_run()

2021-10-21 Thread Cai Huoqing
Repalce kthread_create/wake_up_process() with kthread_run() to simplify the code. Signed-off-by: Cai Huoqing --- drivers/vhost/vhost.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 59edb5a1ffe2..e67bd5603b5f 100644

Re: [PATCH v11 0/3] make hvc pass dma capable memory to its backend

2021-10-21 Thread Greg KH
On Fri, Oct 15, 2021 at 10:46:55AM +0800, Xianting Tian wrote: > Dear all, > > This patch series make hvc framework pass DMA capable memory to > put_chars() of hvc backend(eg, virtio-console), and revert commit > c4baad5029 ("virtio-console: avoid DMA from stackā€) Thanks for sticking with this,

Re: [PATCH] vduse: Don't call interrupt callback without DRIVER_OK bit set

2021-10-21 Thread Jason Wang
On Thu, Oct 21, 2021 at 11:29 AM Xie Yongji wrote: > > Commit 1018722ef0b7 ("vduse: Fix race condition between resetting and > irq injecting") tries to fix a race condition like: > > CPU0 CPU1 > >

[PATCH 2/2] x86/sev: Allow #VC exceptions on the VC2 stack

2021-10-21 Thread Joerg Roedel
From: Joerg Roedel When code running on the VC2 stack causes a nested VC exception, the handler will not handle it as expected but goes again into the error path. The result is that the panic() call happening when the VC exception was raised in an invalid context is called recursively. Fix this

[PATCH 1/2] x86/sev: Fix stack type check in vc_switch_off_ist()

2021-10-21 Thread Joerg Roedel
From: Joerg Roedel The value of STACK_TYPE_EXCEPTION_LAST points to the last _valid_ exception stack. Reflect that in the check done in the vc_switch_off_ist() function. Reported-by: Tom Lendacky Fixes: a13644f3a53de ("x86/entry/64: Add entry code for #VC handler") Signed-off-by: Joerg Roedel

[PATCH 0/2] x86/sev: Two fixes for SEV-ES VC stack handling

2021-10-21 Thread Joerg Roedel
From: Joerg Roedel Hi, here are two fixes for recently discovered issues in the handling of VC handler stack. Please review. Thanks, Joerg Joerg Roedel (2): x86/sev: Fix stack type check in vc_switch_off_ist() x86/sev: Allow #VC exceptions on the VC2 stack

drm/virtio: not pin pages on demand

2021-10-21 Thread Maksym Wezdecki
From: mwezdeck The idea behind the commit: 1. when resource is created, let user space decide if resource should be pinned or not 2. transfer_*_host needs pinned memory. If it is not pinned, then pin it. 3. during execbuffer, decide which bo handles should be pinned based on

RE: [PATCH 0/5] iommu/virtio: Add identity domains

2021-10-21 Thread Tian, Kevin
> From: Jean-Philippe Brucker > Sent: Wednesday, October 13, 2021 8:11 PM > > Support identity domains, allowing to only enable IOMMU protection for a > subset of endpoints (those assigned to userspace, for example). Users > may enable identity domains at compile time >

RE: [PATCH 0/5] iommu/virtio: Add identity domains

2021-10-21 Thread Tian, Kevin
> From: Jean-Philippe Brucker > Sent: Monday, October 18, 2021 11:24 PM > > On Thu, Oct 14, 2021 at 03:00:38AM +, Tian, Kevin wrote: > > > From: Jean-Philippe Brucker > > > Sent: Wednesday, October 13, 2021 8:11 PM > > > > > > Support identity domains, allowing to only enable IOMMU

RE: [PATCH 0/5] iommu/virtio: Add identity domains

2021-10-21 Thread Tian, Kevin
> From: j...@8bytes.org > Sent: Monday, October 18, 2021 7:38 PM > > On Thu, Oct 14, 2021 at 03:00:38AM +, Tian, Kevin wrote: > > I saw a concept of deferred attach in iommu core. See iommu_is_ > > attach_deferred(). Currently this is vendor specific and I haven't > > looked into the exact