All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cornelia Huck <cohuck@redhat.com>
Cc: "Ricardo Cañuelo" <ricardo.canuelo@collabora.com>,
	linux-doc@vger.kernel.org,
	virtualization@lists.linux-foundation.org, jasowang@redhat.com,
	kernel@collabora.com, bagasdotme@gmail.com
Subject: Re: [PATCH v4 2/2] docs: driver-api: virtio: virtio on Linux
Date: Thu, 11 Aug 2022 09:57:20 -0400	[thread overview]
Message-ID: <20220811095251-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <87czd6dha1.fsf@redhat.com>

On Thu, Aug 11, 2022 at 03:46:46PM +0200, Cornelia Huck wrote:
> On Wed, Aug 10 2022, Ricardo Cañuelo <ricardo.canuelo@collabora.com> wrote:
> 
> > Basic doc about Virtio on Linux and a short tutorial on Virtio drivers.
> >
> > Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
> > ---
> >  Documentation/driver-api/index.rst            |   1 +
> >  Documentation/driver-api/virtio/index.rst     |  11 ++
> >  Documentation/driver-api/virtio/virtio.rst    | 144 ++++++++++++++
> >  .../virtio/writing_virtio_drivers.rst         | 186 ++++++++++++++++++
> >  MAINTAINERS                                   |   1 +
> >  5 files changed, 343 insertions(+)
> >  create mode 100644 Documentation/driver-api/virtio/index.rst
> >  create mode 100644 Documentation/driver-api/virtio/virtio.rst
> >  create mode 100644 Documentation/driver-api/virtio/writing_virtio_drivers.rst
> >
> 
> (...)
> 
> > +.. rubric:: Footnotes
> > +
> > +.. [#f1] that's why they may be also referred as virtrings.
> 
> "referred to"
> 
> (...)
> 
> > +The ``probe`` method does the minimum driver setup in this case
> > +(memory allocation for the device data) and initializes the
> > +virtqueue. The virtqueues are automatically enabled after ``probe``
> > +returns, sending the appropriate "DRIVER_OK" status signal to the
> > +device. If the virtqueues need to be enabled before ``probe`` ends, they
> > +can be manually enabled by calling virtio_device_ready():
> > +
> > +.. kernel-doc:: include/linux/virtio_config.h
> > +    :identifiers: virtio_device_ready
> 
> Hm, not quite sure what the actual expectations are here: Should the
> driver set DRIVER_OK in its probe function, and the core only set it as
> a fallback? Michael, Jason?
> 
> (...)
> 
> LGTM in general.

Generally driver should either call device_ready
or defer adding device to linux in a scan callback.

Doing neither is likely a bug since you might
then be asked to add buffers before DRIVER_OK is set,
though e.g. if you are interrupt driven things might work
correctly.

-- 
MST


WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cornelia Huck <cohuck@redhat.com>
Cc: linux-doc@vger.kernel.org,
	virtualization@lists.linux-foundation.org, bagasdotme@gmail.com,
	kernel@collabora.com
Subject: Re: [PATCH v4 2/2] docs: driver-api: virtio: virtio on Linux
Date: Thu, 11 Aug 2022 09:57:20 -0400	[thread overview]
Message-ID: <20220811095251-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <87czd6dha1.fsf@redhat.com>

On Thu, Aug 11, 2022 at 03:46:46PM +0200, Cornelia Huck wrote:
> On Wed, Aug 10 2022, Ricardo Cañuelo <ricardo.canuelo@collabora.com> wrote:
> 
> > Basic doc about Virtio on Linux and a short tutorial on Virtio drivers.
> >
> > Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
> > ---
> >  Documentation/driver-api/index.rst            |   1 +
> >  Documentation/driver-api/virtio/index.rst     |  11 ++
> >  Documentation/driver-api/virtio/virtio.rst    | 144 ++++++++++++++
> >  .../virtio/writing_virtio_drivers.rst         | 186 ++++++++++++++++++
> >  MAINTAINERS                                   |   1 +
> >  5 files changed, 343 insertions(+)
> >  create mode 100644 Documentation/driver-api/virtio/index.rst
> >  create mode 100644 Documentation/driver-api/virtio/virtio.rst
> >  create mode 100644 Documentation/driver-api/virtio/writing_virtio_drivers.rst
> >
> 
> (...)
> 
> > +.. rubric:: Footnotes
> > +
> > +.. [#f1] that's why they may be also referred as virtrings.
> 
> "referred to"
> 
> (...)
> 
> > +The ``probe`` method does the minimum driver setup in this case
> > +(memory allocation for the device data) and initializes the
> > +virtqueue. The virtqueues are automatically enabled after ``probe``
> > +returns, sending the appropriate "DRIVER_OK" status signal to the
> > +device. If the virtqueues need to be enabled before ``probe`` ends, they
> > +can be manually enabled by calling virtio_device_ready():
> > +
> > +.. kernel-doc:: include/linux/virtio_config.h
> > +    :identifiers: virtio_device_ready
> 
> Hm, not quite sure what the actual expectations are here: Should the
> driver set DRIVER_OK in its probe function, and the core only set it as
> a fallback? Michael, Jason?
> 
> (...)
> 
> LGTM in general.

Generally driver should either call device_ready
or defer adding device to linux in a scan callback.

Doing neither is likely a bug since you might
then be asked to add buffers before DRIVER_OK is set,
though e.g. if you are interrupt driven things might work
correctly.

-- 
MST

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2022-08-11 13:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  9:40 [PATCH v4 0/2] docs: driver-api: virtio: virtio on Linux Ricardo Cañuelo
2022-08-10  9:40 ` Ricardo Cañuelo
2022-08-10  9:40 ` [PATCH v4 1/2] virtio: kerneldocs fixes and enhancements Ricardo Cañuelo
2022-08-10  9:40   ` Ricardo Cañuelo
2022-08-11 13:19   ` Cornelia Huck
2022-08-11 13:19     ` Cornelia Huck
2022-08-10  9:40 ` [PATCH v4 2/2] docs: driver-api: virtio: virtio on Linux Ricardo Cañuelo
2022-08-10  9:40   ` Ricardo Cañuelo
2022-08-11 13:32   ` Michael S. Tsirkin
2022-08-11 13:32     ` Michael S. Tsirkin
2022-08-11 14:54     ` Ricardo Cañuelo
2022-08-11 14:54       ` Ricardo Cañuelo
2022-08-11 13:46   ` Cornelia Huck
2022-08-11 13:46     ` Cornelia Huck
2022-08-11 13:57     ` Michael S. Tsirkin [this message]
2022-08-11 13:57       ` Michael S. Tsirkin

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=20220811095251-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=bagasdotme@gmail.com \
    --cc=cohuck@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kernel@collabora.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=ricardo.canuelo@collabora.com \
    --cc=virtualization@lists.linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.