qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH V2 0/2] hw/virtio: fix double use of a virtio flag
@ 2016-02-10 13:31 Marcel Apfelbaum
  2016-02-10 13:31 ` [Qemu-devel] [PATCH V2 1/2] " Marcel Apfelbaum
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Marcel Apfelbaum @ 2016-02-10 13:31 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 feature 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.


v1 -> v2:
  - Addressed Laurent Vivier's comment:
     - forgot to remove a flag
  - Added teset-by to the first patch

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 | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

-- 
2.4.3

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

* [Qemu-devel] [PATCH V2 1/2] hw/virtio: fix double use of a virtio flag
  2016-02-10 13:31 [Qemu-devel] [PATCH V2 0/2] hw/virtio: fix double use of a virtio flag Marcel Apfelbaum
@ 2016-02-10 13:31 ` Marcel Apfelbaum
  2016-02-23  3:42   ` Jason Wang
  2016-02-10 13:31 ` [Qemu-devel] [PATCH V2 2/2] hw/virtio: group virtio flags into an enum Marcel Apfelbaum
  2016-03-01 17:00 ` [Qemu-devel] [PATCH V2 0/2] hw/virtio: fix double use of a virtio flag Marcel Apfelbaum
  2 siblings, 1 reply; 7+ messages in thread
From: Marcel Apfelbaum @ 2016-02-10 13:31 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>
Tested-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] 7+ messages in thread

* [Qemu-devel] [PATCH V2 2/2] hw/virtio: group virtio flags into an enum
  2016-02-10 13:31 [Qemu-devel] [PATCH V2 0/2] hw/virtio: fix double use of a virtio flag Marcel Apfelbaum
  2016-02-10 13:31 ` [Qemu-devel] [PATCH V2 1/2] " Marcel Apfelbaum
@ 2016-02-10 13:31 ` Marcel Apfelbaum
  2016-02-10 13:37   ` Laurent Vivier
  2016-02-23  3:42   ` Jason Wang
  2016-03-01 17:00 ` [Qemu-devel] [PATCH V2 0/2] hw/virtio: fix double use of a virtio flag Marcel Apfelbaum
  2 siblings, 2 replies; 7+ messages in thread
From: Marcel Apfelbaum @ 2016-02-10 13:31 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 | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index 6686b10..e4548c2 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -58,30 +58,33 @@ 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 \
     (1 << VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT)
 
 /* 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] 7+ messages in thread

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



On 10/02/2016 14:31, Marcel Apfelbaum wrote:
> Minimizes the possibility to assign
> the same bit to different features.
> 
> Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>

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

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



On 02/10/2016 09:31 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>
> Tested-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] 7+ messages in thread

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



On 02/10/2016 09:31 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 | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
> index 6686b10..e4548c2 100644
> --- a/hw/virtio/virtio-pci.h
> +++ b/hw/virtio/virtio-pci.h
> @@ -58,30 +58,33 @@ 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 \
>      (1 << VIRTIO_PCI_FLAG_BUS_MASTER_BUG_MIGRATION_BIT)
>  
>  /* 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)
>  

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

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

* Re: [Qemu-devel] [PATCH V2 0/2] hw/virtio: fix double use of a virtio flag
  2016-02-10 13:31 [Qemu-devel] [PATCH V2 0/2] hw/virtio: fix double use of a virtio flag Marcel Apfelbaum
  2016-02-10 13:31 ` [Qemu-devel] [PATCH V2 1/2] " Marcel Apfelbaum
  2016-02-10 13:31 ` [Qemu-devel] [PATCH V2 2/2] hw/virtio: group virtio flags into an enum Marcel Apfelbaum
@ 2016-03-01 17:00 ` Marcel Apfelbaum
  2 siblings, 0 replies; 7+ messages in thread
From: Marcel Apfelbaum @ 2016-03-01 17:00 UTC (permalink / raw)
  To: Marcel Apfelbaum, qemu-devel; +Cc: lvivier, jasowang, qemu-stable, mst

On 02/10/2016 03:31 PM, Marcel Apfelbaum wrote:
> 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 feature 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.
>

ping

Thanks,
Marcel

>
> v1 -> v2:
>    - Addressed Laurent Vivier's comment:
>       - forgot to remove a flag
>    - Added teset-by to the first patch
>
> 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 | 17 ++++++++++-------
>   1 file changed, 10 insertions(+), 7 deletions(-)
>

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

end of thread, other threads:[~2016-03-01 17:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-10 13:31 [Qemu-devel] [PATCH V2 0/2] hw/virtio: fix double use of a virtio flag Marcel Apfelbaum
2016-02-10 13:31 ` [Qemu-devel] [PATCH V2 1/2] " Marcel Apfelbaum
2016-02-23  3:42   ` Jason Wang
2016-02-10 13:31 ` [Qemu-devel] [PATCH V2 2/2] hw/virtio: group virtio flags into an enum Marcel Apfelbaum
2016-02-10 13:37   ` Laurent Vivier
2016-02-23  3:42   ` Jason Wang
2016-03-01 17:00 ` [Qemu-devel] [PATCH V2 0/2] hw/virtio: fix double use of a virtio flag Marcel Apfelbaum

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).