Skip to contentSkip to conversation

vdpa: allow a 32 bit vq alignment

PATCH In review Michael S. Tsirkin 3 participants 4 messages Apr 9, 2020 – Apr 10, 2020

Subsystems (2)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

PATCH 1/1 vdpa: allow a 32 bit vq alignment

get_vq_align returns u16 now, but that's not enough for systems/devices with 64K pages. All callers assign it to a u32 variable anyway, so let's just change the return value type to u32.

---
 drivers/vdpa/ifcvf/ifcvf_main.c  | 2 +-
 drivers/vdpa/vdpa_sim/vdpa_sim.c | 2 +-
 include/linux/vdpa.h             | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/vdpa/ifcvf/ifcvf_main.c +1 -1
index 28d9e5de5675..abf6a061cab6 100644
@@ -226,7 +226,7 @@ static u32 ifcvf_vdpa_get_vendor_id(struct vdpa_device *vdpa_dev)
 	return IFCVF_SUBSYS_VENDOR_ID;
 }
 
-static u16 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev)
+static u32 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev)
 {
 	return IFCVF_QUEUE_ALIGNMENT;
 }
drivers/vdpa/vdpa_sim/vdpa_sim.c +1 -1
index 72863d01a12a..7957d2d41fc4 100644
@@ -435,7 +435,7 @@ static u64 vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx)
 	return vrh->last_avail_idx;
 }
 
-static u16 vdpasim_get_vq_align(struct vdpa_device *vdpa)
+static u32 vdpasim_get_vq_align(struct vdpa_device *vdpa)
 {
 	return VDPASIM_QUEUE_ALIGN;
 }
include/linux/vdpa.h +1 -1
index 733acfb7ef84..5453af87a33e 100644
@@ -164,7 +164,7 @@ struct vdpa_config_ops {
 	u64 (*get_vq_state)(struct vdpa_device *vdev, u16 idx);
 
 	/* Device ops */
-	u16 (*get_vq_align)(struct vdpa_device *vdev);
+	u32 (*get_vq_align)(struct vdpa_device *vdev);
 	u64 (*get_features)(struct vdpa_device *vdev);
 	int (*set_features)(struct vdpa_device *vdev, u64 features);
 	void (*set_config_cb)(struct vdpa_device *vdev,
Signature · 1 line
MST
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Michael S. Tsirkin

get_vq_align returns u16 now, but that's not enough for systems/devices with 64K pages. All callers assign it to a u32 variable anyway, so let's just change the return value type to u32.

---

Quoted 44 lines
  drivers/vdpa/ifcvf/ifcvf_main.c  | 2 +-
  drivers/vdpa/vdpa_sim/vdpa_sim.c | 2 +-
  include/linux/vdpa.h             | 2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)
drivers/vdpa/ifcvf/ifcvf_main.c +1 -1
index 28d9e5de5675..abf6a061cab6 100644
@@ -226,7 +226,7 @@ static u32 ifcvf_vdpa_get_vendor_id(struct vdpa_device *vdpa_dev)
  	return IFCVF_SUBSYS_VENDOR_ID;
  }
 
-static u16 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev)
+static u32 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev)
  {
  	return IFCVF_QUEUE_ALIGNMENT;
  }
drivers/vdpa/vdpa_sim/vdpa_sim.c +1 -1
index 72863d01a12a..7957d2d41fc4 100644
@@ -435,7 +435,7 @@ static u64 vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx)
  	return vrh->last_avail_idx;
  }
 
-static u16 vdpasim_get_vq_align(struct vdpa_device *vdpa)
+static u32 vdpasim_get_vq_align(struct vdpa_device *vdpa)
  {
  	return VDPASIM_QUEUE_ALIGN;
  }
include/linux/vdpa.h +1 -1
index 733acfb7ef84..5453af87a33e 100644
@@ -164,7 +164,7 @@ struct vdpa_config_ops {
  	u64 (*get_vq_state)(struct vdpa_device *vdev, u16 idx);
 
  	/* Device ops */
-	u16 (*get_vq_align)(struct vdpa_device *vdev);
+	u32 (*get_vq_align)(struct vdpa_device *vdev);
  	u64 (*get_features)(struct vdpa_device *vdev);
  	int (*set_features)(struct vdpa_device *vdev, u64 features);
  	void (*set_config_cb)(struct vdpa_device *vdev,
#2 lore raw
In reply to Michael S. Tsirkin

Cc Ling Shan.

Quoted 53 lines · Michael S. Tsirkin

get_vq_align returns u16 now, but that's not enough for systems/devices with 64K pages. All callers assign it to a u32 variable anyway, so let's just change the return value type to u32.

---
  drivers/vdpa/ifcvf/ifcvf_main.c  | 2 +-
  drivers/vdpa/vdpa_sim/vdpa_sim.c | 2 +-
  include/linux/vdpa.h             | 2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)
drivers/vdpa/ifcvf/ifcvf_main.c +1 -1
index 28d9e5de5675..abf6a061cab6 100644
@@ -226,7 +226,7 @@ static u32 ifcvf_vdpa_get_vendor_id(struct vdpa_device *vdpa_dev)
  	return IFCVF_SUBSYS_VENDOR_ID;
  }
 
-static u16 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev)
+static u32 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev)
  {
  	return IFCVF_QUEUE_ALIGNMENT;
  }
drivers/vdpa/vdpa_sim/vdpa_sim.c +1 -1
index 72863d01a12a..7957d2d41fc4 100644
@@ -435,7 +435,7 @@ static u64 vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx)
  	return vrh->last_avail_idx;
  }
 
-static u16 vdpasim_get_vq_align(struct vdpa_device *vdpa)
+static u32 vdpasim_get_vq_align(struct vdpa_device *vdpa)
  {
  	return VDPASIM_QUEUE_ALIGN;
  }
include/linux/vdpa.h +1 -1
index 733acfb7ef84..5453af87a33e 100644
@@ -164,7 +164,7 @@ struct vdpa_config_ops {
  	u64 (*get_vq_state)(struct vdpa_device *vdev, u16 idx);
 
  	/* Device ops */
-	u16 (*get_vq_align)(struct vdpa_device *vdev);
+	u32 (*get_vq_align)(struct vdpa_device *vdev);
  	u64 (*get_features)(struct vdpa_device *vdev);
  	int (*set_features)(struct vdpa_device *vdev, u64 features);
  	void (*set_config_cb)(struct vdpa_device *vdev,
#3 lore raw
Quoted 47 lines · Jason Wang

Cc Ling Shan.

Quoted 44 lines · Michael S. Tsirkin

get_vq_align returns u16 now, but that's not enough for systems/devices with 64K pages. All callers assign it to a u32 variable anyway, so let's just change the return value type to u32.

---
  drivers/vdpa/ifcvf/ifcvf_main.c  | 2 +-
  drivers/vdpa/vdpa_sim/vdpa_sim.c | 2 +-
  include/linux/vdpa.h             | 2 +-

  3 files changed, 3 insertions(+), 3 deletions(-)
drivers/vdpa/ifcvf/ifcvf_main.c +1 -0
index 28d9e5de5675..abf6a061cab6 100644
@@ -226,7 +226,7 @@ static u32 ifcvf_vdpa_get_vendor_id(struct 
 vdpa_device *vdpa_dev)
       return IFCVF_SUBSYS_VENDOR_ID;
   }
   -static u16 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev)
+static u32 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev)
   {
       return IFCVF_QUEUE_ALIGNMENT;

  }

drivers/vdpa/vdpa_sim/vdpa_sim.c +1 -0
index 72863d01a12a..7957d2d41fc4 100644
@@ -435,7 +435,7 @@ static u64 vdpasim_get_vq_state(struct 
 vdpa_device *vdpa, u16 idx)
       return vrh->last_avail_idx;
   }
   -static u16 vdpasim_get_vq_align(struct vdpa_device *vdpa)
+static u32 vdpasim_get_vq_align(struct vdpa_device *vdpa)
   {
       return VDPASIM_QUEUE_ALIGN;

  }

include/linux/vdpa.h +0 -0
index 733acfb7ef84..5453af87a33e 100644
Quoted 9 lines

include/linux/vdpa.h struct vdpa_config_ops { · line 169

Quoted 8 lines
include/linux/vdpa.h +1 -1
@@ -164,7 +164,7 @@ struct vdpa_config_ops {
       u64 (*get_vq_state)(struct vdpa_device *vdev, u16 idx);
         /* Device ops */
-    u16 (*get_vq_align)(struct vdpa_device *vdev);
+    u32 (*get_vq_align)(struct vdpa_device *vdev);
       u64 (*get_features)(struct vdpa_device *vdev);
       int (*set_features)(struct vdpa_device *vdev, u64 features);
       void (*set_config_cb)(struct vdpa_device *vdev,

looks good to me

Thanks,
BR
Zhu Lingshan