virtio: last minute fixes
A couple of last minute fixes Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -----BEGIN PGP SIGNATURE----- iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAl9sbPMPHG1zdEByZWRo YXQuY29tAAoJECgfDbjSjVRpfD0H/1x51oiUpXlC2VcV8Bu3EsyGxFMGWm4BPikR XKlFlOdn0rksbpNe+3ie2eKv+o5ckmAGiqtB19O6kk1wDFTAvKBMjWItxoD560F8 AFYF6hD2qKnfcCXyS9TtJjCMkH6D+RplPxTQHEztBeh603usip8j2kcesMmNQD75 QECwXILQmivyXJ/HyBfGwij78QQNXWnHaUs+PszGLL5I0gNbBdE9TbeRVpTRph34 swvihfryYhZct3BFmAHp32c3oNJ7FOLlmqJoYenpkO6+SY/1OqJkRGVGH2BS5tC2 M87E423bggcpWIfYxKbmaGZwmxumwZEF7pBhEUdGI1wi2BuKEXQ= =lzv1 -----END PGP SIGNATURE----- Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost Pull virtio fixes from Michael Tsirkin: "A couple of last minute fixes" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: vhost-vdpa: fix backend feature ioctls vhost: Fix documentation
This commit is contained in:
commit
1ccfa66d94
@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(vhost_iotlb_free);
|
|||||||
* vhost_iotlb_itree_first - return the first overlapped range
|
* vhost_iotlb_itree_first - return the first overlapped range
|
||||||
* @iotlb: the IOTLB
|
* @iotlb: the IOTLB
|
||||||
* @start: start of IOVA range
|
* @start: start of IOVA range
|
||||||
* @end: end of IOVA range
|
* @last: last byte in IOVA range
|
||||||
*/
|
*/
|
||||||
struct vhost_iotlb_map *
|
struct vhost_iotlb_map *
|
||||||
vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last)
|
vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last)
|
||||||
@ -162,7 +162,7 @@ EXPORT_SYMBOL_GPL(vhost_iotlb_itree_first);
|
|||||||
* vhost_iotlb_itree_next - return the next overlapped range
|
* vhost_iotlb_itree_next - return the next overlapped range
|
||||||
* @map: the starting map node
|
* @map: the starting map node
|
||||||
* @start: start of IOVA range
|
* @start: start of IOVA range
|
||||||
* @end: end of IOVA range
|
* @last: last byte IOVA range
|
||||||
*/
|
*/
|
||||||
struct vhost_iotlb_map *
|
struct vhost_iotlb_map *
|
||||||
vhost_iotlb_itree_next(struct vhost_iotlb_map *map, u64 start, u64 last)
|
vhost_iotlb_itree_next(struct vhost_iotlb_map *map, u64 start, u64 last)
|
||||||
|
@ -353,8 +353,6 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
|
|||||||
struct vdpa_callback cb;
|
struct vdpa_callback cb;
|
||||||
struct vhost_virtqueue *vq;
|
struct vhost_virtqueue *vq;
|
||||||
struct vhost_vring_state s;
|
struct vhost_vring_state s;
|
||||||
u64 __user *featurep = argp;
|
|
||||||
u64 features;
|
|
||||||
u32 idx;
|
u32 idx;
|
||||||
long r;
|
long r;
|
||||||
|
|
||||||
@ -381,18 +379,6 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
|
|||||||
|
|
||||||
vq->last_avail_idx = vq_state.avail_index;
|
vq->last_avail_idx = vq_state.avail_index;
|
||||||
break;
|
break;
|
||||||
case VHOST_GET_BACKEND_FEATURES:
|
|
||||||
features = VHOST_VDPA_BACKEND_FEATURES;
|
|
||||||
if (copy_to_user(featurep, &features, sizeof(features)))
|
|
||||||
return -EFAULT;
|
|
||||||
return 0;
|
|
||||||
case VHOST_SET_BACKEND_FEATURES:
|
|
||||||
if (copy_from_user(&features, featurep, sizeof(features)))
|
|
||||||
return -EFAULT;
|
|
||||||
if (features & ~VHOST_VDPA_BACKEND_FEATURES)
|
|
||||||
return -EOPNOTSUPP;
|
|
||||||
vhost_set_backend_features(&v->vdev, features);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
r = vhost_vring_ioctl(&v->vdev, cmd, argp);
|
r = vhost_vring_ioctl(&v->vdev, cmd, argp);
|
||||||
@ -440,8 +426,20 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep,
|
|||||||
struct vhost_vdpa *v = filep->private_data;
|
struct vhost_vdpa *v = filep->private_data;
|
||||||
struct vhost_dev *d = &v->vdev;
|
struct vhost_dev *d = &v->vdev;
|
||||||
void __user *argp = (void __user *)arg;
|
void __user *argp = (void __user *)arg;
|
||||||
|
u64 __user *featurep = argp;
|
||||||
|
u64 features;
|
||||||
long r;
|
long r;
|
||||||
|
|
||||||
|
if (cmd == VHOST_SET_BACKEND_FEATURES) {
|
||||||
|
r = copy_from_user(&features, featurep, sizeof(features));
|
||||||
|
if (r)
|
||||||
|
return r;
|
||||||
|
if (features & ~VHOST_VDPA_BACKEND_FEATURES)
|
||||||
|
return -EOPNOTSUPP;
|
||||||
|
vhost_set_backend_features(&v->vdev, features);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
mutex_lock(&d->mutex);
|
mutex_lock(&d->mutex);
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
@ -476,6 +474,10 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep,
|
|||||||
case VHOST_VDPA_SET_CONFIG_CALL:
|
case VHOST_VDPA_SET_CONFIG_CALL:
|
||||||
r = vhost_vdpa_set_config_call(v, argp);
|
r = vhost_vdpa_set_config_call(v, argp);
|
||||||
break;
|
break;
|
||||||
|
case VHOST_GET_BACKEND_FEATURES:
|
||||||
|
features = VHOST_VDPA_BACKEND_FEATURES;
|
||||||
|
r = copy_to_user(featurep, &features, sizeof(features));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
r = vhost_dev_ioctl(&v->vdev, cmd, argp);
|
r = vhost_dev_ioctl(&v->vdev, cmd, argp);
|
||||||
if (r == -ENOIOCTLCMD)
|
if (r == -ENOIOCTLCMD)
|
||||||
|
Loading…
Reference in New Issue
Block a user