QEMU-Devel Archive mirror
 help / color / mirror / Atom feed
From: Eugenio Perez Martin <eperezma@redhat.com>
To: Wafer <wafer@jaguarmicro.com>
Cc: Jason Wang <jasowang@redhat.com>,
	"mst@redhat.com" <mst@redhat.com>,
	 "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Angus Chen <angus.chen@jaguarmicro.com>
Subject: Re: [PATCH] hw/virtio: Fix obtain the buffer id from the last descriptor
Date: Thu, 9 May 2024 07:45:28 +0200	[thread overview]
Message-ID: <CAJaqyWeShbAcayZ+7noDocdGNb-p=OAVxK3X5MaaPxUtrh_vBQ@mail.gmail.com> (raw)
In-Reply-To: <PUZPR06MB4713007E9C50E8EA599C44F6A2E62@PUZPR06MB4713.apcprd06.prod.outlook.com>

On Thu, May 9, 2024 at 6:32 AM Wafer <wafer@jaguarmicro.com> wrote:
>
>
>
> On Wed, May 08, 2024 at 12:01 PM Jason Wang <jasowang@redhat.com> wrote:
> >
> > On Mon, Apr 22, 2024 at 9:41 AM Wafer <wafer@jaguarmicro.com> wrote:
> > >
> > > The virtio-1.3 specification
> > > <https://docs.oasis-open.org/virtio/virtio/v1.3/virtio-v1.3.html> writes:
> > > 2.8.6 Next Flag: Descriptor Chaining
> > >       Buffer ID is included in the last descriptor in the list.
> > >
> > > If the feature (_F_INDIRECT_DESC) has been negotiated, install only
> > > one descriptor in the virtqueue.
> > > Therefor the buffer id should be obtained from the first descriptor.
> > >
> > > In descriptor chaining scenarios, the buffer id should be obtained
> > > from the last descriptor.
> > >
> > > Fixes: 86044b24e8 ("virtio: basic packed virtqueue support")
> > >
> > > Signed-off-by: Wafer <wafer@jaguarmicro.com>
> > > ---
> > >  hw/virtio/virtio.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > >
> > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index
> > > 871674f9be..f65d4b4161 100644
> > > --- a/hw/virtio/virtio.c
> > > +++ b/hw/virtio/virtio.c
> > > @@ -1739,6 +1739,11 @@ static void *virtqueue_packed_pop(VirtQueue
> > *vq, size_t sz)
> > >              goto err_undo_map;
> > >          }
> > >
> > > +        if (desc_cache != &indirect_desc_cache) {
> > > +            /* Buffer ID is included in the last descriptor in the list. */
> > > +            id = desc.id;
> > > +        }
> >
> > It looks to me we can move this out of the loop.
> >
> > Others look good.
> >
> > Thanks
> >
>
> Thank you for your suggestion, I'll move out.
>

Please add my

Reviewed-by: Eugenio Pérez <eperezma@redhat.com>

When you do.

Thanks!


> > > +
> > >          rc = virtqueue_packed_read_next_desc(vq, &desc, desc_cache, max,
> > &i,
> > >                                               desc_cache ==
> > >                                               &indirect_desc_cache);
> > > --
> > > 2.27.0
> > >
>



  reply	other threads:[~2024-05-09  5:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22  1:40 [PATCH] hw/virtio: Fix obtain the buffer id from the last descriptor Wafer
2024-05-08  4:00 ` Jason Wang
2024-05-09  4:32   ` Wafer
2024-05-09  5:45     ` Eugenio Perez Martin [this message]
2024-05-08 12:56 ` Eugenio Perez Martin
2024-05-08 18:21   ` Michael S. Tsirkin
2024-05-09  2:20     ` Wafer
2024-05-09  5:44       ` Eugenio Perez Martin

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='CAJaqyWeShbAcayZ+7noDocdGNb-p=OAVxK3X5MaaPxUtrh_vBQ@mail.gmail.com' \
    --to=eperezma@redhat.com \
    --cc=angus.chen@jaguarmicro.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wafer@jaguarmicro.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 read-only IMAP folder(s) and NNTP newsgroup(s).