On Tue, Aug 11, 2015 at 03:01:22PM +0200, Paolo Bonzini wrote:
>
>
> On 11/08/2015 07:59, Michael S. Tsirkin wrote:
> > > +\item If the VIRTIO_BLK_F_CONFIG_WCE feature is negotiated, the cache
> > > + mode can be read or set through the \field{writeback} field. 0 corresponds
> > > + to a writethrough cache, 1 to a writeback cache\footnote{Consistent with
> > > + \ref{devicenormative:Device Types / Block Device / Device Operation},
> > > + a writethrough cache can be defined broadly as a cache that commits
> > > + writes to persistent device backend storage before reporting their
> > > + completion. For example, a battery-backed writeback cache actually
> > > + counts as writethrough according to this definition.}. The cache mode
> > > + after reset is undefined.
> >
> > Is it really undefined, or can it be either
> > writeback or writethrough, and can be determined by reading the
> > \field{writeback} field reset value?
>
> For transitional devices, it can be either writeback or writethrough and
> can be determined by reading \field{writeback}.
I think you when using the legacy interface.
> For non-transitional devices, it can be determined after you've written
> FEATURES_OK. Until then, you shouldn't read the field.
>
> Paolo
I think you mean when using the modern interface (default under
virtio 1 spec).
OK to summarize, how about:
In free text:
The cache mode after reset can be either writeback or writethrough.
The actual mode can be determined by reading \field{writeback}.
In conformance paragraph:
The driver MUST NOT read \field{writeback} before setting
the FEATURES_OK \field{status} bit.
And in legacy section:
Legacy drivers and drivers did not support the FEATURES_OK \field{status} bit,
and used the device before setting the DRIVER_OK bit.
Therefore:
When using the legacy interface, the driver MAY read \field{writeback}
before setting the FEATURES_OK \field{status} field.
When using the legacy interface, the transitional devices MAY assume
that driver features won't be changed after reading \field{writeback}.
--
MST