[PATCH v2 11/12] virtio_net: split free_unused_bufs()

2022-01-19 Thread Xuan Zhuo
This patch separates two functions for freeing sq buf and rq buf from free_unused_bufs(). When supporting the enable/disable tx/rq queue in the future, it is necessary to support separate recovery of a sq buf or a rq buf. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 46 ++

[PATCH v2 09/12] virtio_net: virtnet_tx_timeout() fix style

2022-01-19 Thread Xuan Zhuo
Replace priv with vi which is commonly used in the virtio-net module. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 569eecfbc2cd..97eb4dddba1f 100644 --- a/dr

[PATCH v2 12/12] virtio-net: support pair disable/enable

2022-01-19 Thread Xuan Zhuo
This patch implements virtio-net rx/tx pair disable/enable functionality based on virtio queue reset. The purpose of the current implementation is to quickly recycle the buffer submitted to vq. In the process of pair disable, in theory, as long as virtio supports queue reset, there will be no exce

[PATCH v2 10/12] virtio_net: virtnet_tx_timeout() stop ref sq->vq

2022-01-19 Thread Xuan Zhuo
Make virtnet_tx_timeout() no longer refer to vq directly. Because sq->vq may be equal to NULL after implementing rx/tx queue disable/enable. Signed-off-by: Xuan Zhuo --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/driver

[PATCH v2 07/12] virtio: queue_reset: pci: support VIRTIO_F_RING_RESET

2022-01-19 Thread Xuan Zhuo
This patch implements virtio pci support for QUEUE RESET. Performing reset on a queue is divided into two steps: 1. reset_vq: reset one vq 2. enable_reset_vq: re-enable the reset queue In the first step, these tasks will be completed: 1. notify the hardware queue to reset 2. recycle the bu

[PATCH v2 08/12] virtio: queue_reset: add helper

2022-01-19 Thread Xuan Zhuo
Add helper for virtio queue reset. * virtio_reset_vq: reset a queue individually * virtio_enable_resetq: enable a reset queue In the virtio_reset_vq(), these tasks will be completed: 1. notify the hardware queue to reset 2. recycle the buffer from vq 3. delete the vq Signed-off-by: Xuan

[PATCH v2 06/12] virtio: queue_reset: pci: add independent function to enable msix vq

2022-01-19 Thread Xuan Zhuo
Extract the vp_enable_vq_msix() function from vp_find_vqs_msix() . Used to enable a msix vq individually. In the subsequent patches that supports queue reset, I have the need to enable a vq separately. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_pci_common.c | 61

[PATCH v2 05/12] virito: queue_reset: pci: move the per queue irq logic from vp_del_vqs to vp_del_vq

2022-01-19 Thread Xuan Zhuo
Move irq's processing logic into vp_del_vq(), so that this function can handle a vq's del operation independently. In the subsequent patches that supports queue reset, I have the need to delete a vq separately. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_pci_common.c | 25 +--

[PATCH v2 01/12] virtio: pci: struct virtio_pci_common_cfg add queue_notify_data

2022-01-19 Thread Xuan Zhuo
Add queue_notify_data in struct virtio_pci_common_cfg, which comes from here https://github.com/oasis-tcs/virtio-spec/issues/89 Since I want to add queue_reset after it, I submitted this patch first. Signed-off-by: Xuan Zhuo --- include/uapi/linux/virtio_pci.h | 1 + 1 file changed, 1 insertion

[PATCH v2 04/12] virtio: queue_reset: pci: update struct virtio_pci_common_cfg and option functions

2022-01-19 Thread Xuan Zhuo
Add queue_reset in virtio_pci_common_cfg, and add related operation functions. Signed-off-by: Xuan Zhuo --- drivers/virtio/virtio_pci_modern_dev.c | 28 ++ include/linux/virtio_pci_modern.h | 2 ++ include/uapi/linux/virtio_pci.h| 1 + 3 files changed, 31 i

[PATCH v2 02/12] virtio: queue_reset: add VIRTIO_F_RING_RESET

2022-01-19 Thread Xuan Zhuo
Added VIRTIO_F_RING_RESET, it came from here https://github.com/oasis-tcs/virtio-spec/issues/124 Signed-off-by: Xuan Zhuo --- include/uapi/linux/virtio_config.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virt

[PATCH v2 03/12] virtio: queue_reset: struct virtio_config_ops add callbacks for queue_reset

2022-01-19 Thread Xuan Zhuo
Performing reset on a queue is divided into two steps: 1. reset_vq: reset one vq 2. enable_reset_vq: re-enable the reset queue In the first step, these tasks will be completed: 1. notify the hardware queue to reset 2. recycle the buffer from vq 3. delete the vq So add two callbacks r

[PATCH v2 00/12] virtio pci support VIRTIO_F_RING_RESET

2022-01-19 Thread Xuan Zhuo
The virtio spec already supports the virtio queue reset function. This patch set is to add this function to the kernel. The relevant virtio spec information is here: https://github.com/oasis-tcs/virtio-spec/issues/124 Also regarding MMIO support for queue reset, I plan to support it after thi

Re: [PATCH v2 2/2] virtio: acknowledge all features before access

2022-01-19 Thread Michael S. Tsirkin
On Wed, Jan 19, 2022 at 10:52:34AM +0800, Jason Wang wrote: > On Wed, Jan 19, 2022 at 1:04 AM Michael S. Tsirkin wrote: > > > > The feature negotiation was designed in a way that > > makes it possible for devices to know which config > > fields will be accessed by drivers. > > > > This is broken s

Re: [PATCH v3] drivers/virtio: Enable virtio mem for ARM64

2022-01-19 Thread David Hildenbrand
On 19.01.22 08:46, Gavin Shan wrote: > Hi Michael, > > On 1/19/22 3:39 PM, Michael S. Tsirkin wrote: >> On Wed, Jan 19, 2022 at 09:05:51AM +0800, Gavin Shan wrote: >>> This enables virtio-mem device support by allowing to enable the >>> corresponding kernel config option (CONFIG_VIRTIO_MEM) on the