search for: log_guest_addr

Displaying 20 results from an estimated 60 matches for "log_guest_addr".

2010 Oct 11
2
[patch 1/2] vhost: potential integer overflows
...e, vq->log_addr, @@ -606,12 +617,17 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) } /* Also validate log access for used ring if enabled. */ - if ((a.flags & (0x1 << VHOST_VRING_F_LOG)) && - !log_access_ok(vq->log_base, a.log_guest_addr, + if (a.flags & (0x1 << VHOST_VRING_F_LOG)) { + if (vq->num > UINT_MAX / sizeof *vq->used->ring - sizeof *vq->used) { + r = -EINVAL; + break; + } + if (!log_access_ok(vq->log_base, a.log_guest_addr, sizeof *vq->used + vq->num *...
2010 Oct 11
2
[patch 1/2] vhost: potential integer overflows
...e, vq->log_addr, @@ -606,12 +617,17 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) } /* Also validate log access for used ring if enabled. */ - if ((a.flags & (0x1 << VHOST_VRING_F_LOG)) && - !log_access_ok(vq->log_base, a.log_guest_addr, + if (a.flags & (0x1 << VHOST_VRING_F_LOG)) { + if (vq->num > UINT_MAX / sizeof *vq->used->ring - sizeof *vq->used) { + r = -EINVAL; + break; + } + if (!log_access_ok(vq->log_base, a.log_guest_addr, sizeof *vq->used + vq->num *...
2015 Nov 16
1
[PATCH] vhost: relax log address alignment
...-819,7 +819,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) || (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) || - (a.log_guest_addr & (sizeof(u64) - 1))) { + (a.log_guest_addr & (VRING_USED_ALIGN_SIZE - 1))) { r = -EINVAL; break; } -- MST
2015 Nov 16
1
[PATCH] vhost: relax log address alignment
...-819,7 +819,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) || (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) || - (a.log_guest_addr & (sizeof(u64) - 1))) { + (a.log_guest_addr & (VRING_USED_ALIGN_SIZE - 1))) { r = -EINVAL; break; } -- MST
2014 Dec 20
0
[PATCH] vhost: relax used address alignment
...ivers/vhost/vhost.c @@ -713,9 +713,12 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) r = -EFAULT; break; } - if ((a.avail_user_addr & (sizeof *vq->avail->ring - 1)) || - (a.used_user_addr & (sizeof *vq->used->ring - 1)) || - (a.log_guest_addr & (sizeof *vq->used->ring - 1))) { + + BUILD_BUG_ON(__alignof__ *vq->avail != 2); + BUILD_BUG_ON(__alignof__ *vq->used != 4); + if ((a.avail_user_addr & (__alignof__ *vq->avail - 1)) || + (a.used_user_addr & (__alignof__ *vq->used - 1)) || + (a.log_guest_a...
2014 Dec 25
0
[PATCH v2 2/2] vhost: relax used address alignment
...ivers/vhost/vhost.c @@ -713,9 +713,13 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) r = -EFAULT; break; } - if ((a.avail_user_addr & (sizeof *vq->avail->ring - 1)) || - (a.used_user_addr & (sizeof *vq->used->ring - 1)) || - (a.log_guest_addr & (sizeof *vq->used->ring - 1))) { + + /* Make sure it's safe to cast pointers to vring types. */ + BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE); + BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); + if ((a.avail_user_addr & (VRING_AVAIL...
2014 Dec 20
0
[PATCH] vhost: relax used address alignment
...ivers/vhost/vhost.c @@ -713,9 +713,12 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) r = -EFAULT; break; } - if ((a.avail_user_addr & (sizeof *vq->avail->ring - 1)) || - (a.used_user_addr & (sizeof *vq->used->ring - 1)) || - (a.log_guest_addr & (sizeof *vq->used->ring - 1))) { + + BUILD_BUG_ON(__alignof__ *vq->avail != 2); + BUILD_BUG_ON(__alignof__ *vq->used != 4); + if ((a.avail_user_addr & (__alignof__ *vq->avail - 1)) || + (a.used_user_addr & (__alignof__ *vq->used - 1)) || + (a.log_guest_a...
2014 Dec 25
0
[PATCH v2 2/2] vhost: relax used address alignment
...ivers/vhost/vhost.c @@ -713,9 +713,13 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) r = -EFAULT; break; } - if ((a.avail_user_addr & (sizeof *vq->avail->ring - 1)) || - (a.used_user_addr & (sizeof *vq->used->ring - 1)) || - (a.log_guest_addr & (sizeof *vq->used->ring - 1))) { + + /* Make sure it's safe to cast pointers to vring types. */ + BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE); + BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); + if ((a.avail_user_addr & (VRING_AVAIL...
2011 Jun 16
1
[PATCH] vhost: set dirty log when updating flags of used ring
...ser(vq->last_used_idx, &used->idx); @@ -700,7 +702,6 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) vq->desc = (void __user *)(unsigned long)a.desc_user_addr; vq->avail = (void __user *)(unsigned long)a.avail_user_addr; vq->log_addr = a.log_guest_addr; - vq->used = (void __user *)(unsigned long)a.used_user_addr; break; case VHOST_SET_VRING_KICK: if (copy_from_user(&f, argp, sizeof f)) { @@ -1375,6 +1376,23 @@ void vhost_add_used_and_signal_n(struct vhost_dev *dev, vhost_signal(dev, vq); } +int vhost_update_used_flags(struct...
2011 Jun 16
1
[PATCH] vhost: set dirty log when updating flags of used ring
...ser(vq->last_used_idx, &used->idx); @@ -700,7 +702,6 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) vq->desc = (void __user *)(unsigned long)a.desc_user_addr; vq->avail = (void __user *)(unsigned long)a.avail_user_addr; vq->log_addr = a.log_guest_addr; - vq->used = (void __user *)(unsigned long)a.used_user_addr; break; case VHOST_SET_VRING_KICK: if (copy_from_user(&f, argp, sizeof f)) { @@ -1375,6 +1376,23 @@ void vhost_add_used_and_signal_n(struct vhost_dev *dev, vhost_signal(dev, vq); } +int vhost_update_used_flags(struct...
2019 Apr 23
7
[RFC PATCH V3 0/6] vhost: accelerate metadata access
This series tries to access virtqueue metadata through kernel virtual address instead of copy_user() friends since they had too much overheads like checks, spec barriers or even hardware feature toggling. This is done through setup kernel address through direct mapping and co-opreate VM management with MMU notifiers. Test shows about 23% improvement on TX PPS. TCP_STREAM doesn't see obvious
2019 May 24
10
[PATCH net-next 0/6] vhost: accelerate metadata access
Hi: This series tries to access virtqueue metadata through kernel virtual address instead of copy_user() friends since they had too much overheads like checks, spec barriers or even hardware feature toggling like SMAP. This is done through setup kernel address through direct mapping and co-opreate VM management with MMU notifiers. Test shows about 23% improvement on TX PPS. TCP_STREAM
2019 May 24
10
[PATCH net-next 0/6] vhost: accelerate metadata access
Hi: This series tries to access virtqueue metadata through kernel virtual address instead of copy_user() friends since they had too much overheads like checks, spec barriers or even hardware feature toggling like SMAP. This is done through setup kernel address through direct mapping and co-opreate VM management with MMU notifiers. Test shows about 23% improvement on TX PPS. TCP_STREAM
2015 Feb 20
0
[PATCH 1/3] vhost: add VHOST_VRING_F_LEGACY_BIG_ENDIAN flag
...;< VHOST_VRING_F_LOG| + 0x1 << VHOST_VRING_F_LEGACY_BIG_ENDIAN)) { r = -EOPNOTSUPP; break; } @@ -751,6 +753,8 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) vq->avail = (void __user *)(unsigned long)a.avail_user_addr; vq->log_addr = a.log_guest_addr; vq->used = (void __user *)(unsigned long)a.used_user_addr; + vq->legacy_big_endian = + !!(a.flags & (0x1 << VHOST_VRING_F_LEGACY_BIG_ENDIAN)); break; case VHOST_SET_VRING_KICK: if (copy_from_user(&f, argp, sizeof f)) { diff --git a/drivers/vhost/vhost.h b/drivers/...
2015 Feb 20
0
[PATCH 1/3] vhost: add VHOST_VRING_F_LEGACY_BIG_ENDIAN flag
...;< VHOST_VRING_F_LOG| + 0x1 << VHOST_VRING_F_LEGACY_BIG_ENDIAN)) { r = -EOPNOTSUPP; break; } @@ -751,6 +753,8 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) vq->avail = (void __user *)(unsigned long)a.avail_user_addr; vq->log_addr = a.log_guest_addr; vq->used = (void __user *)(unsigned long)a.used_user_addr; + vq->legacy_big_endian = + !!(a.flags & (0x1 << VHOST_VRING_F_LEGACY_BIG_ENDIAN)); break; case VHOST_SET_VRING_KICK: if (copy_from_user(&f, argp, sizeof f)) { diff --git a/drivers/vhost/vhost.h b/drivers/...
2015 Apr 02
2
[PATCH v2 7/7] vhost: feature to set the vring endianness
...rn virtio_legacy_is_little_endian(); > } > > diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h > index bb6a5b4..09d2a48 100644 > --- a/include/uapi/linux/vhost.h > +++ b/include/uapi/linux/vhost.h > @@ -47,6 +47,11 @@ struct vhost_vring_addr { > __u64 log_guest_addr; > }; > > +struct vhost_vring_endian { > + unsigned int index; > + bool is_big_endian; bool in uapi is a bad idea. Generally, I think you can use vhost_vring_state here. > +}; > + > struct vhost_memory_region { > __u64 guest_phys_addr; > __u64 memory_size; /*...
2015 Apr 02
2
[PATCH v2 7/7] vhost: feature to set the vring endianness
...rn virtio_legacy_is_little_endian(); > } > > diff --git a/include/uapi/linux/vhost.h b/include/uapi/linux/vhost.h > index bb6a5b4..09d2a48 100644 > --- a/include/uapi/linux/vhost.h > +++ b/include/uapi/linux/vhost.h > @@ -47,6 +47,11 @@ struct vhost_vring_addr { > __u64 log_guest_addr; > }; > > +struct vhost_vring_endian { > + unsigned int index; > + bool is_big_endian; bool in uapi is a bad idea. Generally, I think you can use vhost_vring_state here. > +}; > + > struct vhost_memory_region { > __u64 guest_phys_addr; > __u64 memory_size; /*...
2019 Jul 03
0
[RFC v2] vhost: introduce mdev based hardware vhost backend
...vring) > + vdpa->nr_vring = qid + 1; > + > + vring = &vdpa->vring_info[qid]; > + > + vring->desc_user_addr = addr->desc_user_addr; > + vring->used_user_addr = addr->used_user_addr; > + vring->avail_user_addr = addr->avail_user_addr; > + vring->log_guest_addr = addr->log_guest_addr; > + > + return 0; > +} > + > +static int vhost_set_vring_num(struct mdev_device *mdev, > + struct vhost_vring_state *num) > +{ > + struct vdpa_dev *vdpa; > + int qid = num->index; > + struct vdpa_vring_info *vring; > + > + vdpa = md...
2019 Jul 03
4
[RFC v2] vhost: introduce mdev based hardware vhost backend
...-EINVAL; + + if (qid >= vdpa->nr_vring) + vdpa->nr_vring = qid + 1; + + vring = &vdpa->vring_info[qid]; + + vring->desc_user_addr = addr->desc_user_addr; + vring->used_user_addr = addr->used_user_addr; + vring->avail_user_addr = addr->avail_user_addr; + vring->log_guest_addr = addr->log_guest_addr; + + return 0; +} + +static int vhost_set_vring_num(struct mdev_device *mdev, + struct vhost_vring_state *num) +{ + struct vdpa_dev *vdpa; + int qid = num->index; + struct vdpa_vring_info *vring; + + vdpa = mdev_get_drvdata(mdev); + if (!vdpa) + return -ENODEV; + + if...
2019 Jul 03
4
[RFC v2] vhost: introduce mdev based hardware vhost backend
...-EINVAL; + + if (qid >= vdpa->nr_vring) + vdpa->nr_vring = qid + 1; + + vring = &vdpa->vring_info[qid]; + + vring->desc_user_addr = addr->desc_user_addr; + vring->used_user_addr = addr->used_user_addr; + vring->avail_user_addr = addr->avail_user_addr; + vring->log_guest_addr = addr->log_guest_addr; + + return 0; +} + +static int vhost_set_vring_num(struct mdev_device *mdev, + struct vhost_vring_state *num) +{ + struct vdpa_dev *vdpa; + int qid = num->index; + struct vdpa_vring_info *vring; + + vdpa = mdev_get_drvdata(mdev); + if (!vdpa) + return -ENODEV; + + if...