virtio: Call set_features during reset
PATCH 1/1 virtio: Call set_features during reset
virtio-net expects set_features() will be called when the feature set used by the guest changes to update the number of virtqueues. Call it during reset as reset clears all features and the queues added for VIRTIO_NET_F_MQ or VIRTIO_NET_F_RSS will need to be removed.
--- hw/virtio/virtio.c | 86 +++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 43 deletions(-)
hw/virtio/virtio.c +43 -43
@@ -2316,49 +2316,6 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index) } } -void virtio_reset (void *opaque) -{ -VirtIODevice *vdev = opaque; -VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); -int i; - -virtio_set_status (vdev,0 ); -if (current_cpu) { -/* Guest initiated reset */ - vdev->device_endian =virtio_current_cpu_endian (); - }else { -/* System reset */ - vdev->device_endian =virtio_default_endian (); - } - -if (k->get_vhost) { -struct vhost_dev *hdev = k->get_vhost (vdev); -/* Only reset when vhost back-end is connected */ -if (hdev && hdev->vhost_ops) { -vhost_reset_device (hdev); - } - } - -if (k->reset) { - k->reset (vdev); - } - - vdev->start_on_kick = false; - vdev->started = false; - vdev->broken = false; - vdev->guest_features =0 ; - vdev->queue_sel =0 ; - vdev->status =0 ; - vdev->disabled = false; -qatomic_set (&vdev->isr,0 ); - vdev->config_vector =VIRTIO_NO_VECTOR ; -virtio_notify_vector (vdev, vdev->config_vector); - -for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { -__virtio_queue_reset (vdev, i); - } -} -void virtio_queue_set_addr (VirtIODevice *vdev,int n,hwaddr addr) {if (!vdev->vq[n].vring.num) {
@@ -3169,6 +3126,49 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)return ret; } +void virtio_reset (void *opaque) +{ +VirtIODevice *vdev = opaque; +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +int i; + +virtio_set_status (vdev,0 ); +if (current_cpu) { +/* Guest initiated reset */ + vdev->device_endian =virtio_current_cpu_endian (); + }else { +/* System reset */ + vdev->device_endian =virtio_default_endian (); + } + +if (k->get_vhost) { +struct vhost_dev *hdev = k->get_vhost (vdev); +/* Only reset when vhost back-end is connected */ +if (hdev && hdev->vhost_ops) { +vhost_reset_device (hdev); + } + } + +if (k->reset) { + k->reset (vdev); + } + + vdev->start_on_kick = false; + vdev->started = false; + vdev->broken = false; +virtio_set_features_nocheck (vdev,0 ); + vdev->queue_sel =0 ; + vdev->status =0 ; + vdev->disabled = false; +qatomic_set (&vdev->isr,0 ); + vdev->config_vector =VIRTIO_NO_VECTOR ; +virtio_notify_vector (vdev, vdev->config_vector); + +for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { +__virtio_queue_reset (vdev, i); + } +} +static void virtio_device_check_notification_compatibility (VirtIODevice *vdev,Error **errp) {
---
base-commit: 825b96dbcee23d134b691fc75618b59c5f53da32
change-id: 20250406-reset-5ed5248ee3c1
Best regards,
Signature · 1 line
Akihiko Odaki <[email protected]>
Quoted 9 lines · Akihiko Odaki
virtio-net expects
set_features()will be called when the feature set used by the guest changes to update the number of virtqueues. Call it during reset as reset clears all features and the queues added forVIRTIO_NET_F_MQorVIRTIO_NET_F_RSSwill need to be removed.Fixes f9d6dbf0bf6e ("virtio-net: remove virtio queues if the guest doesn't support multiqueue")Signed-off-by Akihiko Odaki <[email protected]>
The issue seems specific to virtio net: rset is reset,
it is distict from set features.
Why not just call the necessary functionality from virtio_net_reset?
Quoted 116 lines
--- hw/virtio/virtio.c | 86 +++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 43 deletions(-)hw/virtio/virtio.c +43
-44@@ -2316,49 +2316,6 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index) } } -void virtio_reset (void *opaque) -{ -VirtIODevice *vdev = opaque; -VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); -int i; - -virtio_set_status (vdev,0 ); -if (current_cpu) { -/* Guest initiated reset */ - vdev->device_endian =virtio_current_cpu_endian (); - }else { -/* System reset */ - vdev->device_endian =virtio_default_endian (); - } - -if (k->get_vhost) { -struct vhost_dev *hdev = k->get_vhost (vdev); -/* Only reset when vhost back-end is connected */ -if (hdev && hdev->vhost_ops) { -vhost_reset_device (hdev); - } - } - -if (k->reset) { - k->reset (vdev); - } - - vdev->start_on_kick = false; - vdev->started = false; - vdev->broken = false; - vdev->guest_features =0 ; - vdev->queue_sel =0 ; - vdev->status =0 ; - vdev->disabled = false; -qatomic_set (&vdev->isr,0 ); - vdev->config_vector =VIRTIO_NO_VECTOR ; -virtio_notify_vector (vdev, vdev->config_vector); - -for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { -__virtio_queue_reset (vdev, i); - } -} -void virtio_queue_set_addr (VirtIODevice *vdev,int n,hwaddr addr) {if (!vdev->vq[n].vring.num) {@@ -3169,6 +3126,49 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)return ret; } +void virtio_reset (void *opaque) +{ +VirtIODevice *vdev = opaque; +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +int i; + +virtio_set_status (vdev,0 ); +if (current_cpu) { +/* Guest initiated reset */ + vdev->device_endian =virtio_current_cpu_endian (); + }else { +/* System reset */ + vdev->device_endian =virtio_default_endian (); + } + +if (k->get_vhost) { +struct vhost_dev *hdev = k->get_vhost (vdev); +/* Only reset when vhost back-end is connected */ +if (hdev && hdev->vhost_ops) { +vhost_reset_device (hdev); + } + } + +if (k->reset) { + k->reset (vdev); + } + + vdev->start_on_kick = false; + vdev->started = false; + vdev->broken = false; +virtio_set_features_nocheck (vdev,0 ); + vdev->queue_sel =0 ; + vdev->status =0 ; + vdev->disabled = false; +qatomic_set (&vdev->isr,0 ); + vdev->config_vector =VIRTIO_NO_VECTOR ; +virtio_notify_vector (vdev, vdev->config_vector); + +for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { +__virtio_queue_reset (vdev, i); + } +} +static void virtio_device_check_notification_compatibility (VirtIODevice *vdev,Error **errp) { ---base-commit:
825b96dbcee23d134b691fc75618b59c5f53da32
change-id: 20250406-reset-5ed5248ee3c1Best regards,
Signature · 1 line
Akihiko Odaki <[email protected]>
Quoted 6 lines · Michael S. Tsirkin' via devel
Quoted 5 lines · Akihiko Odaki
virtio-net expects
set_features()will be called when the feature set used by the guest changes to update the number of virtqueues. Call it during reset as reset clears all features and the queues added forVIRTIO_NET_F_MQorVIRTIO_NET_F_RSSwill need to be removed.
Quoted 8 lines
Quoted 4 lines
Fixes f9d6dbf0bf6e ("virtio-net: remove virtio queues if the guest doesn't support multiqueue")Signed-off-by Akihiko Odaki <[email protected]>The issue seems specific to virtio net: rset is reset,
it is distict from set features.
Why not just call the necessary functionality fromvirtio_net_reset?
set_features is currently implemented only in virtio-net; virtio-gpu-base also have a function set but it only has code to trace. If another device implements the function in the future, I think the device will also want to have it called during reset for the same reason with virtio-net.
virtio_reset() also calls set_status to update the status field so calling set_features() is more aligned with the handling of the status field.
Quoted 119 lines
Quoted 118 lines
--- hw/virtio/virtio.c | 86 +++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 43 deletions(-)hw/virtio/virtio.c +43
-44@@ -2316,49 +2316,6 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index) } } -void virtio_reset (void *opaque) -{ -VirtIODevice *vdev = opaque; -VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); -int i; - -virtio_set_status (vdev,0 ); -if (current_cpu) { -/* Guest initiated reset */ - vdev->device_endian =virtio_current_cpu_endian (); - }else { -/* System reset */ - vdev->device_endian =virtio_default_endian (); - } - -if (k->get_vhost) { -struct vhost_dev *hdev = k->get_vhost (vdev); -/* Only reset when vhost back-end is connected */ -if (hdev && hdev->vhost_ops) { -vhost_reset_device (hdev); - } - } - -if (k->reset) { - k->reset (vdev); - } - - vdev->start_on_kick = false; - vdev->started = false; - vdev->broken = false; - vdev->guest_features =0 ; - vdev->queue_sel =0 ; - vdev->status =0 ; - vdev->disabled = false; -qatomic_set (&vdev->isr,0 ); - vdev->config_vector =VIRTIO_NO_VECTOR ; -virtio_notify_vector (vdev, vdev->config_vector); - -for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { -__virtio_queue_reset (vdev, i); - } -} -void virtio_queue_set_addr (VirtIODevice *vdev,int n,hwaddr addr) {if (!vdev->vq[n].vring.num) {@@ -3169,6 +3126,49 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)return ret; } +void virtio_reset (void *opaque) +{ +VirtIODevice *vdev = opaque; +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +int i; + +virtio_set_status (vdev,0 ); +if (current_cpu) { +/* Guest initiated reset */ + vdev->device_endian =virtio_current_cpu_endian (); + }else { +/* System reset */ + vdev->device_endian =virtio_default_endian (); + } + +if (k->get_vhost) { +struct vhost_dev *hdev = k->get_vhost (vdev); +/* Only reset when vhost back-end is connected */ +if (hdev && hdev->vhost_ops) { +vhost_reset_device (hdev); + } + } + +if (k->reset) { + k->reset (vdev); + } + + vdev->start_on_kick = false; + vdev->started = false; + vdev->broken = false; +virtio_set_features_nocheck (vdev,0 ); + vdev->queue_sel =0 ; + vdev->status =0 ; + vdev->disabled = false; +qatomic_set (&vdev->isr,0 ); + vdev->config_vector =VIRTIO_NO_VECTOR ; +virtio_notify_vector (vdev, vdev->config_vector); + +for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { +__virtio_queue_reset (vdev, i); + } +} +static void virtio_device_check_notification_compatibility (VirtIODevice *vdev,Error **errp) { ---base-commit:
825b96dbcee23d134b691fc75618b59c5f53da32
change-id: 20250406-reset-5ed5248ee3c1Best regards,
Signature · 1 line
Akihiko Odaki <[email protected]>
Quoted 16 lines · Akihiko Odaki
Quoted 6 lines · Michael S. Tsirkin' via devel
Quoted 5 lines · Akihiko Odaki
virtio-net expects
set_features()will be called when the feature set used by the guest changes to update the number of virtqueues. Call it during reset as reset clears all features and the queues added forVIRTIO_NET_F_MQorVIRTIO_NET_F_RSSwill need to be removed.Quoted 8 lines
Quoted 4 lines
Fixes f9d6dbf0bf6e ("virtio-net: remove virtio queues if the guest doesn't support multiqueue")Signed-off-by Akihiko Odaki <[email protected]>The issue seems specific to virtio net: rset is reset,
it is distict from set features.
Why not just call the necessary functionality fromvirtio_net_reset?
Quoted 7 lines
set_featuresis currently implemented only in virtio-net; virtio-gpu-base also have a function set but it only has code to trace. If another device implements the function in the future, I think the device will also want to have it called during reset for the same reason with virtio-net.
virtio_reset()also callsset_statusto update the status field so callingset_features()is more aligned with the handling of the status field.
That came to be because writing 0 to status resets the virtio device. For a while, this was the only way to reset vhost-user so we just went along with it.
Quoted 117 lines
Quoted 117 lines
Quoted 116 lines
--- hw/virtio/virtio.c | 86 +++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 43 deletions(-)hw/virtio/virtio.c +43
-44@@ -2316,49 +2316,6 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index) } } -void virtio_reset (void *opaque) -{ -VirtIODevice *vdev = opaque; -VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); -int i; - -virtio_set_status (vdev,0 ); -if (current_cpu) { -/* Guest initiated reset */ - vdev->device_endian =virtio_current_cpu_endian (); - }else { -/* System reset */ - vdev->device_endian =virtio_default_endian (); - } - -if (k->get_vhost) { -struct vhost_dev *hdev = k->get_vhost (vdev); -/* Only reset when vhost back-end is connected */ -if (hdev && hdev->vhost_ops) { -vhost_reset_device (hdev); - } - } - -if (k->reset) { - k->reset (vdev); - } - - vdev->start_on_kick = false; - vdev->started = false; - vdev->broken = false; - vdev->guest_features =0 ; - vdev->queue_sel =0 ; - vdev->status =0 ; - vdev->disabled = false; -qatomic_set (&vdev->isr,0 ); - vdev->config_vector =VIRTIO_NO_VECTOR ; -virtio_notify_vector (vdev, vdev->config_vector); - -for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { -__virtio_queue_reset (vdev, i); - } -} -void virtio_queue_set_addr (VirtIODevice *vdev,int n,hwaddr addr) {if (!vdev->vq[n].vring.num) {@@ -3169,6 +3126,49 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)return ret; } +void virtio_reset (void *opaque) +{ +VirtIODevice *vdev = opaque; +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +int i; + +virtio_set_status (vdev,0 ); +if (current_cpu) { +/* Guest initiated reset */ + vdev->device_endian =virtio_current_cpu_endian (); + }else { +/* System reset */ + vdev->device_endian =virtio_default_endian (); + } + +if (k->get_vhost) { +struct vhost_dev *hdev = k->get_vhost (vdev); +/* Only reset when vhost back-end is connected */ +if (hdev && hdev->vhost_ops) { +vhost_reset_device (hdev); + } + } + +if (k->reset) { + k->reset (vdev); + } + + vdev->start_on_kick = false; + vdev->started = false; + vdev->broken = false; +virtio_set_features_nocheck (vdev,0 ); + vdev->queue_sel =0 ; + vdev->status =0 ; + vdev->disabled = false; +qatomic_set (&vdev->isr,0 ); + vdev->config_vector =VIRTIO_NO_VECTOR ; +virtio_notify_vector (vdev, vdev->config_vector); + +for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { +__virtio_queue_reset (vdev, i); + } +} +static void virtio_device_check_notification_compatibility (VirtIODevice *vdev,Error **errp) { ---base-commit:
825b96dbcee23d134b691fc75618b59c5f53da32
change-id: 20250406-reset-5ed5248ee3c1Best regards,
Signature · 1 line
Akihiko Odaki <[email protected]>
Quoted 22 lines · Michael S. Tsirkin
Quoted 21 lines · Akihiko Odaki
Quoted 6 lines · Michael S. Tsirkin' via devel
Quoted 5 lines · Akihiko Odaki
virtio-net expects
set_features()will be called when the feature set used by the guest changes to update the number of virtqueues. Call it during reset as reset clears all features and the queues added forVIRTIO_NET_F_MQorVIRTIO_NET_F_RSSwill need to be removed.Quoted 8 lines
Quoted 4 lines
Fixes f9d6dbf0bf6e ("virtio-net: remove virtio queues if the guest doesn't support multiqueue")Signed-off-by Akihiko Odaki <[email protected]>The issue seems specific to virtio net: rset is reset,
it is distict from set features.
Why not just call the necessary functionality fromvirtio_net_reset?
set_featuresis currently implemented only in virtio-net; virtio-gpu-base also have a function set but it only has code to trace. If another device implements the function in the future, I think the device will also want to have it called during reset for the same reason with virtio-net.
Quoted 6 lines
Quoted 2 lines
virtio_reset()also callsset_statusto update the status field so callingset_features()is more aligned with the handling of the status field.That came to be because writing 0 to status resets the virtio device. For a while, this was the only way to reset vhost-user so we just went along with it.
It is possible to have code to send a command to write 0 to status to vhost-user in reset(), but calling set_status() in virtio_reset() is more convenient and makes sense as the status is indeed being set to 0. I think the same reasoning applies to features.
Quoted 120 lines
Quoted 119 lines
Quoted 119 lines
Quoted 118 lines
--- hw/virtio/virtio.c | 86 +++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 43 deletions(-)hw/virtio/virtio.c +43
-44@@ -2316,49 +2316,6 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index) } } -void virtio_reset (void *opaque) -{ -VirtIODevice *vdev = opaque; -VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); -int i; - -virtio_set_status (vdev,0 ); -if (current_cpu) { -/* Guest initiated reset */ - vdev->device_endian =virtio_current_cpu_endian (); - }else { -/* System reset */ - vdev->device_endian =virtio_default_endian (); - } - -if (k->get_vhost) { -struct vhost_dev *hdev = k->get_vhost (vdev); -/* Only reset when vhost back-end is connected */ -if (hdev && hdev->vhost_ops) { -vhost_reset_device (hdev); - } - } - -if (k->reset) { - k->reset (vdev); - } - - vdev->start_on_kick = false; - vdev->started = false; - vdev->broken = false; - vdev->guest_features =0 ; - vdev->queue_sel =0 ; - vdev->status =0 ; - vdev->disabled = false; -qatomic_set (&vdev->isr,0 ); - vdev->config_vector =VIRTIO_NO_VECTOR ; -virtio_notify_vector (vdev, vdev->config_vector); - -for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { -__virtio_queue_reset (vdev, i); - } -} -void virtio_queue_set_addr (VirtIODevice *vdev,int n,hwaddr addr) {if (!vdev->vq[n].vring.num) {@@ -3169,6 +3126,49 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)return ret; } +void virtio_reset (void *opaque) +{ +VirtIODevice *vdev = opaque; +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +int i; + +virtio_set_status (vdev,0 ); +if (current_cpu) { +/* Guest initiated reset */ + vdev->device_endian =virtio_current_cpu_endian (); + }else { +/* System reset */ + vdev->device_endian =virtio_default_endian (); + } + +if (k->get_vhost) { +struct vhost_dev *hdev = k->get_vhost (vdev); +/* Only reset when vhost back-end is connected */ +if (hdev && hdev->vhost_ops) { +vhost_reset_device (hdev); + } + } + +if (k->reset) { + k->reset (vdev); + } + + vdev->start_on_kick = false; + vdev->started = false; + vdev->broken = false; +virtio_set_features_nocheck (vdev,0 ); + vdev->queue_sel =0 ; + vdev->status =0 ; + vdev->disabled = false; +qatomic_set (&vdev->isr,0 ); + vdev->config_vector =VIRTIO_NO_VECTOR ; +virtio_notify_vector (vdev, vdev->config_vector); + +for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { +__virtio_queue_reset (vdev, i); + } +} +static void virtio_device_check_notification_compatibility (VirtIODevice *vdev,Error **errp) { ---base-commit:
825b96dbcee23d134b691fc75618b59c5f53da32
change-id: 20250406-reset-5ed5248ee3c1Best regards,
Signature · 1 line
Akihiko Odaki <[email protected]>
Quoted 26 lines · Akihiko Odaki
Quoted 25 lines · Michael S. Tsirkin
Quoted 23 lines · Akihiko Odaki
Quoted 6 lines · Michael S. Tsirkin' via devel
Quoted 5 lines · Akihiko Odaki
virtio-net expects
set_features()will be called when the feature set used by the guest changes to update the number of virtqueues. Call it during reset as reset clears all features and the queues added forVIRTIO_NET_F_MQorVIRTIO_NET_F_RSSwill need to be removed.Quoted 8 lines
Quoted 4 lines
Fixes f9d6dbf0bf6e ("virtio-net: remove virtio queues if the guest doesn't support multiqueue")Signed-off-by Akihiko Odaki <[email protected]>The issue seems specific to virtio net: rset is reset,
it is distict from set features.
Why not just call the necessary functionality fromvirtio_net_reset?
set_featuresis currently implemented only in virtio-net; virtio-gpu-base also have a function set but it only has code to trace. If another device implements the function in the future, I think the device will also want to have it called during reset for the same reason with virtio-net.
virtio_reset()also callsset_statusto update the status field so callingset_features()is more aligned with the handling of the status field.
Quoted 8 lines
Quoted 3 lines
That came to be because writing 0 to status resets the virtio device. For a while, this was the only way to reset vhost-user so we just went along with it.
It is possible to have code to send a command to write 0 to status to vhost-user in
reset(), but callingset_status()invirtio_reset()is more convenient and makes sense as the status is indeed being set to 0. I think the same reasoning applies to features.
I don't know who makes assumptions that features are only set during driver setup, though.
This will send an extra VHOST_USER_SET_FEATURES message for vhost-user, for example.
I want to have a good reason to add this overhead.
Quoted 120 lines
Quoted 120 lines
Quoted 119 lines
Quoted 119 lines
Quoted 118 lines
--- hw/virtio/virtio.c | 86 +++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 43 deletions(-)hw/virtio/virtio.c +43
-44@@ -2316,49 +2316,6 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index) } } -void virtio_reset (void *opaque) -{ -VirtIODevice *vdev = opaque; -VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); -int i; - -virtio_set_status (vdev,0 ); -if (current_cpu) { -/* Guest initiated reset */ - vdev->device_endian =virtio_current_cpu_endian (); - }else { -/* System reset */ - vdev->device_endian =virtio_default_endian (); - } - -if (k->get_vhost) { -struct vhost_dev *hdev = k->get_vhost (vdev); -/* Only reset when vhost back-end is connected */ -if (hdev && hdev->vhost_ops) { -vhost_reset_device (hdev); - } - } - -if (k->reset) { - k->reset (vdev); - } - - vdev->start_on_kick = false; - vdev->started = false; - vdev->broken = false; - vdev->guest_features =0 ; - vdev->queue_sel =0 ; - vdev->status =0 ; - vdev->disabled = false; -qatomic_set (&vdev->isr,0 ); - vdev->config_vector =VIRTIO_NO_VECTOR ; -virtio_notify_vector (vdev, vdev->config_vector); - -for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { -__virtio_queue_reset (vdev, i); - } -} -void virtio_queue_set_addr (VirtIODevice *vdev,int n,hwaddr addr) {if (!vdev->vq[n].vring.num) {@@ -3169,6 +3126,49 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)return ret; } +void virtio_reset (void *opaque) +{ +VirtIODevice *vdev = opaque; +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +int i; + +virtio_set_status (vdev,0 ); +if (current_cpu) { +/* Guest initiated reset */ + vdev->device_endian =virtio_current_cpu_endian (); + }else { +/* System reset */ + vdev->device_endian =virtio_default_endian (); + } + +if (k->get_vhost) { +struct vhost_dev *hdev = k->get_vhost (vdev); +/* Only reset when vhost back-end is connected */ +if (hdev && hdev->vhost_ops) { +vhost_reset_device (hdev); + } + } + +if (k->reset) { + k->reset (vdev); + } + + vdev->start_on_kick = false; + vdev->started = false; + vdev->broken = false; +virtio_set_features_nocheck (vdev,0 ); + vdev->queue_sel =0 ; + vdev->status =0 ; + vdev->disabled = false; +qatomic_set (&vdev->isr,0 ); + vdev->config_vector =VIRTIO_NO_VECTOR ; +virtio_notify_vector (vdev, vdev->config_vector); + +for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { +__virtio_queue_reset (vdev, i); + } +} +static void virtio_device_check_notification_compatibility (VirtIODevice *vdev,Error **errp) { ---base-commit:
825b96dbcee23d134b691fc75618b59c5f53da32
change-id: 20250406-reset-5ed5248ee3c1Best regards,
Signature · 1 line
Akihiko Odaki <[email protected]>
Quoted 36 lines · Michael S. Tsirkin
Quoted 26 lines · Akihiko Odaki
Quoted 25 lines · Michael S. Tsirkin
Quoted 23 lines · Akihiko Odaki
Quoted 6 lines · Michael S. Tsirkin' via devel
Quoted 5 lines · Akihiko Odaki
virtio-net expects
set_features()will be called when the feature set used by the guest changes to update the number of virtqueues. Call it during reset as reset clears all features and the queues added forVIRTIO_NET_F_MQorVIRTIO_NET_F_RSSwill need to be removed.Quoted 8 lines
Quoted 4 lines
Fixes f9d6dbf0bf6e ("virtio-net: remove virtio queues if the guest doesn't support multiqueue")Signed-off-by Akihiko Odaki <[email protected]>The issue seems specific to virtio net: rset is reset,
it is distict from set features.
Why not just call the necessary functionality fromvirtio_net_reset?
set_featuresis currently implemented only in virtio-net; virtio-gpu-base also have a function set but it only has code to trace. If another device implements the function in the future, I think the device will also want to have it called during reset for the same reason with virtio-net.
virtio_reset()also callsset_statusto update the status field so callingset_features()is more aligned with the handling of the status field.Quoted 8 lines
Quoted 3 lines
That came to be because writing 0 to status resets the virtio device. For a while, this was the only way to reset vhost-user so we just went along with it.
It is possible to have code to send a command to write 0 to status to vhost-user in
reset(), but callingset_status()invirtio_reset()is more convenient and makes sense as the status is indeed being set to 0. I think the same reasoning applies to features.
Quoted 5 lines
I don't know who makes assumptions that features are only set during driver setup, though.
This will send an extraVHOST_USER_SET_FEATURESmessage for vhost-user, for example.
I want to have a good reason to add this overhead.
This change won't add an extra VHOST_USER_SET_FEATURES message for vhost-user because QEMU sends one when VIRTIO_CONFIG_S_DRIVER_OK is being set for status. The only current implementers of set_features() are virtio-net and virtio-gpu-base.
We may have more implementers of set_features() in the future though so it can be worth to think of the semantics of set_features() before that. When thinking of that, I found the current semantics of set_features() is not aligned with set_status(), which is confusing. I hope changing this in virtio_reset() will eliminate this source of confusion and prevents a bug like what virtio-net has in the future.
Quoted 122 lines
Quoted 121 lines
Quoted 121 lines
Quoted 120 lines
Quoted 120 lines
Quoted 119 lines
--- hw/virtio/virtio.c | 86 +++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 43 deletions(-)hw/virtio/virtio.c +43
-44@@ -2316,49 +2316,6 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index) } } -void virtio_reset (void *opaque) -{ -VirtIODevice *vdev = opaque; -VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); -int i; - -virtio_set_status (vdev,0 ); -if (current_cpu) { -/* Guest initiated reset */ - vdev->device_endian =virtio_current_cpu_endian (); - }else { -/* System reset */ - vdev->device_endian =virtio_default_endian (); - } - -if (k->get_vhost) { -struct vhost_dev *hdev = k->get_vhost (vdev); -/* Only reset when vhost back-end is connected */ -if (hdev && hdev->vhost_ops) { -vhost_reset_device (hdev); - } - } - -if (k->reset) { - k->reset (vdev); - } - - vdev->start_on_kick = false; - vdev->started = false; - vdev->broken = false; - vdev->guest_features =0 ; - vdev->queue_sel =0 ; - vdev->status =0 ; - vdev->disabled = false; -qatomic_set (&vdev->isr,0 ); - vdev->config_vector =VIRTIO_NO_VECTOR ; -virtio_notify_vector (vdev, vdev->config_vector); - -for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { -__virtio_queue_reset (vdev, i); - } -} -void virtio_queue_set_addr (VirtIODevice *vdev,int n,hwaddr addr) {if (!vdev->vq[n].vring.num) {@@ -3169,6 +3126,49 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)return ret; } +void virtio_reset (void *opaque) +{ +VirtIODevice *vdev = opaque; +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +int i; + +virtio_set_status (vdev,0 ); +if (current_cpu) { +/* Guest initiated reset */ + vdev->device_endian =virtio_current_cpu_endian (); + }else { +/* System reset */ + vdev->device_endian =virtio_default_endian (); + } + +if (k->get_vhost) { +struct vhost_dev *hdev = k->get_vhost (vdev); +/* Only reset when vhost back-end is connected */ +if (hdev && hdev->vhost_ops) { +vhost_reset_device (hdev); + } + } + +if (k->reset) { + k->reset (vdev); + } + + vdev->start_on_kick = false; + vdev->started = false; + vdev->broken = false; +virtio_set_features_nocheck (vdev,0 ); + vdev->queue_sel =0 ; + vdev->status =0 ; + vdev->disabled = false; +qatomic_set (&vdev->isr,0 ); + vdev->config_vector =VIRTIO_NO_VECTOR ; +virtio_notify_vector (vdev, vdev->config_vector); + +for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { +__virtio_queue_reset (vdev, i); + } +} +static void virtio_device_check_notification_compatibility (VirtIODevice *vdev,Error **errp) { ---base-commit:
825b96dbcee23d134b691fc75618b59c5f53da32
change-id: 20250406-reset-5ed5248ee3c1Best regards,
Signature · 1 line
Akihiko Odaki <[email protected]>
Hi Akihiko,
Quoted 92 lines · Akihiko Odaki
virtio-net expects
set_features()will be called when the feature set used by the guest changes to update the number of virtqueues. Call it during reset as reset clears all features and the queues added forVIRTIO_NET_F_MQorVIRTIO_NET_F_RSSwill need to be removed.Fixes f9d6dbf0bf6e ("virtio-net: remove virtio queues if the guest doesn't support multiqueue")Signed-off-by Akihiko Odaki <[email protected]>--- hw/virtio/virtio.c | 86 +++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 43 deletions(-)hw/virtio/virtio.c +21
-43@@ -2316,49 +2316,6 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index) } } -void virtio_reset (void *opaque) -{ -VirtIODevice *vdev = opaque; -VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); -int i; - -virtio_set_status (vdev,0 ); -if (current_cpu) { -/* Guest initiated reset */ - vdev->device_endian =virtio_current_cpu_endian (); - }else { -/* System reset */ - vdev->device_endian =virtio_default_endian (); - } - -if (k->get_vhost) { -struct vhost_dev *hdev = k->get_vhost (vdev); -/* Only reset when vhost back-end is connected */ -if (hdev && hdev->vhost_ops) { -vhost_reset_device (hdev); - } - } - -if (k->reset) { - k->reset (vdev); - } - - vdev->start_on_kick = false; - vdev->started = false; - vdev->broken = false; - vdev->guest_features =0 ; - vdev->queue_sel =0 ; - vdev->status =0 ; - vdev->disabled = false; -qatomic_set (&vdev->isr,0 ); - vdev->config_vector =VIRTIO_NO_VECTOR ; -virtio_notify_vector (vdev, vdev->config_vector); - -for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { -__virtio_queue_reset (vdev, i); - } -} -void virtio_queue_set_addr (VirtIODevice *vdev,int n,hwaddr addr) {if (!vdev->vq[n].vring.num) {@@ -3169,6 +3126,49 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)return ret; } +void virtio_reset (void *opaque) +{ +VirtIODevice *vdev = opaque; +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +int i; + +virtio_set_status (vdev,0 ); +if (current_cpu) { +/* Guest initiated reset */ + vdev->device_endian =virtio_current_cpu_endian (); + }else { +/* System reset */ + vdev->device_endian =virtio_default_endian (); + } + +if (k->get_vhost) { +struct vhost_dev *hdev = k->get_vhost (vdev); +/* Only reset when vhost back-end is connected */ +if (hdev && hdev->vhost_ops) { +vhost_reset_device (hdev); + }
hw/virtio/virtio.c int virtio_set_features(VirtIODevice *vdev, uint64_t val) · line 3159
Quoted 10 lines
hw/virtio/virtio.c +10
-0+ } + +if (k->reset) { + k->reset (vdev); + } + + vdev->start_on_kick = false; + vdev->started = false; + vdev->broken = false; +virtio_set_features_nocheck (vdev,0 );
It would be simpler to review having a first patch doing code movement, then a second one with the addition.
For my own education, are feature sets modifiable at runtime?
Quoted 21 lines
hw/virtio/virtio.c +12
-1+ vdev->queue_sel =0 ; + vdev->status =0 ; + vdev->disabled = false; +qatomic_set (&vdev->isr,0 ); + vdev->config_vector =VIRTIO_NO_VECTOR ; +virtio_notify_vector (vdev, vdev->config_vector); + +for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { +__virtio_queue_reset (vdev, i); + } +} +static void virtio_device_check_notification_compatibility (VirtIODevice *vdev,Error **errp) { ---base-commit:
825b96dbcee23d134b691fc75618b59c5f53da32
change-id: 20250406-reset-5ed5248ee3c1Best regards,
Quoted 101 lines · Philippe Mathieu-Daudé
Hi Akihiko,
Quoted 98 lines · Akihiko Odaki
virtio-net expects
set_features()will be called when the feature set used by the guest changes to update the number of virtqueues. Call it during reset as reset clears all features and the queues added forVIRTIO_NET_F_MQorVIRTIO_NET_F_RSSwill need to be removed.Fixes f9d6dbf0bf6e ("virtio-net: remove virtio queues if the guest doesn't support multiqueue")Signed-off-by Akihiko Odaki <[email protected]>---
hw/virtio/virtio.c| 86 ++++++++++++++++++++++++++
+---------------------------1 file changed, 43 insertions(+), 43 deletions(-)hw/virtio/virtio.c +26
-43@@ -2316,49 +2316,6 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index) } } -void virtio_reset (void *opaque) -{ - VirtIODevice *vdev = opaque; - VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); - int i; - - virtio_set_status(vdev, 0); - if (current_cpu) { - /* Guest initiated reset */ - vdev->device_endian = virtio_current_cpu_endian(); - } else { - /* System reset */ - vdev->device_endian = virtio_default_endian(); - } - - if (k->get_vhost) { - struct vhost_dev *hdev = k->get_vhost(vdev); - /* Only reset when vhost back-end is connected */ - if (hdev && hdev->vhost_ops) { - vhost_reset_device(hdev); - } - } - - if (k->reset) { - k->reset(vdev); - } - - vdev->start_on_kick = false; - vdev->started = false; - vdev->broken = false; - vdev->guest_features = 0; - vdev->queue_sel = 0; - vdev->status = 0; - vdev->disabled = false; - qatomic_set(&vdev->isr, 0); - vdev->config_vector = VIRTIO_NO_VECTOR; - virtio_notify_vector(vdev, vdev->config_vector); - - for(i = 0; i < VIRTIO_QUEUE_MAX; i++) { - __virtio_queue_reset(vdev, i); - } -} - void virtio_queue_set_addr(VirtIODevice *vdev, int n, hwaddr addr) { if (!vdev->vq[n].vring.num) {@@ -3169,6 +3126,49 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val) return ret; } +void virtio_reset (void *opaque) +{ + VirtIODevice *vdev = opaque; + VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); + int i; + + virtio_set_status(vdev, 0); + if (current_cpu) { + /* Guest initiated reset */ + vdev->device_endian = virtio_current_cpu_endian(); + } else { + /* System reset */ + vdev->device_endian = virtio_default_endian(); + } + + if (k->get_vhost) { + struct vhost_dev *hdev = k->get_vhost(vdev); + /* Only reset when vhost back-end is connected */ + if (hdev && hdev->vhost_ops) { + vhost_reset_device(hdev); + } + } + + if (k->reset) { + k->reset(vdev); + }
Quoted 8 lines
hw/virtio/virtio.c int virtio_set_features(VirtIODevice *vdev, uint64_t val) · line 3159
Quoted 5 lines
hw/virtio/virtio.c +5
-0+ + vdev->start_on_kick = false; + vdev->started = false; + vdev->broken = false; + virtio_set_features_nocheck(vdev, 0);It would be simpler to review having a first patch doing code movement, then a second one with the addition.
I'm thinking of splitting in the reversed order: add this function call with a forward declaration in a first patch and move virtio_reset() in a second one. Hopefully it will also make backporting easier.
Quoted 2 lines
For my own education, are feature sets modifiable at runtime?
Looking at the code and spec, yes, I think so. The feature set cannot be modified if VIRTIO_CONFIG_S_FEATURES_OK is set as part of the "status", but the flag can be cleared anytime.
Quoted 23 lines
Quoted 22 lines
hw/virtio/virtio.c +12
-1+ vdev->queue_sel = 0; + vdev->status = 0; + vdev->disabled = false; + qatomic_set(&vdev->isr, 0); + vdev->config_vector = VIRTIO_NO_VECTOR; + virtio_notify_vector(vdev, vdev->config_vector); + + for (i = 0; i < VIRTIO_QUEUE_MAX; i++) { + __virtio_queue_reset(vdev, i); + } +} + static void virtio_device_check_notification_compatibility(VirtIODevice *vdev, Error **errp) { ---base-commit:
825b96dbcee23d134b691fc75618b59c5f53da32
change-id: 20250406-reset-5ed5248ee3c1Best regards,
Quoted 5 lines · Akihiko Odaki
virtio-net expects
set_features()will be called when the feature set used by the guest changes to update the number of virtqueues. Call it during reset as reset clears all features and the queues added forVIRTIO_NET_F_MQorVIRTIO_NET_F_RSSwill need to be removed.
It's not clear to me what kind of problem we want to fix here. For example, what happens if we don't do this.
Quoted 88 lines
Fixes f9d6dbf0bf6e ("virtio-net: remove virtio queues if the guest doesn't support multiqueue")Signed-off-by Akihiko Odaki <[email protected]>--- hw/virtio/virtio.c | 86 +++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 43 deletions(-)hw/virtio/virtio.c +21
-43@@ -2316,49 +2316,6 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index) } } -void virtio_reset (void *opaque) -{ -VirtIODevice *vdev = opaque; -VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); -int i; - -virtio_set_status (vdev,0 ); -if (current_cpu) { -/* Guest initiated reset */ - vdev->device_endian =virtio_current_cpu_endian (); - }else { -/* System reset */ - vdev->device_endian =virtio_default_endian (); - } - -if (k->get_vhost) { -struct vhost_dev *hdev = k->get_vhost (vdev); -/* Only reset when vhost back-end is connected */ -if (hdev && hdev->vhost_ops) { -vhost_reset_device (hdev); - } - } - -if (k->reset) { - k->reset (vdev); - } - - vdev->start_on_kick = false; - vdev->started = false; - vdev->broken = false; - vdev->guest_features =0 ; - vdev->queue_sel =0 ; - vdev->status =0 ; - vdev->disabled = false; -qatomic_set (&vdev->isr,0 ); - vdev->config_vector =VIRTIO_NO_VECTOR ; -virtio_notify_vector (vdev, vdev->config_vector); - -for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { -__virtio_queue_reset (vdev, i); - } -} -void virtio_queue_set_addr (VirtIODevice *vdev,int n,hwaddr addr) {if (!vdev->vq[n].vring.num) {@@ -3169,6 +3126,49 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)return ret; } +void virtio_reset (void *opaque) +{ +VirtIODevice *vdev = opaque; +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +int i; + +virtio_set_status (vdev,0 ); +if (current_cpu) { +/* Guest initiated reset */ + vdev->device_endian =virtio_current_cpu_endian (); + }else { +/* System reset */ + vdev->device_endian =virtio_default_endian (); + } + +if (k->get_vhost) { +struct vhost_dev *hdev = k->get_vhost (vdev); +/* Only reset when vhost back-end is connected */ +if (hdev && hdev->vhost_ops) { +vhost_reset_device (hdev); + }
hw/virtio/virtio.c int virtio_set_features(VirtIODevice *vdev, uint64_t val) · line 3159
Quoted 10 lines
hw/virtio/virtio.c +10
-0+ } + +if (k->reset) { + k->reset (vdev); + } + + vdev->start_on_kick = false; + vdev->started = false; + vdev->broken = false; +virtio_set_features_nocheck (vdev,0 );
I would just add a forward declaration instead for a smaller changset to ease the review and backport.
Quoted 20 lines
hw/virtio/virtio.c +12
-1+ vdev->queue_sel =0 ; + vdev->status =0 ; + vdev->disabled = false; +qatomic_set (&vdev->isr,0 ); + vdev->config_vector =VIRTIO_NO_VECTOR ; +virtio_notify_vector (vdev, vdev->config_vector); + +for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { +__virtio_queue_reset (vdev, i); + } +} +static void virtio_device_check_notification_compatibility (VirtIODevice *vdev,Error **errp) { ---base-commit:
825b96dbcee23d134b691fc75618b59c5f53da32
change-id: 20250406-reset-5ed5248ee3c1
Quoted 3 lines
Best regards,
--
Akihiko Odaki <[email protected]>
Thanks
Quoted 2 lines
Quoted 9 lines · Jason Wang
Quoted 5 lines · Akihiko Odaki
virtio-net expects
set_features()will be called when the feature set used by the guest changes to update the number of virtqueues. Call it during reset as reset clears all features and the queues added forVIRTIO_NET_F_MQorVIRTIO_NET_F_RSSwill need to be removed.It's not clear to me what kind of problem we want to fix here. For example, what happens if we don't do this.
Without this change, if the device gets reset after VIRTIO_NET_F_MQ or VIRTIO_NET_F_RSS is configured:
- the guest will see too many virtqueues
- migration results in segfault due to the mismatch with the number of virtqueues and feature set
I'll add the description to the patch message with the next version.
Quoted 94 lines
Quoted 94 lines
Fixes f9d6dbf0bf6e ("virtio-net: remove virtio queues if the guest doesn't support multiqueue")Signed-off-by Akihiko Odaki <[email protected]>--- hw/virtio/virtio.c | 86 +++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 43 deletions(-)hw/virtio/virtio.c +26
-43@@ -2316,49 +2316,6 @@ void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index) } } -void virtio_reset (void *opaque) -{ -VirtIODevice *vdev = opaque; -VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); -int i; - -virtio_set_status (vdev,0 ); -if (current_cpu) { -/* Guest initiated reset */ - vdev->device_endian =virtio_current_cpu_endian (); - }else { -/* System reset */ - vdev->device_endian =virtio_default_endian (); - } - -if (k->get_vhost) { -struct vhost_dev *hdev = k->get_vhost (vdev); -/* Only reset when vhost back-end is connected */ -if (hdev && hdev->vhost_ops) { -vhost_reset_device (hdev); - } - } - -if (k->reset) { - k->reset (vdev); - } - - vdev->start_on_kick = false; - vdev->started = false; - vdev->broken = false; - vdev->guest_features =0 ; - vdev->queue_sel =0 ; - vdev->status =0 ; - vdev->disabled = false; -qatomic_set (&vdev->isr,0 ); - vdev->config_vector =VIRTIO_NO_VECTOR ; -virtio_notify_vector (vdev, vdev->config_vector); - -for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { -__virtio_queue_reset (vdev, i); - } -} -void virtio_queue_set_addr (VirtIODevice *vdev,int n,hwaddr addr) {if (!vdev->vq[n].vring.num) {@@ -3169,6 +3126,49 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)return ret; } +void virtio_reset (void *opaque) +{ +VirtIODevice *vdev = opaque; +VirtioDeviceClass *k =VIRTIO_DEVICE_GET_CLASS (vdev); +int i; + +virtio_set_status (vdev,0 ); +if (current_cpu) { +/* Guest initiated reset */ + vdev->device_endian =virtio_current_cpu_endian (); + }else { +/* System reset */ + vdev->device_endian =virtio_default_endian (); + } + +if (k->get_vhost) { +struct vhost_dev *hdev = k->get_vhost (vdev); +/* Only reset when vhost back-end is connected */ +if (hdev && hdev->vhost_ops) { +vhost_reset_device (hdev); + } + } + +if (k->reset) { + k->reset (vdev); + }
Quoted 8 lines
hw/virtio/virtio.c int virtio_set_features(VirtIODevice *vdev, uint64_t val) · line 3159
Quoted 5 lines
hw/virtio/virtio.c +5
-0+ + vdev->start_on_kick = false; + vdev->started = false; + vdev->broken = false; +virtio_set_features_nocheck (vdev,0 );I would just add a forward declaration instead for a smaller changset to ease the review and backport.
Moving virtio_reset() indeed requires a bigger change, but I still want to move it to the latter part of this file. I occasionally saw that functions that affect the whole device state like this calls a number of static functions. Moving virtio_reset() requires more lines to change now, but I hope it will minimize the possibility to require forward declarations or code movement in the future.
Regards,
Akihiko Odaki
Quoted 30 lines
Quoted 21 lines
hw/virtio/virtio.c +12
-1+ vdev->queue_sel =0 ; + vdev->status =0 ; + vdev->disabled = false; +qatomic_set (&vdev->isr,0 ); + vdev->config_vector =VIRTIO_NO_VECTOR ; +virtio_notify_vector (vdev, vdev->config_vector); + +for (i =0 ; i <VIRTIO_QUEUE_MAX ; i++) { +__virtio_queue_reset (vdev, i); + } +} +static void virtio_device_check_notification_compatibility (VirtIODevice *vdev,Error **errp) { ---base-commit:
825b96dbcee23d134b691fc75618b59c5f53da32
change-id: 20250406-reset-5ed5248ee3c1Quoted 3 lines
Best regards,
--
Akihiko Odaki <[email protected]>Thanks
Quoted 2 lines