qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] hw/virtio: fix double use of a virtio flag
@ 2016-02-10 12:22 Marcel Apfelbaum
  2016-02-10 12:22 ` [Qemu-devel] [PATCH 1/2] " Marcel Apfelbaum
  2016-02-10 12:22 ` [Qemu-devel] [PATCH 2/2] hw/virtio: group virtio flags into an enum Marcel Apfelbaum
  0 siblings, 2 replies; 9+ messages in thread
From: Marcel Apfelbaum @ 2016-02-10 12:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcel, lvivier, jasowang, qemu-stable, mst

To the obvious question of "how did that happen?"
I can say we had an unlucky break.
Both Jason and me worked on a new different virtio features in the same
time, and they were both merged in the same pull request.
We both saw BIT 3 as the last used 
    https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg03041.html

Commits 1811e64c and a6df8adf use the same virtio feature bit 4
for different features.

Fix it by using different bits.
While at it, group all the virtio flags into an enum to avoid that
in the feature.

Marcel Apfelbaum (2):
  hw/virtio: fix double use of a virtio flag
  hw/virtio: group virtio flags into an enum

 hw/virtio/virtio-pci.h | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

-- 
2.4.3

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 1/2] hw/virtio: fix double use of a virtio flag
  2016-02-10 12:22 [Qemu-devel] [PATCH 0/2] hw/virtio: fix double use of a virtio flag Marcel Apfelbaum
@ 2016-02-10 12:22 ` Marcel Apfelbaum
  2016-02-10 12:57   ` Laurent Vivier
                     ` (2 more replies)
  2016-02-10 12:22 ` [Qemu-devel] [PATCH 2/2] hw/virtio: group virtio flags into an enum Marcel Apfelbaum
  1 sibling, 3 replies; 9+ messages in thread
From: Marcel Apfelbaum @ 2016-02-10 12:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcel, lvivier, jasowang, qemu-stable, mst

Commits 1811e64c and a6df8adf use the same virtio feature bit 4
for different features.

Fix it by using different bits.

Reported-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
---
 hw/virtio/virtio-pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index e096e98..6686b10 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -71,7 +71,7 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
 /* virtio version flags */
 #define VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT 2
 #define VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT 3
-#define VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT 4
+#define VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT 6
 #define VIRTIO_PCI_FLAG_DISABLE_LEGACY (1 << VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT)
 #define VIRTIO_PCI_FLAG_DISABLE_MODERN (1 << VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT)
 #define VIRTIO_PCI_FLAG_DISABLE_PCIE (1 << VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT)
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 2/2] hw/virtio: group virtio flags into an enum
  2016-02-10 12:22 [Qemu-devel] [PATCH 0/2] hw/virtio: fix double use of a virtio flag Marcel Apfelbaum
  2016-02-10 12:22 ` [Qemu-devel] [PATCH 1/2] " Marcel Apfelbaum
@ 2016-02-10 12:22 ` Marcel Apfelbaum
  2016-02-10 13:07   ` Laurent Vivier
  2016-02-23  3:39   ` Jason Wang
  1 sibling, 2 replies; 9+ messages in thread
From: Marcel Apfelbaum @ 2016-02-10 12:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: marcel, lvivier, jasowang, qemu-stable, mst

Minimizes the possibility to assign
the same bit to different features.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
---
 hw/virtio/virtio-pci.h | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index 6686b10..817bcde 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -58,6 +58,16 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
 #define VIRTIO_PCI_BUS_CLASS(klass) \
         OBJECT_CLASS_CHECK(VirtioPCIBusClass, klass, TYPE_VIRTIO_PCI_BUS)
 
+enum {
+    VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT,
+    VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT,
+    VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT,
+    VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT,
+    VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT,
+    VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT,
+    VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT,
+};
+
 /* Need to activate work-arounds for buggy guests at vmstate load. */
 #define VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT  0
 #define VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION \
@@ -65,23 +75,17 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
 
 /* Performance improves when virtqueue kick processing is decoupled from the
  * vcpu thread using ioeventfd for some devices. */
-#define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT 1
 #define VIRTIO_PCI_FLAG_USE_IOEVENTFD   (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT)
 
 /* virtio version flags */
-#define VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT 2
-#define VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT 3
-#define VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT 6
 #define VIRTIO_PCI_FLAG_DISABLE_LEGACY (1 << VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT)
 #define VIRTIO_PCI_FLAG_DISABLE_MODERN (1 << VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT)
 #define VIRTIO_PCI_FLAG_DISABLE_PCIE (1 << VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT)
 
 /* migrate extra state */
-#define VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT 4
 #define VIRTIO_PCI_FLAG_MIGRATE_EXTRA (1 << VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT)
 
 /* have pio notification for modern device ? */
-#define VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT 5
 #define VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY \
     (1 << VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT)
 
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] hw/virtio: fix double use of a virtio flag
  2016-02-10 12:22 ` [Qemu-devel] [PATCH 1/2] " Marcel Apfelbaum
@ 2016-02-10 12:57   ` Laurent Vivier
  2016-02-10 13:19   ` Laurent Vivier
  2016-02-23  3:34   ` Jason Wang
  2 siblings, 0 replies; 9+ messages in thread
From: Laurent Vivier @ 2016-02-10 12:57 UTC (permalink / raw)
  To: Marcel Apfelbaum, qemu-devel; +Cc: jasowang, qemu-stable, mst



On 10/02/2016 13:22, Marcel Apfelbaum wrote:
> Commits 1811e64c and a6df8adf use the same virtio feature bit 4
> for different features.
> 
> Fix it by using different bits.
> 
> Reported-by: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
>  hw/virtio/virtio-pci.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
> index e096e98..6686b10 100644
> --- a/hw/virtio/virtio-pci.h
> +++ b/hw/virtio/virtio-pci.h
> @@ -71,7 +71,7 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
>  /* virtio version flags */
>  #define VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT 2
>  #define VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT 3
> -#define VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT 4
> +#define VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT 6
>  #define VIRTIO_PCI_FLAG_DISABLE_LEGACY (1 << VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT)
>  #define VIRTIO_PCI_FLAG_DISABLE_MODERN (1 << VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT)
>  #define VIRTIO_PCI_FLAG_DISABLE_PCIE (1 << VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT)
> 
Reviewed-by: Laurent Vivier <lvivier@redhat.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] hw/virtio: group virtio flags into an enum
  2016-02-10 12:22 ` [Qemu-devel] [PATCH 2/2] hw/virtio: group virtio flags into an enum Marcel Apfelbaum
@ 2016-02-10 13:07   ` Laurent Vivier
  2016-02-10 13:24     ` Marcel Apfelbaum
  2016-02-23  3:39   ` Jason Wang
  1 sibling, 1 reply; 9+ messages in thread
From: Laurent Vivier @ 2016-02-10 13:07 UTC (permalink / raw)
  To: Marcel Apfelbaum, qemu-devel; +Cc: jasowang, qemu-stable, mst



On 10/02/2016 13:22, Marcel Apfelbaum wrote:
> Minimizes the possibility to assign
> the same bit to different features.
> 
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
>  hw/virtio/virtio-pci.h | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
> index 6686b10..817bcde 100644
> --- a/hw/virtio/virtio-pci.h
> +++ b/hw/virtio/virtio-pci.h
> @@ -58,6 +58,16 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
>  #define VIRTIO_PCI_BUS_CLASS(klass) \
>          OBJECT_CLASS_CHECK(VirtioPCIBusClass, klass, TYPE_VIRTIO_PCI_BUS)
>  
> +enum {
> +    VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT,
> +    VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT,
> +    VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT,
> +    VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT,
> +    VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT,
> +    VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT,
> +    VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT,
> +};

You can keep the "#define", doing something like this after the enum:

#define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT

So, if someone includes this ".h" out of qemu and wants to use some
"#ifdef" to see if the bit is defined, it always works.
(see for an example, /usr/include/linux/rtnetlink.h).

> +
>  /* Need to activate work-arounds for buggy guests at vmstate load. */
>  #define VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT  0

You should remove this one too.

>  #define VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION \
> @@ -65,23 +75,17 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
>  
>  /* Performance improves when virtqueue kick processing is decoupled from the
>   * vcpu thread using ioeventfd for some devices. */
> -#define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT 1
>  #define VIRTIO_PCI_FLAG_USE_IOEVENTFD   (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT)
>  
>  /* virtio version flags */
> -#define VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT 2
> -#define VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT 3
> -#define VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT 6
>  #define VIRTIO_PCI_FLAG_DISABLE_LEGACY (1 << VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT)
>  #define VIRTIO_PCI_FLAG_DISABLE_MODERN (1 << VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT)
>  #define VIRTIO_PCI_FLAG_DISABLE_PCIE (1 << VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT)
>  
>  /* migrate extra state */
> -#define VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT 4
>  #define VIRTIO_PCI_FLAG_MIGRATE_EXTRA (1 << VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT)
>  
>  /* have pio notification for modern device ? */
> -#define VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT 5
>  #define VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY \
>      (1 << VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT)
>  
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] hw/virtio: fix double use of a virtio flag
  2016-02-10 12:22 ` [Qemu-devel] [PATCH 1/2] " Marcel Apfelbaum
  2016-02-10 12:57   ` Laurent Vivier
@ 2016-02-10 13:19   ` Laurent Vivier
  2016-02-23  3:34   ` Jason Wang
  2 siblings, 0 replies; 9+ messages in thread
From: Laurent Vivier @ 2016-02-10 13:19 UTC (permalink / raw)
  To: Marcel Apfelbaum, qemu-devel; +Cc: jasowang, qemu-stable, mst



On 10/02/2016 13:22, Marcel Apfelbaum wrote:
> Commits 1811e64c and a6df8adf use the same virtio feature bit 4
> for different features.
> 
> Fix it by using different bits.
> 
> Reported-by: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
>  hw/virtio/virtio-pci.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
> index e096e98..6686b10 100644
> --- a/hw/virtio/virtio-pci.h
> +++ b/hw/virtio/virtio-pci.h
> @@ -71,7 +71,7 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
>  /* virtio version flags */
>  #define VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT 2
>  #define VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT 3
> -#define VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT 4
> +#define VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT 6
>  #define VIRTIO_PCI_FLAG_DISABLE_LEGACY (1 << VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT)
>  #define VIRTIO_PCI_FLAG_DISABLE_MODERN (1 << VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT)
>  #define VIRTIO_PCI_FLAG_DISABLE_PCIE (1 << VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT)
> 
Tested-by: Laurent Vivier <lvivier@redhat.com>

pc-i440fx-2.4
    migrate-extra = false
    x-disable-pcie = true

pc-i440fx-2.5
    migrate-extra = true
    x-disable-pcie = false

This is correct, now.

Thanks,
Laurent

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] hw/virtio: group virtio flags into an enum
  2016-02-10 13:07   ` Laurent Vivier
@ 2016-02-10 13:24     ` Marcel Apfelbaum
  0 siblings, 0 replies; 9+ messages in thread
From: Marcel Apfelbaum @ 2016-02-10 13:24 UTC (permalink / raw)
  To: Laurent Vivier, Marcel Apfelbaum, qemu-devel; +Cc: jasowang, qemu-stable, mst

On 02/10/2016 03:07 PM, Laurent Vivier wrote:
>
>
> On 10/02/2016 13:22, Marcel Apfelbaum wrote:
>> Minimizes the possibility to assign
>> the same bit to different features.
>>
>> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
>> ---
>>   hw/virtio/virtio-pci.h | 16 ++++++++++------
>>   1 file changed, 10 insertions(+), 6 deletions(-)
>>
>> diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
>> index 6686b10..817bcde 100644
>> --- a/hw/virtio/virtio-pci.h
>> +++ b/hw/virtio/virtio-pci.h
>> @@ -58,6 +58,16 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
>>   #define VIRTIO_PCI_BUS_CLASS(klass) \
>>           OBJECT_CLASS_CHECK(VirtioPCIBusClass, klass, TYPE_VIRTIO_PCI_BUS)
>>
>> +enum {
>> +    VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT,
>> +    VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT,
>> +    VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT,
>> +    VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT,
>> +    VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT,
>> +    VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT,
>> +    VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT,
>> +};
>
> You can keep the "#define", doing something like this after the enum:
>
> #define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT
>
> So, if someone includes this ".h" out of qemu and wants to use some
> "#ifdef" to see if the bit is defined, it always works.
> (see for an example, /usr/include/linux/rtnetlink.h).

Thanks for the idea, but I don't think anyone would want to use those out
of qemu :)
I am also afraid that developers will forget to add it to the enum
and will still use the defines only.

>
>> +
>>   /* Need to activate work-arounds for buggy guests at vmstate load. */
>>   #define VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT  0
>
> You should remove this one too.

How did I manage to miss it? Thanks!
I'll send a v2
Marcel

>
>>   #define VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION \
>> @@ -65,23 +75,17 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
>>
>>   /* Performance improves when virtqueue kick processing is decoupled from the
>>    * vcpu thread using ioeventfd for some devices. */
>> -#define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT 1
>>   #define VIRTIO_PCI_FLAG_USE_IOEVENTFD   (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT)
>>
>>   /* virtio version flags */
>> -#define VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT 2
>> -#define VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT 3
>> -#define VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT 6
>>   #define VIRTIO_PCI_FLAG_DISABLE_LEGACY (1 << VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT)
>>   #define VIRTIO_PCI_FLAG_DISABLE_MODERN (1 << VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT)
>>   #define VIRTIO_PCI_FLAG_DISABLE_PCIE (1 << VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT)
>>
>>   /* migrate extra state */
>> -#define VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT 4
>>   #define VIRTIO_PCI_FLAG_MIGRATE_EXTRA (1 << VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT)
>>
>>   /* have pio notification for modern device ? */
>> -#define VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT 5
>>   #define VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY \
>>       (1 << VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT)
>>
>>
>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 1/2] hw/virtio: fix double use of a virtio flag
  2016-02-10 12:22 ` [Qemu-devel] [PATCH 1/2] " Marcel Apfelbaum
  2016-02-10 12:57   ` Laurent Vivier
  2016-02-10 13:19   ` Laurent Vivier
@ 2016-02-23  3:34   ` Jason Wang
  2 siblings, 0 replies; 9+ messages in thread
From: Jason Wang @ 2016-02-23  3:34 UTC (permalink / raw)
  To: Marcel Apfelbaum, qemu-devel; +Cc: lvivier, qemu-stable, mst



On 02/10/2016 08:22 PM, Marcel Apfelbaum wrote:
> Commits 1811e64c and a6df8adf use the same virtio feature bit 4
> for different features.
>
> Fix it by using different bits.
>
> Reported-by: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
>  hw/virtio/virtio-pci.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
> index e096e98..6686b10 100644
> --- a/hw/virtio/virtio-pci.h
> +++ b/hw/virtio/virtio-pci.h
> @@ -71,7 +71,7 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
>  /* virtio version flags */
>  #define VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT 2
>  #define VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT 3
> -#define VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT 4
> +#define VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT 6
>  #define VIRTIO_PCI_FLAG_DISABLE_LEGACY (1 << VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT)
>  #define VIRTIO_PCI_FLAG_DISABLE_MODERN (1 << VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT)
>  #define VIRTIO_PCI_FLAG_DISABLE_PCIE (1 << VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT)

Acked-by: Jason Wang <jasowang@redhat.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] hw/virtio: group virtio flags into an enum
  2016-02-10 12:22 ` [Qemu-devel] [PATCH 2/2] hw/virtio: group virtio flags into an enum Marcel Apfelbaum
  2016-02-10 13:07   ` Laurent Vivier
@ 2016-02-23  3:39   ` Jason Wang
  1 sibling, 0 replies; 9+ messages in thread
From: Jason Wang @ 2016-02-23  3:39 UTC (permalink / raw)
  To: Marcel Apfelbaum, qemu-devel; +Cc: lvivier, qemu-stable, mst



On 02/10/2016 08:22 PM, Marcel Apfelbaum wrote:
> Minimizes the possibility to assign
> the same bit to different features.
>
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
> ---
>  hw/virtio/virtio-pci.h | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
> index 6686b10..817bcde 100644
> --- a/hw/virtio/virtio-pci.h
> +++ b/hw/virtio/virtio-pci.h
> @@ -58,6 +58,16 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
>  #define VIRTIO_PCI_BUS_CLASS(klass) \
>          OBJECT_CLASS_CHECK(VirtioPCIBusClass, klass, TYPE_VIRTIO_PCI_BUS)
>  
> +enum {
> +    VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT,
> +    VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT,
> +    VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT,
> +    VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT,
> +    VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT,
> +    VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT,
> +    VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT,
> +};
> +
>  /* Need to activate work-arounds for buggy guests at vmstate load. */
>  #define VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT  0

Why not remove this line too?

>  #define VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION \
> @@ -65,23 +75,17 @@ typedef struct VirtioBusClass VirtioPCIBusClass;
>  
>  /* Performance improves when virtqueue kick processing is decoupled from the
>   * vcpu thread using ioeventfd for some devices. */
> -#define VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT 1
>  #define VIRTIO_PCI_FLAG_USE_IOEVENTFD   (1 << VIRTIO_PCI_FLAG_USE_IOEVENTFD_BIT)
>  
>  /* virtio version flags */
> -#define VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT 2
> -#define VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT 3
> -#define VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT 6
>  #define VIRTIO_PCI_FLAG_DISABLE_LEGACY (1 << VIRTIO_PCI_FLAG_DISABLE_LEGACY_BIT)
>  #define VIRTIO_PCI_FLAG_DISABLE_MODERN (1 << VIRTIO_PCI_FLAG_DISABLE_MODERN_BIT)
>  #define VIRTIO_PCI_FLAG_DISABLE_PCIE (1 << VIRTIO_PCI_FLAG_DISABLE_PCIE_BIT)
>  
>  /* migrate extra state */
> -#define VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT 4
>  #define VIRTIO_PCI_FLAG_MIGRATE_EXTRA (1 << VIRTIO_PCI_FLAG_MIGRATE_EXTRA_BIT)
>  
>  /* have pio notification for modern device ? */
> -#define VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT 5
>  #define VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY \
>      (1 << VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY_BIT)
>  

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-02-23  3:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-10 12:22 [Qemu-devel] [PATCH 0/2] hw/virtio: fix double use of a virtio flag Marcel Apfelbaum
2016-02-10 12:22 ` [Qemu-devel] [PATCH 1/2] " Marcel Apfelbaum
2016-02-10 12:57   ` Laurent Vivier
2016-02-10 13:19   ` Laurent Vivier
2016-02-23  3:34   ` Jason Wang
2016-02-10 12:22 ` [Qemu-devel] [PATCH 2/2] hw/virtio: group virtio flags into an enum Marcel Apfelbaum
2016-02-10 13:07   ` Laurent Vivier
2016-02-10 13:24     ` Marcel Apfelbaum
2016-02-23  3:39   ` Jason Wang

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 NNTP newsgroup(s).