virtio: Fix typecast of pointer in vring_init()
Subsystems (2)
PATCH RESEND 1/1 virtio: Fix typecast of pointer in vring_init()
The virtio_ring.h header is used in userspace programs (ie. QEMU), too. Here we can not assume that sizeof(pointer) is the same as sizeof(long), e.g. when compiling for Windows, so the typecast in vring_init() should be done with (uintptr_t) instead of (unsigned long).
--- include/uapi/linux/virtio_ring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/virtio_ring.h +1 -1
@@ -143,7 +143,7 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p, vr->num = num; vr->desc = p; vr->avail = p + num*sizeof (struct vring_desc ); - vr->used = (void *)(((unsigned long )&vr->avail->ring[num] +sizeof (__virtio16) + vr->used = (void *)(((uintptr_t )&vr->avail->ring[num] +sizeof (__virtio16) + align-1 ) & ~(align -1 )); }
Signature · 1 line
1.8.3.1
Michael S. Tsirkin
maintainerQuoted 6 lines · Thomas Huth
The
virtio_ring.hheader is used in userspace programs (ie. QEMU), too. Here we can not assume that sizeof(pointer) is the same as sizeof(long), e.g. when compiling for Windows, so the typecast invring_init()should be done with (uintptr_t) instead of (unsigned long).Signed-off-by Thomas Huth <[email protected]>
This seems to break some userspace too:
INSTALL usr/include/linux/ (413 files)
CHECK usr/include/linux/ (413 files) HOSTCC Documentation/accounting/getdelays HOSTCC Documentation/connector/ucon HOSTCC Documentation/mic/mpssd/mpssd.o
In file included from Documentation/mic/mpssd/mpssd.c:36:0:./usr/include/linux/virtio_ring.h: In function ‘vring_init’:./usr/include/linux/virtio_ring.h:146:24: error: ‘uintptr_t’ undeclared (first use in this function)
vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] +sizeof(__virtio16)
^
./usr/include/linux/virtio_ring.h:146:24: note: each undeclared identifier is reported only once for each function it appears in scripts/Makefile.host:108: recipe for target 'Documentation/mic/mpssd/mpssd.o' failed
make[3]: *** [Documentation/mic/mpssd/mpssd.o] Error 1 scripts/Makefile.build:403: recipe for target 'Documentation/mic/mpssd' failed
make[2]: *** [Documentation/mic/mpssd] Error 2 scripts/Makefile.build:403: recipe for target 'Documentation/mic' failed make[1]: *** [Documentation/mic] Error 2
E.g. fuse.h has this code:
#ifdef __KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endif
Maybe we need something similar.
Quoted 19 lines
--- include/uapi/linux/virtio_ring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/uapi/linux/virtio_ring.h +1
-1@@ -143,7 +143,7 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p, vr->num = num; vr->desc = p; vr->avail = p + num*sizeof (struct vring_desc ); - vr->used = (void *)(((unsigned long )&vr->avail->ring[num] +sizeof (__virtio16) + vr->used = (void *)(((uintptr_t )&vr->avail->ring[num] +sizeof (__virtio16) + align-1 ) & ~(align -1 )); }Signature · 1 line
1.8.3.1
Michael S. Tsirkin
maintainerQuoted 34 lines · Michael S. Tsirkin
Quoted 6 lines · Thomas Huth
The
virtio_ring.hheader is used in userspace programs (ie. QEMU), too. Here we can not assume that sizeof(pointer) is the same as sizeof(long), e.g. when compiling for Windows, so the typecast invring_init()should be done with (uintptr_t) instead of (unsigned long).Signed-off-by Thomas Huth <[email protected]>This seems to break some userspace too:
INSTALL
usr/include/linux/(413 files)CHECK usr/include/linux/ (413 files) HOSTCC Documentation/accounting/getdelays HOSTCC Documentation/connector/ucon HOSTCC Documentation/mic/mpssd/mpssd.oIn file included from
Documentation/mic/mpssd/mpssd.c:36:0:./usr/include/linux/virtio_ring.h: In function ‘vring_init’:./usr/include/linux/virtio_ring.h:146:24: error: ‘uintptr_t’ undeclared (first use in this function)
vr->used= (void *)(((uintptr_t)&vr->avail->ring[num] +sizeof(__virtio16)^
./usr/include/linux/virtio_ring.h:146:24: note: each undeclared identifier is reported only once for each function it appears inscripts/Makefile.host:108: recipe for target 'Documentation/mic/mpssd/mpssd.o' failed
make[3]: *** [Documentation/mic/mpssd/mpssd.o] Error 1scripts/Makefile.build:403: recipe for target 'Documentation/mic/mpssd' failed
make[2]: *** [Documentation/mic/mpssd] Error 2scripts/Makefile.build:403: recipe for target 'Documentation/mic' failed make[1]: *** [Documentation/mic] Error 2
Quoted 8 lines
E.g.
fuse.hhas this code:
#ifdef__KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endifMaybe we need something similar.
The following seems to help. Does it help the windows build?
--- include/uapi/linux/virtio_ring.h | 3 +++ 1 file changed, 3 insertions(+)
include/uapi/linux/virtio_ring.h +3 -0
@@ -31,6 +31,9 @@* SUCH DAMAGE. * * Copyright Rusty Russell IBM Corporation 2007. */ +#ifndef __KERNEL__ +#include <stdint.h> +#endif #include <linux/types.h> #include <linux/virtio_types.h>
Signature · 1 line
MST
Quoted 11 lines · On Sun, 5 Jul 2015 14:59:54 +0200 "Michael S. Tsirkin"…
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Thomas Huth
The
virtio_ring.hheader is used in userspace programs (ie. QEMU), too. Here we can not assume that sizeof(pointer) is the same as sizeof(long), e.g. when compiling for Windows, so the typecast invring_init()should be done with (uintptr_t) instead of (unsigned long).Signed-off-by Thomas Huth <[email protected]>This seems to break some userspace too:
Quoted 15 lines
Quoted 11 lines
INSTALL
usr/include/linux/(413 files)CHECK usr/include/linux/ (413 files) HOSTCC Documentation/accounting/getdelays HOSTCC Documentation/connector/ucon HOSTCC Documentation/mic/mpssd/mpssd.oIn file included from
Documentation/mic/mpssd/mpssd.c:36:0:./usr/include/linux/virtio_ring.h: In function ‘vring_init’:./usr/include/linux/virtio_ring.h:146:24: error: ‘uintptr_t’ undeclared (first use in this function)
vr->used= (void *)(((uintptr_t)&vr->avail->ring[num] +sizeof(__virtio16)Quoted 4 lines
^
./usr/include/linux/virtio_ring.h:146:24: note: each undeclared identifier is reported only once for each function it appears inscripts/Makefile.host:108: recipe for target
D'oh, I only built the kernel for powerpc, that's why I did not notice this breakage in the MIC code. Sorry!
Quoted 10 lines
Quoted 8 lines
E.g.
fuse.hhas this code:
#ifdef__KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endifMaybe we need something similar.
The following seems to help. Does it help the windows build?
...
include/uapi/linux/virtio_ring.h line 38
Quoted 13 lines
include/uapi/linux/virtio_ring.h +3
-0@@ -31,6 +31,9 @@* SUCH DAMAGE. * * Copyright Rusty Russell IBM Corporation 2007. */ +#ifndef __KERNEL__ +#include <stdint.h> +#endif #include <linux/types.h> #include <linux/virtio_types.h>
Since the update-linux-headers.sh script from QEMU replaces the "#include <linux/types.h>" in virtio_ring.h to include a file that again includes stdint.h already, your above patch should not do any difference for compiling QEMU for Windows, I think. It's really just about replacing the typecast there.
But you're right of course for other user space applications which include this header by other means. So I'm fine if you change my patch with your hunk above (or add it as an additional patch). Or shall I rather resend my patch with your above hunk included?
Thomas
Michael S. Tsirkin
maintainerQuoted 64 lines · Thomas Huth
Quoted 11 lines · On Sun, 5 Jul 2015 14:59:54 +0200 "Michael S. Tsirkin"…
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Thomas Huth
The
virtio_ring.hheader is used in userspace programs (ie. QEMU), too. Here we can not assume that sizeof(pointer) is the same as sizeof(long), e.g. when compiling for Windows, so the typecast invring_init()should be done with (uintptr_t) instead of (unsigned long).Signed-off-by Thomas Huth <[email protected]>This seems to break some userspace too:
Quoted 15 lines
Quoted 11 lines
INSTALL
usr/include/linux/(413 files)CHECK usr/include/linux/ (413 files) HOSTCC Documentation/accounting/getdelays HOSTCC Documentation/connector/ucon HOSTCC Documentation/mic/mpssd/mpssd.oIn file included from
Documentation/mic/mpssd/mpssd.c:36:0:./usr/include/linux/virtio_ring.h: In function ‘vring_init’:./usr/include/linux/virtio_ring.h:146:24: error: ‘uintptr_t’ undeclared (first use in this function)
vr->used= (void *)(((uintptr_t)&vr->avail->ring[num] +sizeof(__virtio16)Quoted 4 lines
^
./usr/include/linux/virtio_ring.h:146:24: note: each undeclared identifier is reported only once for each function it appears inscripts/Makefile.host:108: recipe for targetD'oh, I only built the kernel for powerpc, that's why I did not notice this breakage in the MIC code. Sorry!
Quoted 10 lines
Quoted 8 lines
E.g.
fuse.hhas this code:
#ifdef__KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endifMaybe we need something similar.
The following seems to help. Does it help the windows build?
...
include/uapi/linux/virtio_ring.h line 38
Quoted 13 lines
include/uapi/linux/virtio_ring.h +3
-0@@ -31,6 +31,9 @@* SUCH DAMAGE. * * Copyright Rusty Russell IBM Corporation 2007. */ +#ifndef __KERNEL__ +#include <stdint.h> +#endif #include <linux/types.h> #include <linux/virtio_types.h> Since the
update-linux-headers.shscript from QEMU replaces the "#include <linux/types.h>" invirtio_ring.hto include a file that again includesstdint.halready, your above patch should not do any difference for compiling QEMU for Windows, I think. It's really just about replacing the typecast there.
Quoted 6 lines
But you're right of course for other user space applications which include this header by other means. So I'm fine if you change my patch with your hunk above (or add it as an additional patch). Or shall I rather resend my patch with your above hunk included?
Thomas
You don't have to, but could you confirm that stdint has uintptr_t on mingw?
Signature · 1 line
MST
Quoted 70 lines · On Mon, 6 Jul 2015 12:50:22 +0300 "Michael S. Tsirkin"…
Quoted 69 lines · Thomas Huth
Quoted 11 lines · On Sun, 5 Jul 2015 14:59:54 +0200 "Michael S. Tsirkin"…
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Thomas Huth
The
virtio_ring.hheader is used in userspace programs (ie. QEMU), too. Here we can not assume that sizeof(pointer) is the same as sizeof(long), e.g. when compiling for Windows, so the typecast invring_init()should be done with (uintptr_t) instead of (unsigned long).Signed-off-by Thomas Huth <[email protected]>This seems to break some userspace too:
Quoted 15 lines
Quoted 11 lines
INSTALL
usr/include/linux/(413 files)CHECK usr/include/linux/ (413 files) HOSTCC Documentation/accounting/getdelays HOSTCC Documentation/connector/ucon HOSTCC Documentation/mic/mpssd/mpssd.oIn file included from
Documentation/mic/mpssd/mpssd.c:36:0:./usr/include/linux/virtio_ring.h: In function ‘vring_init’:./usr/include/linux/virtio_ring.h:146:24: error: ‘uintptr_t’ undeclared (first use in this function)
vr->used= (void *)(((uintptr_t)&vr->avail->ring[num] +sizeof(__virtio16)Quoted 4 lines
^
./usr/include/linux/virtio_ring.h:146:24: note: each undeclared identifier is reported only once for each function it appears inscripts/Makefile.host:108: recipe for targetD'oh, I only built the kernel for powerpc, that's why I did not notice this breakage in the MIC code. Sorry!
Quoted 10 lines
Quoted 8 lines
E.g.
fuse.hhas this code:
#ifdef__KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endifMaybe we need something similar.
The following seems to help. Does it help the windows build?
...
include/uapi/linux/virtio_ring.h line 38
Quoted 13 lines
include/uapi/linux/virtio_ring.h +3
-0@@ -31,6 +31,9 @@* SUCH DAMAGE. * * Copyright Rusty Russell IBM Corporation 2007. */ +#ifndef __KERNEL__ +#include <stdint.h> +#endif #include <linux/types.h> #include <linux/virtio_types.h> Since the
update-linux-headers.shscript from QEMU replaces the "#include <linux/types.h>" invirtio_ring.hto include a file that again includesstdint.halready, your above patch should not do any difference for compiling QEMU for Windows, I think. It's really just about replacing the typecast there.But you're right of course for other user space applications which include this header by other means. So I'm fine if you change my patch with your hunk above (or add it as an additional patch). Or shall I rather resend my patch with your above hunk included?
Quoted 5 lines
Quoted 1 line
Thomas
You don't have to, but could you confirm that stdint has
uintptr_ton mingw?
$ grep typedef.*uintptr /usr/x86_64-w64-mingw32/sys-root/mingw/include/*.h ... /usr/x86_64-w64-mingw32/sys-root/mingw/include/crtdefs.h:__MINGW_EXTENSION typedef unsigned __int64 uintptr_t; ...
And the stdint.h from my MinGW installation includes crtdefs.h. So yes, confirmed that stdint.h provides uintptr_t there, too.
Thomas
Quoted 70 lines · On Mon, 6 Jul 2015 12:50:22 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 69 lines · Thomas Huth
Quoted 11 lines · On Sun, 5 Jul 2015 14:59:54 +0200 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Thomas Huth
The
virtio_ring.hheader is used in userspace programs (ie. QEMU), too. Here we can not assume that sizeof(pointer) is the same as sizeof(long), e.g. when compiling for Windows, so the typecast invring_init()should be done with (uintptr_t) instead of (unsigned long).Signed-off-by Thomas Huth <[email protected]>This seems to break some userspace too:
Quoted 15 lines
Quoted 11 lines
INSTALL
usr/include/linux/(413 files)CHECK usr/include/linux/ (413 files) HOSTCC Documentation/accounting/getdelays HOSTCC Documentation/connector/ucon HOSTCC Documentation/mic/mpssd/mpssd.oIn file included from
Documentation/mic/mpssd/mpssd.c:36:0:./usr/include/linux/virtio_ring.h: In function ‘vring_init’:./usr/include/linux/virtio_ring.h:146:24: error: ‘uintptr_t’ undeclared (first use in this function)
vr->used= (void *)(((uintptr_t)&vr->avail->ring[num] +sizeof(__virtio16)Quoted 4 lines
^
./usr/include/linux/virtio_ring.h:146:24: note: each undeclared identifier is reported only once for each function it appears inscripts/Makefile.host:108: recipe for targetD'oh, I only built the kernel for powerpc, that's why I did not notice this breakage in the MIC code. Sorry!
Quoted 10 lines
Quoted 8 lines
E.g.
fuse.hhas this code:
#ifdef__KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endifMaybe we need something similar.
The following seems to help. Does it help the windows build?
...
include/uapi/linux/virtio_ring.h line 38
Quoted 13 lines
include/uapi/linux/virtio_ring.h +3
-0@@ -31,6 +31,9 @@* SUCH DAMAGE. * * Copyright Rusty Russell IBM Corporation 2007. */ +#ifndef __KERNEL__ +#include <stdint.h> +#endif #include <linux/types.h> #include <linux/virtio_types.h> Since the
update-linux-headers.shscript from QEMU replaces the "#include <linux/types.h>" invirtio_ring.hto include a file that again includesstdint.halready, your above patch should not do any difference for compiling QEMU for Windows, I think. It's really just about replacing the typecast there.But you're right of course for other user space applications which include this header by other means. So I'm fine if you change my patch with your hunk above (or add it as an additional patch). Or shall I rather resend my patch with your above hunk included?
Quoted 5 lines
Quoted 1 line
Thomas
You don't have to, but could you confirm that stdint has
uintptr_ton mingw?
$ grep typedef.*uintptr /usr/x86_64-w64-mingw32/sys-root/mingw/include/*.h ... /usr/x86_64-w64-mingw32/sys-root/mingw/include/crtdefs.h:__MINGW_EXTENSION typedef unsigned __int64 uintptr_t; ...
And the stdint.h from my MinGW installation includes crtdefs.h. So yes, confirmed that stdint.h provides uintptr_t there, too.
Thomas
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 64 lines · Thomas Huth
Quoted 11 lines · On Sun, 5 Jul 2015 14:59:54 +0200 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Thomas Huth
The
virtio_ring.hheader is used in userspace programs (ie. QEMU), too. Here we can not assume that sizeof(pointer) is the same as sizeof(long), e.g. when compiling for Windows, so the typecast invring_init()should be done with (uintptr_t) instead of (unsigned long).Signed-off-by Thomas Huth <[email protected]>This seems to break some userspace too:
Quoted 15 lines
Quoted 11 lines
INSTALL
usr/include/linux/(413 files)CHECK usr/include/linux/ (413 files) HOSTCC Documentation/accounting/getdelays HOSTCC Documentation/connector/ucon HOSTCC Documentation/mic/mpssd/mpssd.oIn file included from
Documentation/mic/mpssd/mpssd.c:36:0:./usr/include/linux/virtio_ring.h: In function ‘vring_init’:./usr/include/linux/virtio_ring.h:146:24: error: ‘uintptr_t’ undeclared (first use in this function)
vr->used= (void *)(((uintptr_t)&vr->avail->ring[num] +sizeof(__virtio16)Quoted 4 lines
^
./usr/include/linux/virtio_ring.h:146:24: note: each undeclared identifier is reported only once for each function it appears inscripts/Makefile.host:108: recipe for targetD'oh, I only built the kernel for powerpc, that's why I did not notice this breakage in the MIC code. Sorry!
Quoted 10 lines
Quoted 8 lines
E.g.
fuse.hhas this code:
#ifdef__KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endifMaybe we need something similar.
The following seems to help. Does it help the windows build?
...
include/uapi/linux/virtio_ring.h line 38
Quoted 13 lines
include/uapi/linux/virtio_ring.h +3
-0@@ -31,6 +31,9 @@* SUCH DAMAGE. * * Copyright Rusty Russell IBM Corporation 2007. */ +#ifndef __KERNEL__ +#include <stdint.h> +#endif #include <linux/types.h> #include <linux/virtio_types.h> Since the
update-linux-headers.shscript from QEMU replaces the "#include <linux/types.h>" invirtio_ring.hto include a file that again includesstdint.halready, your above patch should not do any difference for compiling QEMU for Windows, I think. It's really just about replacing the typecast there.
Quoted 6 lines
But you're right of course for other user space applications which include this header by other means. So I'm fine if you change my patch with your hunk above (or add it as an additional patch). Or shall I rather resend my patch with your above hunk included?
Thomas
You don't have to, but could you confirm that stdint has uintptr_t on mingw?
Signature · 5 lines
MST _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Quoted 11 lines · On Sun, 5 Jul 2015 14:59:54 +0200 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Thomas Huth
The
virtio_ring.hheader is used in userspace programs (ie. QEMU), too. Here we can not assume that sizeof(pointer) is the same as sizeof(long), e.g. when compiling for Windows, so the typecast invring_init()should be done with (uintptr_t) instead of (unsigned long).Signed-off-by Thomas Huth <[email protected]>This seems to break some userspace too:
Quoted 15 lines
Quoted 11 lines
INSTALL
usr/include/linux/(413 files)CHECK usr/include/linux/ (413 files) HOSTCC Documentation/accounting/getdelays HOSTCC Documentation/connector/ucon HOSTCC Documentation/mic/mpssd/mpssd.oIn file included from
Documentation/mic/mpssd/mpssd.c:36:0:./usr/include/linux/virtio_ring.h: In function ‘vring_init’:./usr/include/linux/virtio_ring.h:146:24: error: ‘uintptr_t’ undeclared (first use in this function)
vr->used= (void *)(((uintptr_t)&vr->avail->ring[num] +sizeof(__virtio16)Quoted 4 lines
^
./usr/include/linux/virtio_ring.h:146:24: note: each undeclared identifier is reported only once for each function it appears inscripts/Makefile.host:108: recipe for target
D'oh, I only built the kernel for powerpc, that's why I did not notice this breakage in the MIC code. Sorry!
Quoted 10 lines
Quoted 8 lines
E.g.
fuse.hhas this code:
#ifdef__KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endifMaybe we need something similar.
The following seems to help. Does it help the windows build?
...
include/uapi/linux/virtio_ring.h line 38
Quoted 13 lines
include/uapi/linux/virtio_ring.h +3
-0@@ -31,6 +31,9 @@* SUCH DAMAGE. * * Copyright Rusty Russell IBM Corporation 2007. */ +#ifndef __KERNEL__ +#include <stdint.h> +#endif #include <linux/types.h> #include <linux/virtio_types.h>
Since the update-linux-headers.sh script from QEMU replaces the "#include <linux/types.h>" in virtio_ring.h to include a file that again includes stdint.h already, your above patch should not do any difference for compiling QEMU for Windows, I think. It's really just about replacing the typecast there.
But you're right of course for other user space applications which include this header by other means. So I'm fine if you change my patch with your hunk above (or add it as an additional patch). Or shall I rather resend my patch with your above hunk included?
Thomas
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 34 lines · Michael S. Tsirkin
Quoted 6 lines · Thomas Huth
The
virtio_ring.hheader is used in userspace programs (ie. QEMU), too. Here we can not assume that sizeof(pointer) is the same as sizeof(long), e.g. when compiling for Windows, so the typecast invring_init()should be done with (uintptr_t) instead of (unsigned long).Signed-off-by Thomas Huth <[email protected]>This seems to break some userspace too:
INSTALL
usr/include/linux/(413 files)CHECK usr/include/linux/ (413 files) HOSTCC Documentation/accounting/getdelays HOSTCC Documentation/connector/ucon HOSTCC Documentation/mic/mpssd/mpssd.oIn file included from
Documentation/mic/mpssd/mpssd.c:36:0:./usr/include/linux/virtio_ring.h: In function ‘vring_init’:./usr/include/linux/virtio_ring.h:146:24: error: ‘uintptr_t’ undeclared (first use in this function)
vr->used= (void *)(((uintptr_t)&vr->avail->ring[num] +sizeof(__virtio16)^
./usr/include/linux/virtio_ring.h:146:24: note: each undeclared identifier is reported only once for each function it appears inscripts/Makefile.host:108: recipe for target 'Documentation/mic/mpssd/mpssd.o' failed
make[3]: *** [Documentation/mic/mpssd/mpssd.o] Error 1scripts/Makefile.build:403: recipe for target 'Documentation/mic/mpssd' failed
make[2]: *** [Documentation/mic/mpssd] Error 2scripts/Makefile.build:403: recipe for target 'Documentation/mic' failed make[1]: *** [Documentation/mic] Error 2
Quoted 8 lines
E.g.
fuse.hhas this code:
#ifdef__KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endifMaybe we need something similar.
The following seems to help. Does it help the windows build?
--- include/uapi/linux/virtio_ring.h | 3 +++ 1 file changed, 3 insertions(+)
include/uapi/linux/virtio_ring.h +3 -0
@@ -31,6 +31,9 @@* SUCH DAMAGE. * * Copyright Rusty Russell IBM Corporation 2007. */ +#ifndef __KERNEL__ +#include <stdint.h> +#endif #include <linux/types.h> #include <linux/virtio_types.h>
Signature · 5 lines
MST _______________________________________________ Virtualization mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Michael S. Tsirkin
maintainerQuoted 6 lines · Thomas Huth
The
virtio_ring.hheader is used in userspace programs (ie. QEMU), too. Here we can not assume that sizeof(pointer) is the same as sizeof(long), e.g. when compiling for Windows, so the typecast invring_init()should be done with (uintptr_t) instead of (unsigned long).Signed-off-by Thomas Huth <[email protected]>
This seems to break some userspace too:
INSTALL usr/include/linux/ (413 files)
CHECK usr/include/linux/ (413 files) HOSTCC Documentation/accounting/getdelays HOSTCC Documentation/connector/ucon HOSTCC Documentation/mic/mpssd/mpssd.o
In file included from Documentation/mic/mpssd/mpssd.c:36:0:./usr/include/linux/virtio_ring.h: In function ‘vring_init’:./usr/include/linux/virtio_ring.h:146:24: error: ‘uintptr_t’ undeclared (first use in this function)
vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] +sizeof(__virtio16)
^
./usr/include/linux/virtio_ring.h:146:24: note: each undeclared identifier is reported only once for each function it appears in scripts/Makefile.host:108: recipe for target 'Documentation/mic/mpssd/mpssd.o' failed
make[3]: *** [Documentation/mic/mpssd/mpssd.o] Error 1 scripts/Makefile.build:403: recipe for target 'Documentation/mic/mpssd' failed
make[2]: *** [Documentation/mic/mpssd] Error 2 scripts/Makefile.build:403: recipe for target 'Documentation/mic' failed make[1]: *** [Documentation/mic] Error 2
E.g. fuse.h has this code:
#ifdef __KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endif
Maybe we need something similar.
Quoted 19 lines
--- include/uapi/linux/virtio_ring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/uapi/linux/virtio_ring.h +1
-1@@ -143,7 +143,7 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p, vr->num = num; vr->desc = p; vr->avail = p + num*sizeof (struct vring_desc ); - vr->used = (void *)(((unsigned long )&vr->avail->ring[num] +sizeof (__virtio16) + vr->used = (void *)(((uintptr_t )&vr->avail->ring[num] +sizeof (__virtio16) + align-1 ) & ~(align -1 )); }Signature · 1 line
1.8.3.1
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization