qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/4] virtio-mmio: cleanup reset


From: Paolo Bonzini
Subject: Re: [PATCH 4/4] virtio-mmio: cleanup reset
Date: Thu, 9 Jun 2022 16:44:06 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]