Merge "configs: Enable CONFIG_VIRTIO_MMIO_POLL_RESET for autoghgvm"

This commit is contained in:
qctecmdr 2024-05-25 10:40:20 -07:00 committed by Gerrit - the friendly Code Review server
commit d7f339ee30
3 changed files with 18 additions and 0 deletions

View file

@ -82,6 +82,7 @@ CONFIG_VHOST_MENU=y
CONFIG_VIRTIO_BLK=m
CONFIG_VIRTIO_INPUT=m
CONFIG_VIRTIO_MMIO=m
CONFIG_VIRTIO_MMIO_POLL_RESET=y
CONFIG_VIRTIO_MMIO_SWIOTLB=y
CONFIG_VIRTIO_NET=m
CONFIG_VIRT_DRIVERS=y

View file

@ -194,4 +194,13 @@ config VIRTIO_DMA_SHARED_BUFFER
This option adds a flavor of dma buffers that are backed by
virtio resources.
config VIRTIO_MMIO_POLL_RESET
bool "Virti-mmio device synchronous reset support"
depends on VIRTIO_MMIO
help
Say y here to enable synchronous reset for the MMIO transport based
virtio device. After writing 0 to device_status, the driver must
wait for a read of device_status to return 0 before reinitializing
the device.
endif # VIRTIO_MENU

View file

@ -70,6 +70,7 @@
#include <linux/virtio_config.h>
#include <uapi/linux/virtio_mmio.h>
#include <linux/virtio_ring.h>
#include <linux/delay.h>
#ifdef CONFIG_GH_VIRTIO_DEBUG
#define CREATE_TRACE_POINTS
@ -292,6 +293,13 @@ static void vm_reset(struct virtio_device *vdev)
/* 0 status means a reset. */
writel(0, vm_dev->base + VIRTIO_MMIO_STATUS);
#ifdef CONFIG_VIRTIO_MMIO_POLL_RESET
/* After writing 0 to device_status, the driver MUST wait for a read of
* device_status to return 0 before reinitializing the device.
*/
while (readl(vm_dev->base + VIRTIO_MMIO_STATUS))
usleep_range(1000, 1100);
#endif
}