Discussion of the implementations of VIRTIO specification
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cornelia Huck <cohuck@redhat.com>
Cc: Srivatsa Vaddagiri <svaddagi@qti.qualcomm.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"virtio-dev@lists.oasis-open.org"
	<virtio-dev@lists.oasis-open.org>,
	Trilok Soni <tsoni@quicinc.com>,
	Pratik Patel <pratikp@quicinc.com>
Subject: Re: [PATCH v1] virtio-mmio: Specify wait needed in driver during reset
Date: Mon, 26 Jul 2021 09:18:43 -0400	[thread overview]
Message-ID: <20210726091723-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <87h7gh5od5.fsf@redhat.com>

On Mon, Jul 26, 2021 at 01:03:02PM +0200, Cornelia Huck wrote:
> On Fri, Jul 23 2021, Srivatsa Vaddagiri <svaddagi@qti.qualcomm.com> wrote:
> 
> > Changes since v0:
> >
> > Introduce a new feature bit, VIRTIO_F_MMIO_RESET_WAIT, which controls whether a driver polls
> > for reset completion or not.
> 
> Nit: changelog should go into a "---" section, next to the diffstat (git
> format-patch should give you the correct base to edit.)
> 
> >
> > ===
> >
> > Reset of a virtio-mmio device is accomplished by writing 0 to its Status register.
> > For devices that are emulated in software, writes to Status register are trapped
> > and resumed only after the reset operation is complete. Thus a driver can be
> > assured of reset completion as soon as its write completes.
> >
> > That may not be the case for virtio-mmio devices implemented in hardware
> > directly. A write could complete before the reset operation inside device is
> > completed. Introduce a new feature, VIRTIO_F_MMIO_RESET_WAIT, that such devices
> > will offer as means to indicate to driver that they need to poll for reset
> > completion, indicated by a read of Status register returning 0.
> >
> > Signed-off-by: Srivatsa Vaddagiri <svaddagi@qti.qualcomm.com>
> >
> > diff --git a/content.tex b/content.tex
> > index 5c70a3c..1990a5c 100644
> > --- a/content.tex
> > +++ b/content.tex
> > @@ -1924,7 +1924,10 @@ \subsection{MMIO Device Register Layout}\label{sec:Virtio Transport Options / Vi
> >  do not represent events which took place MUST be zero.
> >
> >  Upon reset, the device MUST clear all bits in \field{InterruptStatus} and ready bits in the
> > -\field{QueueReady} register for all queues in the device.
> > +\field{QueueReady} register for all queues in the device. The device MUST also offer
> > +VIRTIO_F_MMIO_RESET_WAIT if it requires driver to poll for reset completion
> 
> s/driver/the driver/
> 
> > +indicated by a read of \field{Status} returning 0. Such a device MUST also fail to accept
> > +FEATURES_OK bit if driver does not negotiate VIRTIO_F_MMIO_RESET_WAIT.
> 
> So, this basically means that an older driver that does not know the new
> feature bit will not work with devices offering this bit, even if it did
> poll? This seems acceptable, I just wanted to spell it out.

Maybe should or even may is enough here. For example it is reasonable to have
hypervisor block guest until reset is complete.


> >
> >  The device MUST change value returned in \field{ConfigGeneration} if there is any risk of a
> >  driver seeing an inconsistent configuration state.
> > @@ -1944,6 +1947,10 @@ \subsection{MMIO Device Register Layout}\label{sec:Virtio Transport Options / Vi
> >  8 bit wide fields, 16 bit wide and aligned accesses for 16 bit wide fields and 32 bit wide and
> >  aligned accesses for 32 and 64 bit wide fields.
> >
> > +The driver MUST accept VIRTIO_F_MMIO_RESET_WAIT if offered by device. During
> 
> s/device/the device/
> 
> > +reset of such a device that offers VIRTIO_F_MMIO_RESET_WAIT, driver MUST poll for
> 
> s/driver/the driver/
> 
> But maybe use "if VIRTIO_F_MMIO_RESET_WAIT has been negotiated" instead?
> This is implied by the statements above, but the deciding factor here is
> that the feature has been negotiated, and not that it has been offered.
> 
> 
> > +reset completion indicated by a read of \field{Status} returning 0.
> > +
> >  The driver MUST ignore a device with \field{MagicValue} which is not 0x74726976,
> >  although it MAY report an error.
> >
> > @@ -6672,6 +6679,10 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
> >    transport specific.
> >    For more details about driver notifications over PCI see \ref{sec:Virtio Transport Options / Virtio Over PCI Bus / PCI-specific Initialization And Device Operation / Available Buffer Notifications}.
> >
> > +  \item[VIRTIO_F_MMIO_RESET_WAIT(40)] This feature could be offered by a device
> > +  using MMIO transport and indicates that the driver needs to poll for reset
> 
> "This feature is specific to the MMIO transport and indicates that the
> device requires the driver to poll..."
> 
> ?
> 
> > +  completion indicated by a read of \field{Status} returning 0.
> > +
> >  \end{description}
> >
> >  \drivernormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
> > @@ -6708,6 +6719,8 @@ \chapter{Reserved Feature Bits}\label{sec:Reserved Feature Bits}
> >
> >  A driver SHOULD accept VIRTIO_F_NOTIF_CONFIG_DATA if it is offered.
> >
> > +A driver SHOULD accept VIRTIO_F_MMIO_RESET_WAIT if it is offered.
> > +
> 
> But this was specified as MUST above, wasn't it?
> 
> >  \devicenormative{\section}{Reserved Feature Bits}{Reserved Feature Bits}
> >
> >  A device MUST offer VIRTIO_F_VERSION_1.  A device MAY fail to operate further


  parent reply	other threads:[~2021-07-26 13:18 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23 14:55 [PATCH v1] virtio-mmio: Specify wait needed in driver during reset Srivatsa Vaddagiri
2021-07-26 11:03 ` [virtio-dev] " Cornelia Huck
2021-07-26 11:25   ` Srivatsa Vaddagiri
2021-07-26 11:36     ` [virtio-dev] " Cornelia Huck
2021-07-26 13:19       ` Michael S. Tsirkin
2021-07-26 14:09         ` [virtio-dev] " Cornelia Huck
2021-07-26 14:17         ` Srivatsa Vaddagiri
2021-07-26 19:03           ` Michael S. Tsirkin
2021-07-27  9:52             ` [virtio-dev] " Srivatsa Vaddagiri
2021-07-29 15:21               ` Cornelia Huck
2021-07-30  3:49                 ` Srivatsa Vaddagiri
2021-08-02  6:06             ` Jason Wang
2021-08-11 10:05               ` [virtio-dev] " Srivatsa Vaddagiri
2021-08-16  2:09                 ` Jason Wang
2021-08-16  5:35                   ` Michael S. Tsirkin
     [not found]                     ` <20210816063550.GD5604@quicinc.com>
2021-08-16 11:48                       ` Michael S. Tsirkin
2021-08-16 13:34                         ` Srivatsa Vaddagiri
2021-08-16 14:37                           ` Michael S. Tsirkin
2021-08-16 14:58                             ` Srivatsa Vaddagiri
2021-08-17  5:45                         ` Jason Wang
2021-08-17  7:51                           ` Michael S. Tsirkin
2021-08-17  8:15                             ` Jason Wang
2021-08-17 10:03                             ` Srivatsa Vaddagiri
2021-08-17 12:48                               ` Srivatsa Vaddagiri
2021-08-18  2:57                                 ` Jason Wang
2021-08-18  2:54                               ` Jason Wang
2021-08-18  5:15                                 ` Srivatsa Vaddagiri
2021-08-18  5:40                                   ` Jason Wang
2021-08-18  5:51                                     ` Srivatsa Vaddagiri
2021-08-18  6:04                                       ` Jason Wang
2021-08-18  6:13                                         ` Srivatsa Vaddagiri
2021-08-24 16:57                                           ` Srivatsa Vaddagiri
2021-08-20  3:56                     ` Jason Wang
2021-08-20 11:15                       ` Michael S. Tsirkin
2021-07-26 13:18   ` Michael S. Tsirkin [this message]
2021-07-26 14:13     ` Cornelia Huck

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=20210726091723-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=pratikp@quicinc.com \
    --cc=svaddagi@qti.qualcomm.com \
    --cc=tsoni@quicinc.com \
    --cc=virtio-dev@lists.oasis-open.org \
    /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