qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls
@ 2020-01-16 22:49 Aleksandar Markovic
  2020-01-16 22:49 ` [PATCH 01/12] linux-user: Add support for FS_IOC_<GET|SET>VERSION ioctls Aleksandar Markovic
                   ` (11 more replies)
  0 siblings, 12 replies; 22+ messages in thread
From: Aleksandar Markovic @ 2020-01-16 22:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

This series is a spin-off of v5 of earlier series "linux-user: Misc
patches for 5.0", that became too large to manage. I will submit the
rest of that large series separately.

The only difference between patches in this series and in the former
series is that all Laurent's comments and concerns were addressed.

The summary of the patches is as follows:

Patches 1-6: Adding support for some filesystem-related ioctls
Patches 7-9: Adding support for some floppy-drive-related ioctls
Patches 10-12: Adding support for kcov-related ioctls

Aleksandar Markovic (12):
  linux-user: Add support for FS_IOC_<GET|SET>VERSION ioctls
  linux-user: Add support for FS_IOC32_<GET|SET>FLAGS ioctls
  linux-user: Add support for FS_IOC32_<GET|SET>VERSION ioctls
  linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls
  linux-user: Add support for FITRIM ioctl
  linux-user: Add support for FIFREEZE and FITHAW ioctls
  linux-user: Add support for FD<SETEMSGTRESH|SETMAXERRS|GETMAXERRS>
    ioctls
  linux-user: Add support for FDFMT<BEG|TRK|END> ioctls
  linux-user: Add support for FDGETFDCSTAT ioctl
  configure: Detect kcov support and introduce CONFIG_KCOV
  linux-user: Add support for KCOV_<ENABLE|DISABLE> ioctls
  linux-user: Add support for KCOV_INIT_TRACE ioctl

 configure                  |  9 +++++++++
 linux-user/ioctls.h        | 36 +++++++++++++++++++++++++++++++++
 linux-user/syscall.c       |  3 +++
 linux-user/syscall_defs.h  | 50 +++++++++++++++++++++++++++++++++++++++++++---
 linux-user/syscall_types.h | 29 +++++++++++++++++++++++++++
 5 files changed, 124 insertions(+), 3 deletions(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 01/12] linux-user: Add support for FS_IOC_<GET|SET>VERSION ioctls
  2020-01-16 22:49 [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls Aleksandar Markovic
@ 2020-01-16 22:49 ` Aleksandar Markovic
  2020-01-22 14:04   ` Laurent Vivier
  2020-01-16 22:49 ` [PATCH 02/12] linux-user: Add support for FS_IOC32_<GET|SET>FLAGS ioctls Aleksandar Markovic
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 22+ messages in thread
From: Aleksandar Markovic @ 2020-01-16 22:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

A very specific thing for these two ioctls is that their code
implies that their third argument is of type 'long', but the
kernel uses that argument as if it is of type 'int'. This anomaly
is recognized also in commit 6080723 (linux-user: Implement
FS_IOC_GETFLAGS and FS_IOC_SETFLAGS ioctls).

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall_defs.h | 8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index c6b9d6a..c44f42e 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -138,6 +138,8 @@
 
      IOCTL(FS_IOC_GETFLAGS, IOC_R, MK_PTR(TYPE_INT))
      IOCTL(FS_IOC_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
+     IOCTL(FS_IOC_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
+     IOCTL(FS_IOC_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
 
 #ifdef CONFIG_USBFS
   /* USB ioctls */
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 98c2119..f68a8b6 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -911,12 +911,14 @@ struct target_pollfd {
 #define TARGET_FICLONE    TARGET_IOW(0x94, 9, int)
 #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
 
-/* Note that the ioctl numbers claim type "long" but the actual type
- * used by the kernel is "int".
+/*
+ * Note that the ioctl numbers for FS_IOC_<GET|SET><FLAGS|VERSION>
+ * claim type "long" but the actual type used by the kernel is "int".
  */
 #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long)
 #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long)
-
+#define TARGET_FS_IOC_GETVERSION TARGET_IOR('v', 1, abi_long)
+#define TARGET_FS_IOC_SETVERSION TARGET_IOW('v', 2, abi_long)
 #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
 
 /* usb ioctls */
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 02/12] linux-user: Add support for FS_IOC32_<GET|SET>FLAGS ioctls
  2020-01-16 22:49 [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls Aleksandar Markovic
  2020-01-16 22:49 ` [PATCH 01/12] linux-user: Add support for FS_IOC_<GET|SET>VERSION ioctls Aleksandar Markovic
@ 2020-01-16 22:49 ` Aleksandar Markovic
  2020-01-22 14:06   ` Laurent Vivier
  2020-01-16 22:49 ` [PATCH 03/12] linux-user: Add support for FS_IOC32_<GET|SET>VERSION ioctls Aleksandar Markovic
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 22+ messages in thread
From: Aleksandar Markovic @ 2020-01-16 22:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

These FS_IOC32_<GET|SET>FLAGS ioctls are identical to
FS_IOC_<GET|SET>FLAGS ioctls, but without the anomaly of their
number defined as if their third argument is of type long, while
it is treated internally in kernel as is of type int.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall_defs.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index c44f42e..4fd6939 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -140,6 +140,8 @@
      IOCTL(FS_IOC_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
      IOCTL(FS_IOC_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
      IOCTL(FS_IOC_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
+     IOCTL(FS_IOC32_GETFLAGS, IOC_R, MK_PTR(TYPE_INT))
+     IOCTL(FS_IOC32_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
 
 #ifdef CONFIG_USBFS
   /* USB ioctls */
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index f68a8b6..964b2b4 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -920,6 +920,8 @@ struct target_pollfd {
 #define TARGET_FS_IOC_GETVERSION TARGET_IOR('v', 1, abi_long)
 #define TARGET_FS_IOC_SETVERSION TARGET_IOW('v', 2, abi_long)
 #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
+#define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, int)
+#define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, int)
 
 /* usb ioctls */
 #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 03/12] linux-user: Add support for FS_IOC32_<GET|SET>VERSION ioctls
  2020-01-16 22:49 [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls Aleksandar Markovic
  2020-01-16 22:49 ` [PATCH 01/12] linux-user: Add support for FS_IOC_<GET|SET>VERSION ioctls Aleksandar Markovic
  2020-01-16 22:49 ` [PATCH 02/12] linux-user: Add support for FS_IOC32_<GET|SET>FLAGS ioctls Aleksandar Markovic
@ 2020-01-16 22:49 ` Aleksandar Markovic
  2020-01-22 14:07   ` Laurent Vivier
  2020-01-16 22:49 ` [PATCH 04/12] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls Aleksandar Markovic
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 22+ messages in thread
From: Aleksandar Markovic @ 2020-01-16 22:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

These FS_IOC32_<GET|SET>VERSION ioctls are identical to
FS_IOC_<GET|SET>VERSION ioctls, but without the anomaly of their
number defined as if their third argument is of type long, while
it is treated internally in kernel as is of type int.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h       | 2 ++
 linux-user/syscall_defs.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 4fd6939..3affd88 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -142,6 +142,8 @@
      IOCTL(FS_IOC_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
      IOCTL(FS_IOC32_GETFLAGS, IOC_R, MK_PTR(TYPE_INT))
      IOCTL(FS_IOC32_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
+     IOCTL(FS_IOC32_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
+     IOCTL(FS_IOC32_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
 
 #ifdef CONFIG_USBFS
   /* USB ioctls */
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 964b2b4..a73cc3d 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -922,6 +922,8 @@ struct target_pollfd {
 #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
 #define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, int)
 #define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, int)
+#define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, int)
+#define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int)
 
 /* usb ioctls */
 #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 04/12] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls
  2020-01-16 22:49 [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls Aleksandar Markovic
                   ` (2 preceding siblings ...)
  2020-01-16 22:49 ` [PATCH 03/12] linux-user: Add support for FS_IOC32_<GET|SET>VERSION ioctls Aleksandar Markovic
@ 2020-01-16 22:49 ` Aleksandar Markovic
  2020-01-16 22:49 ` [PATCH 05/12] linux-user: Add support for FITRIM ioctl Aleksandar Markovic
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 22+ messages in thread
From: Aleksandar Markovic @ 2020-01-16 22:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Both FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR accept a pointer to
the structure

struct fsxattr {
    __u32         fsx_xflags;     /* xflags field value (get/set) */
    __u32         fsx_extsize;    /* extsize field value (get/set)*/
    __u32         fsx_nextents;   /* nextents field value (get)	*/
    __u32         fsx_projid;     /* project identifier (get/set) */
    __u32         fsx_cowextsize; /* CoW extsize field value (get/set)*/
    unsigned char fsx_pad[8];
};

as their third argument.

These ioctls were relatively recently introduced, so the "#ifdef"
guards are used in this implementation.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h       | 7 +++++++
 linux-user/syscall_defs.h | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 3affd88..e1b89a7 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -144,6 +144,13 @@
      IOCTL(FS_IOC32_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
      IOCTL(FS_IOC32_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
      IOCTL(FS_IOC32_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
+#ifdef FS_IOC_FSGETXATTR
+     IOCTL(FS_IOC_FSGETXATTR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_fsxattr)))
+#endif
+#ifdef FS_IOC_FSSETXATTR
+     IOCTL(FS_IOC_FSSETXATTR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_fsxattr)))
+#endif
+
 
 #ifdef CONFIG_USBFS
   /* USB ioctls */
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index a73cc3d..e1663b6 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -924,6 +924,12 @@ struct target_pollfd {
 #define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, int)
 #define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, int)
 #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int)
+#ifdef FS_IOC_FSGETXATTR
+#define TARGET_FS_IOC_FSGETXATTR TARGET_IOR('X', 31, struct fsxattr)
+#endif
+#ifdef FS_IOC_FSSETXATTR
+#define TARGET_FS_IOC_FSSETXATTR TARGET_IOR('X', 32, struct fsxattr)
+#endif
 
 /* usb ioctls */
 #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 05/12] linux-user: Add support for FITRIM ioctl
  2020-01-16 22:49 [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls Aleksandar Markovic
                   ` (3 preceding siblings ...)
  2020-01-16 22:49 ` [PATCH 04/12] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls Aleksandar Markovic
@ 2020-01-16 22:49 ` Aleksandar Markovic
  2020-01-16 22:49 ` [PATCH 06/12] linux-user: Add support for FIFREEZE and FITHAW ioctls Aleksandar Markovic
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 22+ messages in thread
From: Aleksandar Markovic @ 2020-01-16 22:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

FITRIM ioctl accepts a pointer to the structure

struct fstrim_range {
    __u64 start;
    __u64 len;
    __u64 minlen;
};

as its third argument.

All ioctls in this group (FI* ioctl) are guarded with "#ifdef", so the
guards are used in this implementation too for consistency (however,
many of ioctls in FI* group became old enough that their #ifdef guards
could be removed, bit this is out of the scope of this patch).

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h        | 3 +++
 linux-user/syscall_defs.h  | 1 +
 linux-user/syscall_types.h | 5 +++++
 3 files changed, 9 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index e1b89a7..e4f0a04 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -123,6 +123,9 @@
 #ifdef FIBMAP
      IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
 #endif
+#ifdef FITRIM
+     IOCTL(FITRIM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_fstrim_range)))
+#endif
 #ifdef FICLONE
      IOCTL(FICLONE, IOC_W, TYPE_INT)
      IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index e1663b6..97ab3e1 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -908,6 +908,7 @@ struct target_pollfd {
 #define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
 #define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
 
+#define TARGET_FITRIM     TARGET_IOWR('X', 121, struct fstrim_range)
 #define TARGET_FICLONE    TARGET_IOW(0x94, 9, int)
 #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
 
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index 4e36983..ca9429e 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -226,6 +226,11 @@ STRUCT(dm_target_versions,
 STRUCT(dm_target_msg,
        TYPE_ULONGLONG) /* sector */
 
+STRUCT(fstrim_range,
+       TYPE_LONGLONG, /* start */
+       TYPE_LONGLONG, /* len */
+       TYPE_LONGLONG) /* minlen */
+
 STRUCT(file_clone_range,
        TYPE_LONGLONG, /* src_fd */
        TYPE_ULONGLONG, /* src_offset */
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 06/12] linux-user: Add support for FIFREEZE and FITHAW ioctls
  2020-01-16 22:49 [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls Aleksandar Markovic
                   ` (4 preceding siblings ...)
  2020-01-16 22:49 ` [PATCH 05/12] linux-user: Add support for FITRIM ioctl Aleksandar Markovic
@ 2020-01-16 22:49 ` Aleksandar Markovic
  2020-01-16 22:49 ` [PATCH 07/12] linux-user: Add support for FD<SETEMSGTRESH|SETMAXERRS|GETMAXERRS> ioctls Aleksandar Markovic
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 22+ messages in thread
From: Aleksandar Markovic @ 2020-01-16 22:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Both FIFREEZE and FITHAW ioctls accept an integer as their third
argument.

All ioctls in this group (FI* ioctl) are guarded with "#ifdef", so the
guards are used in this implementation too for consistency (however,
many of ioctls in FI* group became old enough that their #ifdef guards
could be removed, bit this is out of the scope of this patch).

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h       | 6 ++++++
 linux-user/syscall_defs.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index e4f0a04..66f8c4e 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -123,6 +123,12 @@
 #ifdef FIBMAP
      IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
 #endif
+#ifdef FIFREEZE
+     IOCTL(FIFREEZE, IOC_W | IOC_R, TYPE_INT)
+#endif
+#ifdef FITHAW
+     IOCTL(FITHAW, IOC_W | IOC_R, TYPE_INT)
+#endif
 #ifdef FITRIM
      IOCTL(FITRIM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_fstrim_range)))
 #endif
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 97ab3e1..d4d39de 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -908,6 +908,8 @@ struct target_pollfd {
 #define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
 #define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
 
+#define TARGET_FIFREEZE   TARGET_IOWR('X', 119, int)    /* Freeze */
+#define TARGET_FITHAW     TARGET_IOWR('X', 120, int)    /* Thaw */
 #define TARGET_FITRIM     TARGET_IOWR('X', 121, struct fstrim_range)
 #define TARGET_FICLONE    TARGET_IOW(0x94, 9, int)
 #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 07/12] linux-user: Add support for FD<SETEMSGTRESH|SETMAXERRS|GETMAXERRS> ioctls
  2020-01-16 22:49 [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls Aleksandar Markovic
                   ` (5 preceding siblings ...)
  2020-01-16 22:49 ` [PATCH 06/12] linux-user: Add support for FIFREEZE and FITHAW ioctls Aleksandar Markovic
@ 2020-01-16 22:49 ` Aleksandar Markovic
  2020-01-22 14:13   ` Laurent Vivier
  2020-01-16 22:49 ` [PATCH 08/12] linux-user: Add support for FDFMT<BEG|TRK|END> ioctls Aleksandar Markovic
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 22+ messages in thread
From: Aleksandar Markovic @ 2020-01-16 22:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

FDSETEMSGTRESH, FDSETMAXERRS, and FDGETMAXERRS ioctls are commands
for controlling error reporting of a floppy drive.

FDSETEMSGTRESH's third agrument is a pointer to the structure:

struct floppy_max_errors {
    unsigned int
      abort,      /* number of errors to be reached before aborting */
      read_track, /* maximal number of errors permitted to read an
                   * entire track at once */
      reset,      /* maximal number of errors before a reset is tried */
      recal,      /* maximal number of errors before a recalibrate is
                   * tried */
      /*
       * Threshold for reporting FDC errors to the console.
       * Setting this to zero may flood your screen when using
       * ultra cheap floppies ;-)
       */
      reporting;
};

defined in Linux kernel header <linux/fd.h>.

Since all fields of the structure are of type 'unsigned int', there is
no need to define "target_floppy_max_errors".

FDSETMAXERRS and FDGETMAXERRS ioctls do not use the third argument.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h        | 3 +++
 linux-user/syscall_defs.h  | 3 +++
 linux-user/syscall_types.h | 7 +++++++
 3 files changed, 13 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 66f8c4e..9e3ca90 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -114,7 +114,10 @@
 
      IOCTL(FDMSGON, 0, TYPE_NULL)
      IOCTL(FDMSGOFF, 0, TYPE_NULL)
+     IOCTL(FDSETEMSGTRESH, 0, TYPE_NULL)
      IOCTL(FDFLUSH, 0, TYPE_NULL)
+     IOCTL(FDSETMAXERRS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
+     IOCTL(FDGETMAXERRS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
      IOCTL(FDRESET, 0, TYPE_NULL)
      IOCTL(FDRAWCMD, 0, TYPE_NULL)
      IOCTL(FDTWADDLE, 0, TYPE_NULL)
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index d4d39de..e317115 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -899,7 +899,10 @@ struct target_pollfd {
 
 #define TARGET_FDMSGON        TARGET_IO(2, 0x45)
 #define TARGET_FDMSGOFF       TARGET_IO(2, 0x46)
+#define TARGET_FDSETEMSGTRESH TARGET_IO(2, 0x4a)
 #define TARGET_FDFLUSH        TARGET_IO(2, 0x4b)
+#define TARGET_FDSETMAXERRS  TARGET_IOW(2, 0x4c, struct floppy_max_errors)
+#define TARGET_FDGETMAXERRS  TARGET_IOR(2, 0x0e, struct floppy_max_errors)
 #define TARGET_FDRESET        TARGET_IO(2, 0x54)
 #define TARGET_FDRAWCMD       TARGET_IO(2, 0x58)
 #define TARGET_FDTWADDLE      TARGET_IO(2, 0x59)
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index ca9429e..434ce1c 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -266,6 +266,13 @@ STRUCT(blkpg_ioctl_arg,
        TYPE_INT, /* datalen */
        TYPE_PTRVOID) /* data */
 
+STRUCT(floppy_max_errors,
+       TYPE_INT, /* abort */
+       TYPE_INT, /* read_track */
+       TYPE_INT, /* reset */
+       TYPE_INT, /* recal */
+       TYPE_INT) /* reporting */
+
 #if defined(CONFIG_USBFS)
 /* usb device ioctls */
 STRUCT(usbdevfs_ctrltransfer,
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 08/12] linux-user: Add support for FDFMT<BEG|TRK|END> ioctls
  2020-01-16 22:49 [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls Aleksandar Markovic
                   ` (6 preceding siblings ...)
  2020-01-16 22:49 ` [PATCH 07/12] linux-user: Add support for FD<SETEMSGTRESH|SETMAXERRS|GETMAXERRS> ioctls Aleksandar Markovic
@ 2020-01-16 22:49 ` Aleksandar Markovic
  2020-01-22 14:13   ` Laurent Vivier
  2020-01-16 22:49 ` [PATCH 09/12] linux-user: Add support for FDGETFDCSTAT ioctl Aleksandar Markovic
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 22+ messages in thread
From: Aleksandar Markovic @ 2020-01-16 22:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

FDFMTBEG, FDFMTTRK, and FDFMTEND ioctls provide means for controlling
formatting of a floppy drive.

FDFMTTRK's third agrument is a pointer to the structure:

struct format_descr {
    unsigned int device,head,track;
};

defined in Linux kernel header <linux/fd.h>.

Since all fields of the structure are of type 'unsigned int', there is
no need to define "target_format_descr".

FDFMTBEG and FDFMTEND ioctls do not use the third argument.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h        | 3 +++
 linux-user/syscall_defs.h  | 3 +++
 linux-user/syscall_types.h | 5 +++++
 3 files changed, 11 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 9e3ca90..e754a6b 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -115,6 +115,9 @@
      IOCTL(FDMSGON, 0, TYPE_NULL)
      IOCTL(FDMSGOFF, 0, TYPE_NULL)
      IOCTL(FDSETEMSGTRESH, 0, TYPE_NULL)
+     IOCTL(FDFMTBEG, 0, TYPE_NULL)
+     IOCTL(FDFMTTRK, IOC_W, MK_PTR(MK_STRUCT(STRUCT_format_descr)))
+     IOCTL(FDFMTEND, 0, TYPE_NULL)
      IOCTL(FDFLUSH, 0, TYPE_NULL)
      IOCTL(FDSETMAXERRS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
      IOCTL(FDGETMAXERRS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index e317115..9fbf04a 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -899,6 +899,9 @@ struct target_pollfd {
 
 #define TARGET_FDMSGON        TARGET_IO(2, 0x45)
 #define TARGET_FDMSGOFF       TARGET_IO(2, 0x46)
+#define TARGET_FDFMTBEG       TARGET_IO(2, 0x47)
+#define TARGET_FDFMTTRK      TARGET_IOW(2, 0x48, struct format_descr)
+#define TARGET_FDFMTEND       TARGET_IO(2, 0x49)
 #define TARGET_FDSETEMSGTRESH TARGET_IO(2, 0x4a)
 #define TARGET_FDFLUSH        TARGET_IO(2, 0x4b)
 #define TARGET_FDSETMAXERRS  TARGET_IOW(2, 0x4c, struct floppy_max_errors)
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index 434ce1c..ff60240 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -266,6 +266,11 @@ STRUCT(blkpg_ioctl_arg,
        TYPE_INT, /* datalen */
        TYPE_PTRVOID) /* data */
 
+STRUCT(format_descr,
+       TYPE_INT,     /* device */
+       TYPE_INT,     /* head */
+       TYPE_INT)     /* track */
+
 STRUCT(floppy_max_errors,
        TYPE_INT, /* abort */
        TYPE_INT, /* read_track */
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 09/12] linux-user: Add support for FDGETFDCSTAT ioctl
  2020-01-16 22:49 [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls Aleksandar Markovic
                   ` (7 preceding siblings ...)
  2020-01-16 22:49 ` [PATCH 08/12] linux-user: Add support for FDFMT<BEG|TRK|END> ioctls Aleksandar Markovic
@ 2020-01-16 22:49 ` Aleksandar Markovic
  2020-01-16 22:49 ` [PATCH 10/12] configure: Detect kcov support and introduce CONFIG_KCOV Aleksandar Markovic
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 22+ messages in thread
From: Aleksandar Markovic @ 2020-01-16 22:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

FDGETFDCSTAT's third agrument is a pointer to the structure:

struct floppy_fdc_state {
    int spec1;
    int spec2;
    int dtr;
    unsigned char version;
    unsigned char dor;
    unsigned long address;
    unsigned int rawcmd:2;
    unsigned int reset:1;
    unsigned int need_configure:1;
    unsigned int perp_mode:2;
    unsigned int has_fifo:1;
    unsigned int driver_version;
    unsigned char track[4];
};

defined in Linux kernel header <linux/fd.h>.

Since there is a fields of the structure of type 'unsigned long', there is
a need to define "target_format_descr". Also, five fields rawcmd, reset,
need_configure, perp_mode, and has_fifo are all just bitfields and are
part od a single 'unsigned int' field.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h        |  2 ++
 linux-user/syscall_defs.h  | 18 ++++++++++++++++++
 linux-user/syscall_types.h | 12 ++++++++++++
 3 files changed, 32 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index e754a6b..d72cd76 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -122,6 +122,8 @@
      IOCTL(FDSETMAXERRS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
      IOCTL(FDGETMAXERRS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
      IOCTL(FDRESET, 0, TYPE_NULL)
+     IOCTL(FDGETFDCSTAT, IOC_R,
+           MK_PTR(MK_STRUCT(STRUCT_target_floppy_fdc_state)))
      IOCTL(FDRAWCMD, 0, TYPE_NULL)
      IOCTL(FDTWADDLE, 0, TYPE_NULL)
      IOCTL(FDEJECT, 0, TYPE_NULL)
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 9fbf04a..46dc565 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -897,6 +897,23 @@ struct target_pollfd {
 
 /* From <linux/fd.h> */
 
+struct target_floppy_fdc_state {
+    int spec1;                      /* spec1 value last used */
+    int spec2;                      /* spec2 value last used */
+    int dtr;
+    unsigned char version;          /* FDC version code */
+    unsigned char dor;
+    abi_ulong address;              /* io address */
+    unsigned int rawcmd:2;
+    unsigned int reset:1;
+    unsigned int need_configure:1;
+    unsigned int perp_mode:2;
+    unsigned int has_fifo:1;
+    unsigned int driver_version;    /* version code for floppy driver */
+    unsigned char track[4];
+};
+
+
 #define TARGET_FDMSGON        TARGET_IO(2, 0x45)
 #define TARGET_FDMSGOFF       TARGET_IO(2, 0x46)
 #define TARGET_FDFMTBEG       TARGET_IO(2, 0x47)
@@ -907,6 +924,7 @@ struct target_pollfd {
 #define TARGET_FDSETMAXERRS  TARGET_IOW(2, 0x4c, struct floppy_max_errors)
 #define TARGET_FDGETMAXERRS  TARGET_IOR(2, 0x0e, struct floppy_max_errors)
 #define TARGET_FDRESET        TARGET_IO(2, 0x54)
+#define TARGET_FDGETFDCSTAT  TARGET_IOR(2, 0x15, struct target_floppy_fdc_state)
 #define TARGET_FDRAWCMD       TARGET_IO(2, 0x58)
 #define TARGET_FDTWADDLE      TARGET_IO(2, 0x59)
 #define TARGET_FDEJECT        TARGET_IO(2, 0x5a)
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index ff60240..2b480d0 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -278,6 +278,18 @@ STRUCT(floppy_max_errors,
        TYPE_INT, /* recal */
        TYPE_INT) /* reporting */
 
+STRUCT(target_floppy_fdc_state,
+       TYPE_INT, /* spec1 */
+       TYPE_INT, /* spec2 */
+       TYPE_INT, /* dtr */
+       TYPE_CHAR, /* version */
+       TYPE_CHAR, /* dor */
+       TYPE_ULONG, /* address */
+       TYPE_INT, /* bit field for rawcmd:2, reset:1, need_configure:1, */
+                 /* perp_mode:2, and has_fifo:1 */
+       TYPE_INT, /* driver_version */
+       MK_ARRAY(TYPE_CHAR, 4)) /* track */
+
 #if defined(CONFIG_USBFS)
 /* usb device ioctls */
 STRUCT(usbdevfs_ctrltransfer,
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 10/12] configure: Detect kcov support and introduce CONFIG_KCOV
  2020-01-16 22:49 [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls Aleksandar Markovic
                   ` (8 preceding siblings ...)
  2020-01-16 22:49 ` [PATCH 09/12] linux-user: Add support for FDGETFDCSTAT ioctl Aleksandar Markovic
@ 2020-01-16 22:49 ` Aleksandar Markovic
  2020-01-22 14:10   ` Laurent Vivier
  2020-01-22 14:16   ` Laurent Vivier
  2020-01-16 22:49 ` [PATCH 11/12] linux-user: Add support for KCOV_<ENABLE|DISABLE> ioctls Aleksandar Markovic
  2020-01-16 22:49 ` [PATCH 12/12] linux-user: Add support for KCOV_INIT_TRACE ioctl Aleksandar Markovic
  11 siblings, 2 replies; 22+ messages in thread
From: Aleksandar Markovic @ 2020-01-16 22:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

kcov is kernel code coverage tracing tool. It requires kernel 4.4+
compiled with certain kernel options.

This patch checks if kcov header "sys/kcov.h" is present on build
machine, and stores the result in variable CONFIG_KCOV, meant to
be used in linux-user code related to the support for three ioctls
that were introduced at the same time as the mentioned header
(their definition was a part of the first version of that header).

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 configure | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/configure b/configure
index 940bf9e..57e6eba 100755
--- a/configure
+++ b/configure
@@ -4752,6 +4752,12 @@ if compile_prog "" "" ; then
   syncfs=yes
 fi
 
+# check for kcov support (kernel must be 4.4+, compiled with certain options)
+kcov=no
+if check_include sys/kcov.h ; then
+    kcov=yes
+fi
+
 # Check we have a new enough version of sphinx-build
 has_sphinx_build() {
     # This is a bit awkward but works: create a trivial document and
@@ -6874,6 +6880,9 @@ fi
 if test "$syncfs" = "yes" ; then
   echo "CONFIG_SYNCFS=y" >> $config_host_mak
 fi
+if test "$kcov" = "yes" ; then
+  echo "CONFIG_KCOV=y" >> $config_host_mak
+fi
 if test "$inotify" = "yes" ; then
   echo "CONFIG_INOTIFY=y" >> $config_host_mak
 fi
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 11/12] linux-user: Add support for KCOV_<ENABLE|DISABLE> ioctls
  2020-01-16 22:49 [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls Aleksandar Markovic
                   ` (9 preceding siblings ...)
  2020-01-16 22:49 ` [PATCH 10/12] configure: Detect kcov support and introduce CONFIG_KCOV Aleksandar Markovic
@ 2020-01-16 22:49 ` Aleksandar Markovic
  2020-01-22 14:16   ` Laurent Vivier
  2020-01-16 22:49 ` [PATCH 12/12] linux-user: Add support for KCOV_INIT_TRACE ioctl Aleksandar Markovic
  11 siblings, 1 reply; 22+ messages in thread
From: Aleksandar Markovic @ 2020-01-16 22:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

KCOV_ENABLE and KCOV_DISABLE play the role in kernel coverage
tracing. These ioctls do not use the third argument of ioctl()
system call and are straightforward to implement in QEMU.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h       | 5 +++++
 linux-user/syscall.c      | 3 +++
 linux-user/syscall_defs.h | 4 ++++
 3 files changed, 12 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index d72cd76..39b3825 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -552,3 +552,8 @@
   IOCTL_IGNORE(TIOCSTART)
   IOCTL_IGNORE(TIOCSTOP)
 #endif
+
+#ifdef CONFIG_KCOV
+  IOCTL(KCOV_ENABLE, 0, TYPE_NULL)
+  IOCTL(KCOV_DISABLE, 0, TYPE_NULL)
+#endif
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 171c0ca..6edcb0d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -73,6 +73,9 @@
 #ifdef CONFIG_SENDFILE
 #include <sys/sendfile.h>
 #endif
+#ifdef CONFIG_KCOV
+#include <sys/kcov.h>
+#endif
 
 #define termios host_termios
 #define winsize host_winsize
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 46dc565..c8999ef 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2461,6 +2461,10 @@ struct target_mtpos {
 #define TARGET_MTIOCGET        TARGET_IOR('m', 2, struct target_mtget)
 #define TARGET_MTIOCPOS        TARGET_IOR('m', 3, struct target_mtpos)
 
+/* kcov ioctls */
+#define TARGET_KCOV_ENABLE     TARGET_IO('c', 100)
+#define TARGET_KCOV_DISABLE    TARGET_IO('c', 101)
+
 struct target_sysinfo {
     abi_long uptime;                /* Seconds since boot */
     abi_ulong loads[3];             /* 1, 5, and 15 minute load averages */
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 12/12] linux-user: Add support for KCOV_INIT_TRACE ioctl
  2020-01-16 22:49 [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls Aleksandar Markovic
                   ` (10 preceding siblings ...)
  2020-01-16 22:49 ` [PATCH 11/12] linux-user: Add support for KCOV_<ENABLE|DISABLE> ioctls Aleksandar Markovic
@ 2020-01-16 22:49 ` Aleksandar Markovic
  2020-01-22 14:16   ` Laurent Vivier
  11 siblings, 1 reply; 22+ messages in thread
From: Aleksandar Markovic @ 2020-01-16 22:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

KCOV_INIT_TRACE ioctl plays the role in kernel coverage tracing.
This ioctl's third argument is of type 'unsigned long', and the
implementation in QEMU is straightforward.

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h       | 1 +
 linux-user/syscall_defs.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 39b3825..1da71dd 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -556,4 +556,5 @@
 #ifdef CONFIG_KCOV
   IOCTL(KCOV_ENABLE, 0, TYPE_NULL)
   IOCTL(KCOV_DISABLE, 0, TYPE_NULL)
+  IOCTL(KCOV_INIT_TRACE, IOC_R, TYPE_ULONG)
 #endif
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index c8999ef..bf71b3a 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2464,6 +2464,7 @@ struct target_mtpos {
 /* kcov ioctls */
 #define TARGET_KCOV_ENABLE     TARGET_IO('c', 100)
 #define TARGET_KCOV_DISABLE    TARGET_IO('c', 101)
+#define TARGET_KCOV_INIT_TRACE TARGET_IOR('c', 1, abi_ulong)
 
 struct target_sysinfo {
     abi_long uptime;                /* Seconds since boot */
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 01/12] linux-user: Add support for FS_IOC_<GET|SET>VERSION ioctls
  2020-01-16 22:49 ` [PATCH 01/12] linux-user: Add support for FS_IOC_<GET|SET>VERSION ioctls Aleksandar Markovic
@ 2020-01-22 14:04   ` Laurent Vivier
  0 siblings, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2020-01-22 14:04 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 16/01/2020 à 23:49, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> A very specific thing for these two ioctls is that their code
> implies that their third argument is of type 'long', but the
> kernel uses that argument as if it is of type 'int'. This anomaly
> is recognized also in commit 6080723 (linux-user: Implement
> FS_IOC_GETFLAGS and FS_IOC_SETFLAGS ioctls).
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h       | 2 ++
>  linux-user/syscall_defs.h | 8 +++++---
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index c6b9d6a..c44f42e 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -138,6 +138,8 @@
>  
>       IOCTL(FS_IOC_GETFLAGS, IOC_R, MK_PTR(TYPE_INT))
>       IOCTL(FS_IOC_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
> +     IOCTL(FS_IOC_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
> +     IOCTL(FS_IOC_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
>  
>  #ifdef CONFIG_USBFS
>    /* USB ioctls */
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 98c2119..f68a8b6 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -911,12 +911,14 @@ struct target_pollfd {
>  #define TARGET_FICLONE    TARGET_IOW(0x94, 9, int)
>  #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
>  
> -/* Note that the ioctl numbers claim type "long" but the actual type
> - * used by the kernel is "int".
> +/*
> + * Note that the ioctl numbers for FS_IOC_<GET|SET><FLAGS|VERSION>
> + * claim type "long" but the actual type used by the kernel is "int".
>   */
>  #define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, abi_long)
>  #define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, abi_long)
> -
> +#define TARGET_FS_IOC_GETVERSION TARGET_IOR('v', 1, abi_long)
> +#define TARGET_FS_IOC_SETVERSION TARGET_IOW('v', 2, abi_long)
>  #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
>  
>  /* usb ioctls */
> 

Applied to my linux-user branch.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 02/12] linux-user: Add support for FS_IOC32_<GET|SET>FLAGS ioctls
  2020-01-16 22:49 ` [PATCH 02/12] linux-user: Add support for FS_IOC32_<GET|SET>FLAGS ioctls Aleksandar Markovic
@ 2020-01-22 14:06   ` Laurent Vivier
  0 siblings, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2020-01-22 14:06 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 16/01/2020 à 23:49, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> These FS_IOC32_<GET|SET>FLAGS ioctls are identical to
> FS_IOC_<GET|SET>FLAGS ioctls, but without the anomaly of their
> number defined as if their third argument is of type long, while
> it is treated internally in kernel as is of type int.
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h       | 2 ++
>  linux-user/syscall_defs.h | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index c44f42e..4fd6939 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -140,6 +140,8 @@
>       IOCTL(FS_IOC_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
>       IOCTL(FS_IOC_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
>       IOCTL(FS_IOC_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
> +     IOCTL(FS_IOC32_GETFLAGS, IOC_R, MK_PTR(TYPE_INT))
> +     IOCTL(FS_IOC32_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
>  
>  #ifdef CONFIG_USBFS
>    /* USB ioctls */
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index f68a8b6..964b2b4 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -920,6 +920,8 @@ struct target_pollfd {
>  #define TARGET_FS_IOC_GETVERSION TARGET_IOR('v', 1, abi_long)
>  #define TARGET_FS_IOC_SETVERSION TARGET_IOW('v', 2, abi_long)
>  #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
> +#define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, int)
> +#define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, int)
>  
>  /* usb ioctls */
>  #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
> 

Applied to my linux-user branch.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 03/12] linux-user: Add support for FS_IOC32_<GET|SET>VERSION ioctls
  2020-01-16 22:49 ` [PATCH 03/12] linux-user: Add support for FS_IOC32_<GET|SET>VERSION ioctls Aleksandar Markovic
@ 2020-01-22 14:07   ` Laurent Vivier
  0 siblings, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2020-01-22 14:07 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 16/01/2020 à 23:49, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> These FS_IOC32_<GET|SET>VERSION ioctls are identical to
> FS_IOC_<GET|SET>VERSION ioctls, but without the anomaly of their
> number defined as if their third argument is of type long, while
> it is treated internally in kernel as is of type int.
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h       | 2 ++
>  linux-user/syscall_defs.h | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index 4fd6939..3affd88 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -142,6 +142,8 @@
>       IOCTL(FS_IOC_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
>       IOCTL(FS_IOC32_GETFLAGS, IOC_R, MK_PTR(TYPE_INT))
>       IOCTL(FS_IOC32_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
> +     IOCTL(FS_IOC32_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
> +     IOCTL(FS_IOC32_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
>  
>  #ifdef CONFIG_USBFS
>    /* USB ioctls */
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 964b2b4..a73cc3d 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -922,6 +922,8 @@ struct target_pollfd {
>  #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
>  #define TARGET_FS_IOC32_GETFLAGS TARGET_IOR('f', 1, int)
>  #define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, int)
> +#define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, int)
> +#define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int)
>  
>  /* usb ioctls */
>  #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
> 

Applied to my linux-user branch.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 10/12] configure: Detect kcov support and introduce CONFIG_KCOV
  2020-01-16 22:49 ` [PATCH 10/12] configure: Detect kcov support and introduce CONFIG_KCOV Aleksandar Markovic
@ 2020-01-22 14:10   ` Laurent Vivier
  2020-01-22 14:16   ` Laurent Vivier
  1 sibling, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2020-01-22 14:10 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 16/01/2020 à 23:49, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> kcov is kernel code coverage tracing tool. It requires kernel 4.4+
> compiled with certain kernel options.
> 
> This patch checks if kcov header "sys/kcov.h" is present on build
> machine, and stores the result in variable CONFIG_KCOV, meant to
> be used in linux-user code related to the support for three ioctls
> that were introduced at the same time as the mentioned header
> (their definition was a part of the first version of that header).
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  configure | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/configure b/configure
> index 940bf9e..57e6eba 100755
> --- a/configure
> +++ b/configure
> @@ -4752,6 +4752,12 @@ if compile_prog "" "" ; then
>    syncfs=yes
>  fi
>  
> +# check for kcov support (kernel must be 4.4+, compiled with certain options)
> +kcov=no
> +if check_include sys/kcov.h ; then
> +    kcov=yes
> +fi
> +
>  # Check we have a new enough version of sphinx-build
>  has_sphinx_build() {
>      # This is a bit awkward but works: create a trivial document and
> @@ -6874,6 +6880,9 @@ fi
>  if test "$syncfs" = "yes" ; then
>    echo "CONFIG_SYNCFS=y" >> $config_host_mak
>  fi
> +if test "$kcov" = "yes" ; then
> +  echo "CONFIG_KCOV=y" >> $config_host_mak
> +fi
>  if test "$inotify" = "yes" ; then
>    echo "CONFIG_INOTIFY=y" >> $config_host_mak
>  fi
>

Reviewed-by: Laurent Vivier <laurent@vivier.eu>



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 07/12] linux-user: Add support for FD<SETEMSGTRESH|SETMAXERRS|GETMAXERRS> ioctls
  2020-01-16 22:49 ` [PATCH 07/12] linux-user: Add support for FD<SETEMSGTRESH|SETMAXERRS|GETMAXERRS> ioctls Aleksandar Markovic
@ 2020-01-22 14:13   ` Laurent Vivier
  0 siblings, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2020-01-22 14:13 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 16/01/2020 à 23:49, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> FDSETEMSGTRESH, FDSETMAXERRS, and FDGETMAXERRS ioctls are commands
> for controlling error reporting of a floppy drive.
> 
> FDSETEMSGTRESH's third agrument is a pointer to the structure:
> 
> struct floppy_max_errors {
>     unsigned int
>       abort,      /* number of errors to be reached before aborting */
>       read_track, /* maximal number of errors permitted to read an
>                    * entire track at once */
>       reset,      /* maximal number of errors before a reset is tried */
>       recal,      /* maximal number of errors before a recalibrate is
>                    * tried */
>       /*
>        * Threshold for reporting FDC errors to the console.
>        * Setting this to zero may flood your screen when using
>        * ultra cheap floppies ;-)
>        */
>       reporting;
> };
> 
> defined in Linux kernel header <linux/fd.h>.
> 
> Since all fields of the structure are of type 'unsigned int', there is
> no need to define "target_floppy_max_errors".
> 
> FDSETMAXERRS and FDGETMAXERRS ioctls do not use the third argument.
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h        | 3 +++
>  linux-user/syscall_defs.h  | 3 +++
>  linux-user/syscall_types.h | 7 +++++++
>  3 files changed, 13 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index 66f8c4e..9e3ca90 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -114,7 +114,10 @@
>  
>       IOCTL(FDMSGON, 0, TYPE_NULL)
>       IOCTL(FDMSGOFF, 0, TYPE_NULL)
> +     IOCTL(FDSETEMSGTRESH, 0, TYPE_NULL)
>       IOCTL(FDFLUSH, 0, TYPE_NULL)
> +     IOCTL(FDSETMAXERRS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
> +     IOCTL(FDGETMAXERRS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
>       IOCTL(FDRESET, 0, TYPE_NULL)
>       IOCTL(FDRAWCMD, 0, TYPE_NULL)
>       IOCTL(FDTWADDLE, 0, TYPE_NULL)
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index d4d39de..e317115 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -899,7 +899,10 @@ struct target_pollfd {
>  
>  #define TARGET_FDMSGON        TARGET_IO(2, 0x45)
>  #define TARGET_FDMSGOFF       TARGET_IO(2, 0x46)
> +#define TARGET_FDSETEMSGTRESH TARGET_IO(2, 0x4a)
>  #define TARGET_FDFLUSH        TARGET_IO(2, 0x4b)
> +#define TARGET_FDSETMAXERRS  TARGET_IOW(2, 0x4c, struct floppy_max_errors)
> +#define TARGET_FDGETMAXERRS  TARGET_IOR(2, 0x0e, struct floppy_max_errors)
>  #define TARGET_FDRESET        TARGET_IO(2, 0x54)
>  #define TARGET_FDRAWCMD       TARGET_IO(2, 0x58)
>  #define TARGET_FDTWADDLE      TARGET_IO(2, 0x59)
> diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
> index ca9429e..434ce1c 100644
> --- a/linux-user/syscall_types.h
> +++ b/linux-user/syscall_types.h
> @@ -266,6 +266,13 @@ STRUCT(blkpg_ioctl_arg,
>         TYPE_INT, /* datalen */
>         TYPE_PTRVOID) /* data */
>  
> +STRUCT(floppy_max_errors,
> +       TYPE_INT, /* abort */
> +       TYPE_INT, /* read_track */
> +       TYPE_INT, /* reset */
> +       TYPE_INT, /* recal */
> +       TYPE_INT) /* reporting */
> +
>  #if defined(CONFIG_USBFS)
>  /* usb device ioctls */
>  STRUCT(usbdevfs_ctrltransfer,
> 

Applied to my linux-user branch.

Thanks,
Laurent



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 08/12] linux-user: Add support for FDFMT<BEG|TRK|END> ioctls
  2020-01-16 22:49 ` [PATCH 08/12] linux-user: Add support for FDFMT<BEG|TRK|END> ioctls Aleksandar Markovic
@ 2020-01-22 14:13   ` Laurent Vivier
  0 siblings, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2020-01-22 14:13 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 16/01/2020 à 23:49, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> FDFMTBEG, FDFMTTRK, and FDFMTEND ioctls provide means for controlling
> formatting of a floppy drive.
> 
> FDFMTTRK's third agrument is a pointer to the structure:
> 
> struct format_descr {
>     unsigned int device,head,track;
> };
> 
> defined in Linux kernel header <linux/fd.h>.
> 
> Since all fields of the structure are of type 'unsigned int', there is
> no need to define "target_format_descr".
> 
> FDFMTBEG and FDFMTEND ioctls do not use the third argument.
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h        | 3 +++
>  linux-user/syscall_defs.h  | 3 +++
>  linux-user/syscall_types.h | 5 +++++
>  3 files changed, 11 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index 9e3ca90..e754a6b 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -115,6 +115,9 @@
>       IOCTL(FDMSGON, 0, TYPE_NULL)
>       IOCTL(FDMSGOFF, 0, TYPE_NULL)
>       IOCTL(FDSETEMSGTRESH, 0, TYPE_NULL)
> +     IOCTL(FDFMTBEG, 0, TYPE_NULL)
> +     IOCTL(FDFMTTRK, IOC_W, MK_PTR(MK_STRUCT(STRUCT_format_descr)))
> +     IOCTL(FDFMTEND, 0, TYPE_NULL)
>       IOCTL(FDFLUSH, 0, TYPE_NULL)
>       IOCTL(FDSETMAXERRS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
>       IOCTL(FDGETMAXERRS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index e317115..9fbf04a 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -899,6 +899,9 @@ struct target_pollfd {
>  
>  #define TARGET_FDMSGON        TARGET_IO(2, 0x45)
>  #define TARGET_FDMSGOFF       TARGET_IO(2, 0x46)
> +#define TARGET_FDFMTBEG       TARGET_IO(2, 0x47)
> +#define TARGET_FDFMTTRK      TARGET_IOW(2, 0x48, struct format_descr)
> +#define TARGET_FDFMTEND       TARGET_IO(2, 0x49)
>  #define TARGET_FDSETEMSGTRESH TARGET_IO(2, 0x4a)
>  #define TARGET_FDFLUSH        TARGET_IO(2, 0x4b)
>  #define TARGET_FDSETMAXERRS  TARGET_IOW(2, 0x4c, struct floppy_max_errors)
> diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
> index 434ce1c..ff60240 100644
> --- a/linux-user/syscall_types.h
> +++ b/linux-user/syscall_types.h
> @@ -266,6 +266,11 @@ STRUCT(blkpg_ioctl_arg,
>         TYPE_INT, /* datalen */
>         TYPE_PTRVOID) /* data */
>  
> +STRUCT(format_descr,
> +       TYPE_INT,     /* device */
> +       TYPE_INT,     /* head */
> +       TYPE_INT)     /* track */
> +
>  STRUCT(floppy_max_errors,
>         TYPE_INT, /* abort */
>         TYPE_INT, /* read_track */
> 

Applied to my linux-user branch.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 10/12] configure: Detect kcov support and introduce CONFIG_KCOV
  2020-01-16 22:49 ` [PATCH 10/12] configure: Detect kcov support and introduce CONFIG_KCOV Aleksandar Markovic
  2020-01-22 14:10   ` Laurent Vivier
@ 2020-01-22 14:16   ` Laurent Vivier
  1 sibling, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2020-01-22 14:16 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 16/01/2020 à 23:49, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> kcov is kernel code coverage tracing tool. It requires kernel 4.4+
> compiled with certain kernel options.
> 
> This patch checks if kcov header "sys/kcov.h" is present on build
> machine, and stores the result in variable CONFIG_KCOV, meant to
> be used in linux-user code related to the support for three ioctls
> that were introduced at the same time as the mentioned header
> (their definition was a part of the first version of that header).
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  configure | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/configure b/configure
> index 940bf9e..57e6eba 100755
> --- a/configure
> +++ b/configure
> @@ -4752,6 +4752,12 @@ if compile_prog "" "" ; then
>    syncfs=yes
>  fi
>  
> +# check for kcov support (kernel must be 4.4+, compiled with certain options)
> +kcov=no
> +if check_include sys/kcov.h ; then
> +    kcov=yes
> +fi
> +
>  # Check we have a new enough version of sphinx-build
>  has_sphinx_build() {
>      # This is a bit awkward but works: create a trivial document and
> @@ -6874,6 +6880,9 @@ fi
>  if test "$syncfs" = "yes" ; then
>    echo "CONFIG_SYNCFS=y" >> $config_host_mak
>  fi
> +if test "$kcov" = "yes" ; then
> +  echo "CONFIG_KCOV=y" >> $config_host_mak
> +fi
>  if test "$inotify" = "yes" ; then
>    echo "CONFIG_INOTIFY=y" >> $config_host_mak
>  fi
> 

Applied to my linux-user branch.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 11/12] linux-user: Add support for KCOV_<ENABLE|DISABLE> ioctls
  2020-01-16 22:49 ` [PATCH 11/12] linux-user: Add support for KCOV_<ENABLE|DISABLE> ioctls Aleksandar Markovic
@ 2020-01-22 14:16   ` Laurent Vivier
  0 siblings, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2020-01-22 14:16 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 16/01/2020 à 23:49, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> KCOV_ENABLE and KCOV_DISABLE play the role in kernel coverage
> tracing. These ioctls do not use the third argument of ioctl()
> system call and are straightforward to implement in QEMU.
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h       | 5 +++++
>  linux-user/syscall.c      | 3 +++
>  linux-user/syscall_defs.h | 4 ++++
>  3 files changed, 12 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index d72cd76..39b3825 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -552,3 +552,8 @@
>    IOCTL_IGNORE(TIOCSTART)
>    IOCTL_IGNORE(TIOCSTOP)
>  #endif
> +
> +#ifdef CONFIG_KCOV
> +  IOCTL(KCOV_ENABLE, 0, TYPE_NULL)
> +  IOCTL(KCOV_DISABLE, 0, TYPE_NULL)
> +#endif
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 171c0ca..6edcb0d 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -73,6 +73,9 @@
>  #ifdef CONFIG_SENDFILE
>  #include <sys/sendfile.h>
>  #endif
> +#ifdef CONFIG_KCOV
> +#include <sys/kcov.h>
> +#endif
>  
>  #define termios host_termios
>  #define winsize host_winsize
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 46dc565..c8999ef 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2461,6 +2461,10 @@ struct target_mtpos {
>  #define TARGET_MTIOCGET        TARGET_IOR('m', 2, struct target_mtget)
>  #define TARGET_MTIOCPOS        TARGET_IOR('m', 3, struct target_mtpos)
>  
> +/* kcov ioctls */
> +#define TARGET_KCOV_ENABLE     TARGET_IO('c', 100)
> +#define TARGET_KCOV_DISABLE    TARGET_IO('c', 101)
> +
>  struct target_sysinfo {
>      abi_long uptime;                /* Seconds since boot */
>      abi_ulong loads[3];             /* 1, 5, and 15 minute load averages */
> 

Applied to my linux-user branch.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 12/12] linux-user: Add support for KCOV_INIT_TRACE ioctl
  2020-01-16 22:49 ` [PATCH 12/12] linux-user: Add support for KCOV_INIT_TRACE ioctl Aleksandar Markovic
@ 2020-01-22 14:16   ` Laurent Vivier
  0 siblings, 0 replies; 22+ messages in thread
From: Laurent Vivier @ 2020-01-22 14:16 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 16/01/2020 à 23:49, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> KCOV_INIT_TRACE ioctl plays the role in kernel coverage tracing.
> This ioctl's third argument is of type 'unsigned long', and the
> implementation in QEMU is straightforward.
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h       | 1 +
>  linux-user/syscall_defs.h | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index 39b3825..1da71dd 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -556,4 +556,5 @@
>  #ifdef CONFIG_KCOV
>    IOCTL(KCOV_ENABLE, 0, TYPE_NULL)
>    IOCTL(KCOV_DISABLE, 0, TYPE_NULL)
> +  IOCTL(KCOV_INIT_TRACE, IOC_R, TYPE_ULONG)
>  #endif
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index c8999ef..bf71b3a 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2464,6 +2464,7 @@ struct target_mtpos {
>  /* kcov ioctls */
>  #define TARGET_KCOV_ENABLE     TARGET_IO('c', 100)
>  #define TARGET_KCOV_DISABLE    TARGET_IO('c', 101)
> +#define TARGET_KCOV_INIT_TRACE TARGET_IOR('c', 1, abi_ulong)
>  
>  struct target_sysinfo {
>      abi_long uptime;                /* Seconds since boot */
> 

Applied to my linux-user branch.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2020-01-22 14:22 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-16 22:49 [PATCH 00/12] linux-user: Add support for fs, fd,and kcov ioctls Aleksandar Markovic
2020-01-16 22:49 ` [PATCH 01/12] linux-user: Add support for FS_IOC_<GET|SET>VERSION ioctls Aleksandar Markovic
2020-01-22 14:04   ` Laurent Vivier
2020-01-16 22:49 ` [PATCH 02/12] linux-user: Add support for FS_IOC32_<GET|SET>FLAGS ioctls Aleksandar Markovic
2020-01-22 14:06   ` Laurent Vivier
2020-01-16 22:49 ` [PATCH 03/12] linux-user: Add support for FS_IOC32_<GET|SET>VERSION ioctls Aleksandar Markovic
2020-01-22 14:07   ` Laurent Vivier
2020-01-16 22:49 ` [PATCH 04/12] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls Aleksandar Markovic
2020-01-16 22:49 ` [PATCH 05/12] linux-user: Add support for FITRIM ioctl Aleksandar Markovic
2020-01-16 22:49 ` [PATCH 06/12] linux-user: Add support for FIFREEZE and FITHAW ioctls Aleksandar Markovic
2020-01-16 22:49 ` [PATCH 07/12] linux-user: Add support for FD<SETEMSGTRESH|SETMAXERRS|GETMAXERRS> ioctls Aleksandar Markovic
2020-01-22 14:13   ` Laurent Vivier
2020-01-16 22:49 ` [PATCH 08/12] linux-user: Add support for FDFMT<BEG|TRK|END> ioctls Aleksandar Markovic
2020-01-22 14:13   ` Laurent Vivier
2020-01-16 22:49 ` [PATCH 09/12] linux-user: Add support for FDGETFDCSTAT ioctl Aleksandar Markovic
2020-01-16 22:49 ` [PATCH 10/12] configure: Detect kcov support and introduce CONFIG_KCOV Aleksandar Markovic
2020-01-22 14:10   ` Laurent Vivier
2020-01-22 14:16   ` Laurent Vivier
2020-01-16 22:49 ` [PATCH 11/12] linux-user: Add support for KCOV_<ENABLE|DISABLE> ioctls Aleksandar Markovic
2020-01-22 14:16   ` Laurent Vivier
2020-01-16 22:49 ` [PATCH 12/12] linux-user: Add support for KCOV_INIT_TRACE ioctl Aleksandar Markovic
2020-01-22 14:16   ` Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).