Displaying 20 results from an estimated 51 matches for "__user_addr_max".
2013 Feb 18
9
[PATCH 0/5] vringh
This introduces vringh, which are generic accessors for virtio rings (host side).
There's a host-side implementation in vhost, but it assumes that the rings are
in userspace, and is tied to the vhost implementation. I have patches to adapt
it to use vringh, but I'm pushing this in the next merge window for Sjur, who has
CAIF patches which need it.
This also includes a test program in
2013 Feb 18
9
[PATCH 0/5] vringh
This introduces vringh, which are generic accessors for virtio rings (host side).
There's a host-side implementation in vhost, but it assumes that the rings are
in userspace, and is tied to the vhost implementation. I have patches to adapt
it to use vringh, but I'm pushing this in the next merge window for Sjur, who has
CAIF patches which need it.
This also includes a test program in
2023 Apr 10
2
[PATCH v2 2/2] tools/virtio: fix build caused by virtio_ring changes
...> diff --git a/tools/virtio/linux/uaccess.h b/tools/virtio/linux/uaccess.h
> > index 991dfb263998..cde2c344b260 100644
> > --- a/tools/virtio/linux/uaccess.h
> > +++ b/tools/virtio/linux/uaccess.h
> > @@ -6,15 +6,10 @@
> >
> > extern void *__user_addr_min, *__user_addr_max;
> >
> > -static inline void __chk_user_ptr(const volatile void *p, size_t size)
> > -{
> > - assert(p >= __user_addr_min && p + size <= __user_addr_max);
> > -}
> > -
What does this function have to do with container_of()?
> > #define p...
2020 Apr 06
1
[PATCH v3 1/2] virtio: stop using legacy struct vring in kernel
...ZE, ALIGN);
+ data = guest_map + vring_legacy_size(RINGSIZE, ALIGN);
indirects = (void *)data + (RINGSIZE + 1) * 2 * sizeof(int);
/* We are the guest. */
@@ -478,7 +478,7 @@ int main(int argc, char *argv[])
if (posix_memalign(&__user_addr_min, PAGE_SIZE, USER_MEM) != 0)
abort();
__user_addr_max = __user_addr_min + USER_MEM;
- memset(__user_addr_min, 0, vring_size(RINGSIZE, ALIGN));
+ memset(__user_addr_min, 0, vring_legacy_size(RINGSIZE, ALIGN));
/* Set up guest side. */
vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true, false,
@@ -487,7 +487,7 @@ int main(int argc, char...
2016 Nov 25
0
[PATCH 3/3] tools/virtio: use {READ,WRITE}_ONCE() in uaccess.h
...gt; diff --git a/tools/virtio/linux/uaccess.h b/tools/virtio/linux/uaccess.h
> index 0a578fe..fa05d01 100644
> --- a/tools/virtio/linux/uaccess.h
> +++ b/tools/virtio/linux/uaccess.h
> @@ -1,8 +1,9 @@
> #ifndef UACCESS_H
> #define UACCESS_H
> -extern void *__user_addr_min, *__user_addr_max;
>
> -#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
> +#include <linux/compiler.h>
> +
> +extern void *__user_addr_min, *__user_addr_max;
>
> static inline void __chk_user_ptr(const volatile void *p, size_t size)
> {
> @@ -13,7 +14,7 @@ static i...
2016 Nov 24
0
[PATCH 3/3] tools/virtio: use {READ,WRITE}_ONCE() in uaccess.h
...hanged, 5 insertions(+), 4 deletions(-)
diff --git a/tools/virtio/linux/uaccess.h b/tools/virtio/linux/uaccess.h
index 0a578fe..fa05d01 100644
--- a/tools/virtio/linux/uaccess.h
+++ b/tools/virtio/linux/uaccess.h
@@ -1,8 +1,9 @@
#ifndef UACCESS_H
#define UACCESS_H
-extern void *__user_addr_min, *__user_addr_max;
-#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
+#include <linux/compiler.h>
+
+extern void *__user_addr_min, *__user_addr_max;
static inline void __chk_user_ptr(const volatile void *p, size_t size)
{
@@ -13,7 +14,7 @@ static inline void __chk_user_ptr(const volatile void *p,...
2014 Nov 27
2
[PATCH v5 01/45] virtio: use u32, not bitmap for struct virtio_device's features
.../* No descriptor to get yet... */
@@ -652,13 +652,13 @@ int main(int argc, char *argv[])
}
/* Test weird (but legal!) indirect. */
- if (vdev.features[0] & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
+ if (vdev.features & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
char *data = __user_addr_max - USER_MEM/4;
struct vring_desc *d = __user_addr_max - USER_MEM/2;
struct vring vring;
/* Force creation of direct, which we modify. */
- vdev.features[0] &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
+ vdev.features &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
vq = vring_n...
2014 Nov 27
2
[PATCH v5 01/45] virtio: use u32, not bitmap for struct virtio_device's features
.../* No descriptor to get yet... */
@@ -652,13 +652,13 @@ int main(int argc, char *argv[])
}
/* Test weird (but legal!) indirect. */
- if (vdev.features[0] & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
+ if (vdev.features & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
char *data = __user_addr_max - USER_MEM/4;
struct vring_desc *d = __user_addr_max - USER_MEM/2;
struct vring vring;
/* Force creation of direct, which we modify. */
- vdev.features[0] &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
+ vdev.features &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
vq = vring_n...
2020 Apr 06
2
[PATCH v2 1/2] virtio: stop using legacy struct vring
...ZE, ALIGN);
+ data = guest_map + vring_legacy_size(RINGSIZE, ALIGN);
indirects = (void *)data + (RINGSIZE + 1) * 2 * sizeof(int);
/* We are the guest. */
@@ -478,7 +478,7 @@ int main(int argc, char *argv[])
if (posix_memalign(&__user_addr_min, PAGE_SIZE, USER_MEM) != 0)
abort();
__user_addr_max = __user_addr_min + USER_MEM;
- memset(__user_addr_min, 0, vring_size(RINGSIZE, ALIGN));
+ memset(__user_addr_min, 0, vring_legacy_size(RINGSIZE, ALIGN));
/* Set up guest side. */
vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true, false,
@@ -487,7 +487,7 @@ int main(int argc, char...
2020 Apr 06
2
[PATCH v2 1/2] virtio: stop using legacy struct vring
...ZE, ALIGN);
+ data = guest_map + vring_legacy_size(RINGSIZE, ALIGN);
indirects = (void *)data + (RINGSIZE + 1) * 2 * sizeof(int);
/* We are the guest. */
@@ -478,7 +478,7 @@ int main(int argc, char *argv[])
if (posix_memalign(&__user_addr_min, PAGE_SIZE, USER_MEM) != 0)
abort();
__user_addr_max = __user_addr_min + USER_MEM;
- memset(__user_addr_min, 0, vring_size(RINGSIZE, ALIGN));
+ memset(__user_addr_min, 0, vring_legacy_size(RINGSIZE, ALIGN));
/* Set up guest side. */
vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true, false,
@@ -487,7 +487,7 @@ int main(int argc, char...
2014 Nov 27
0
[PATCH v5 01/45] virtio: use u32, not bitmap for struct virtio_device's features
...*/
> @@ -652,13 +652,13 @@ int main(int argc, char *argv[])
> }
>
> /* Test weird (but legal!) indirect. */
> - if (vdev.features[0] & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
> + if (vdev.features & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
> char *data = __user_addr_max - USER_MEM/4;
> struct vring_desc *d = __user_addr_max - USER_MEM/2;
> struct vring vring;
>
> /* Force creation of direct, which we modify. */
> - vdev.features[0] &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
> + vdev.features &= ~(1 << VIRTIO_RING_F_IN...
2014 Nov 27
0
[PATCH v5 01/45] virtio: use u32, not bitmap for struct virtio_device's features
...*/
> @@ -652,13 +652,13 @@ int main(int argc, char *argv[])
> }
>
> /* Test weird (but legal!) indirect. */
> - if (vdev.features[0] & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
> + if (vdev.features & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
> char *data = __user_addr_max - USER_MEM/4;
> struct vring_desc *d = __user_addr_max - USER_MEM/2;
> struct vring vring;
>
> /* Force creation of direct, which we modify. */
> - vdev.features[0] &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
> + vdev.features &= ~(1 << VIRTIO_RING_F_IN...
2023 Apr 17
1
[PATCH v3 RESEND 1/2] virtio_ring: add a struct device forward declaration
The virtio_ring header file uses the struct device without a forward
declaration.
Signed-off-by: Shunsuke Mie <mie at igel.co.jp>
---
Changes from v2: https://lore.kernel.org/virtualization/20230410074929-mutt-send-email-mst at kernel.org/
- Fix a typo of commit title
include/linux/virtio_ring.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/virtio_ring.h
2014 Nov 27
1
[PATCH v5 01/45] virtio: use u32, not bitmap for struct virtio_device's features
...int main(int argc, char *argv[])
> > }
> >
> > /* Test weird (but legal!) indirect. */
> > - if (vdev.features[0] & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
> > + if (vdev.features & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
> > char *data = __user_addr_max - USER_MEM/4;
> > struct vring_desc *d = __user_addr_max - USER_MEM/2;
> > struct vring vring;
> >
> > /* Force creation of direct, which we modify. */
> > - vdev.features[0] &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
> > + vdev.features &=...
2014 Nov 27
1
[PATCH v5 01/45] virtio: use u32, not bitmap for struct virtio_device's features
...int main(int argc, char *argv[])
> > }
> >
> > /* Test weird (but legal!) indirect. */
> > - if (vdev.features[0] & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
> > + if (vdev.features & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
> > char *data = __user_addr_max - USER_MEM/4;
> > struct vring_desc *d = __user_addr_max - USER_MEM/2;
> > struct vring vring;
> >
> > /* Force creation of direct, which we modify. */
> > - vdev.features[0] &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
> > + vdev.features &=...
2023 Apr 10
2
[PATCH v2 1/2] virtio_ring: add a struce device forward declaration
The virtio_ring header file uses the struct device without a forward
declaration.
Signed-off-by: Shunsuke Mie <mie at igel.co.jp>
---
include/linux/virtio_ring.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 8b95b69ef694..77a9c2f52919 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -58,6
2020 Apr 06
0
[PATCH v4 09/12] tools/virtio: switch to virtio_legacy_init/size
...ZE, ALIGN);
+ data = guest_map + vring_legacy_size(RINGSIZE, ALIGN);
indirects = (void *)data + (RINGSIZE + 1) * 2 * sizeof(int);
/* We are the guest. */
@@ -478,7 +478,7 @@ int main(int argc, char *argv[])
if (posix_memalign(&__user_addr_min, PAGE_SIZE, USER_MEM) != 0)
abort();
__user_addr_max = __user_addr_min + USER_MEM;
- memset(__user_addr_min, 0, vring_size(RINGSIZE, ALIGN));
+ memset(__user_addr_min, 0, vring_legacy_size(RINGSIZE, ALIGN));
/* Set up guest side. */
vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true, false,
@@ -487,7 +487,7 @@ int main(int argc, char...
2020 Apr 06
0
[PATCH v4 09/12] tools/virtio: switch to virtio_legacy_init/size
...ZE, ALIGN);
+ data = guest_map + vring_legacy_size(RINGSIZE, ALIGN);
indirects = (void *)data + (RINGSIZE + 1) * 2 * sizeof(int);
/* We are the guest. */
@@ -478,7 +478,7 @@ int main(int argc, char *argv[])
if (posix_memalign(&__user_addr_min, PAGE_SIZE, USER_MEM) != 0)
abort();
__user_addr_max = __user_addr_min + USER_MEM;
- memset(__user_addr_min, 0, vring_size(RINGSIZE, ALIGN));
+ memset(__user_addr_min, 0, vring_legacy_size(RINGSIZE, ALIGN));
/* Set up guest side. */
vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true, false,
@@ -487,7 +487,7 @@ int main(int argc, char...
2020 Apr 06
0
[PATCH v5 09/12] tools/virtio: switch to virtio_legacy_init/size
...ZE, ALIGN);
+ data = guest_map + vring_legacy_size(RINGSIZE, ALIGN);
indirects = (void *)data + (RINGSIZE + 1) * 2 * sizeof(int);
/* We are the guest. */
@@ -478,7 +478,7 @@ int main(int argc, char *argv[])
if (posix_memalign(&__user_addr_min, PAGE_SIZE, USER_MEM) != 0)
abort();
__user_addr_max = __user_addr_min + USER_MEM;
- memset(__user_addr_min, 0, vring_size(RINGSIZE, ALIGN));
+ memset(__user_addr_min, 0, vring_legacy_size(RINGSIZE, ALIGN));
/* Set up guest side. */
vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true, false,
@@ -487,7 +487,7 @@ int main(int argc, char...
2020 Apr 06
0
[PATCH v6 09/12] tools/virtio: switch to virtio_legacy_init/size
...ZE, ALIGN);
+ data = guest_map + vring_legacy_size(RINGSIZE, ALIGN);
indirects = (void *)data + (RINGSIZE + 1) * 2 * sizeof(int);
/* We are the guest. */
@@ -478,7 +478,7 @@ int main(int argc, char *argv[])
if (posix_memalign(&__user_addr_min, PAGE_SIZE, USER_MEM) != 0)
abort();
__user_addr_max = __user_addr_min + USER_MEM;
- memset(__user_addr_min, 0, vring_size(RINGSIZE, ALIGN));
+ memset(__user_addr_min, 0, vring_legacy_size(RINGSIZE, ALIGN));
/* Set up guest side. */
vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true, false,
@@ -487,7 +487,7 @@ int main(int argc, char...