History

vhost-vdpa: introduce uAPI to set group ASID

Follows the vDPA support for associating ASID to a specific virtqueue group. This patch adds a uAPI to support setting them from userspace.

Gautam Dawar committed 4 years ago

Commit 84d7c8f1 parent 2d1fcb72 files · +15 −0Browse files

Unified · Split

2 files
  1. drivers/vhost/vdpa.c +8 −0
  2. include/uapi/linux/vhost.h +7 −0
drivers/vhost/vdpa.c+8−0
@@ -473,6 +473,14 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, · 472 unmodified lines
473473 else if (copy_to_user(argp, &s, sizeof(s)))
474474 return -EFAULT;
475475 return 0;
476+ case VHOST_VDPA_SET_GROUP_ASID:
477+ if (copy_from_user(&s, argp, sizeof(s)))
478+ return -EFAULT;
479+ if (s.num >= vdpa->nas)
480+ return -EINVAL;
481+ if (!ops->set_group_asid)
482+ return -EOPNOTSUPP;
483+ return ops->set_group_asid(vdpa, idx, s.num);
476484 case VHOST_GET_VRING_BASE:
477485 r = ops->get_vq_state(v->vdpa, idx, &vq_state);
478486 if (r)
include/uapi/linux/vhost.h+7−0
@@ -164,4 +164,11 @@ · 163 unmodified lines
164164 */
165165 #define VHOST_VDPA_GET_VRING_GROUP _IOWR(VHOST_VIRTIO, 0x7B, \
166166 struct vhost_vring_state)
167+/* Set the ASID for a virtqueue group. The group index is stored in
168+ * the index field of vhost_vring_state, the ASID associated with this
169+ * group is stored at num field of vhost_vring_state.
170+ */
171+#define VHOST_VDPA_SET_GROUP_ASID _IOW(VHOST_VIRTIO, 0x7C, \
172+ struct vhost_vring_state)
173+
167174 #endif