On 6/9/22 14:22, Cornelia Huck wrote:
- if (proxy->legacy) {
- return;
- }
+ virtio_bus_reset(&proxy->bus);
- for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
- proxy->vqs[i].enabled = 0;
+ if (!proxy->legacy) {
+ for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
+ proxy->vqs[i].enabled = 0;
+ }
}
}
The more I look at this, the more confused I get.
The current code calls soft_reset when the driver sets the status to 0,
after already having called virtio_reset().
Yes, that's before the patch.
But doesn't virtio_reset() ultimately already trigger the virtio-mmio
reset routine, which sets enabled to 0 for all queues? Why do that
again? (And why is soft_reset a "soft reset"?)
No, it does not set enabled = 0 because "enabled" is specific to
virtio-mmio (it is read by VIRTIO_MMIO_QUEUE_READY, which is only
available in virtio-mmio 1.0 devices). In fact it is stored in
proxy->vqs[], while virtio_reset only resets fields in vdev->vq[].
k->reset() instead triggers the *device* reset routine (e.g.
virtio_blk_reset). So what makes it "soft" is that the various queue
addresses remain there, and can be enabled just by writing 1 to
VIRTIO_MMIO_QUEUE_READY for every queue.
Paolo