All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: Simon Glass <sjg@chromium.org>
Cc: trini@konsulko.com, tuomas.tynkkynen@iki.fi, bmeng.cn@gmail.com,
	jerome.forissier@arm.com, jserv@ccns.ncku.edu.tw,
	eleanor15x@gmail.com, marscheng@google.com,
	u-boot@lists.u-boot-project.org
Subject: Re: [PATCH v2 3/6] virtio: 9p: Add 9P transport driver
Date: Thu, 24 Sep 2026 04:53:33 +0800	[thread overview]
Message-ID: <arQ8TZcziIi7vjpe@google.com> (raw)
In-Reply-To: <CAFLszTh6STRL=4sE1eYAuTKQEymKK1xXmJwxA0u7p1BPGU9pmg@mail.gmail.com>

Hi Simon,

On Fri, Sep 11, 2026 at 05:43:39AM -0600, Simon Glass wrote:
> Hi Kuan-Wei,
> 
> On 2026-08-29T19:21:13, Kuan-Wei Chiu <visitorckw@gmail.com> wrote:
> > virtio: 9p: Add 9P transport driver
> >
> > Add virtio transport driver for the 9P filesystem.
> >
> > This driver binds to the virtio-9p device exposed by the hypervisor and
> > registers as a DM UCLASS_9P device. It implements the transmit and
> > receive routines.
> >
> > Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
> >
> > drivers/virtio/Kconfig         |   7 +++
> >  drivers/virtio/Makefile        |   1 +
> >  drivers/virtio/virtio-uclass.c |   1 +
> >  drivers/virtio/virtio_9p.c     | 119 +++++++++++++++++++++++++++++++++++++++++
> >  include/virtio.h               |  12 ++++-
> >  5 files changed, 139 insertions(+), 1 deletion(-)
> 
> > diff --git a/drivers/virtio/virtio_9p.c b/drivers/virtio/virtio_9p.c
> > @@ -0,0 +1,119 @@
> > +static int virtio_9p_remove(struct udevice *dev)
> > +{
> > +     return virtio_reset(dev);
> > +}
> > +
> > +U_BOOT_DRIVER(virtio_9p) = {
> > +     .name       = VIRTIO_9P_DRV_NAME,
> > +     .id         = UCLASS_9P,
> > +     .ops        = &virtio_9p_ops,
> > +     .bind       = virtio_9p_bind,
> > +     .probe      = virtio_9p_probe,
> > +     .remove     = virtio_9p_remove,
> 
> Sorry, I gave you the wrong function name last time. Other virtio
> drivers set .remove = virtio_remove, which calls virtio_del_vqs()
> before virtio_reset(). Going straight to virtio_reset() here leaks the
> vq allocated in probe(). Please drop the wrapper and use virtio_remove
> directly.

I checked the tree and it seems virtio_remove() does not exist in
U-Boot. Existing drivers like virtio_blk, virtio_net, and virtio_rng
all set .remove = virtio_reset directly. To avoid leaking the vq on
removal, I will keep virtio_9p_remove() and call virtio_del_vqs(dev)
before virtio_reset(dev) in v3.

> 
> > diff --git a/drivers/virtio/virtio_9p.c b/drivers/virtio/virtio_9p.c
> > @@ -0,0 +1,119 @@
> > +     start = get_timer(0);
> > +     while (!virtqueue_get_buf(priv->vq, &len)) {
> > +             if (get_timer(start) > VIRTIO_9P_TIMEOUT_MS)
> > +                     return -ETIMEDOUT;
> > +     }
> > +
> > +     if (len < (int)sizeof(struct p9_header))
> > +             return -EIO;
> > +
> > +     return 0;
> > +}
> 
> Looks good, It might be worth returning len to the caller so the
> client can cross-check it against the size field in the reply header,
> but up to you.
> 
Ack. Will do in v3.

Regards,
Kuan-Wei

  reply	other threads:[~2026-09-23 20:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-29 19:21 [PATCH v2 0/6] fs: Add 9P filesystem support over virtio Kuan-Wei Chiu
2026-08-29 19:21 ` [PATCH v2 1/6] net: 9p: Add 9P2000.L protocol support Kuan-Wei Chiu
2026-09-11 11:43   ` Simon Glass
2026-08-29 19:21 ` [PATCH v2 2/6] fs: 9p: Add 9P filesystem support Kuan-Wei Chiu
2026-09-11 11:43   ` Simon Glass
2026-08-29 19:21 ` [PATCH v2 3/6] virtio: 9p: Add 9P transport driver Kuan-Wei Chiu
2026-09-11 11:43   ` Simon Glass
2026-09-23 20:53     ` Kuan-Wei Chiu [this message]
2026-08-29 19:21 ` [PATCH v2 4/6] doc: 9p: Add 9P filesystem documentation Kuan-Wei Chiu
2026-09-11 11:43   ` Simon Glass
2026-08-29 19:21 ` [PATCH v2 5/6] test: 9p: Add test for 9P filesystem Kuan-Wei Chiu
2026-09-11 11:44   ` Simon Glass
2026-09-23 21:08     ` Kuan-Wei Chiu
2026-09-15 15:57   ` Tom Rini
2026-08-29 19:21 ` [PATCH v2 6/6] MAINTAINERS: Add entry for 9PFS Kuan-Wei Chiu
2026-08-30 10:41 ` [PATCH v2 0/6] fs: Add 9P filesystem support over virtio Peter Robinson
2026-09-02  1:51   ` Kuan-Wei Chiu

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=arQ8TZcziIi7vjpe@google.com \
    --to=visitorckw@gmail.com \
    --cc=bmeng.cn@gmail.com \
    --cc=eleanor15x@gmail.com \
    --cc=jerome.forissier@arm.com \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=marscheng@google.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=tuomas.tynkkynen@iki.fi \
    --cc=u-boot@lists.u-boot-project.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.