From: Paolo Bonzini <pbonzini@redhat.com>
To: Cornelia Huck <cohuck@redhat.com>, qemu-devel@nongnu.org
Cc: mst@redhat.com, thuth@redhat.com
Subject: Re: [PATCH 4/4] virtio-mmio: cleanup reset
Date: Thu, 9 Jun 2022 16:44:06 +0200 [thread overview]
Message-ID: <1ebafbc4-8085-7f9a-9b4a-a6327680ca07@redhat.com> (raw)
In-Reply-To: <87ilpa9gbz.fsf@redhat.com>
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
prev parent reply other threads:[~2022-06-09 16:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-09 9:15 [PATCH 0/4] virtio: various cleanups to reset code Paolo Bonzini
2022-06-09 9:15 ` [PATCH 1/4] s390x: simplify virtio_ccw_reset_virtio Paolo Bonzini
2022-06-09 11:40 ` Cornelia Huck
2022-06-09 9:15 ` [PATCH 2/4] virtio-mmio: stop ioeventfd on legacy reset Paolo Bonzini
2022-06-09 11:49 ` Cornelia Huck
2022-06-09 9:15 ` [PATCH 3/4] virtio: stop ioeventfd on reset Paolo Bonzini
2022-06-09 11:56 ` Cornelia Huck
2022-06-09 9:15 ` [PATCH 4/4] virtio-mmio: cleanup reset Paolo Bonzini
2022-06-09 12:22 ` Cornelia Huck
2022-06-09 14:44 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1ebafbc4-8085-7f9a-9b4a-a6327680ca07@redhat.com \
--to=pbonzini@redhat.com \
--cc=cohuck@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).