Follows the vDPA support for associating ASID to a specific virtqueue group. This patch adds a uAPI to support setting them from userspace.
Unified · Split
| @@ -473,6 +473,14 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, · 472 unmodified lines | |||
| 473 | else if (copy_to_user(argp, &s, sizeof(s))) | 473 | else if (copy_to_user(argp, &s, sizeof(s))) |
| 474 | return -EFAULT; | 474 | return -EFAULT; |
| 475 | return 0; | 475 | 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); | ||
| 476 | case VHOST_GET_VRING_BASE: | 484 | case VHOST_GET_VRING_BASE: |
| 477 | r = ops->get_vq_state(v->vdpa, idx, &vq_state); | 485 | r = ops->get_vq_state(v->vdpa, idx, &vq_state); |
| 478 | if (r) | 486 | if (r) |
| @@ -164,4 +164,11 @@ · 163 unmodified lines | |||
| 164 | */ | 164 | */ |
| 165 | #define VHOST_VDPA_GET_VRING_GROUP _IOWR(VHOST_VIRTIO, 0x7B, \ | 165 | #define VHOST_VDPA_GET_VRING_GROUP _IOWR(VHOST_VIRTIO, 0x7B, \ |
| 166 | struct vhost_vring_state) | 166 | 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 | |||
| 167 | #endif | 174 | #endif |