[2 0/3] Linux user for 3.1 patches
The following changes since commit 1b7490446bf41f54130c2d495dd4c8768c8e1ce3:
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.1-pull-request' into staging (2018-10-19 11:20:05 +0100)
are available in the Git repository at:
git://github.com/vivier/qemu.git tags/linux-user-for-3.1-pull-request
for you to fetch changes up to a133367ec1b689410f1e7427921e33bb1b569bd7:
linux-user: Implement special usbfs ioctls. (2018-10-19 14:05:10 +0200)
----------------------------------------------------------------
A series to enable ioctl usbfs in linux-user
----------------------------------------------------------------
Cortland Tölva (3):
linux-user: Check for Linux USBFS in configure
linux-user: Define ordinary usbfs ioctls.
linux-user: Implement special usbfs ioctls.
configure | 12 ++- linux-user/ioctls.h | 46 ++++++++++ linux-user/syscall.c | 180 +++++++++++++++++++++++++++++++++++++ linux-user/syscall_defs.h | 28 ++++++ linux-user/syscall_types.h | 68 ++++++++++++++ 5 files changed, 333 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.2
[Qemu-devel] [2 1/3] linux-user: Check for Linux USBFS in configure
From: Cortland Tölva <[email protected]>
In preparation for adding user mode emulation support for the Linux usbfs interface, check for its kernel header.
Message-Id: <[email protected]>
--- configure | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
configure +11 -1
@@ -4202,7 +4202,14 @@ if compile_prog "" "" ; then memfd=yes fi - +# check for usbfs +have_usbfs=no +if test "$linux_user" = "yes"; then + if check_include linux/usbdevice_fs.h; then + have_usbfs=yes + fi + have_usbfs=yes +fi # check for fallocate fallocate=no
@@ -6310,6 +6317,9 @@ fi if test "$memfd" = "yes" ; then echo "CONFIG_MEMFD=y" >> $config_host_mak fi +if test "$have_usbfs" = "yes" ; then + echo "CONFIG_USBFS=y" >> $config_host_mak +fi if test "$fallocate" = "yes" ; then echo "CONFIG_FALLOCATE=y" >> $config_host_mak fi
Signature · 1 line
2.17.2
[Qemu-devel] [2 3/3] linux-user: Implement special usbfs ioctls.
In reply to Laurent VivierFrom: Cortland Tölva <[email protected]>
Userspace submits a USB Request Buffer to the kernel, optionally discards it, and finally reaps the URB. Thunk buffers from target to host and back.
Tested by running an i386 scanner driver on ARMv7 and by running the PowerPC lsusb utility on x86_64. The discardurb ioctl is not exercised in these tests.
Message-Id: <[email protected]>
--- linux-user/ioctls.h | 8 ++ linux-user/syscall.c | 177 +++++++++++++++++++++++++++++++++++++ linux-user/syscall_defs.h | 4 + linux-user/syscall_types.h | 20 +++++ 4 files changed, 209 insertions(+)
linux-user/ioctls.h +8 -0
@@ -143,6 +143,14 @@ IOCTL(USBDEVFS_SETCONFIGURATION, IOC_W, MK_PTR(TYPE_INT))IOCTL (USBDEVFS_GETDRIVER ,IOC_R , MK_PTR(MK_STRUCT(STRUCT_usbdevfs_getdriver))) +IOCTL_SPECIAL (USBDEVFS_SUBMITURB ,IOC_W , do_ioctl_usbdevfs_submiturb, + MK_PTR(MK_STRUCT(STRUCT_usbdevfs_urb))) +IOCTL_SPECIAL (USBDEVFS_DISCARDURB ,IOC_RW , do_ioctl_usbdevfs_discardurb, + MK_PTR(MK_STRUCT(STRUCT_usbdevfs_urb))) +IOCTL_SPECIAL (USBDEVFS_REAPURB ,IOC_R , do_ioctl_usbdevfs_reapurb, + MK_PTR(TYPE_PTRVOID)) +IOCTL_SPECIAL (USBDEVFS_REAPURBNDELAY ,IOC_R , do_ioctl_usbdevfs_reapurb, + MK_PTR(TYPE_PTRVOID))IOCTL (USBDEVFS_DISCSIGNAL ,IOC_W , MK_PTR(MK_STRUCT(STRUCT_usbdevfs_disconnectsignal)))IOCTL (USBDEVFS_CLAIMINTERFACE ,IOC_W ,MK_PTR (TYPE_INT ))
linux-user/syscall.c +177 -0
189 lines not on this page · raw message
linux-user/syscall_defs.h +4 -0
@@ -870,6 +870,10 @@ struct target_pollfd {#define TARGET_USBDEVFS_SETINTERFACE TARGET_IORU('U', 4)#define TARGET_USBDEVFS_SETCONFIGURATION TARGET_IORU('U', 5)#define TARGET_USBDEVFS_GETDRIVER TARGET_IOWU('U', 8) +#define TARGET_USBDEVFS_SUBMITURB TARGET_IORU('U', 10) +#define TARGET_USBDEVFS_DISCARDURB TARGET_IO('U', 11) +#define TARGET_USBDEVFS_REAPURB TARGET_IOWU('U', 12) +#define TARGET_USBDEVFS_REAPURBNDELAY TARGET_IOWU('U', 13)#define TARGET_USBDEVFS_DISCSIGNAL TARGET_IORU('U', 14)#define TARGET_USBDEVFS_CLAIMINTERFACE TARGET_IORU('U', 15)#define TARGET_USBDEVFS_RELEASEINTERFACE TARGET_IORU('U', 16)
linux-user/syscall_types.h +20 -0
@@ -300,6 +300,26 @@ STRUCT(usbdevfs_connectinfo, TYPE_INT, /* devnum */ TYPE_CHAR) /* slow */ +STRUCT (usbdevfs_iso_packet_desc, +TYPE_INT ,/* length */ +TYPE_INT ,/* actual_length */ + TYPE_INT) /* status */ + +STRUCT (usbdevfs_urb, +TYPE_CHAR ,/* type */ +TYPE_CHAR ,/* endpoint */ +TYPE_INT ,/* status */ +TYPE_INT ,/* flags */ +TYPE_PTRVOID ,/* buffer */ +TYPE_INT ,/* buffer_length */ +TYPE_INT ,/* actual_length */ +TYPE_INT ,/* start_frame */ +TYPE_INT ,/* union number_of_packets stream_id */ +TYPE_INT ,/* error_count */ +TYPE_INT ,/* signr */ +TYPE_PTRVOID ,/* usercontext */ + MK_ARRAY(MK_STRUCT(STRUCT_usbdevfs_iso_packet_desc), 0)) /* desc */ + STRUCT(usbdevfs_ioctl, TYPE_INT, /* ifno */ TYPE_INT, /* ioctl_code */
Signature · 1 line
2.17.2
[Qemu-devel] [2 2/3] linux-user: Define ordinary usbfs ioctls.
In reply to Laurent VivierFrom: Cortland Tölva <[email protected]>
Provide ioctl definitions for the generic thunk mechanism to convert most usbfs calls. Calculate arg size at runtime.
Message-Id: <[email protected]>
--- linux-user/ioctls.h | 38 ++++++++++++++++++++++++++++++ linux-user/syscall.c | 3 +++ linux-user/syscall_defs.h | 24 +++++++++++++++++++ linux-user/syscall_types.h | 48 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 113 insertions(+)
linux-user/ioctls.h +38 -0
@@ -131,6 +131,44 @@ IOCTL(FS_IOC_GETFLAGS, IOC_R, MK_PTR(TYPE_INT)) IOCTL(FS_IOC_SETFLAGS, IOC_W, MK_PTR(TYPE_INT)) +#ifdef CONFIG_USBFS +/* USB ioctls */ +IOCTL (USBDEVFS_CONTROL ,IOC_RW , + MK_PTR(MK_STRUCT(STRUCT_usbdevfs_ctrltransfer))) +IOCTL (USBDEVFS_BULK ,IOC_RW , + MK_PTR(MK_STRUCT(STRUCT_usbdevfs_bulktransfer))) + IOCTL(USBDEVFS_RESETEP, IOC_W, MK_PTR(TYPE_INT)) +IOCTL (USBDEVFS_SETINTERFACE ,IOC_W , + MK_PTR(MK_STRUCT(STRUCT_usbdevfs_setinterface))) + IOCTL(USBDEVFS_SETCONFIGURATION, IOC_W, MK_PTR(TYPE_INT)) +IOCTL (USBDEVFS_GETDRIVER ,IOC_R , + MK_PTR(MK_STRUCT(STRUCT_usbdevfs_getdriver))) +IOCTL (USBDEVFS_DISCSIGNAL ,IOC_W , + MK_PTR(MK_STRUCT(STRUCT_usbdevfs_disconnectsignal))) + IOCTL(USBDEVFS_CLAIMINTERFACE, IOC_W, MK_PTR(TYPE_INT)) + IOCTL(USBDEVFS_RELEASEINTERFACE, IOC_W, MK_PTR(TYPE_INT)) +IOCTL (USBDEVFS_CONNECTINFO ,IOC_R , + MK_PTR(MK_STRUCT(STRUCT_usbdevfs_connectinfo))) + IOCTL(USBDEVFS_IOCTL, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_usbdevfs_ioctl))) +IOCTL (USBDEVFS_HUB_PORTINFO ,IOC_R , + MK_PTR(MK_STRUCT(STRUCT_usbdevfs_hub_portinfo))) + IOCTL(USBDEVFS_RESET, 0, TYPE_NULL) + IOCTL(USBDEVFS_CLEAR_HALT, IOC_W, MK_PTR(TYPE_INT)) + IOCTL(USBDEVFS_DISCONNECT, 0, TYPE_NULL) + IOCTL(USBDEVFS_CONNECT, 0, TYPE_NULL) + IOCTL(USBDEVFS_CLAIM_PORT, IOC_W, MK_PTR(TYPE_INT)) + IOCTL(USBDEVFS_RELEASE_PORT, IOC_W, MK_PTR(TYPE_INT)) + IOCTL(USBDEVFS_GET_CAPABILITIES, IOC_R, MK_PTR(TYPE_INT)) +IOCTL (USBDEVFS_DISCONNECT_CLAIM ,IOC_W , + MK_PTR(MK_STRUCT(STRUCT_usbdevfs_disconnect_claim))) +#ifdef USBDEVFS_DROP_PRIVILEGES + IOCTL(USBDEVFS_DROP_PRIVILEGES, IOC_W, MK_PTR(TYPE_INT)) +#endif +#ifdef USBDEVFS_GET_SPEED + IOCTL(USBDEVFS_GET_SPEED, 0, TYPE_NULL) +#endif +#endif /* CONFIG_USBFS */ + IOCTL(SIOCATMARK, IOC_R, MK_PTR(TYPE_INT)) IOCTL(SIOCGIFNAME, IOC_RW, MK_PTR(TYPE_INT))IOCTL (SIOCGIFFLAGS ,IOC_W |IOC_R ,MK_PTR (MK_STRUCT (STRUCT_short_ifreq)))
linux-user/syscall.c +3 -0
@@ -94,6 +94,9 @@#include <linux/fiemap.h> #endif #include <linux/fb.h> +#if defined(CONFIG_USBFS ) +#include <linux/usbdevice_fs.h> +#endif #include <linux/vt.h> #include <linux/dm-ioctl.h> #include <linux/reboot.h>
linux-user/syscall_defs.h +24 -0
@@ -863,6 +863,30 @@ struct target_pollfd {#define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap) +/* usb ioctls */ +#define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0) +#define TARGET_USBDEVFS_BULK TARGET_IOWRU('U', 2) +#define TARGET_USBDEVFS_RESETEP TARGET_IORU('U', 3) +#define TARGET_USBDEVFS_SETINTERFACE TARGET_IORU('U', 4) +#define TARGET_USBDEVFS_SETCONFIGURATION TARGET_IORU('U', 5) +#define TARGET_USBDEVFS_GETDRIVER TARGET_IOWU('U', 8) +#define TARGET_USBDEVFS_DISCSIGNAL TARGET_IORU('U', 14) +#define TARGET_USBDEVFS_CLAIMINTERFACE TARGET_IORU('U', 15) +#define TARGET_USBDEVFS_RELEASEINTERFACE TARGET_IORU('U', 16) +#define TARGET_USBDEVFS_CONNECTINFO TARGET_IOWU('U', 17) +#define TARGET_USBDEVFS_IOCTL TARGET_IOWRU('U', 18) +#define TARGET_USBDEVFS_HUB_PORTINFO TARGET_IORU('U', 19) +#define TARGET_USBDEVFS_RESET TARGET_IO('U', 20) +#define TARGET_USBDEVFS_CLEAR_HALT TARGET_IORU('U', 21) +#define TARGET_USBDEVFS_DISCONNECT TARGET_IO('U', 22) +#define TARGET_USBDEVFS_CONNECT TARGET_IO('U', 23) +#define TARGET_USBDEVFS_CLAIM_PORT TARGET_IORU('U', 24) +#define TARGET_USBDEVFS_RELEASE_PORT TARGET_IORU('U', 25) +#define TARGET_USBDEVFS_GET_CAPABILITIES TARGET_IORU('U', 26) +#define TARGET_USBDEVFS_DISCONNECT_CLAIM TARGET_IORU('U', 27) +#define TARGET_USBDEVFS_DROP_PRIVILEGES TARGET_IOWU('U', 30) +#define TARGET_USBDEVFS_GET_SPEED TARGET_IO('U', 31) +/* cdrom commands */ #define TARGET_CDROMPAUSE 0x5301/* Pause Audio Operation */ #define TARGET_CDROMRESUME 0x5302/* Resume paused Audio Operation */
linux-user/syscall_types.h +48 -0
51 lines not on this page · raw message
Signature · 1 line
2.17.2
Le 19/10/2018 à 14:16, Laurent Vivier a écrit :
Quoted 22 lines
The following changes since commit
1b7490446bf41f54130c2d495dd4c8768c8e1ce3:Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.1-pull-request' into staging (2018-10-19 11:20:05 +0100)
are available in the Git repository at:
git://github.com/vivier/qemu.gittags/linux-user-for-3.1-pull-requestfor you to fetch changes up to
a133367ec1b689410f1e7427921e33bb1b569bd7:linux-user: Implement special usbfs ioctls. (2018-10-19 14:05:10 +0200)
----------------------------------------------------------------
A series to enable ioctl usbfs in linux-user----------------------------------------------------------------
Cortland Tölva (3):
linux-user: Check for Linux USBFS in configure
linux-user: Define ordinary usbfs ioctls.
linux-user: Implement special usbfs ioctls.
Quoted 7 lines
configure | 12 ++- linux-user/ioctls.h | 46 ++++++++++ linux-user/syscall.c | 180 +++++++++++++++++++++++++++++++++++++ linux-user/syscall_defs.h | 28 ++++++ linux-user/syscall_types.h | 68 ++++++++++++++ 5 files changed, 333 insertions(+), 1 deletion(-)
oops, I'm going to resend with the good subject prefix.
Thanks,
Laurent