Skip to contentSkip to conversation

vfio-user: trivial VFIOProxy flags fix

PATCH In review Mark Cave-Ayland 3 participants 8 messages Jan 21

lore
Share & tools
lore
#0 lore raw

cover vfio-user: trivial VFIOProxy flags fix

This series contains a couple of trivial fixes for the VFIOProxy flags found whilst rebasing some internal patches.

The first patch in the series fixes the incorrect value of the VFIO_PROXY_USE_MULTI constant, whilst the second patch updates the constants to use the BIT() macro (also removing a gap in the bit numbering) to help prevent similar errors from occurring in future.

Note that the VFIOProxy flags are internal to QEMU and not included in the migration stream so there are no visible effects from the bit renumbering.

Mark Cave-Ayland (2):
vfio-user: fix VFIO_PROXY_USE_MULTI constant value
vfio-user: update VFIOProxy flag constants to use the BIT() macro

 hw/vfio-user/proxy.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 vfio-user: fix VFIO_PROXY_USE_MULTI constant value

The constant value should represent the next bit in the VFIOProxy flags which is 0x10 and not 0x16.

---
 hw/vfio-user/proxy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio-user/proxy.h +1 -1
index 61e64a0020..b09fd886f1 100644
@@ -94,7 +94,7 @@ typedef struct VFIOUserProxy {
 #define VFIO_PROXY_CLIENT        0x1
 #define VFIO_PROXY_FORCE_QUEUED  0x4
 #define VFIO_PROXY_NO_POST       0x8
-#define VFIO_PROXY_USE_MULTI     0x16
+#define VFIO_PROXY_USE_MULTI     0x10
 
 /* coalescing high and low water marks for VFIOProxy num_outgoing */
 #define VFIO_USER_OUT_HIGH       1024
Signature · 1 line
2.43.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] vfio-user: fix VFIO_PROXY_USE_MULTI constant value

Quoted 13 lines · Mark Cave-Ayland

The constant value should represent the next bit in the VFIOProxy flags which is 0x10 and not 0x16.

---
 hw/vfio-user/proxy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio-user/proxy.h +0 -0
index 61e64a0020..b09fd886f1 100644

hw/vfio-user/proxy.h typedef struct VFIOUserProxy { · line 100

Quoted 8 lines
hw/vfio-user/proxy.h +1 -1
@@ -94,7 +94,7 @@ typedef struct VFIOUserProxy {
 #define VFIO_PROXY_CLIENT        0x1
 #define VFIO_PROXY_FORCE_QUEUED  0x4
 #define VFIO_PROXY_NO_POST       0x8
-#define VFIO_PROXY_USE_MULTI     0x16
+#define VFIO_PROXY_USE_MULTI     0x10
 
 /* coalescing high and low water marks for VFIOProxy num_outgoing */
 #define VFIO_USER_OUT_HIGH       1024

thanks
john

#3 lore raw

Re: [PATCH 1/2] vfio-user: fix VFIO_PROXY_USE_MULTI constant value

In reply to Mark Cave-Ayland
Quoted 4 lines · Mark Cave-Ayland

The constant value should represent the next bit in the VFIOProxy flags which is 0x10 and not 0x16.

Should there be a Fixes tag ?

Thanks,

C.

Quoted 17 lines
---
  hw/vfio-user/proxy.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio-user/proxy.h +1 -1
index 61e64a0020..b09fd886f1 100644
@@ -94,7 +94,7 @@ typedef struct VFIOUserProxy {
  #define VFIO_PROXY_CLIENT        0x1
  #define VFIO_PROXY_FORCE_QUEUED  0x4
  #define VFIO_PROXY_NO_POST       0x8
-#define VFIO_PROXY_USE_MULTI     0x16
+#define VFIO_PROXY_USE_MULTI     0x10
 
  /* coalescing high and low water marks for VFIOProxy num_outgoing */
  #define VFIO_USER_OUT_HIGH       1024
#4 lore raw

Re: [PATCH 1/2] vfio-user: fix VFIO_PROXY_USE_MULTI constant value

Quoted 7 lines · Cédric Le Goater
Quoted 4 lines · Mark Cave-Ayland

The constant value should represent the next bit in the VFIOProxy flags which is 0x10 and not 0x16.

Should there be a Fixes tag ?

Yes indeed, it should be:

Fixes 1a0c32a9da ("vfio-user: add coalesced posted writes")

Would you like me to resend a v2?

ATB,

Mark.

Quoted 21 lines

Thanks,

C.

Quoted 16 lines

---
  hw/vfio-user/proxy.h | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio-user/proxy.h +1 -1
index 61e64a0020..b09fd886f1 100644
@@ -94,7 +94,7 @@ typedef struct VFIOUserProxy {
   #define VFIO_PROXY_CLIENT        0x1
   #define VFIO_PROXY_FORCE_QUEUED  0x4
   #define VFIO_PROXY_NO_POST       0x8
-#define VFIO_PROXY_USE_MULTI     0x16
+#define VFIO_PROXY_USE_MULTI     0x10
   /* coalescing high and low water marks for VFIOProxy num_outgoing */
   #define VFIO_USER_OUT_HIGH       1024
#5 lore raw

Re: [PATCH 1/2] vfio-user: fix VFIO_PROXY_USE_MULTI constant value

In reply to Mark Cave-Ayland
Quoted 13 lines · Mark Cave-Ayland

The constant value should represent the next bit in the VFIOProxy flags which is 0x10 and not 0x16.

---
 hw/vfio-user/proxy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio-user/proxy.h +0 -0
index 61e64a0020..b09fd886f1 100644

hw/vfio-user/proxy.h typedef struct VFIOUserProxy { · line 100

Quoted 8 lines
hw/vfio-user/proxy.h +1 -1
@@ -94,7 +94,7 @@ typedef struct VFIOUserProxy {
 #define VFIO_PROXY_CLIENT        0x1
 #define VFIO_PROXY_FORCE_QUEUED  0x4
 #define VFIO_PROXY_NO_POST       0x8
-#define VFIO_PROXY_USE_MULTI     0x16
+#define VFIO_PROXY_USE_MULTI     0x10
 
 /* coalescing high and low water marks for VFIOProxy num_outgoing */
 #define VFIO_USER_OUT_HIGH       1024

In case anyone is wondering, this never bit us because the MULTI support is not yet merged into libvfio-user

regards
john

#6 lore raw

PATCH 2/2 vfio-user: update VFIOProxy flag constants to use the BIT() macro

In reply to Mark Cave-Ayland

This should help avoid incorrect constant values being used in future. At the same time we can remove the gap left for BIT(1) which was originally intended for the VFIO_PROXY_NO_MMAP feature which was removed from later versions of the vfio-user series.

---
 hw/vfio-user/proxy.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/vfio-user/proxy.h +4 -4
index b09fd886f1..7b97460cc5 100644
@@ -91,10 +91,10 @@ typedef struct VFIOUserProxy {
 } VFIOUserProxy;
 
 /* VFIOProxy flags */
-#define VFIO_PROXY_CLIENT        0x1
-#define VFIO_PROXY_FORCE_QUEUED  0x4
-#define VFIO_PROXY_NO_POST       0x8
-#define VFIO_PROXY_USE_MULTI     0x10
+#define VFIO_PROXY_CLIENT        BIT(0)
+#define VFIO_PROXY_FORCE_QUEUED  BIT(1)
+#define VFIO_PROXY_NO_POST       BIT(2)
+#define VFIO_PROXY_USE_MULTI     BIT(3)
 
 /* coalescing high and low water marks for VFIOProxy num_outgoing */
 #define VFIO_USER_OUT_HIGH       1024
Signature · 1 line
2.43.0
Reviewed-by on v1 2/2
#7 lore raw

Re: [PATCH 2/2] vfio-user: update VFIOProxy flag constants to use the BIT() macro

Quoted 20 lines · Mark Cave-Ayland

This should help avoid incorrect constant values being used in future. At the same time we can remove the gap left for BIT(1) which was originally intended for the VFIO_PROXY_NO_MMAP feature which was removed from later versions of the vfio-user series.

---
 hw/vfio-user/proxy.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/vfio-user/proxy.h +0 -1
index b09fd886f1..7b97460cc5 100644
@@ -91,10 +91,10 @@ typedef struct VFIOUserProxy {
 } VFIOUserProxy;
 
 /* VFIOProxy flags */
-#define VFIO_PROXY_CLIENT        0x1

hw/vfio-user/proxy.h typedef struct VFIOUserProxy { · line 100

Quoted 10 lines
hw/vfio-user/proxy.h +4 -3
-#define VFIO_PROXY_FORCE_QUEUED  0x4
-#define VFIO_PROXY_NO_POST       0x8
-#define VFIO_PROXY_USE_MULTI     0x10
+#define VFIO_PROXY_CLIENT        BIT(0)
+#define VFIO_PROXY_FORCE_QUEUED  BIT(1)
+#define VFIO_PROXY_NO_POST       BIT(2)
+#define VFIO_PROXY_USE_MULTI     BIT(3)
 
 /* coalescing high and low water marks for VFIOProxy num_outgoing */
 #define VFIO_USER_OUT_HIGH       1024

thanks
john