All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc Marí" <marc.mari.barcelo@gmail.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH for-2.7 3/8] libqos: drop duplicated virtio_config.h definitions
Date: Sun, 8 May 2016 20:40:36 +0200	[thread overview]
Message-ID: <20160508204036.08e33b65@home> (raw)
In-Reply-To: <20160508202253.0e45ab52@home>

On Sun, 8 May 2016 20:22:53 +0200
Marc Marí <marc.mari.barcelo@gmail.com> wrote:

> On Mon, 25 Apr 2016 13:46:08 +0100
> Stefan Hajnoczi <stefanha@redhat.com> wrote:
> 
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > ---
> >  tests/libqos/virtio.c   | 19 ++++++++++---------
> >  tests/libqos/virtio.h   |  9 ---------
> >  tests/virtio-blk-test.c |  5 +++--
> >  3 files changed, 13 insertions(+), 20 deletions(-)
> > 
> > diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c
> > index 613dece..ee9e892 100644
> > --- a/tests/libqos/virtio.c
> > +++ b/tests/libqos/virtio.c
> > @@ -11,6 +11,7 @@
> >  #include <glib.h>
> >  #include "libqtest.h"
> >  #include "libqos/virtio.h"
> > +#include "standard-headers/linux/virtio_config.h"
> >  
> >  uint8_t qvirtio_config_readb(const QVirtioBus *bus, QVirtioDevice
> > *d, uint64_t
> > addr) @@ -55,28 +56,28 @@ QVirtQueue *qvirtqueue_setup(const
> > QVirtioBus *bus, QVirtioDevice *d, 
> >  void qvirtio_reset(const QVirtioBus *bus, QVirtioDevice *d)
> >  {
> > -    bus->set_status(d, QVIRTIO_RESET);
> > -    g_assert_cmphex(bus->get_status(d), ==, QVIRTIO_RESET);
> > +    bus->set_status(d, 0);
> > +    g_assert_cmphex(bus->get_status(d), ==, 0);
> >  }
> >  
> >  void qvirtio_set_acknowledge(const QVirtioBus *bus, QVirtioDevice
> > *d) {
> > -    bus->set_status(d, bus->get_status(d) | QVIRTIO_ACKNOWLEDGE);
> > -    g_assert_cmphex(bus->get_status(d), ==, QVIRTIO_ACKNOWLEDGE);
> > +    bus->set_status(d, bus->get_status(d) |
> > VIRTIO_CONFIG_S_ACKNOWLEDGE);
> > +    g_assert_cmphex(bus->get_status(d), ==,
> > VIRTIO_CONFIG_S_ACKNOWLEDGE); }
> >  
> >  void qvirtio_set_driver(const QVirtioBus *bus, QVirtioDevice *d)
> >  {
> > -    bus->set_status(d, bus->get_status(d) | QVIRTIO_DRIVER);
> > +    bus->set_status(d, bus->get_status(d) |
> > VIRTIO_CONFIG_S_DRIVER); g_assert_cmphex(bus->get_status(d), ==,
> > -                                    QVIRTIO_DRIVER |
> > QVIRTIO_ACKNOWLEDGE);
> > +                    VIRTIO_CONFIG_S_DRIVER |
> > VIRTIO_CONFIG_S_ACKNOWLEDGE); }
> >  
> >  void qvirtio_set_driver_ok(const QVirtioBus *bus, QVirtioDevice *d)
> >  {
> > -    bus->set_status(d, bus->get_status(d) | QVIRTIO_DRIVER_OK);
> > -    g_assert_cmphex(bus->get_status(d), ==,
> > -                QVIRTIO_DRIVER_OK | QVIRTIO_DRIVER |
> > QVIRTIO_ACKNOWLEDGE);
> > +    bus->set_status(d, bus->get_status(d) |
> > VIRTIO_CONFIG_S_DRIVER_OK);
> > +    g_assert_cmphex(bus->get_status(d), ==,
> > VIRTIO_CONFIG_S_DRIVER_OK |
> > +                    VIRTIO_CONFIG_S_DRIVER |
> > VIRTIO_CONFIG_S_ACKNOWLEDGE); }
> >  
> >  void qvirtio_wait_queue_isr(const QVirtioBus *bus, QVirtioDevice
> > *d, diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h
> > index e663bcf..993ae0e 100644
> > --- a/tests/libqos/virtio.h
> > +++ b/tests/libqos/virtio.h
> > @@ -12,13 +12,6 @@
> >  
> >  #include "libqos/malloc.h"
> >  
> > -#define QVIRTIO_RESET           0x0
> > -#define QVIRTIO_ACKNOWLEDGE     0x1
> > -#define QVIRTIO_DRIVER          0x2
> > -#define QVIRTIO_DRIVER_OK       0x4
> > -
> > -#define QVIRTIO_F_NOTIFY_ON_EMPTY       0x01000000
> > -#define QVIRTIO_F_ANY_LAYOUT            0x08000000
> >  #define QVIRTIO_F_RING_INDIRECT_DESC    0x10000000
> >  #define QVIRTIO_F_RING_EVENT_IDX        0x20000000
> >  #define QVIRTIO_F_BAD_FEATURE           0x40000000
> > @@ -27,8 +20,6 @@
> >  #define QVRING_DESC_F_WRITE     0x2
> >  #define QVRING_DESC_F_INDIRECT  0x4
> >  
> > -#define QVIRTIO_F_NOTIFY_ON_EMPTY       0x01000000
> > -#define QVIRTIO_F_ANY_LAYOUT            0x08000000
> >  #define QVIRTIO_F_RING_INDIRECT_DESC    0x10000000
> >  #define QVIRTIO_F_RING_EVENT_IDX        0x20000000
> >  #define QVIRTIO_F_BAD_FEATURE           0x40000000
> > diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c
> > index 02107a6..bfeffc4 100644
> > --- a/tests/virtio-blk-test.c
> > +++ b/tests/virtio-blk-test.c
> > @@ -20,6 +20,7 @@
> >  #include "libqos/malloc-generic.h"
> >  #include "qemu/bswap.h"
> >  #include "standard-headers/linux/virtio_ids.h"
> > +#include "standard-headers/linux/virtio_config.h"
> >  
> >  #define QVIRTIO_BLK_F_BARRIER       0x00000001
> >  #define QVIRTIO_BLK_F_SIZE_MAX      0x00000002
> > @@ -240,7 +241,7 @@ static void test_basic(const QVirtioBus *bus,
> > QVirtioDevice *dev, 
> >      guest_free(alloc, req_addr);
> >  
> > -    if (features & QVIRTIO_F_ANY_LAYOUT) {
> > +    if (features & VIRTIO_F_ANY_LAYOUT) {
> >          /* Write and read with 2 descriptor layout */
> >          /* Write request */
> >          req.type = QVIRTIO_BLK_T_OUT;
> > @@ -607,7 +608,7 @@ static void pci_idx(void)
> >      features = qvirtio_get_features(&qvirtio_pci, &dev->vdev);
> >      features = features & ~(QVIRTIO_F_BAD_FEATURE |
> >                              QVIRTIO_F_RING_INDIRECT_DESC |
> > -                            QVIRTIO_F_NOTIFY_ON_EMPTY |
> > QVIRTIO_BLK_F_SCSI);
> > +                            VIRTIO_F_NOTIFY_ON_EMPTY |
> > QVIRTIO_BLK_F_SCSI); qvirtio_set_features(&qvirtio_pci, &dev->vdev,
> > features); 
> >      vqpci = (QVirtQueuePCI *)qvirtqueue_setup(&qvirtio_pci,
> > &dev->vdev,  
> 
> In standard-headers/linux/virtio_config.h, there is;
> 
> #define VIRTIO_F_NOTIFY_ON_EMPTY	24
> #define VIRTIO_F_ANY_LAYOUT		27
> 
> whereas in tests/libqos.h, there is:
> 
> #define QVIRTIO_F_NOTIFY_ON_EMPTY       0x01000000
> #define QVIRTIO_F_ANY_LAYOUT            0x08000000
> 
> It is necessary to use 2 << VIRTIO_F_NOTIFY_ON_EMPTY to make the
> change properly.
> 

I meant 1 << VIRTIO_F_NOTIFY_ON_EMPTY, obviously.

And what I say is half corrected in the next patch. I think it would be
nicer to make the changes directly in this patch.

In any case, this line:
>    if (features & VIRTIO_F_ANY_LAYOUT) {
is not corrected in any patch

Marc

  reply	other threads:[~2016-05-08 18:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-25 12:46 [Qemu-devel] [PATCH for-2.7 0/8] libqos: use standard virtio headers Stefan Hajnoczi
2016-04-25 12:46 ` [Qemu-devel] [PATCH for-2.7 1/8] libqos: use virtio_ids.h for device ID definitions Stefan Hajnoczi
2016-04-25 12:46 ` [Qemu-devel] [PATCH for-2.7 2/8] libqos: drop duplicated PCI vendor ID definition Stefan Hajnoczi
2016-04-25 12:46 ` [Qemu-devel] [PATCH for-2.7 3/8] libqos: drop duplicated virtio_config.h definitions Stefan Hajnoczi
2016-05-08 18:22   ` Marc Marí
2016-05-08 18:40     ` Marc Marí [this message]
2016-05-09 11:46       ` Stefan Hajnoczi
2016-04-25 12:46 ` [Qemu-devel] [PATCH for-2.7 4/8] libqos: drop duplicated virtio_ring.h bit definitions Stefan Hajnoczi
2016-04-25 12:46 ` [Qemu-devel] [PATCH for-2.7 5/8] libqos: drop duplicated virtio_vring.h structs Stefan Hajnoczi
2016-04-25 12:46 ` [Qemu-devel] [PATCH for-2.7 6/8] libqos: drop duplicated virtio_blk.h definitions Stefan Hajnoczi
2016-04-25 12:46 ` [Qemu-devel] [PATCH for-2.7 7/8] libqos: drop duplicated virtio_scsi.h definitions Stefan Hajnoczi
2016-04-25 12:46 ` [Qemu-devel] [PATCH for-2.7 8/8] libqos: drop duplicated virtio_pci.h definitions Stefan Hajnoczi
2016-04-25 19:09 ` [Qemu-devel] [PATCH for-2.7 0/8] libqos: use standard virtio headers John Snow
2016-04-26  9:58   ` Stefan Hajnoczi

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=20160508204036.08e33b65@home \
    --to=marc.mari.barcelo@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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 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.