qemu-e2k/hw/virtio
Stefan Hajnoczi c0c4f14729 virtio: call ->vhost_reset_device() during reset
vhost-user-scsi has a VirtioDeviceClass->reset() function that calls
->vhost_reset_device(). The other vhost devices don't notify the vhost
device upon reset.

Stateful vhost devices may need to handle device reset in order to free
resources or prevent stale device state from interfering after reset.

Call ->vhost_device_reset() from virtio_reset() so that that vhost
devices are notified of device reset.

This patch affects behavior as follows:
- vhost-kernel: No change in behavior since ->vhost_reset_device() is
  not implemented.
- vhost-user: back-ends that negotiate
  VHOST_USER_PROTOCOL_F_RESET_DEVICE now receive a
  VHOST_USER_DEVICE_RESET message upon device reset. Otherwise there is
  no change in behavior. DPDK, SPDK, libvhost-user, and the
  vhost-user-backend crate do not negotiate
  VHOST_USER_PROTOCOL_F_RESET_DEVICE automatically.
- vhost-vdpa: an extra SET_STATUS 0 call is made during device reset.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20231004014532.1228637-4-stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
2023-10-22 05:18:16 -04:00
..
Kconfig virtio-md-pci: New parent type for virtio-mem-pci and virtio-pmem-pci 2023-07-12 09:27:25 +02:00
meson.build virtio: add vhost-user-base and a generic vhost-user-device 2023-10-04 04:54:04 -04:00
trace-events vdpa: export vhost_vdpa_set_vring_ready 2023-10-04 04:54:19 -04:00
trace.h
vdpa-dev-pci.c
vdpa-dev.c vdpa: move vhost_vdpa_set_vring_ready to the caller 2023-10-04 04:54:21 -04:00
vhost-backend.c vhost-backend: remove vhost_kernel_reset_device() 2023-10-22 05:18:16 -04:00
vhost-iova-tree.c
vhost-iova-tree.h
vhost-scsi-pci.c
vhost-shadow-virtqueue.c vhost: Expose vhost_svq_available_slots() 2023-10-18 10:41:50 -04:00
vhost-shadow-virtqueue.h vhost: Expose vhost_svq_available_slots() 2023-10-18 10:41:50 -04:00
vhost-stub.c vhost: Add vhost_get_max_memslots() 2023-10-12 14:15:22 +02:00
vhost-user-blk-pci.c
vhost-user-device-pci.c virtio: add vhost-user-base and a generic vhost-user-device 2023-10-04 04:54:04 -04:00
vhost-user-device.c hw/virtio: add config support to vhost-user-device 2023-10-04 04:54:05 -04:00
vhost-user-fs-pci.c
vhost-user-fs.c hw/virtio: fix typo in VIRTIO_CONFIG_IRQ_IDX comments 2023-07-10 18:59:32 -04:00
vhost-user-gpio-pci.c
vhost-user-gpio.c qmp: update virtio feature maps, vhost-user-gpio introspection 2023-10-04 04:54:26 -04:00
vhost-user-i2c-pci.c
vhost-user-i2c.c virtio: i2c: Check notifier helpers for VIRTIO_CONFIG_IRQ_IDX 2023-04-24 22:56:55 -04:00
vhost-user-input-pci.c
vhost-user-rng-pci.c
vhost-user-rng.c vhost-user-rng: Back up vqs before cleaning up vhost_dev 2023-03-02 03:10:47 -05:00
vhost-user-scmi-pci.c hw/virtio: Add vhost-user-scmi-pci boilerplate 2023-07-10 16:17:08 -04:00
vhost-user-scmi.c hw/virtio: Add a protection against duplicate vu_scmi_stop calls 2023-08-03 16:06:49 -04:00
vhost-user-scsi-pci.c
vhost-user-vsock-pci.c
vhost-user-vsock.c
vhost-user.c vhost-user: do not send RESET_OWNER on device reset 2023-10-22 05:18:16 -04:00
vhost-vdpa.c vhost: Remove vhost_backend_can_merge() callback 2023-10-12 14:15:21 +02:00
vhost-vsock-common.c hw/virtio: fix typo in VIRTIO_CONFIG_IRQ_IDX comments 2023-07-10 18:59:32 -04:00
vhost-vsock-pci.c
vhost-vsock.c
vhost.c virtio: call ->vhost_reset_device() during reset 2023-10-22 05:18:16 -04:00
virtio-9p-pci.c
virtio-balloon-pci.c
virtio-balloon.c hw: replace most qemu_bh_new calls with qemu_bh_new_guarded 2023-04-28 11:31:54 +02:00
virtio-blk-pci.c
virtio-bus.c
virtio-config-io.c
virtio-crypto-pci.c
virtio-crypto.c hw/other: spelling fixes 2023-09-21 11:31:16 +03:00
virtio-hmp-cmds.c
virtio-input-host-pci.c
virtio-input-pci.c virtio-input-pci: add virtio-multitouch-pci 2023-05-28 13:08:25 +04:00
virtio-iommu-pci.c
virtio-iommu.c virtio-iommu: Standardize granule extraction and formatting 2023-08-03 16:06:49 -04:00
virtio-md-pci.c virtio-md-pci: Support unplug requests for compatible devices 2023-07-12 09:27:30 +02:00
virtio-mem-pci.c virtio-mem: Expose device memory dynamically via multiple memslots if enabled 2023-10-12 14:15:22 +02:00
virtio-mem-pci.h virtio-md-pci: New parent type for virtio-mem-pci and virtio-pmem-pci 2023-07-12 09:27:25 +02:00
virtio-mem.c virtio-mem: Mark memslot alias memory regions unmergeable 2023-10-12 14:15:22 +02:00
virtio-mmio.c virtio: refresh vring region cache after updating a virtqueue size 2023-04-21 03:08:21 -04:00
virtio-net-pci.c
virtio-pci.c virtio: Add shared memory capability 2023-10-16 11:29:56 +04:00
virtio-pmem-pci.c virtio-md-pci: New parent type for virtio-mem-pci and virtio-pmem-pci 2023-07-12 09:27:25 +02:00
virtio-pmem-pci.h virtio-md-pci: New parent type for virtio-mem-pci and virtio-pmem-pci 2023-07-12 09:27:25 +02:00
virtio-pmem.c thread-pool: avoid passing the pool parameter every time 2023-04-25 13:17:28 +02:00
virtio-qmp.c vhost-user: move VhostUserProtocolFeature definition to header file 2023-10-04 04:54:28 -04:00
virtio-qmp.h qmp: remove virtio_list, search QOM tree instead 2023-10-04 04:54:24 -04:00
virtio-rng-pci.c
virtio-rng.c
virtio-scsi-pci.c
virtio-serial-pci.c
virtio-stub.c
virtio.c virtio: call ->vhost_reset_device() during reset 2023-10-22 05:18:16 -04:00