All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 00/20] linux-user: Misc patches for 5.0
@ 2020-01-13 20:34 Aleksandar Markovic
  2020-01-13 20:34 ` [PATCH v5 01/20] linux-user: Fix some constants in termbits.h Aleksandar Markovic
                   ` (19 more replies)
  0 siblings, 20 replies; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

This series is a collection of linux-user patches I recently
accumulated.

The summary of the patches is as follows:

Patch 1: Fix for some issues in termbits.h files.
Patches 2-7: Updating syscall numbers
Patch 8: A minor xtensa cleanup
Patches 9-14: Adding support for some filesystem-related ioctls
Patches 15-17: Adding support for some floppy-drive-related ioctls
Patches 18-20: Adding support for kcov-related ioctls

History of the series:

v4->v5:

  - fixed some minor issues in commit messages
  - added syscall number update for alpha

v3->v4:

  - added support for three filesystem-related ioctls
  - added syscall number update for m68k, microblaze, x86_64 and xtensa
  - fixed some issues related to unused ranges of syscall numbers for
    mips o32
  - several minor corrections

v2->v3:

  - added support for seven floppy-drive-related ioctls
  - added support for three kcov-related ioctls

v1->v2:

  - fixed a constant in xtensa's termbits.h that was missed in v1
  - redid syscall numbers for mips o32
  - minor formatting and wording changes

Aleksandar Markovic (20):
  linux-user: Fix some constants in termbits.h
  linux-user: alpha: Update syscall numbers to kernel 5.5 rc3 level
  linux-user: m68k: Update syscall numbers to kernel 5.5 rc3 level
  linux-user: microblaze: Update syscall numbers to kernel 5.5 rc3 level
  linux-user: mips: Update syscall numbers to kernel 5.5 rc3 level
  linux-user: x86_64: Update syscall numbers to kernel 5.5 rc3 level
  linux-user: xtensa: Update syscall numbers to kernel 5.5 rc3 level
  linux-user: xtensa: Remove unused constant TARGET_NR_syscall_count
  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                          |  21 +++++
 linux-user/aarch64/termbits.h      |   4 +-
 linux-user/alpha/syscall_nr.h      |  35 +++++++++
 linux-user/alpha/termbits.h        |  10 +--
 linux-user/arm/termbits.h          |   4 +-
 linux-user/cris/termbits.h         |   4 +-
 linux-user/hppa/termbits.h         |   4 +-
 linux-user/i386/termbits.h         |   4 +-
 linux-user/ioctls.h                |  36 +++++++++
 linux-user/m68k/syscall_nr.h       |  50 +++++++++++-
 linux-user/m68k/termbits.h         |   4 +-
 linux-user/microblaze/syscall_nr.h |  45 +++++++++++
 linux-user/microblaze/termbits.h   |   4 +-
 linux-user/mips/cpu_loop.c         |  78 ++++++++++++++++++-
 linux-user/mips/syscall_nr.h       |  45 +++++++++++
 linux-user/mips/termbits.h         |   4 +-
 linux-user/mips64/syscall_nr.h     |  13 ++++
 linux-user/nios2/termbits.h        |   4 +-
 linux-user/openrisc/termbits.h     |   6 +-
 linux-user/ppc/termbits.h          |   4 +-
 linux-user/riscv/termbits.h        |   4 +-
 linux-user/s390x/termbits.h        |  26 ++++---
 linux-user/sh4/termbits.h          |   4 +-
 linux-user/sparc/termbits.h        |   4 +-
 linux-user/sparc64/termbits.h      |   4 +-
 linux-user/syscall.c               |   3 +
 linux-user/syscall_defs.h          |  46 ++++++++++-
 linux-user/syscall_types.h         |  24 ++++++
 linux-user/x86_64/syscall_nr.h     |  24 ++++++
 linux-user/x86_64/termbits.h       |   6 +-
 linux-user/xtensa/syscall_nr.h     |  36 ++++++++-
 linux-user/xtensa/termbits.h       | 156 +++++++++++++++++++++----------------
 32 files changed, 590 insertions(+), 126 deletions(-)

-- 
2.7.4



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

* [PATCH v5 01/20] linux-user: Fix some constants in termbits.h
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:16   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 02/20] linux-user: alpha: Update syscall numbers to kernel 5.5 rc3 level Aleksandar Markovic
                   ` (18 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Some constants were defined in terms of host, instead of target,
as they should be.

Some additional trivial changes in this patch were forced by
checkpatch.pl.

Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/aarch64/termbits.h    |   4 +-
 linux-user/alpha/termbits.h      |  10 +--
 linux-user/arm/termbits.h        |   4 +-
 linux-user/cris/termbits.h       |   4 +-
 linux-user/hppa/termbits.h       |   4 +-
 linux-user/i386/termbits.h       |   4 +-
 linux-user/m68k/termbits.h       |   4 +-
 linux-user/microblaze/termbits.h |   4 +-
 linux-user/mips/termbits.h       |   4 +-
 linux-user/nios2/termbits.h      |   4 +-
 linux-user/openrisc/termbits.h   |   6 +-
 linux-user/ppc/termbits.h        |   4 +-
 linux-user/riscv/termbits.h      |   4 +-
 linux-user/s390x/termbits.h      |  26 ++++---
 linux-user/sh4/termbits.h        |   4 +-
 linux-user/sparc/termbits.h      |   4 +-
 linux-user/sparc64/termbits.h    |   4 +-
 linux-user/x86_64/termbits.h     |   6 +-
 linux-user/xtensa/termbits.h     | 156 ++++++++++++++++++++++-----------------
 19 files changed, 141 insertions(+), 119 deletions(-)

diff --git a/linux-user/aarch64/termbits.h b/linux-user/aarch64/termbits.h
index 0ab448d..998fc1d 100644
--- a/linux-user/aarch64/termbits.h
+++ b/linux-user/aarch64/termbits.h
@@ -83,8 +83,8 @@ struct target_termios {
 #define  TARGET_B9600  0000015
 #define  TARGET_B19200 0000016
 #define  TARGET_B38400 0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA    TARGET_B19200
+#define TARGET_EXTB    TARGET_B38400
 #define TARGET_CSIZE   0000060
 #define   TARGET_CS5   0000000
 #define   TARGET_CS6   0000020
diff --git a/linux-user/alpha/termbits.h b/linux-user/alpha/termbits.h
index a714251..ace19be 100644
--- a/linux-user/alpha/termbits.h
+++ b/linux-user/alpha/termbits.h
@@ -108,8 +108,8 @@ struct target_termios {
 #define  TARGET_B9600	0000015
 #define  TARGET_B19200	0000016
 #define  TARGET_B38400	0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA     TARGET_B19200
+#define TARGET_EXTB     TARGET_B38400
 #define TARGET_CBAUDEX 0000000
 #define  TARGET_B57600   00020
 #define  TARGET_B115200  00021
@@ -165,7 +165,7 @@ struct target_termios {
 #define TARGET_FIOASYNC	TARGET_IOW('f', 125, int)
 #define TARGET_FIONBIO		TARGET_IOW('f', 126, int)
 #define TARGET_FIONREAD	TARGET_IOR('f', 127, int)
-#define TARGET_TIOCINQ		FIONREAD
+#define TARGET_TIOCINQ  TARGET_FIONREAD
 #define TARGET_FIOQSIZE	TARGET_IOR('f', 128, loff_t)
 
 #define TARGET_TIOCGETP	TARGET_IOR('t', 8, struct target_sgttyb)
@@ -217,8 +217,8 @@ struct target_termios {
 # define TARGET_TIOCM_CAR	0x040
 # define TARGET_TIOCM_RNG	0x080
 # define TARGET_TIOCM_DSR	0x100
-# define TARGET_TIOCM_CD	TIOCM_CAR
-# define TARGET_TIOCM_RI	TIOCM_RNG
+# define TARGET_TIOCM_CD        TARGET_TIOCM_CAR
+# define TARGET_TIOCM_RI        TARGET_TIOCM_RNG
 # define TARGET_TIOCM_OUT1	0x2000
 # define TARGET_TIOCM_OUT2	0x4000
 # define TARGET_TIOCM_LOOP	0x8000
diff --git a/linux-user/arm/termbits.h b/linux-user/arm/termbits.h
index e555cff..7170b8a 100644
--- a/linux-user/arm/termbits.h
+++ b/linux-user/arm/termbits.h
@@ -83,8 +83,8 @@ struct target_termios {
 #define  TARGET_B9600  0000015
 #define  TARGET_B19200 0000016
 #define  TARGET_B38400 0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA    TARGET_B19200
+#define TARGET_EXTB    TARGET_B38400
 #define TARGET_CSIZE   0000060
 #define   TARGET_CS5   0000000
 #define   TARGET_CS6   0000020
diff --git a/linux-user/cris/termbits.h b/linux-user/cris/termbits.h
index 475ee70..76d5ed0 100644
--- a/linux-user/cris/termbits.h
+++ b/linux-user/cris/termbits.h
@@ -81,8 +81,8 @@ struct target_termios {
 #define  TARGET_B9600  0000015
 #define  TARGET_B19200 0000016
 #define  TARGET_B38400 0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA    TARGET_B19200
+#define TARGET_EXTB    TARGET_B38400
 #define TARGET_CSIZE   0000060
 #define   TARGET_CS5   0000000
 #define   TARGET_CS6   0000020
diff --git a/linux-user/hppa/termbits.h b/linux-user/hppa/termbits.h
index 8fba839..3094710 100644
--- a/linux-user/hppa/termbits.h
+++ b/linux-user/hppa/termbits.h
@@ -82,8 +82,8 @@ struct target_termios {
 #define  TARGET_B9600  0000015
 #define  TARGET_B19200 0000016
 #define  TARGET_B38400 0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA    TARGET_B19200
+#define TARGET_EXTB    TARGET_B38400
 #define TARGET_CSIZE   0000060
 #define   TARGET_CS5   0000000
 #define   TARGET_CS6   0000020
diff --git a/linux-user/i386/termbits.h b/linux-user/i386/termbits.h
index 88264bb..3b16977 100644
--- a/linux-user/i386/termbits.h
+++ b/linux-user/i386/termbits.h
@@ -82,8 +82,8 @@ struct target_termios {
 #define  TARGET_B9600  0000015
 #define  TARGET_B19200 0000016
 #define  TARGET_B38400 0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA    TARGET_B19200
+#define TARGET_EXTB    TARGET_B38400
 #define TARGET_CSIZE   0000060
 #define   TARGET_CS5   0000000
 #define   TARGET_CS6   0000020
diff --git a/linux-user/m68k/termbits.h b/linux-user/m68k/termbits.h
index 23840aa..f3ae025 100644
--- a/linux-user/m68k/termbits.h
+++ b/linux-user/m68k/termbits.h
@@ -83,8 +83,8 @@ struct target_termios {
 #define  TARGET_B9600  0000015
 #define  TARGET_B19200 0000016
 #define  TARGET_B38400 0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA    TARGET_B19200
+#define TARGET_EXTB    TARGET_B38400
 #define TARGET_CSIZE   0000060
 #define   TARGET_CS5   0000000
 #define   TARGET_CS6   0000020
diff --git a/linux-user/microblaze/termbits.h b/linux-user/microblaze/termbits.h
index 17db8a4..7697736 100644
--- a/linux-user/microblaze/termbits.h
+++ b/linux-user/microblaze/termbits.h
@@ -81,8 +81,8 @@ struct target_termios {
 #define  TARGET_B9600  0000015
 #define  TARGET_B19200 0000016
 #define  TARGET_B38400 0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA    TARGET_B19200
+#define TARGET_EXTB    TARGET_B38400
 #define TARGET_CSIZE   0000060
 #define   TARGET_CS5   0000000
 #define   TARGET_CS6   0000020
diff --git a/linux-user/mips/termbits.h b/linux-user/mips/termbits.h
index 3287cf6..3419a49 100644
--- a/linux-user/mips/termbits.h
+++ b/linux-user/mips/termbits.h
@@ -82,8 +82,8 @@ struct target_termios {
 #define  TARGET_B9600  0000015
 #define  TARGET_B19200 0000016
 #define  TARGET_B38400 0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA    TARGET_B19200
+#define TARGET_EXTB    TARGET_B38400
 #define TARGET_CSIZE   0000060
 #define   TARGET_CS5   0000000
 #define   TARGET_CS6   0000020
diff --git a/linux-user/nios2/termbits.h b/linux-user/nios2/termbits.h
index 425a2fe..269ab59 100644
--- a/linux-user/nios2/termbits.h
+++ b/linux-user/nios2/termbits.h
@@ -83,8 +83,8 @@ struct target_termios {
 #define  TARGET_B9600  0000015
 #define  TARGET_B19200 0000016
 #define  TARGET_B38400 0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA    TARGET_B19200
+#define TARGET_EXTB    TARGET_B38400
 #define TARGET_CSIZE   0000060
 #define   TARGET_CS5   0000000
 #define   TARGET_CS6   0000020
diff --git a/linux-user/openrisc/termbits.h b/linux-user/openrisc/termbits.h
index 7a635ff..220742e 100644
--- a/linux-user/openrisc/termbits.h
+++ b/linux-user/openrisc/termbits.h
@@ -124,8 +124,8 @@ struct target_termios3 {
 #define TARGET_B9600    0000015
 #define TARGET_B19200   0000016
 #define TARGET_B38400   0000017
-#define TARGET_EXTA     B19200
-#define TARGET_EXTB     B38400
+#define TARGET_EXTA     TARGET_B19200
+#define TARGET_EXTB     TARGET_B38400
 #define TARGET_CSIZE    0000060
 #define TARGET_CS5      0000000
 #define TARGET_CS6      0000020
@@ -222,7 +222,7 @@ struct target_termios3 {
 #define TARGET_TIOCGSOFTCAR    0x5419
 #define TARGET_TIOCSSOFTCAR    0x541A
 #define TARGET_FIONREAD        0x541B
-#define TARGET_TIOCINQ         FIONREAD
+#define TARGET_TIOCINQ         TARGET_FIONREAD
 #define TARGET_TIOCLINUX       0x541C
 #define TARGET_TIOCCONS        0x541D
 #define TARGET_TIOCGSERIAL     0x541E
diff --git a/linux-user/ppc/termbits.h b/linux-user/ppc/termbits.h
index 19e4c6e..66bb76c 100644
--- a/linux-user/ppc/termbits.h
+++ b/linux-user/ppc/termbits.h
@@ -107,8 +107,8 @@ struct target_termios {
 #define  TARGET_B9600	0000015
 #define  TARGET_B19200	0000016
 #define  TARGET_B38400	0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA     TARGET_B19200
+#define TARGET_EXTB     TARGET_B38400
 #define TARGET_CBAUDEX 0000000
 #define  TARGET_B57600   00020
 #define  TARGET_B115200  00021
diff --git a/linux-user/riscv/termbits.h b/linux-user/riscv/termbits.h
index 5e0af0d..778de0c 100644
--- a/linux-user/riscv/termbits.h
+++ b/linux-user/riscv/termbits.h
@@ -83,8 +83,8 @@ struct target_termios {
 #define  TARGET_B9600  0000015
 #define  TARGET_B19200 0000016
 #define  TARGET_B38400 0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA    TARGET_B19200
+#define TARGET_EXTB    TARGET_B38400
 #define TARGET_CSIZE   0000060
 #define   TARGET_CS5   0000000
 #define   TARGET_CS6   0000020
diff --git a/linux-user/s390x/termbits.h b/linux-user/s390x/termbits.h
index 9affa8f..79a71c2 100644
--- a/linux-user/s390x/termbits.h
+++ b/linux-user/s390x/termbits.h
@@ -128,8 +128,8 @@ struct target_ktermios {
 #define TARGET_B9600	0000015
 #define TARGET_B19200	0000016
 #define TARGET_B38400	0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA     TARGET_B19200
+#define TARGET_EXTB     TARGET_B38400
 #define TARGET_CSIZE	0000060
 #define TARGET_CS5	0000000
 #define TARGET_CS6	0000020
@@ -234,7 +234,7 @@ struct target_ktermios {
 #define TARGET_TIOCGSOFTCAR	0x5419
 #define TARGET_TIOCSSOFTCAR	0x541A
 #define TARGET_FIONREAD	0x541B
-#define TARGET_TIOCINQ		FIONREAD
+#define TARGET_TIOCINQ      TARGET_FIONREAD
 #define TARGET_TIOCLINUX	0x541C
 #define TARGET_TIOCCONS	0x541D
 #define TARGET_TIOCGSERIAL	0x541E
@@ -248,14 +248,18 @@ struct target_ktermios {
 #define TARGET_TIOCSBRK	0x5427  /* BSD compatibility */
 #define TARGET_TIOCCBRK	0x5428  /* BSD compatibility */
 #define TARGET_TIOCGSID	0x5429  /* Return the session ID of FD */
-#define TARGET_TCGETS2		_IOR('T',0x2A, struct termios2)
-#define TARGET_TCSETS2		_IOW('T',0x2B, struct termios2)
-#define TARGET_TCSETSW2	_IOW('T',0x2C, struct termios2)
-#define TARGET_TCSETSF2	_IOW('T',0x2D, struct termios2)
-#define TARGET_TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TARGET_TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
-#define TARGET_TIOCGDEV	_IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
-#define TARGET_TIOCGPTPEER      TARGET_IO('T', 0x41) /* Safely open the slave */
+#define TARGET_TCGETS2          TARGET_IOR('T', 0x2A, struct termios2)
+#define TARGET_TCSETS2          TARGET_IOW('T', 0x2B, struct termios2)
+#define TARGET_TCSETSW2         TARGET_IOW('T', 0x2C, struct termios2)
+#define TARGET_TCSETSF2         TARGET_IOW('T', 0x2D, struct termios2)
+/* Get Pty Number (of pty-mux device) */
+#define TARGET_TIOCGPTN         TARGET_IOR('T', 0x30, unsigned int)
+/* Lock/unlock Pty */
+#define TARGET_TIOCSPTLCK       TARGET_IOW('T', 0x31, int)
+/* Get real dev no below /dev/console */
+#define TARGET_TIOCGDEV         TARGET_IOR('T', 0x32, unsigned int)
+/* Safely open the slave */
+#define TARGET_TIOCGPTPEER      TARGET_IO('T', 0x41)
 
 #define TARGET_FIONCLEX	0x5450  /* these numbers need to be adjusted. */
 #define TARGET_FIOCLEX		0x5451
diff --git a/linux-user/sh4/termbits.h b/linux-user/sh4/termbits.h
index dd125b6..89a124d 100644
--- a/linux-user/sh4/termbits.h
+++ b/linux-user/sh4/termbits.h
@@ -101,8 +101,8 @@ struct target_termios {
 #define TARGET_B9600	0000015
 #define TARGET_B19200	0000016
 #define TARGET_B38400	0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA     TARGET_B19200
+#define TARGET_EXTB     TARGET_B38400
 #define TARGET_CSIZE	0000060
 #define TARGET_CS5	0000000
 #define TARGET_CS6	0000020
diff --git a/linux-user/sparc/termbits.h b/linux-user/sparc/termbits.h
index f85219e..e38e53e 100644
--- a/linux-user/sparc/termbits.h
+++ b/linux-user/sparc/termbits.h
@@ -109,8 +109,8 @@ struct target_termios {
 #define  TARGET_B9600	  0x0000000d
 #define  TARGET_B19200	  0x0000000e
 #define  TARGET_B38400	  0x0000000f
-#define TARGET_EXTA      B19200
-#define TARGET_EXTB      B38400
+#define TARGET_EXTA      TARGET_B19200
+#define TARGET_EXTB      TARGET_B38400
 #define  TARGET_CSIZE    0x00000030
 #define   TARGET_CS5	  0x00000000
 #define   TARGET_CS6	  0x00000010
diff --git a/linux-user/sparc64/termbits.h b/linux-user/sparc64/termbits.h
index 11b5abc..c86f714 100644
--- a/linux-user/sparc64/termbits.h
+++ b/linux-user/sparc64/termbits.h
@@ -109,8 +109,8 @@ struct target_termios {
 #define  TARGET_B9600	  0x0000000d
 #define  TARGET_B19200	  0x0000000e
 #define  TARGET_B38400	  0x0000000f
-#define TARGET_EXTA      B19200
-#define TARGET_EXTB      B38400
+#define TARGET_EXTA       TARGET_B19200
+#define TARGET_EXTB       TARGET_B38400
 #define  TARGET_CSIZE    0x00000030
 #define   TARGET_CS5	  0x00000000
 #define   TARGET_CS6	  0x00000010
diff --git a/linux-user/x86_64/termbits.h b/linux-user/x86_64/termbits.h
index c8bb599..efd35ae 100644
--- a/linux-user/x86_64/termbits.h
+++ b/linux-user/x86_64/termbits.h
@@ -102,8 +102,8 @@ struct target_termios {
 #define  TARGET_B9600	0000015
 #define  TARGET_B19200	0000016
 #define  TARGET_B38400	0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA     TARGET_B19200
+#define TARGET_EXTB     TARGET_B38400
 #define TARGET_CSIZE	0000060
 #define   TARGET_CS5	0000000
 #define   TARGET_CS6	0000020
@@ -198,7 +198,7 @@ struct target_termios {
 #define TARGET_TIOCGSOFTCAR	0x5419
 #define TARGET_TIOCSSOFTCAR	0x541A
 #define TARGET_FIONREAD	0x541B
-#define TARGET_TIOCINQ		FIONREAD
+#define TARGET_TIOCINQ          TARGET_FIONREAD
 #define TARGET_TIOCLINUX	0x541C
 #define TARGET_TIOCCONS	0x541D
 #define TARGET_TIOCGSERIAL	0x541E
diff --git a/linux-user/xtensa/termbits.h b/linux-user/xtensa/termbits.h
index d1e09e6..d92fe9c 100644
--- a/linux-user/xtensa/termbits.h
+++ b/linux-user/xtensa/termbits.h
@@ -142,8 +142,8 @@ struct target_ktermios {
 #define  TARGET_B9600   0000015
 #define  TARGET_B19200  0000016
 #define  TARGET_B38400  0000017
-#define TARGET_EXTA B19200
-#define TARGET_EXTB B38400
+#define TARGET_EXTA     TARGET_B19200
+#define TARGET_EXTB     TARGET_B38400
 #define TARGET_CSIZE    0000060
 #define   TARGET_CS5    0000000
 #define   TARGET_CS6    0000020
@@ -217,13 +217,13 @@ struct target_ktermios {
 
 /* from arch/xtensa/include/uapi/asm/ioctls.h */
 
-#define TARGET_FIOCLEX     _IO('f', 1)
-#define TARGET_FIONCLEX    _IO('f', 2)
-#define TARGET_FIOASYNC    _IOW('f', 125, int)
-#define TARGET_FIONBIO     _IOW('f', 126, int)
-#define TARGET_FIONREAD    _IOR('f', 127, int)
-#define TARGET_TIOCINQ     FIONREAD
-#define TARGET_FIOQSIZE    _IOR('f', 128, loff_t)
+#define TARGET_FIOCLEX     TARGET_IO('f', 1)
+#define TARGET_FIONCLEX    TARGET_IO('f', 2)
+#define TARGET_FIOASYNC    TARGET_IOW('f', 125, int)
+#define TARGET_FIONBIO     TARGET_IOW('f', 126, int)
+#define TARGET_FIONREAD    TARGET_IOR('f', 127, int)
+#define TARGET_TIOCINQ     TARGET_FIONREAD
+#define TARGET_FIOQSIZE    TARGET_IOR('f', 128, loff_t)
 
 #define TARGET_TCGETS      0x5401
 #define TARGET_TCSETS      0x5402
@@ -235,28 +235,28 @@ struct target_ktermios {
 #define TARGET_TCSETAW     0x40127419  /* _IOW('t', 25, struct termio) */
 #define TARGET_TCSETAF     0x4012741C  /* _IOW('t', 28, struct termio) */
 
-#define TARGET_TCSBRK      _IO('t', 29)
-#define TARGET_TCXONC      _IO('t', 30)
-#define TARGET_TCFLSH      _IO('t', 31)
+#define TARGET_TCSBRK      TARGET_IO('t', 29)
+#define TARGET_TCXONC      TARGET_IO('t', 30)
+#define TARGET_TCFLSH      TARGET_IO('t', 31)
 
 #define TARGET_TIOCSWINSZ  0x40087467  /* _IOW('t', 103, struct winsize) */
 #define TARGET_TIOCGWINSZ  0x80087468  /* _IOR('t', 104, struct winsize) */
-#define TARGET_TIOCSTART   _IO('t', 110)       /* start output, like ^Q */
-#define TARGET_TIOCSTOP    _IO('t', 111)       /* stop output, like ^S */
-#define TARGET_TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */
-
-#define TARGET_TIOCSPGRP   _IOW('t', 118, int)
-#define TARGET_TIOCGPGRP   _IOR('t', 119, int)
-
-#define TARGET_TIOCEXCL    _IO('T', 12)
-#define TARGET_TIOCNXCL    _IO('T', 13)
-#define TARGET_TIOCSCTTY   _IO('T', 14)
-
-#define TARGET_TIOCSTI     _IOW('T', 18, char)
-#define TARGET_TIOCMGET    _IOR('T', 21, unsigned int)
-#define TARGET_TIOCMBIS    _IOW('T', 22, unsigned int)
-#define TARGET_TIOCMBIC    _IOW('T', 23, unsigned int)
-#define TARGET_TIOCMSET    _IOW('T', 24, unsigned int)
+#define TARGET_TIOCSTART   TARGET_IO('t', 110)       /* start output, like ^Q */
+#define TARGET_TIOCSTOP    TARGET_IO('t', 111)       /* stop output, like ^S */
+#define TARGET_TIOCOUTQ    TARGET_IOR('t', 115, int) /* output queue size */
+
+#define TARGET_TIOCSPGRP   TARGET_IOW('t', 118, int)
+#define TARGET_TIOCGPGRP   TARGET_IOR('t', 119, int)
+
+#define TARGET_TIOCEXCL    TARGET_IO('T', 12)
+#define TARGET_TIOCNXCL    TARGET_IO('T', 13)
+#define TARGET_TIOCSCTTY   TARGET_IO('T', 14)
+
+#define TARGET_TIOCSTI     TARGET_IOW('T', 18, char)
+#define TARGET_TIOCMGET    TARGET_IOR('T', 21, unsigned int)
+#define TARGET_TIOCMBIS    TARGET_IOW('T', 22, unsigned int)
+#define TARGET_TIOCMBIC    TARGET_IOW('T', 23, unsigned int)
+#define TARGET_TIOCMSET    TARGET_IOW('T', 24, unsigned int)
 # define TARGET_TIOCM_LE   0x001
 # define TARGET_TIOCM_DTR  0x002
 # define TARGET_TIOCM_RTS  0x004
@@ -266,16 +266,16 @@ struct target_ktermios {
 # define TARGET_TIOCM_CAR  0x040
 # define TARGET_TIOCM_RNG  0x080
 # define TARGET_TIOCM_DSR  0x100
-# define TARGET_TIOCM_CD   TIOCM_CAR
-# define TARGET_TIOCM_RI   TIOCM_RNG
+# define TARGET_TIOCM_CD   TARGET_TIOCM_CAR
+# define TARGET_TIOCM_RI   TARGET_TIOCM_RNG
 
-#define TARGET_TIOCGSOFTCAR    _IOR('T', 25, unsigned int)
-#define TARGET_TIOCSSOFTCAR    _IOW('T', 26, unsigned int)
-#define TARGET_TIOCLINUX   _IOW('T', 28, char)
-#define TARGET_TIOCCONS    _IO('T', 29)
+#define TARGET_TIOCGSOFTCAR    TARGET_IOR('T', 25, unsigned int)
+#define TARGET_TIOCSSOFTCAR    TARGET_IOW('T', 26, unsigned int)
+#define TARGET_TIOCLINUX   TARGET_IOW('T', 28, char)
+#define TARGET_TIOCCONS    TARGET_IO('T', 29)
 #define TARGET_TIOCGSERIAL 0x803C541E  /*_IOR('T', 30, struct serial_struct)*/
 #define TARGET_TIOCSSERIAL 0x403C541F  /*_IOW('T', 31, struct serial_struct)*/
-#define TARGET_TIOCPKT     _IOW('T', 32, int)
+#define TARGET_TIOCPKT     TARGET_IOW('T', 32, int)
 # define TARGET_TIOCPKT_DATA        0
 # define TARGET_TIOCPKT_FLUSHREAD   1
 # define TARGET_TIOCPKT_FLUSHWRITE  2
@@ -286,43 +286,61 @@ struct target_ktermios {
 # define TARGET_TIOCPKT_IOCTL      64
 
 
-#define TARGET_TIOCNOTTY   _IO('T', 34)
-#define TARGET_TIOCSETD    _IOW('T', 35, int)
-#define TARGET_TIOCGETD    _IOR('T', 36, int)
-#define TARGET_TCSBRKP     _IOW('T', 37, int)   /* Needed for POSIX tcsendbreak()*/
-#define TARGET_TIOCSBRK    _IO('T', 39)         /* BSD compatibility */
-#define TARGET_TIOCCBRK    _IO('T', 40)         /* BSD compatibility */
-#define TARGET_TIOCGSID    _IOR('T', 41, pid_t) /* Return the session ID of FD*/
-#define TARGET_TCGETS2     _IOR('T', 42, struct termios2)
-#define TARGET_TCSETS2     _IOW('T', 43, struct termios2)
-#define TARGET_TCSETSW2    _IOW('T', 44, struct termios2)
-#define TARGET_TCSETSF2    _IOW('T', 45, struct termios2)
-#define TARGET_TIOCGRS485  _IOR('T', 46, struct serial_rs485)
-#define TARGET_TIOCSRS485  _IOWR('T', 47, struct serial_rs485)
-#define TARGET_TIOCGPTN    _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TARGET_TIOCSPTLCK  _IOW('T',0x31, int)  /* Lock/unlock Pty */
-#define TARGET_TIOCGDEV    _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
-#define TARGET_TIOCSIG     _IOW('T',0x36, int)  /* Generate signal on Pty slave */
-#define TARGET_TIOCVHANGUP _IO('T', 0x37)
-#define TARGET_TIOCGPKT    _IOR('T', 0x38, int) /* Get packet mode state */
-#define TARGET_TIOCGPTLCK  _IOR('T', 0x39, int) /* Get Pty lock state */
-#define TARGET_TIOCGEXCL   _IOR('T', 0x40, int) /* Get exclusive mode state */
-#define TARGET_TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */
-
-#define TARGET_TIOCSERCONFIG   _IO('T', 83)
-#define TARGET_TIOCSERGWILD    _IOR('T', 84,  int)
-#define TARGET_TIOCSERSWILD    _IOW('T', 85,  int)
+#define TARGET_TIOCNOTTY   TARGET_IO('T', 34)
+#define TARGET_TIOCSETD    TARGET_IOW('T', 35, int)
+#define TARGET_TIOCGETD    TARGET_IOR('T', 36, int)
+/* Needed for POSIX tcsendbreak()*/
+#define TARGET_TCSBRKP     TARGET_IOW('T', 37, int)
+/* BSD compatibility */
+#define TARGET_TIOCSBRK    TARGET_IO('T', 39)
+/* BSD compatibility */
+#define TARGET_TIOCCBRK    TARGET_IO('T', 40)
+/* Return the session ID of FD*/
+#define TARGET_TIOCGSID    TARGET_IOR('T', 41, pid_t)
+#define TARGET_TCGETS2     TARGET_IOR('T', 42, struct termios2)
+#define TARGET_TCSETS2     TARGET_IOW('T', 43, struct termios2)
+#define TARGET_TCSETSW2    TARGET_IOW('T', 44, struct termios2)
+#define TARGET_TCSETSF2    TARGET_IOW('T', 45, struct termios2)
+#define TARGET_TIOCGRS485  TARGET_IOR('T', 46, struct serial_rs485)
+#define TARGET_TIOCSRS485  TARGET_IOWR('T', 47, struct serial_rs485)
+/* Get Pty Number (of pty-mux device) */
+#define TARGET_TIOCGPTN    TARGET_IOR('T', 0x30, unsigned int)
+/* Lock/unlock Pty */
+#define TARGET_TIOCSPTLCK  TARGET_IOW('T', 0x31, int)
+/* Get primary device node of /dev/console */
+#define TARGET_TIOCGDEV    TARGET_IOR('T', 0x32, unsigned int)
+/* Generate signal on Pty slave */
+#define TARGET_TIOCSIG     TARGET_IOW('T', 0x36, int)
+#define TARGET_TIOCVHANGUP TARGET_IO('T', 0x37)
+/* Get packet mode state */
+#define TARGET_TIOCGPKT    TARGET_IOR('T', 0x38, int)
+/* Get Pty lock state */
+#define TARGET_TIOCGPTLCK  TARGET_IOR('T', 0x39, int)
+/* Get exclusive mode state */
+#define TARGET_TIOCGEXCL   TARGET_IOR('T', 0x40, int)
+/* Safely open the slave */
+#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)
+
+#define TARGET_TIOCSERCONFIG   TARGET_IO('T', 83)
+#define TARGET_TIOCSERGWILD    TARGET_IOR('T', 84,  int)
+#define TARGET_TIOCSERSWILD    TARGET_IOW('T', 85,  int)
 #define TARGET_TIOCGLCKTRMIOS  0x5456
 #define TARGET_TIOCSLCKTRMIOS  0x5457
-#define TARGET_TIOCSERGSTRUCT  0x5458           /* For debugging only */
-#define TARGET_TIOCSERGETLSR   _IOR('T', 89, unsigned int) /* Get line status reg. */
+/* For debugging only */
+#define TARGET_TIOCSERGSTRUCT  0x5458
+/* Get line status reg. */
+#define TARGET_TIOCSERGETLSR   TARGET_IOR('T', 89, unsigned int)
 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-# define TARGET_TIOCSER_TEMT    0x01            /* Transmitter physically empty */
-#define TARGET_TIOCSERGETMULTI 0x80a8545a /* Get multiport config  */
+/* Transmitter physically empty */
+# define TARGET_TIOCSER_TEMT    0x01
+/* Get multiport config  */
+#define TARGET_TIOCSERGETMULTI 0x80a8545a
 /* _IOR('T', 90, struct serial_multiport_struct) */
-#define TARGET_TIOCSERSETMULTI 0x40a8545b /* Set multiport config */
+/* Set multiport config */
+#define TARGET_TIOCSERSETMULTI 0x40a8545b
 /* _IOW('T', 91, struct serial_multiport_struct) */
-
-#define TARGET_TIOCMIWAIT  _IO('T', 92) /* wait for a change on serial input line(s) */
-#define TARGET_TIOCGICOUNT 0x545D  /* read serial port inline interrupt counts */
+/* wait for a change on serial input line(s) */
+#define TARGET_TIOCMIWAIT      TARGET_IO('T', 92)
+/* read serial port inline interrupt counts */
+#define TARGET_TIOCGICOUNT 0x545D
 #endif /* XTENSA_TERMBITS_H */
-- 
2.7.4



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

* [PATCH v5 02/20] linux-user: alpha: Update syscall numbers to kernel 5.5 rc3 level
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
  2020-01-13 20:34 ` [PATCH v5 01/20] linux-user: Fix some constants in termbits.h Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 15:12   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 03/20] linux-user: m68k: " Aleksandar Markovic
                   ` (17 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic, Richard Henderson

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Update alpha syscall numbers based on Linux kernel tag v5.5-rc3
(commit 46cf053e).

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>

---

cc: Richard Henderson <rth@twiddle.net>
---
 linux-user/alpha/syscall_nr.h | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/linux-user/alpha/syscall_nr.h b/linux-user/alpha/syscall_nr.h
index 2e5541b..c29fc17 100644
--- a/linux-user/alpha/syscall_nr.h
+++ b/linux-user/alpha/syscall_nr.h
@@ -453,5 +453,40 @@
 #define TARGET_NR_getrandom                     511
 #define TARGET_NR_memfd_create                  512
 #define TARGET_NR_execveat                      513
+#define TARGET_NR_seccomp                       514
+#define TARGET_NR_bpf                           515
+#define TARGET_NR_userfaultfd                   516
+#define TARGET_NR_membarrier                    517
+#define TARGET_NR_mlock2                        518
+#define TARGET_NR_copy_file_range               519
+#define TARGET_NR_preadv2                       520
+#define TARGET_NR_pwritev2                      521
+#define TARGET_NR_statx                         522
+#define TARGET_NR_io_pgetevents                 523
+#define TARGET_NR_pkey_mprotect                 524
+#define TARGET_NR_pkey_alloc                    525
+#define TARGET_NR_pkey_free                     526
+#define TARGET_NR_rseq                          527
+#define TARGET_NR_statfs64                      528
+#define TARGET_NR_fstatfs64                     529
+#define TARGET_NR_getegid                       530
+#define TARGET_NR_geteuid                       531
+#define TARGET_NR_getppid                       532
+/*
+ * all other architectures have common numbers for new syscall, alpha
+ * is the exception.
+ */
+#define TARGET_NR_pidfd_send_signal             534
+#define TARGET_NR_io_uring_setup                535
+#define TARGET_NR_io_uring_enter                536
+#define TARGET_NR_io_uring_register             537
+#define TARGET_NR_open_tree                     538
+#define TARGET_NR_move_mount                    539
+#define TARGET_NR_fsopen                        540
+#define TARGET_NR_fsconfig                      541
+#define TARGET_NR_fsmount                       542
+#define TARGET_NR_fspick                        543
+#define TARGET_NR_pidfd_open                    544
+/* 545 reserved for clone3 */
 
 #endif
-- 
2.7.4



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

* [PATCH v5 03/20] linux-user: m68k: Update syscall numbers to kernel 5.5 rc3 level
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
  2020-01-13 20:34 ` [PATCH v5 01/20] linux-user: Fix some constants in termbits.h Aleksandar Markovic
  2020-01-13 20:34 ` [PATCH v5 02/20] linux-user: alpha: Update syscall numbers to kernel 5.5 rc3 level Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 15:03   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 04/20] linux-user: microblaze: " Aleksandar Markovic
                   ` (16 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Update m68k syscall numbers based on Linux kernel tag v5.5-rc3
(commit 46cf053e).

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>

---

cc: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/m68k/syscall_nr.h | 50 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)

diff --git a/linux-user/m68k/syscall_nr.h b/linux-user/m68k/syscall_nr.h
index d33d8e9..01aee34 100644
--- a/linux-user/m68k/syscall_nr.h
+++ b/linux-user/m68k/syscall_nr.h
@@ -382,5 +382,53 @@
 #define TARGET_NR_copy_file_range       376
 #define TARGET_NR_preadv2               377
 #define TARGET_NR_pwritev2              378
-
+#define TARGET_NR_statx                 379
+#define TARGET_NR_seccomp               380
+#define TARGET_NR_pkey_mprotect         381
+#define TARGET_NR_pkey_alloc            382
+#define TARGET_NR_pkey_free             383
+#define TARGET_NR_rseq                  384
+/* room for arch specific calls */
+#define TARGET_NR_semget                393
+#define TARGET_NR_semctl                394
+#define TARGET_NR_shmget                395
+#define TARGET_NR_shmctl                396
+#define TARGET_NR_shmat                 397
+#define TARGET_NR_shmdt                 398
+#define TARGET_NR_msgget                399
+#define TARGET_NR_msgsnd                400
+#define TARGET_NR_msgrcv                401
+#define TARGET_NR_msgctl                402
+#define TARGET_NR_clock_gettime64       403
+#define TARGET_NR_clock_settime64       404
+#define TARGET_NR_clock_adjtime64       405
+#define TARGET_NR_clock_getres_time64   406
+#define TARGET_NR_clock_nanosleep_time64 407
+#define TARGET_NR_timer_gettime64       408
+#define TARGET_NR_timer_settime64       409
+#define TARGET_NR_timerfd_gettime64     410
+#define TARGET_NR_timerfd_settime64     411
+#define TARGET_NR_utimensat_time64      412
+#define TARGET_NR_pselect6_time64       413
+#define TARGET_NR_ppoll_time64          414
+#define TARGET_NR_io_pgetevents_time64  416
+#define TARGET_NR_recvmmsg_time64       417
+#define TARGET_NR_mq_timedsend_time64   418
+#define TARGET_NR_mq_timedreceive_time64 419
+#define TARGET_NR_semtimedop_time64     420
+#define TARGET_NR_rt_sigtimedwait_time64 421
+#define TARGET_NR_futex_time64          422
+#define TARGET_NR_sched_rr_get_interval_time64 423
+#define TARGET_NR_pidfd_send_signal     424
+#define TARGET_NR_io_uring_setup        425
+#define TARGET_NR_io_uring_enter        426
+#define TARGET_NR_io_uring_register     427
+#define TARGET_NR_open_tree             428
+#define TARGET_NR_move_mount            429
+#define TARGET_NR_fsopen                430
+#define TARGET_NR_fsconfig              431
+#define TARGET_NR_fsmount               432
+#define TARGET_NR_fspick                433
+#define TARGET_NR_pidfd_open            434
+/* 435 reserved for clone3 */
 #endif
-- 
2.7.4



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

* [PATCH v5 04/20] linux-user: microblaze: Update syscall numbers to kernel 5.5 rc3 level
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (2 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 03/20] linux-user: m68k: " Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 15:06   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 05/20] linux-user: mips: " Aleksandar Markovic
                   ` (15 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Edgar E . Iglesias, laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Update microblaze syscall numbers based on Linux kernel tag v5.5-rc3
(commit 46cf053e).

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>

---

cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
---
 linux-user/microblaze/syscall_nr.h | 45 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/linux-user/microblaze/syscall_nr.h b/linux-user/microblaze/syscall_nr.h
index aa2eb93..ec1758e 100644
--- a/linux-user/microblaze/syscall_nr.h
+++ b/linux-user/microblaze/syscall_nr.h
@@ -393,5 +393,50 @@
 #define TARGET_NR_memfd_create          386
 #define TARGET_NR_bpf                   387
 #define TARGET_NR_execveat              388
+#define TARGET_NR_userfaultfd           389
+#define TARGET_NR_membarrier            390
+#define TARGET_NR_mlock2                391
+#define TARGET_NR_copy_file_range       392
+#define TARGET_NR_preadv2               393
+#define TARGET_NR_pwritev2              394
+#define TARGET_NR_pkey_mprotect         395
+#define TARGET_NR_pkey_alloc            396
+#define TARGET_NR_pkey_free             397
+#define TARGET_NR_statx                 398
+#define TARGET_NR_io_pgetevents         399
+#define TARGET_NR_rseq                  400
+/* 401 and 402 are unused */
+#define TARGET_NR_clock_gettime64       403
+#define TARGET_NR_clock_settime64       404
+#define TARGET_NR_clock_adjtime64       405
+#define TARGET_NR_clock_getres_time64   406
+#define TARGET_NR_clock_nanosleep_time64 407
+#define TARGET_NR_timer_gettime64       408
+#define TARGET_NR_timer_settime64       409
+#define TARGET_NR_timerfd_gettime64     410
+#define TARGET_NR_timerfd_settime64     411
+#define TARGET_NR_utimensat_time64      412
+#define TARGET_NR_pselect6_time64       413
+#define TARGET_NR_ppoll_time64          414
+#define TARGET_NR_io_pgetevents_time64  416
+#define TARGET_NR_recvmmsg_time64       417
+#define TARGET_NR_mq_timedsend_time64   418
+#define TARGET_NR_mq_timedreceive_time64 419
+#define TARGET_NR_semtimedop_time64     420
+#define TARGET_NR_rt_sigtimedwait_time64 421
+#define TARGET_NR_futex_time64          422
+#define TARGET_NR_sched_rr_get_interval_time64 423
+#define TARGET_NR_pidfd_send_signal     424
+#define TARGET_NR_io_uring_setup        425
+#define TARGET_NR_io_uring_enter        426
+#define TARGET_NR_io_uring_register     427
+#define TARGET_NR_open_tree             428
+#define TARGET_NR_move_mount            429
+#define TARGET_NR_fsopen                430
+#define TARGET_NR_fsconfig              431
+#define TARGET_NR_fsmount               432
+#define TARGET_NR_fspick                433
+#define TARGET_NR_pidfd_open            434
+#define TARGET_NR_clone3                435
 
 #endif
-- 
2.7.4



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

* [PATCH v5 05/20] linux-user: mips: Update syscall numbers to kernel 5.5 rc3 level
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (3 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 04/20] linux-user: microblaze: " Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 16:39   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 06/20] linux-user: x86_64: " Aleksandar Markovic
                   ` (14 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Update mips syscall numbers based on Linux kernel tag v5.5-rc3
(commit 46cf053e).

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/mips/cpu_loop.c     | 78 +++++++++++++++++++++++++++++++++++++++++-
 linux-user/mips/syscall_nr.h   | 45 ++++++++++++++++++++++++
 linux-user/mips64/syscall_nr.h | 13 +++++++
 3 files changed, 135 insertions(+), 1 deletion(-)

diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
index 39915b3..b81479b 100644
--- a/linux-user/mips/cpu_loop.c
+++ b/linux-user/mips/cpu_loop.c
@@ -25,8 +25,9 @@
 #include "internal.h"
 
 # ifdef TARGET_ABI_MIPSO32
+#  define MIPS_SYSCALL_NUMBER_UNUSED -1
 #  define MIPS_SYS(name, args) args,
-static const uint8_t mips_syscall_args[] = {
+static const int8_t mips_syscall_args[] = {
         MIPS_SYS(sys_syscall    , 8)    /* 4000 */
         MIPS_SYS(sys_exit       , 1)
         MIPS_SYS(sys_fork       , 0)
@@ -390,6 +391,75 @@ static const uint8_t mips_syscall_args[] = {
         MIPS_SYS(sys_copy_file_range, 6) /* 360 */
         MIPS_SYS(sys_preadv2, 6)
         MIPS_SYS(sys_pwritev2, 6)
+        MIPS_SYS(sys_pkey_mprotect, 4)
+        MIPS_SYS(sys_pkey_alloc, 2)
+        MIPS_SYS(sys_pkey_free, 1)                 /* 365 */
+        MIPS_SYS(sys_statx, 5)
+        MIPS_SYS(sys_rseq, 4)
+        MIPS_SYS(sys_io_pgetevents, 6)
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,                /* 370 */
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,                /* 375 */
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,                /* 380 */
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,                /* 385 */
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,                /* 390 */
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYSCALL_NUMBER_UNUSED,
+        MIPS_SYS(sys_semget, 3)
+        MIPS_SYS(sys_semctl, 4)
+        MIPS_SYS(sys_shmget, 3)                    /* 395 */
+        MIPS_SYS(sys_shmctl, 3)
+        MIPS_SYS(sys_shmat, 3)
+        MIPS_SYS(sys_shmdt, 1)
+        MIPS_SYS(sys_msgget, 2)
+        MIPS_SYS(sys_msgsnd, 4)                    /* 400 */
+        MIPS_SYS(sys_msgrcv, 5)
+        MIPS_SYS(sys_msgctl, 3)
+        MIPS_SYS(sys_timer_gettime64, 2)
+        MIPS_SYS(sys_timer_settime64, 4)
+        MIPS_SYS(sys_timerfd_gettime64, 2)         /* 410 */
+        MIPS_SYS(sys_timerfd_settime64, 4)
+        MIPS_SYS(sys_utimensat_time64, 4)
+        MIPS_SYS(sys_pselect6_time64, 6)
+        MIPS_SYS(sys_ppoll_time64, 5)
+        MIPS_SYSCALL_NUMBER_UNUSED,                /* 415 */
+        MIPS_SYS(sys_io_pgetevents_time64, 6)
+        MIPS_SYS(sys_recvmmsg_time64, 5)
+        MIPS_SYS(sys_mq_timedsend_time64, 5)
+        MIPS_SYS(sys_mq_timedreceive_time64, 5)
+        MIPS_SYS(sys_semtimedop_time64, 4)         /* 420 */
+        MIPS_SYS(sys_rt_sigtimedwait_time64, 4)
+        MIPS_SYS(sys_futex_time64, 6)
+        MIPS_SYS(sys_sched_rr_get_interval_time64, 2)
+        MIPS_SYS(sys_pidfd_send_signal, 4)
+        MIPS_SYS(sys_io_uring_setup, 2)            /* 425 */
+        MIPS_SYS(sys_io_uring_enter, 6)
+        MIPS_SYS(sys_io_uring_register, 4)
+        MIPS_SYS(sys_open_tree, 3)
+        MIPS_SYS(sys_move_mount, 5)
+        MIPS_SYS(sys_fsopen, 2)                    /* 430 */
+        MIPS_SYS(sys_fsconfig, 5)
+        MIPS_SYS(sys_fsmount, 3)
+        MIPS_SYS(sys_fspick, 3)
+        MIPS_SYS(sys_pidfd_open, 2)
+        MIPS_SYS(sys_clone3, 2)                    /* 435 */
+
 };
 #  undef MIPS_SYS
 # endif /* O32 */
@@ -447,8 +517,14 @@ void cpu_loop(CPUMIPSState *env)
 # ifdef TARGET_ABI_MIPSO32
             syscall_num = env->active_tc.gpr[2] - 4000;
             if (syscall_num >= sizeof(mips_syscall_args)) {
+                /* syscall_num is larger that any defined for MIPS O32 */
+                ret = -TARGET_ENOSYS;
+            } else if (mips_syscall_args[syscall_num] ==
+                       MIPS_SYSCALL_NUMBER_UNUSED) {
+                /* syscall_num belongs to the range not defined for MIPS O32 */
                 ret = -TARGET_ENOSYS;
             } else {
+                /* syscall_num is valid */
                 int nb_args;
                 abi_ulong sp_reg;
                 abi_ulong arg5 = 0, arg6 = 0, arg7 = 0, arg8 = 0;
diff --git a/linux-user/mips/syscall_nr.h b/linux-user/mips/syscall_nr.h
index 7fa7fa5..0be3af1 100644
--- a/linux-user/mips/syscall_nr.h
+++ b/linux-user/mips/syscall_nr.h
@@ -376,5 +376,50 @@
 #define TARGET_NR_statx                 (TARGET_NR_Linux + 366)
 #define TARGET_NR_rseq                  (TARGET_NR_Linux + 367)
 #define TARGET_NR_io_pgetevents         (TARGET_NR_Linux + 368)
+/* room for arch specific calls */
+#define TARGET_NR_semget                (TARGET_NR_Linux + 393)
+#define TARGET_NR_semctl                (TARGET_NR_Linux + 394)
+#define TARGET_NR_shmget                (TARGET_NR_Linux + 395)
+#define TARGET_NR_shmctl                (TARGET_NR_Linux + 396)
+#define TARGET_NR_shmat                 (TARGET_NR_Linux + 397)
+#define TARGET_NR_shmdt                 (TARGET_NR_Linux + 398)
+#define TARGET_NR_msgget                (TARGET_NR_Linux + 399)
+#define TARGET_NR_msgsnd                (TARGET_NR_Linux + 400)
+#define TARGET_NR_msgrcv                (TARGET_NR_Linux + 401)
+#define TARGET_NR_msgctl                (TARGET_NR_Linux + 402)
+/* 403-423 common for 32-bit archs */
+#define TARGET_NR_clock_gettime64              (TARGET_NR_Linux + 403)
+#define TARGET_NR_clock_settime64              (TARGET_NR_Linux + 404)
+#define TARGET_NR_clock_adjtime64              (TARGET_NR_Linux + 405)
+#define TARGET_NR_clock_getres_time64          (TARGET_NR_Linux + 406)
+#define TARGET_NR_clock_nanosleep_time64       (TARGET_NR_Linux + 407)
+#define TARGET_NR_timer_gettime64              (TARGET_NR_Linux + 408)
+#define TARGET_NR_timer_settime64              (TARGET_NR_Linux + 409)
+#define TARGET_NR_timerfd_gettime64            (TARGET_NR_Linux + 410)
+#define TARGET_NR_timerfd_settime64            (TARGET_NR_Linux + 411)
+#define TARGET_NR_utimensat_time64             (TARGET_NR_Linux + 412)
+#define TARGET_NR_pselect6_time64              (TARGET_NR_Linux + 413)
+#define TARGET_NR_ppoll_time64                 (TARGET_NR_Linux + 414)
+#define TARGET_NR_io_pgetevents_time64         (TARGET_NR_Linux + 416)
+#define TARGET_NR_recvmmsg_time64              (TARGET_NR_Linux + 417)
+#define TARGET_NR_mq_timedsend_time64          (TARGET_NR_Linux + 418)
+#define TARGET_NR_mq_timedreceive_time64       (TARGET_NR_Linux + 419)
+#define TARGET_NR_semtimedop_time64            (TARGET_NR_Linux + 420)
+#define TARGET_NR_rt_sigtimedwait_time64       (TARGET_NR_Linux + 421)
+#define TARGET_NR_futex_time64                 (TARGET_NR_Linux + 422)
+#define TARGET_NR_sched_rr_get_interval_time64 (TARGET_NR_Linux + 423)
+/* 424 onwards common for all archs */
+#define TARGET_NR_pidfd_send_signal            (TARGET_NR_Linux + 424)
+#define TARGET_NR_io_uring_setup               (TARGET_NR_Linux + 425)
+#define TARGET_NR_io_uring_enter               (TARGET_NR_Linux + 426)
+#define TARGET_NR_io_uring_register            (TARGET_NR_Linux + 427)
+#define TARGET_NR_open_tree                    (TARGET_NR_Linux + 428)
+#define TARGET_NR_move_mount                   (TARGET_NR_Linux + 429)
+#define TARGET_NR_fsopen                       (TARGET_NR_Linux + 430)
+#define TARGET_NR_fsconfig                     (TARGET_NR_Linux + 431)
+#define TARGET_NR_fsmount                      (TARGET_NR_Linux + 432)
+#define TARGET_NR_fspick                       (TARGET_NR_Linux + 433)
+#define TARGET_NR_pidfd_open                   (TARGET_NR_Linux + 434)
+#define TARGET_NR_clone3                       (TARGET_NR_Linux + 435)
 
 #endif
diff --git a/linux-user/mips64/syscall_nr.h b/linux-user/mips64/syscall_nr.h
index db40f69..c86943a 100644
--- a/linux-user/mips64/syscall_nr.h
+++ b/linux-user/mips64/syscall_nr.h
@@ -674,6 +674,19 @@
 #define TARGET_NR_statx                 (TARGET_NR_Linux + 326)
 #define TARGET_NR_rseq                  (TARGET_NR_Linux + 327)
 #define TARGET_NR_io_pgetevents         (TARGET_NR_Linux + 328)
+/* 329 through 423 are reserved to sync up with other architectures */
+#define TARGET_NR_pidfd_send_signal     (TARGET_NR_Linux + 424)
+#define TARGET_NR_io_uring_setup        (TARGET_NR_Linux + 425)
+#define TARGET_NR_io_uring_enter        (TARGET_NR_Linux + 426)
+#define TARGET_NR_io_uring_register     (TARGET_NR_Linux + 427)
+#define TARGET_NR_open_tree             (TARGET_NR_Linux + 428)
+#define TARGET_NR_move_mount            (TARGET_NR_Linux + 429)
+#define TARGET_NR_fsopen                (TARGET_NR_Linux + 430)
+#define TARGET_NR_fsconfig              (TARGET_NR_Linux + 431)
+#define TARGET_NR_fsmount               (TARGET_NR_Linux + 432)
+#define TARGET_NR_fspick                (TARGET_NR_Linux + 433)
+#define TARGET_NR_pidfd_open            (TARGET_NR_Linux + 434)
+#define TARGET_NR_clone3                (TARGET_NR_Linux + 435)
 #endif
 
 #endif
-- 
2.7.4



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

* [PATCH v5 06/20] linux-user: x86_64: Update syscall numbers to kernel 5.5 rc3 level
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (4 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 05/20] linux-user: mips: " Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 15:16   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 07/20] linux-user: xtensa: " Aleksandar Markovic
                   ` (13 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, laurent, amarkovic, Richard Henderson

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Update x86_64 syscall numbers based on Linux kernel tag v5.5-rc3
(commit 46cf053e).

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>

---

cc: Paolo Bonzini <pbonzini@redhat.com>
cc: Richard Henderson <rth@twiddle.net>
cc: Eduardo Habkost <ehabkost@redhat.com>
---
 linux-user/x86_64/syscall_nr.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/linux-user/x86_64/syscall_nr.h b/linux-user/x86_64/syscall_nr.h
index 9b6981e..e5d14ec 100644
--- a/linux-user/x86_64/syscall_nr.h
+++ b/linux-user/x86_64/syscall_nr.h
@@ -328,5 +328,29 @@
 #define TARGET_NR_membarrier            324
 #define TARGET_NR_mlock2                325
 #define TARGET_NR_copy_file_range       326
+#define TARGET_NR_preadv2               327
+#define TARGET_NR_pwritev2              328
+#define TARGET_NR_pkey_mprotect         329
+#define TARGET_NR_pkey_alloc            330
+#define TARGET_NR_pkey_free             331
+#define TARGET_NR_statx                 332
+#define TARGET_NR_io_pgetevents         333
+#define TARGET_NR_rseq                  334
+/*
+ * don't use numbers 387 through 423, add new calls after the last
+ * 'common' entry
+ */
+#define TARGET_NR_pidfd_send_signal     424
+#define TARGET_NR_io_uring_setup        425
+#define TARGET_NR_io_uring_enter        426
+#define TARGET_NR_io_uring_register     427
+#define TARGET_NR_open_tree             428
+#define TARGET_NR_move_mount            429
+#define TARGET_NR_fsopen                430
+#define TARGET_NR_fsconfig              431
+#define TARGET_NR_fsmount               432
+#define TARGET_NR_fspick                433
+#define TARGET_NR_pidfd_open            434
+#define TARGET_NR_clone3                435
 
 #endif
-- 
2.7.4



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

* [PATCH v5 07/20] linux-user: xtensa: Update syscall numbers to kernel 5.5 rc3 level
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (5 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 06/20] linux-user: x86_64: " Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 15:08   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 08/20] linux-user: xtensa: Remove unused constant TARGET_NR_syscall_count Aleksandar Markovic
                   ` (12 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Max Filippov, laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Update xtensa syscall numbers based on Linux kernel tag v5.5-rc3
(commit 46cf053e).

Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>

---

cc: Max Filippov <jcmvbkbc@gmail.com>
---
 linux-user/xtensa/syscall_nr.h | 38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/linux-user/xtensa/syscall_nr.h b/linux-user/xtensa/syscall_nr.h
index 27645be..3d19d0c 100644
--- a/linux-user/xtensa/syscall_nr.h
+++ b/linux-user/xtensa/syscall_nr.h
@@ -431,7 +431,41 @@
 #define TARGET_NR_pkey_free                          350
 
 #define TARGET_NR_statx                              351
-
-#define TARGET_NR_syscall_count                      352
+#define TARGET_NR_rseq                               352
+/* 353 through 402 are unassigned to sync up with generic numbers */
+#define TARGET_NR_clock_gettime64                    403
+#define TARGET_NR_clock_settime64                    404
+#define TARGET_NR_clock_adjtime64                    405
+#define TARGET_NR_clock_getres_time64                406
+#define TARGET_NR_clock_nanosleep_time64             407
+#define TARGET_NR_timer_gettime64                    408
+#define TARGET_NR_timer_settime64                    409
+#define TARGET_NR_timerfd_gettime64                  410
+#define TARGET_NR_timerfd_settime64                  411
+#define TARGET_NR_utimensat_time64                   412
+#define TARGET_NR_pselect6_time64                    413
+#define TARGET_NR_ppoll_time64                       414
+#define TARGET_NR_io_pgetevents_time64               416
+#define TARGET_NR_recvmmsg_time64                    417
+#define TARGET_NR_mq_timedsend_time64                418
+#define TARGET_NR_mq_timedreceive_time64             419
+#define TARGET_NR_semtimedop_time64                  420
+#define TARGET_NR_rt_sigtimedwait_time64             421
+#define TARGET_NR_futex_time64                       422
+#define TARGET_NR_sched_rr_get_interval_time64       423
+#define TARGET_NR_pidfd_send_signal                  424
+#define TARGET_NR_io_uring_setup                     425
+#define TARGET_NR_io_uring_enter                     426
+#define TARGET_NR_io_uring_register                  427
+#define TARGET_NR_open_tree                          428
+#define TARGET_NR_move_mount                         429
+#define TARGET_NR_fsopen                             430
+#define TARGET_NR_fsconfig                           431
+#define TARGET_NR_fsmount                            432
+#define TARGET_NR_fspick                             433
+#define TARGET_NR_pidfd_open                         434
+#define TARGET_NR_clone3                             435
+
+#define TARGET_NR_syscall_count                      436
 
 #endif /* XTENSA_SYSCALL_NR_H */
-- 
2.7.4



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

* [PATCH v5 08/20] linux-user: xtensa: Remove unused constant TARGET_NR_syscall_count
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (6 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 07/20] linux-user: xtensa: " Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:59   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 09/20] linux-user: Add support for FS_IOC_<GET|SET>VERSION ioctls Aleksandar Markovic
                   ` (11 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Max Filippov, laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Currently, there is no usage of TARGET_NR_syscall_count for target
xtensa, and there is no obvious indication if there is some planned
usage in future.

Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>

---

cc: Max Filippov <jcmvbkbc@gmail.com>
---
 linux-user/xtensa/syscall_nr.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/linux-user/xtensa/syscall_nr.h b/linux-user/xtensa/syscall_nr.h
index 3d19d0c..39bff65 100644
--- a/linux-user/xtensa/syscall_nr.h
+++ b/linux-user/xtensa/syscall_nr.h
@@ -466,6 +466,4 @@
 #define TARGET_NR_pidfd_open                         434
 #define TARGET_NR_clone3                             435
 
-#define TARGET_NR_syscall_count                      436
-
 #endif /* XTENSA_SYSCALL_NR_H */
-- 
2.7.4



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

* [PATCH v5 09/20] linux-user: Add support for FS_IOC_<GET|SET>VERSION ioctls
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (7 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 08/20] linux-user: xtensa: Remove unused constant TARGET_NR_syscall_count Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:21   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 10/20] linux-user: Add support for FS_IOC32_<GET|SET>FLAGS ioctls Aleksandar Markovic
                   ` (10 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 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).

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] 44+ messages in thread

* [PATCH v5 10/20] linux-user: Add support for FS_IOC32_<GET|SET>FLAGS ioctls
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (8 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 09/20] linux-user: Add support for FS_IOC_<GET|SET>VERSION ioctls Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:24   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 11/20] linux-user: Add support for FS_IOC32_<GET|SET>VERSION ioctls Aleksandar Markovic
                   ` (9 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 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.

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] 44+ messages in thread

* [PATCH v5 11/20] linux-user: Add support for FS_IOC32_<GET|SET>VERSION ioctls
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (9 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 10/20] linux-user: Add support for FS_IOC32_<GET|SET>FLAGS ioctls Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:24   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 12/20] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls Aleksandar Markovic
                   ` (8 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 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.

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] 44+ messages in thread

* [PATCH v5 12/20] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (10 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 11/20] linux-user: Add support for FS_IOC32_<GET|SET>VERSION ioctls Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:29   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 13/20] linux-user: Add support for FITRIM ioctl Aleksandar Markovic
                   ` (7 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 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 file_clone_range {
	__s64 src_fd;
	__u64 src_offset;
	__u64 src_length;
	__u64 dest_offset;
};

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 | 2 ++
 2 files changed, 9 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..12cd3de 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -924,6 +924,8 @@ 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)
+#define TARGET_FS_IOC_FSGETXATTR TARGET_IOR('X', 31, struct file_clone_range)
+#define TARGET_FS_IOC_FSSETXATTR TARGET_IOR('X', 32, struct file_clone_range)
 
 /* usb ioctls */
 #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
-- 
2.7.4



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

* [PATCH v5 13/20] linux-user: Add support for FITRIM ioctl
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (11 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 12/20] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:32   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 14/20] linux-user: Add support for FIFREEZE and FITHAW ioctls Aleksandar Markovic
                   ` (6 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 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 +
 2 files changed, 4 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 12cd3de..40851e9 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)
 
-- 
2.7.4



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

* [PATCH v5 14/20] linux-user: Add support for FIFREEZE and FITHAW ioctls
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (12 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 13/20] linux-user: Add support for FITRIM ioctl Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:34   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 15/20] linux-user: Add support for FD<SETEMSGTRESH|SETMAXERRS|GETMAXERRS> ioctls Aleksandar Markovic
                   ` (5 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 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).

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 40851e9..6b88030 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] 44+ messages in thread

* [PATCH v5 15/20] linux-user: Add support for FD<SETEMSGTRESH|SETMAXERRS|GETMAXERRS> ioctls
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (13 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 14/20] linux-user: Add support for FIFREEZE and FITHAW ioctls Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:36   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 16/20] linux-user: Add support for FDFMT<BEG|TRK|END> ioctls Aleksandar Markovic
                   ` (4 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 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.

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 6b88030..efe3860 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 4e36983..e4e0429 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -261,6 +261,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] 44+ messages in thread

* [PATCH v5 16/20] linux-user: Add support for FDFMT<BEG|TRK|END> ioctls
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (14 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 15/20] linux-user: Add support for FD<SETEMSGTRESH|SETMAXERRS|GETMAXERRS> ioctls Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:38   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 17/20] linux-user: Add support for FDGETFDCSTAT ioctl Aleksandar Markovic
                   ` (3 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 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.

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 efe3860..d85ab46 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 e4e0429..8ff78a6 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -261,6 +261,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] 44+ messages in thread

* [PATCH v5 17/20] linux-user: Add support for FDGETFDCSTAT ioctl
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (15 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 16/20] linux-user: Add support for FDFMT<BEG|TRK|END> ioctls Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:42   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 18/20] configure: Detect kcov support and introduce CONFIG_KCOV Aleksandar Markovic
                   ` (2 subsequent siblings)
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 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 d85ab46..225dcfb 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_long 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 8ff78a6..a111c61 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -273,6 +273,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] 44+ messages in thread

* [PATCH v5 18/20] configure: Detect kcov support and introduce CONFIG_KCOV
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (16 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 17/20] linux-user: Add support for FDGETFDCSTAT ioctl Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:48   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 19/20] linux-user: Add support for KCOV_<ENABLE|DISABLE> ioctls Aleksandar Markovic
  2020-01-13 20:34 ` [PATCH v5 20/20] linux-user: Add support for KCOV_INIT_TRACE ioctl Aleksandar Markovic
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 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. Its interface consists of
three ioctls.

This patch checks if kcov support 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 above mentioned ioctls.

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

diff --git a/configure b/configure
index 940bf9e..dbdba8f 100755
--- a/configure
+++ b/configure
@@ -4752,6 +4752,24 @@ if compile_prog "" "" ; then
   syncfs=yes
 fi
 
+# check for kcov support (kernel must be 4.4+, compiled with certain options)
+kcov=no
+cat > $TMPC << EOF
+#include <sys/kcov.h>
+
+int main(void)
+{
+    ioctl(-1, KCOV_ENABLE, NULL);
+    ioctl(-1, KCOV_DISABLE, NULL);
+    ioctl(-1, KCOV_INIT_TRACE, NULL);
+
+    return 0;
+}
+EOF
+if compile_prog "" "" ; 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 +6892,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] 44+ messages in thread

* [PATCH v5 19/20] linux-user: Add support for KCOV_<ENABLE|DISABLE> ioctls
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (17 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 18/20] configure: Detect kcov support and introduce CONFIG_KCOV Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:49   ` Laurent Vivier
  2020-01-13 20:34 ` [PATCH v5 20/20] linux-user: Add support for KCOV_INIT_TRACE ioctl Aleksandar Markovic
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 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.

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 225dcfb..87e390d 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2457,6 +2457,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] 44+ messages in thread

* [PATCH v5 20/20] linux-user: Add support for KCOV_INIT_TRACE ioctl
  2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
                   ` (18 preceding siblings ...)
  2020-01-13 20:34 ` [PATCH v5 19/20] linux-user: Add support for KCOV_<ENABLE|DISABLE> ioctls Aleksandar Markovic
@ 2020-01-13 20:34 ` Aleksandar Markovic
  2020-01-14 14:53   ` Laurent Vivier
  19 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-01-13 20:34 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.

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 87e390d..209c138 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2460,6 +2460,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] 44+ messages in thread

* Re: [PATCH v5 01/20] linux-user: Fix some constants in termbits.h
  2020-01-13 20:34 ` [PATCH v5 01/20] linux-user: Fix some constants in termbits.h Aleksandar Markovic
@ 2020-01-14 14:16   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 14:16 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Some constants were defined in terms of host, instead of target,
> as they should be.
> 
> Some additional trivial changes in this patch were forced by
> checkpatch.pl.
> 
> Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/aarch64/termbits.h    |   4 +-
>  linux-user/alpha/termbits.h      |  10 +--
>  linux-user/arm/termbits.h        |   4 +-
>  linux-user/cris/termbits.h       |   4 +-
>  linux-user/hppa/termbits.h       |   4 +-
>  linux-user/i386/termbits.h       |   4 +-
>  linux-user/m68k/termbits.h       |   4 +-
>  linux-user/microblaze/termbits.h |   4 +-
>  linux-user/mips/termbits.h       |   4 +-
>  linux-user/nios2/termbits.h      |   4 +-
>  linux-user/openrisc/termbits.h   |   6 +-
>  linux-user/ppc/termbits.h        |   4 +-
>  linux-user/riscv/termbits.h      |   4 +-
>  linux-user/s390x/termbits.h      |  26 ++++---
>  linux-user/sh4/termbits.h        |   4 +-
>  linux-user/sparc/termbits.h      |   4 +-
>  linux-user/sparc64/termbits.h    |   4 +-
>  linux-user/x86_64/termbits.h     |   6 +-
>  linux-user/xtensa/termbits.h     | 156 ++++++++++++++++++++++-----------------
>  19 files changed, 141 insertions(+), 119 deletions(-)
> 
...
> diff --git a/linux-user/s390x/termbits.h b/linux-user/s390x/termbits.h
> index 9affa8f..79a71c2 100644
> --- a/linux-user/s390x/termbits.h
> +++ b/linux-user/s390x/termbits.h
> @@ -128,8 +128,8 @@ struct target_ktermios {
>  #define TARGET_B9600	0000015
>  #define TARGET_B19200	0000016
>  #define TARGET_B38400	0000017
> -#define TARGET_EXTA B19200
> -#define TARGET_EXTB B38400
> +#define TARGET_EXTA     TARGET_B19200
> +#define TARGET_EXTB     TARGET_B38400
>  #define TARGET_CSIZE	0000060
>  #define TARGET_CS5	0000000
>  #define TARGET_CS6	0000020
> @@ -234,7 +234,7 @@ struct target_ktermios {
>  #define TARGET_TIOCGSOFTCAR	0x5419
>  #define TARGET_TIOCSSOFTCAR	0x541A
>  #define TARGET_FIONREAD	0x541B
> -#define TARGET_TIOCINQ		FIONREAD
> +#define TARGET_TIOCINQ      TARGET_FIONREAD
>  #define TARGET_TIOCLINUX	0x541C
>  #define TARGET_TIOCCONS	0x541D
>  #define TARGET_TIOCGSERIAL	0x541E
> @@ -248,14 +248,18 @@ struct target_ktermios {
>  #define TARGET_TIOCSBRK	0x5427  /* BSD compatibility */
>  #define TARGET_TIOCCBRK	0x5428  /* BSD compatibility */
>  #define TARGET_TIOCGSID	0x5429  /* Return the session ID of FD */
> -#define TARGET_TCGETS2		_IOR('T',0x2A, struct termios2)
> -#define TARGET_TCSETS2		_IOW('T',0x2B, struct termios2)
> -#define TARGET_TCSETSW2	_IOW('T',0x2C, struct termios2)
> -#define TARGET_TCSETSF2	_IOW('T',0x2D, struct termios2)
> -#define TARGET_TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> -#define TARGET_TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */
> -#define TARGET_TIOCGDEV	_IOR('T',0x32, unsigned int) /* Get real dev no below /dev/console */
> -#define TARGET_TIOCGPTPEER      TARGET_IO('T', 0x41) /* Safely open the slave */
> +#define TARGET_TCGETS2          TARGET_IOR('T', 0x2A, struct termios2)
> +#define TARGET_TCSETS2          TARGET_IOW('T', 0x2B, struct termios2)
> +#define TARGET_TCSETSW2         TARGET_IOW('T', 0x2C, struct termios2)
> +#define TARGET_TCSETSF2         TARGET_IOW('T', 0x2D, struct termios2)

should be target_termios2

> +/* Get Pty Number (of pty-mux device) */
> +#define TARGET_TIOCGPTN         TARGET_IOR('T', 0x30, unsigned int)
> +/* Lock/unlock Pty */
> +#define TARGET_TIOCSPTLCK       TARGET_IOW('T', 0x31, int)
> +/* Get real dev no below /dev/console */
> +#define TARGET_TIOCGDEV         TARGET_IOR('T', 0x32, unsigned int)
> +/* Safely open the slave */
> +#define TARGET_TIOCGPTPEER      TARGET_IO('T', 0x41)
>  
>  #define TARGET_FIONCLEX	0x5450  /* these numbers need to be adjusted. */
>  #define TARGET_FIOCLEX		0x5451
...
> diff --git a/linux-user/xtensa/termbits.h b/linux-user/xtensa/termbits.h
> index d1e09e6..d92fe9c 100644
> --- a/linux-user/xtensa/termbits.h
> +++ b/linux-user/xtensa/termbits.h
...
> @@ -286,43 +286,61 @@ struct target_ktermios {
>  # define TARGET_TIOCPKT_IOCTL      64
>  
>  
> -#define TARGET_TIOCNOTTY   _IO('T', 34)
> -#define TARGET_TIOCSETD    _IOW('T', 35, int)
> -#define TARGET_TIOCGETD    _IOR('T', 36, int)
> -#define TARGET_TCSBRKP     _IOW('T', 37, int)   /* Needed for POSIX tcsendbreak()*/
> -#define TARGET_TIOCSBRK    _IO('T', 39)         /* BSD compatibility */
> -#define TARGET_TIOCCBRK    _IO('T', 40)         /* BSD compatibility */
> -#define TARGET_TIOCGSID    _IOR('T', 41, pid_t) /* Return the session ID of FD*/
> -#define TARGET_TCGETS2     _IOR('T', 42, struct termios2)
> -#define TARGET_TCSETS2     _IOW('T', 43, struct termios2)
> -#define TARGET_TCSETSW2    _IOW('T', 44, struct termios2)
> -#define TARGET_TCSETSF2    _IOW('T', 45, struct termios2)
> -#define TARGET_TIOCGRS485  _IOR('T', 46, struct serial_rs485)
> -#define TARGET_TIOCSRS485  _IOWR('T', 47, struct serial_rs485)
> -#define TARGET_TIOCGPTN    _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
> -#define TARGET_TIOCSPTLCK  _IOW('T',0x31, int)  /* Lock/unlock Pty */
> -#define TARGET_TIOCGDEV    _IOR('T',0x32, unsigned int) /* Get primary device node of /dev/console */
> -#define TARGET_TIOCSIG     _IOW('T',0x36, int)  /* Generate signal on Pty slave */
> -#define TARGET_TIOCVHANGUP _IO('T', 0x37)
> -#define TARGET_TIOCGPKT    _IOR('T', 0x38, int) /* Get packet mode state */
> -#define TARGET_TIOCGPTLCK  _IOR('T', 0x39, int) /* Get Pty lock state */
> -#define TARGET_TIOCGEXCL   _IOR('T', 0x40, int) /* Get exclusive mode state */
> -#define TARGET_TIOCGPTPEER _IO('T', 0x41) /* Safely open the slave */
> -
> -#define TARGET_TIOCSERCONFIG   _IO('T', 83)
> -#define TARGET_TIOCSERGWILD    _IOR('T', 84,  int)
> -#define TARGET_TIOCSERSWILD    _IOW('T', 85,  int)
> +#define TARGET_TIOCNOTTY   TARGET_IO('T', 34)
> +#define TARGET_TIOCSETD    TARGET_IOW('T', 35, int)
> +#define TARGET_TIOCGETD    TARGET_IOR('T', 36, int)
> +/* Needed for POSIX tcsendbreak()*/
> +#define TARGET_TCSBRKP     TARGET_IOW('T', 37, int)
> +/* BSD compatibility */
> +#define TARGET_TIOCSBRK    TARGET_IO('T', 39)
> +/* BSD compatibility */
> +#define TARGET_TIOCCBRK    TARGET_IO('T', 40)
> +/* Return the session ID of FD*/
> +#define TARGET_TIOCGSID    TARGET_IOR('T', 41, pid_t)
> +#define TARGET_TCGETS2     TARGET_IOR('T', 42, struct termios2)
> +#define TARGET_TCSETS2     TARGET_IOW('T', 43, struct termios2)
> +#define TARGET_TCSETSW2    TARGET_IOW('T', 44, struct termios2)
> +#define TARGET_TCSETSF2    TARGET_IOW('T', 45, struct termios2)

should be target_termios2

Thanks,
Laurent


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

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

Le 13/01/2020 à 21:34, 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).
> 
> 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 */
> 

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


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

* Re: [PATCH v5 10/20] linux-user: Add support for FS_IOC32_<GET|SET>FLAGS ioctls
  2020-01-13 20:34 ` [PATCH v5 10/20] linux-user: Add support for FS_IOC32_<GET|SET>FLAGS ioctls Aleksandar Markovic
@ 2020-01-14 14:24   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 14:24 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 13/01/2020 à 21:34, 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.
> 
> 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)
> 

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


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

* Re: [PATCH v5 11/20] linux-user: Add support for FS_IOC32_<GET|SET>VERSION ioctls
  2020-01-13 20:34 ` [PATCH v5 11/20] linux-user: Add support for FS_IOC32_<GET|SET>VERSION ioctls Aleksandar Markovic
@ 2020-01-14 14:24   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 14:24 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 13/01/2020 à 21:34, 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.
> 
> 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)
> 

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


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

* Re: [PATCH v5 12/20] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls
  2020-01-13 20:34 ` [PATCH v5 12/20] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls Aleksandar Markovic
@ 2020-01-14 14:29   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 14:29 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Both FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR accept a pointer to
> the structure
> 
> struct file_clone_range {
> 	__s64 src_fd;
> 	__u64 src_offset;
> 	__u64 src_length;
> 	__u64 dest_offset;
> };
> 
> as their third argument.

There is a mismatch somewhere: they take 'struct fsxattr'.

'struct file_clone_range' is used by FICLONERANGE.

> 
> 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 | 2 ++
>  2 files changed, 9 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..12cd3de 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -924,6 +924,8 @@ 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)
> +#define TARGET_FS_IOC_FSGETXATTR TARGET_IOR('X', 31, struct file_clone_range)
> +#define TARGET_FS_IOC_FSSETXATTR TARGET_IOR('X', 32, struct file_clone_range)

Do you need also a "#if" around this?
Because I think the structure is only defined if the IOCTL is defined.

>  
>  /* usb ioctls */
>  #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
> 

Thanks,
Laurent


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

* Re: [PATCH v5 13/20] linux-user: Add support for FITRIM ioctl
  2020-01-13 20:34 ` [PATCH v5 13/20] linux-user: Add support for FITRIM ioctl Aleksandar Markovic
@ 2020-01-14 14:32   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 14:32 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> 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 +
>  2 files changed, 4 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)))

It seems STRUCT_fstrim_range is not defined.

> +#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 12cd3de..40851e9 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)

I think you need a "#ifdef" here too.

>  #define TARGET_FICLONE    TARGET_IOW(0x94, 9, int)
>  #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
>  
> 

Thanks,
Laurent


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

* Re: [PATCH v5 14/20] linux-user: Add support for FIFREEZE and FITHAW ioctls
  2020-01-13 20:34 ` [PATCH v5 14/20] linux-user: Add support for FIFREEZE and FITHAW ioctls Aleksandar Markovic
@ 2020-01-14 14:34   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 14:34 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> 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).
> 
> 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 40851e9..6b88030 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)
> 

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


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

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

Le 13/01/2020 à 21:34, 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.
> 
> 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 6b88030..efe3860 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 4e36983..e4e0429 100644
> --- a/linux-user/syscall_types.h
> +++ b/linux-user/syscall_types.h
> @@ -261,6 +261,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,
> 

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


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

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

Le 13/01/2020 à 21:34, 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.
> 
> 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 efe3860..d85ab46 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 e4e0429..8ff78a6 100644
> --- a/linux-user/syscall_types.h
> +++ b/linux-user/syscall_types.h
> @@ -261,6 +261,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 */
> 

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


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

* Re: [PATCH v5 17/20] linux-user: Add support for FDGETFDCSTAT ioctl
  2020-01-13 20:34 ` [PATCH v5 17/20] linux-user: Add support for FDGETFDCSTAT ioctl Aleksandar Markovic
@ 2020-01-14 14:42   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 14:42 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> 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 d85ab46..225dcfb 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_long address;  /* io address */

s/abi_long/abi_ulong/

Thanks,
Laurent


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

* Re: [PATCH v5 18/20] configure: Detect kcov support and introduce CONFIG_KCOV
  2020-01-13 20:34 ` [PATCH v5 18/20] configure: Detect kcov support and introduce CONFIG_KCOV Aleksandar Markovic
@ 2020-01-14 14:48   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 14:48 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 13/01/2020 à 21:34, 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. Its interface consists of
> three ioctls.
> 
> This patch checks if kcov support 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 above mentioned ioctls.
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  configure | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/configure b/configure
> index 940bf9e..dbdba8f 100755
> --- a/configure
> +++ b/configure
> @@ -4752,6 +4752,24 @@ if compile_prog "" "" ; then
>    syncfs=yes
>  fi
>  
> +# check for kcov support (kernel must be 4.4+, compiled with certain options)
> +kcov=no
> +cat > $TMPC << EOF
> +#include <sys/kcov.h>
> +
> +int main(void)
> +{
> +    ioctl(-1, KCOV_ENABLE, NULL);
> +    ioctl(-1, KCOV_DISABLE, NULL);
> +    ioctl(-1, KCOV_INIT_TRACE, NULL);
> +
> +    return 0;
> +}
> +EOF
> +if compile_prog "" "" ; then
> +  kcov=yes
> +fi

Perhaps a 'check_include sys/kcov.h' is enough?

All these defines are present since the first release of the file.

Thanks,
Laurent


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

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

Le 13/01/2020 à 21:34, 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.
> 
> 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 225dcfb..87e390d 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2457,6 +2457,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 */
> 

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


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

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

Le 13/01/2020 à 21:34, 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.
> 
> 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 87e390d..209c138 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2460,6 +2460,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 */
> 

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


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

* Re: [PATCH v5 08/20] linux-user: xtensa: Remove unused constant TARGET_NR_syscall_count
  2020-01-13 20:34 ` [PATCH v5 08/20] linux-user: xtensa: Remove unused constant TARGET_NR_syscall_count Aleksandar Markovic
@ 2020-01-14 14:59   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 14:59 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: Max Filippov, amarkovic

Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Currently, there is no usage of TARGET_NR_syscall_count for target
> xtensa, and there is no obvious indication if there is some planned
> usage in future.
> 
> Acked-by: Max Filippov <jcmvbkbc@gmail.com>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> ---
> 
> cc: Max Filippov <jcmvbkbc@gmail.com>
> ---
>  linux-user/xtensa/syscall_nr.h | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/linux-user/xtensa/syscall_nr.h b/linux-user/xtensa/syscall_nr.h
> index 3d19d0c..39bff65 100644
> --- a/linux-user/xtensa/syscall_nr.h
> +++ b/linux-user/xtensa/syscall_nr.h
> @@ -466,6 +466,4 @@
>  #define TARGET_NR_pidfd_open                         434
>  #define TARGET_NR_clone3                             435
>  
> -#define TARGET_NR_syscall_count                      436
> -
>  #endif /* XTENSA_SYSCALL_NR_H */
> 

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


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

* Re: [PATCH v5 03/20] linux-user: m68k: Update syscall numbers to kernel 5.5 rc3 level
  2020-01-13 20:34 ` [PATCH v5 03/20] linux-user: m68k: " Aleksandar Markovic
@ 2020-01-14 15:03   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 15:03 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Update m68k syscall numbers based on Linux kernel tag v5.5-rc3
> (commit 46cf053e).
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> ---
> 
> cc: Laurent Vivier <laurent@vivier.eu>
> ---
>  linux-user/m68k/syscall_nr.h | 50 +++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 49 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/m68k/syscall_nr.h b/linux-user/m68k/syscall_nr.h
> index d33d8e9..01aee34 100644
> --- a/linux-user/m68k/syscall_nr.h
> +++ b/linux-user/m68k/syscall_nr.h
> @@ -382,5 +382,53 @@
>  #define TARGET_NR_copy_file_range       376
>  #define TARGET_NR_preadv2               377
>  #define TARGET_NR_pwritev2              378
> -
> +#define TARGET_NR_statx                 379
> +#define TARGET_NR_seccomp               380
> +#define TARGET_NR_pkey_mprotect         381
> +#define TARGET_NR_pkey_alloc            382
> +#define TARGET_NR_pkey_free             383
> +#define TARGET_NR_rseq                  384
> +/* room for arch specific calls */
> +#define TARGET_NR_semget                393
> +#define TARGET_NR_semctl                394
> +#define TARGET_NR_shmget                395
> +#define TARGET_NR_shmctl                396
> +#define TARGET_NR_shmat                 397
> +#define TARGET_NR_shmdt                 398
> +#define TARGET_NR_msgget                399
> +#define TARGET_NR_msgsnd                400
> +#define TARGET_NR_msgrcv                401
> +#define TARGET_NR_msgctl                402
> +#define TARGET_NR_clock_gettime64       403
> +#define TARGET_NR_clock_settime64       404
> +#define TARGET_NR_clock_adjtime64       405
> +#define TARGET_NR_clock_getres_time64   406
> +#define TARGET_NR_clock_nanosleep_time64 407
> +#define TARGET_NR_timer_gettime64       408
> +#define TARGET_NR_timer_settime64       409
> +#define TARGET_NR_timerfd_gettime64     410
> +#define TARGET_NR_timerfd_settime64     411
> +#define TARGET_NR_utimensat_time64      412
> +#define TARGET_NR_pselect6_time64       413
> +#define TARGET_NR_ppoll_time64          414
> +#define TARGET_NR_io_pgetevents_time64  416
> +#define TARGET_NR_recvmmsg_time64       417
> +#define TARGET_NR_mq_timedsend_time64   418
> +#define TARGET_NR_mq_timedreceive_time64 419
> +#define TARGET_NR_semtimedop_time64     420
> +#define TARGET_NR_rt_sigtimedwait_time64 421
> +#define TARGET_NR_futex_time64          422
> +#define TARGET_NR_sched_rr_get_interval_time64 423
> +#define TARGET_NR_pidfd_send_signal     424
> +#define TARGET_NR_io_uring_setup        425
> +#define TARGET_NR_io_uring_enter        426
> +#define TARGET_NR_io_uring_register     427
> +#define TARGET_NR_open_tree             428
> +#define TARGET_NR_move_mount            429
> +#define TARGET_NR_fsopen                430
> +#define TARGET_NR_fsconfig              431
> +#define TARGET_NR_fsmount               432
> +#define TARGET_NR_fspick                433
> +#define TARGET_NR_pidfd_open            434
> +/* 435 reserved for clone3 */
>  #endif
> 

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


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

* Re: [PATCH v5 04/20] linux-user: microblaze: Update syscall numbers to kernel 5.5 rc3 level
  2020-01-13 20:34 ` [PATCH v5 04/20] linux-user: microblaze: " Aleksandar Markovic
@ 2020-01-14 15:06   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 15:06 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: Edgar E . Iglesias, amarkovic

Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Update microblaze syscall numbers based on Linux kernel tag v5.5-rc3
> (commit 46cf053e).
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> ---
> 
> cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
> ---
>  linux-user/microblaze/syscall_nr.h | 45 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
> 
> diff --git a/linux-user/microblaze/syscall_nr.h b/linux-user/microblaze/syscall_nr.h
> index aa2eb93..ec1758e 100644
> --- a/linux-user/microblaze/syscall_nr.h
> +++ b/linux-user/microblaze/syscall_nr.h
> @@ -393,5 +393,50 @@
>  #define TARGET_NR_memfd_create          386
>  #define TARGET_NR_bpf                   387
>  #define TARGET_NR_execveat              388
> +#define TARGET_NR_userfaultfd           389
> +#define TARGET_NR_membarrier            390
> +#define TARGET_NR_mlock2                391
> +#define TARGET_NR_copy_file_range       392
> +#define TARGET_NR_preadv2               393
> +#define TARGET_NR_pwritev2              394
> +#define TARGET_NR_pkey_mprotect         395
> +#define TARGET_NR_pkey_alloc            396
> +#define TARGET_NR_pkey_free             397
> +#define TARGET_NR_statx                 398
> +#define TARGET_NR_io_pgetevents         399
> +#define TARGET_NR_rseq                  400
> +/* 401 and 402 are unused */
> +#define TARGET_NR_clock_gettime64       403
> +#define TARGET_NR_clock_settime64       404
> +#define TARGET_NR_clock_adjtime64       405
> +#define TARGET_NR_clock_getres_time64   406
> +#define TARGET_NR_clock_nanosleep_time64 407
> +#define TARGET_NR_timer_gettime64       408
> +#define TARGET_NR_timer_settime64       409
> +#define TARGET_NR_timerfd_gettime64     410
> +#define TARGET_NR_timerfd_settime64     411
> +#define TARGET_NR_utimensat_time64      412
> +#define TARGET_NR_pselect6_time64       413
> +#define TARGET_NR_ppoll_time64          414
> +#define TARGET_NR_io_pgetevents_time64  416
> +#define TARGET_NR_recvmmsg_time64       417
> +#define TARGET_NR_mq_timedsend_time64   418
> +#define TARGET_NR_mq_timedreceive_time64 419
> +#define TARGET_NR_semtimedop_time64     420
> +#define TARGET_NR_rt_sigtimedwait_time64 421
> +#define TARGET_NR_futex_time64          422
> +#define TARGET_NR_sched_rr_get_interval_time64 423
> +#define TARGET_NR_pidfd_send_signal     424
> +#define TARGET_NR_io_uring_setup        425
> +#define TARGET_NR_io_uring_enter        426
> +#define TARGET_NR_io_uring_register     427
> +#define TARGET_NR_open_tree             428
> +#define TARGET_NR_move_mount            429
> +#define TARGET_NR_fsopen                430
> +#define TARGET_NR_fsconfig              431
> +#define TARGET_NR_fsmount               432
> +#define TARGET_NR_fspick                433
> +#define TARGET_NR_pidfd_open            434
> +#define TARGET_NR_clone3                435
>  
>  #endif
> 

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


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

* Re: [PATCH v5 07/20] linux-user: xtensa: Update syscall numbers to kernel 5.5 rc3 level
  2020-01-13 20:34 ` [PATCH v5 07/20] linux-user: xtensa: " Aleksandar Markovic
@ 2020-01-14 15:08   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 15:08 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: Max Filippov, amarkovic

Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Update xtensa syscall numbers based on Linux kernel tag v5.5-rc3
> (commit 46cf053e).
> 
> Acked-by: Max Filippov <jcmvbkbc@gmail.com>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> ---
> 
> cc: Max Filippov <jcmvbkbc@gmail.com>
> ---
>  linux-user/xtensa/syscall_nr.h | 38 ++++++++++++++++++++++++++++++++++++--
>  1 file changed, 36 insertions(+), 2 deletions(-)
> 
> diff --git a/linux-user/xtensa/syscall_nr.h b/linux-user/xtensa/syscall_nr.h
> index 27645be..3d19d0c 100644
> --- a/linux-user/xtensa/syscall_nr.h
> +++ b/linux-user/xtensa/syscall_nr.h
> @@ -431,7 +431,41 @@
>  #define TARGET_NR_pkey_free                          350
>  
>  #define TARGET_NR_statx                              351
> -
> -#define TARGET_NR_syscall_count                      352
> +#define TARGET_NR_rseq                               352
> +/* 353 through 402 are unassigned to sync up with generic numbers */
> +#define TARGET_NR_clock_gettime64                    403
> +#define TARGET_NR_clock_settime64                    404
> +#define TARGET_NR_clock_adjtime64                    405
> +#define TARGET_NR_clock_getres_time64                406
> +#define TARGET_NR_clock_nanosleep_time64             407
> +#define TARGET_NR_timer_gettime64                    408
> +#define TARGET_NR_timer_settime64                    409
> +#define TARGET_NR_timerfd_gettime64                  410
> +#define TARGET_NR_timerfd_settime64                  411
> +#define TARGET_NR_utimensat_time64                   412
> +#define TARGET_NR_pselect6_time64                    413
> +#define TARGET_NR_ppoll_time64                       414
> +#define TARGET_NR_io_pgetevents_time64               416
> +#define TARGET_NR_recvmmsg_time64                    417
> +#define TARGET_NR_mq_timedsend_time64                418
> +#define TARGET_NR_mq_timedreceive_time64             419
> +#define TARGET_NR_semtimedop_time64                  420
> +#define TARGET_NR_rt_sigtimedwait_time64             421
> +#define TARGET_NR_futex_time64                       422
> +#define TARGET_NR_sched_rr_get_interval_time64       423
> +#define TARGET_NR_pidfd_send_signal                  424
> +#define TARGET_NR_io_uring_setup                     425
> +#define TARGET_NR_io_uring_enter                     426
> +#define TARGET_NR_io_uring_register                  427
> +#define TARGET_NR_open_tree                          428
> +#define TARGET_NR_move_mount                         429
> +#define TARGET_NR_fsopen                             430
> +#define TARGET_NR_fsconfig                           431
> +#define TARGET_NR_fsmount                            432
> +#define TARGET_NR_fspick                             433
> +#define TARGET_NR_pidfd_open                         434
> +#define TARGET_NR_clone3                             435
> +
> +#define TARGET_NR_syscall_count                      436
>  
>  #endif /* XTENSA_SYSCALL_NR_H */
> 

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


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

* Re: [PATCH v5 02/20] linux-user: alpha: Update syscall numbers to kernel 5.5 rc3 level
  2020-01-13 20:34 ` [PATCH v5 02/20] linux-user: alpha: Update syscall numbers to kernel 5.5 rc3 level Aleksandar Markovic
@ 2020-01-14 15:12   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 15:12 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic, Richard Henderson

Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Update alpha syscall numbers based on Linux kernel tag v5.5-rc3
> (commit 46cf053e).
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> ---
> 
> cc: Richard Henderson <rth@twiddle.net>
> ---
>  linux-user/alpha/syscall_nr.h | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/linux-user/alpha/syscall_nr.h b/linux-user/alpha/syscall_nr.h
> index 2e5541b..c29fc17 100644
> --- a/linux-user/alpha/syscall_nr.h
> +++ b/linux-user/alpha/syscall_nr.h
> @@ -453,5 +453,40 @@
>  #define TARGET_NR_getrandom                     511
>  #define TARGET_NR_memfd_create                  512
>  #define TARGET_NR_execveat                      513
> +#define TARGET_NR_seccomp                       514
> +#define TARGET_NR_bpf                           515
> +#define TARGET_NR_userfaultfd                   516
> +#define TARGET_NR_membarrier                    517
> +#define TARGET_NR_mlock2                        518
> +#define TARGET_NR_copy_file_range               519
> +#define TARGET_NR_preadv2                       520
> +#define TARGET_NR_pwritev2                      521
> +#define TARGET_NR_statx                         522
> +#define TARGET_NR_io_pgetevents                 523
> +#define TARGET_NR_pkey_mprotect                 524
> +#define TARGET_NR_pkey_alloc                    525
> +#define TARGET_NR_pkey_free                     526
> +#define TARGET_NR_rseq                          527
> +#define TARGET_NR_statfs64                      528
> +#define TARGET_NR_fstatfs64                     529
> +#define TARGET_NR_getegid                       530
> +#define TARGET_NR_geteuid                       531
> +#define TARGET_NR_getppid                       532
> +/*
> + * all other architectures have common numbers for new syscall, alpha
> + * is the exception.
> + */
> +#define TARGET_NR_pidfd_send_signal             534
> +#define TARGET_NR_io_uring_setup                535
> +#define TARGET_NR_io_uring_enter                536
> +#define TARGET_NR_io_uring_register             537
> +#define TARGET_NR_open_tree                     538
> +#define TARGET_NR_move_mount                    539
> +#define TARGET_NR_fsopen                        540
> +#define TARGET_NR_fsconfig                      541
> +#define TARGET_NR_fsmount                       542
> +#define TARGET_NR_fspick                        543
> +#define TARGET_NR_pidfd_open                    544
> +/* 545 reserved for clone3 */
>  
>  #endif
> 

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


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

* Re: [PATCH v5 06/20] linux-user: x86_64: Update syscall numbers to kernel 5.5 rc3 level
  2020-01-13 20:34 ` [PATCH v5 06/20] linux-user: x86_64: " Aleksandar Markovic
@ 2020-01-14 15:16   ` Laurent Vivier
  0 siblings, 0 replies; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 15:16 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, amarkovic, Richard Henderson

Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Update x86_64 syscall numbers based on Linux kernel tag v5.5-rc3
> (commit 46cf053e).
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> ---
> 
> cc: Paolo Bonzini <pbonzini@redhat.com>
> cc: Richard Henderson <rth@twiddle.net>
> cc: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  linux-user/x86_64/syscall_nr.h | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/linux-user/x86_64/syscall_nr.h b/linux-user/x86_64/syscall_nr.h
> index 9b6981e..e5d14ec 100644
> --- a/linux-user/x86_64/syscall_nr.h
> +++ b/linux-user/x86_64/syscall_nr.h
> @@ -328,5 +328,29 @@
>  #define TARGET_NR_membarrier            324
>  #define TARGET_NR_mlock2                325
>  #define TARGET_NR_copy_file_range       326
> +#define TARGET_NR_preadv2               327
> +#define TARGET_NR_pwritev2              328
> +#define TARGET_NR_pkey_mprotect         329
> +#define TARGET_NR_pkey_alloc            330
> +#define TARGET_NR_pkey_free             331
> +#define TARGET_NR_statx                 332
> +#define TARGET_NR_io_pgetevents         333
> +#define TARGET_NR_rseq                  334
> +/*
> + * don't use numbers 387 through 423, add new calls after the last
> + * 'common' entry
> + */
> +#define TARGET_NR_pidfd_send_signal     424
> +#define TARGET_NR_io_uring_setup        425
> +#define TARGET_NR_io_uring_enter        426
> +#define TARGET_NR_io_uring_register     427
> +#define TARGET_NR_open_tree             428
> +#define TARGET_NR_move_mount            429
> +#define TARGET_NR_fsopen                430
> +#define TARGET_NR_fsconfig              431
> +#define TARGET_NR_fsmount               432
> +#define TARGET_NR_fspick                433
> +#define TARGET_NR_pidfd_open            434
> +#define TARGET_NR_clone3                435
>  
>  #endif
> 

And what about to update linux-user/i386/syscall_nr.h too?

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


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

* Re: [PATCH v5 05/20] linux-user: mips: Update syscall numbers to kernel 5.5 rc3 level
  2020-01-13 20:34 ` [PATCH v5 05/20] linux-user: mips: " Aleksandar Markovic
@ 2020-01-14 16:39   ` Laurent Vivier
  2020-02-04 11:56     ` Aleksandar Markovic
  0 siblings, 1 reply; 44+ messages in thread
From: Laurent Vivier @ 2020-01-14 16:39 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Update mips syscall numbers based on Linux kernel tag v5.5-rc3
> (commit 46cf053e).
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/mips/cpu_loop.c     | 78 +++++++++++++++++++++++++++++++++++++++++-
>  linux-user/mips/syscall_nr.h   | 45 ++++++++++++++++++++++++
>  linux-user/mips64/syscall_nr.h | 13 +++++++
>  3 files changed, 135 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
> index 39915b3..b81479b 100644
> --- a/linux-user/mips/cpu_loop.c
> +++ b/linux-user/mips/cpu_loop.c
> @@ -25,8 +25,9 @@
>  #include "internal.h"
>  
>  # ifdef TARGET_ABI_MIPSO32
> +#  define MIPS_SYSCALL_NUMBER_UNUSED -1

I'm not sure you need to introduce this change.

The case already exists (stat, fstat, old_select, lstat, ...) and the
entry that was used is:

           MIPS_SYS(sys_ni_syscall , 0)

perhaps you can do the same ?

I think the do_syscall() will return -ENOSYS as the TARGET_NR_XXX is not
defined for o32 in linux-user/mips/syscall_nr.h.

Thanks,
Laurent


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

* Re: [PATCH v5 05/20] linux-user: mips: Update syscall numbers to kernel 5.5 rc3 level
  2020-01-14 16:39   ` Laurent Vivier
@ 2020-02-04 11:56     ` Aleksandar Markovic
  2020-02-04 22:34       ` Laurent Vivier
  0 siblings, 1 reply; 44+ messages in thread
From: Aleksandar Markovic @ 2020-02-04 11:56 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Aleksandar Markovic, QEMU Developers, Aleksandar Markovic

On Tue, Jan 14, 2020 at 5:40 PM Laurent Vivier <laurent@vivier.eu> wrote:
>
> Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> > From: Aleksandar Markovic <amarkovic@wavecomp.com>
> >
> > Update mips syscall numbers based on Linux kernel tag v5.5-rc3
> > (commit 46cf053e).
> >
> > Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> > ---
> >  linux-user/mips/cpu_loop.c     | 78 +++++++++++++++++++++++++++++++++++++++++-
> >  linux-user/mips/syscall_nr.h   | 45 ++++++++++++++++++++++++
> >  linux-user/mips64/syscall_nr.h | 13 +++++++
> >  3 files changed, 135 insertions(+), 1 deletion(-)
> >
> > diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
> > index 39915b3..b81479b 100644
> > --- a/linux-user/mips/cpu_loop.c
> > +++ b/linux-user/mips/cpu_loop.c
> > @@ -25,8 +25,9 @@
> >  #include "internal.h"
> >
> >  # ifdef TARGET_ABI_MIPSO32
> > +#  define MIPS_SYSCALL_NUMBER_UNUSED -1
>
> I'm not sure you need to introduce this change.
>
> The case already exists (stat, fstat, old_select, lstat, ...) and the
> entry that was used is:
>
>            MIPS_SYS(sys_ni_syscall , 0)
>
> perhaps you can do the same ?
>

I like better the new way of dealing with this (like in this patch), since it is
more explicit. For now, I won't change this patch, if you agree, and later on
I will synchronize all such cases to be the same (but this is not critical for
the time being).

Yours,
Aleksandar

> I think the do_syscall() will return -ENOSYS as the TARGET_NR_XXX is not
> defined for o32 in linux-user/mips/syscall_nr.h.
>
> Thanks,
> Laurent
>


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

* Re: [PATCH v5 05/20] linux-user: mips: Update syscall numbers to kernel 5.5 rc3 level
  2020-02-04 11:56     ` Aleksandar Markovic
@ 2020-02-04 22:34       ` Laurent Vivier
  2020-02-04 22:53         ` Aleksandar Markovic
  0 siblings, 1 reply; 44+ messages in thread
From: Laurent Vivier @ 2020-02-04 22:34 UTC (permalink / raw)
  To: Aleksandar Markovic
  Cc: Aleksandar Markovic, QEMU Developers, Aleksandar Markovic

Le 04/02/2020 à 12:56, Aleksandar Markovic a écrit :
> On Tue, Jan 14, 2020 at 5:40 PM Laurent Vivier <laurent@vivier.eu> wrote:
>>
>> Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
>>> From: Aleksandar Markovic <amarkovic@wavecomp.com>
>>>
>>> Update mips syscall numbers based on Linux kernel tag v5.5-rc3
>>> (commit 46cf053e).
>>>
>>> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
>>> ---
>>>  linux-user/mips/cpu_loop.c     | 78 +++++++++++++++++++++++++++++++++++++++++-
>>>  linux-user/mips/syscall_nr.h   | 45 ++++++++++++++++++++++++
>>>  linux-user/mips64/syscall_nr.h | 13 +++++++
>>>  3 files changed, 135 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
>>> index 39915b3..b81479b 100644
>>> --- a/linux-user/mips/cpu_loop.c
>>> +++ b/linux-user/mips/cpu_loop.c
>>> @@ -25,8 +25,9 @@
>>>  #include "internal.h"
>>>
>>>  # ifdef TARGET_ABI_MIPSO32
>>> +#  define MIPS_SYSCALL_NUMBER_UNUSED -1
>>
>> I'm not sure you need to introduce this change.
>>
>> The case already exists (stat, fstat, old_select, lstat, ...) and the
>> entry that was used is:
>>
>>            MIPS_SYS(sys_ni_syscall , 0)
>>
>> perhaps you can do the same ?
>>
> 
> I like better the new way of dealing with this (like in this patch), since it is
> more explicit. For now, I won't change this patch, if you agree, and later on
> I will synchronize all such cases to be the same (but this is not critical for
> the time being).

So Perhaps you can do:

#  define MIPS_SYSCALL_NUMBER_UNUSED 0

And so the real availability of the syscall will be detected in
do_syscall1() based on a "#ifdef TARGET_XXXX" (well, not sure
syscall_nr.h differentiates O32 and N32)

By the way, do we really need this table?

It seems kernel is always copying 4 words from the stack.
But kernel code is not really clear, perhaps I'm missing something...

In the end, as you are the MIPS maintainer, you can choose the solution
you prefer.

Thanks,
Laurent


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

* Re: [PATCH v5 05/20] linux-user: mips: Update syscall numbers to kernel 5.5 rc3 level
  2020-02-04 22:34       ` Laurent Vivier
@ 2020-02-04 22:53         ` Aleksandar Markovic
  0 siblings, 0 replies; 44+ messages in thread
From: Aleksandar Markovic @ 2020-02-04 22:53 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Aleksandar Markovic, QEMU Developers, Aleksandar Markovic

[-- Attachment #1: Type: text/plain, Size: 3075 bytes --]

On Tuesday, February 4, 2020, Laurent Vivier <laurent@vivier.eu> wrote:

> Le 04/02/2020 à 12:56, Aleksandar Markovic a écrit :
> > On Tue, Jan 14, 2020 at 5:40 PM Laurent Vivier <laurent@vivier.eu>
> wrote:
> >>
> >> Le 13/01/2020 à 21:34, Aleksandar Markovic a écrit :
> >>> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> >>>
> >>> Update mips syscall numbers based on Linux kernel tag v5.5-rc3
> >>> (commit 46cf053e).
> >>>
> >>> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> >>> ---
> >>>  linux-user/mips/cpu_loop.c     | 78 ++++++++++++++++++++++++++++++
> +++++++++++-
> >>>  linux-user/mips/syscall_nr.h   | 45 ++++++++++++++++++++++++
> >>>  linux-user/mips64/syscall_nr.h | 13 +++++++
> >>>  3 files changed, 135 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c
> >>> index 39915b3..b81479b 100644
> >>> --- a/linux-user/mips/cpu_loop.c
> >>> +++ b/linux-user/mips/cpu_loop.c
> >>> @@ -25,8 +25,9 @@
> >>>  #include "internal.h"
> >>>
> >>>  # ifdef TARGET_ABI_MIPSO32
> >>> +#  define MIPS_SYSCALL_NUMBER_UNUSED -1
> >>
> >> I'm not sure you need to introduce this change.
> >>
> >> The case already exists (stat, fstat, old_select, lstat, ...) and the
> >> entry that was used is:
> >>
> >>            MIPS_SYS(sys_ni_syscall , 0)
> >>
> >> perhaps you can do the same ?
> >>
> >
> > I like better the new way of dealing with this (like in this patch),
> since it is
> > more explicit. For now, I won't change this patch, if you agree, and
> later on
> > I will synchronize all such cases to be the same (but this is not
> critical for
> > the time being).
>
> So Perhaps you can do:
>
> #  define MIPS_SYSCALL_NUMBER_UNUSED 0
>
> And so the real availability of the syscall will be detected in
> do_syscall1() based on a "#ifdef TARGET_XXXX" (well, not sure
> syscall_nr.h differentiates O32 and N32)
>
> By the way, do we really need this table?
>
> It seems kernel is always copying 4 words from the stack.
> But kernel code is not really clear, perhaps I'm missing something...
>
>
Yes, Laurent, we actually don't need that table. We could have just a
series of preprocessor constants, like any other ABI, but it would have
required larger code reorganization. It started that way long time ago, and
nobody bothered to correct this, partially for sure because of fear of
regressions.

I am not in the mood for refactoring this area of code right now in any
substantial way, until the situation stabilizes with new syscalls. The
current solution in this patch is good enough for me, and it is not that
intrusive, which I like. Please accept it as is, and the time for
refactoring will hopefully come at some later point of time.

I prefer several incremental smaller refactoring to one large one. I'll
take into account all your suggestions and hints.

Thanks, Aleksandar


> In the end, as you are the MIPS maintainer, you can choose the solution
> you prefer.
>
> Thanks,
> Laurent
>

[-- Attachment #2: Type: text/html, Size: 4043 bytes --]

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

end of thread, other threads:[~2020-02-04 22:54 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13 20:34 [PATCH v5 00/20] linux-user: Misc patches for 5.0 Aleksandar Markovic
2020-01-13 20:34 ` [PATCH v5 01/20] linux-user: Fix some constants in termbits.h Aleksandar Markovic
2020-01-14 14:16   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 02/20] linux-user: alpha: Update syscall numbers to kernel 5.5 rc3 level Aleksandar Markovic
2020-01-14 15:12   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 03/20] linux-user: m68k: " Aleksandar Markovic
2020-01-14 15:03   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 04/20] linux-user: microblaze: " Aleksandar Markovic
2020-01-14 15:06   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 05/20] linux-user: mips: " Aleksandar Markovic
2020-01-14 16:39   ` Laurent Vivier
2020-02-04 11:56     ` Aleksandar Markovic
2020-02-04 22:34       ` Laurent Vivier
2020-02-04 22:53         ` Aleksandar Markovic
2020-01-13 20:34 ` [PATCH v5 06/20] linux-user: x86_64: " Aleksandar Markovic
2020-01-14 15:16   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 07/20] linux-user: xtensa: " Aleksandar Markovic
2020-01-14 15:08   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 08/20] linux-user: xtensa: Remove unused constant TARGET_NR_syscall_count Aleksandar Markovic
2020-01-14 14:59   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 09/20] linux-user: Add support for FS_IOC_<GET|SET>VERSION ioctls Aleksandar Markovic
2020-01-14 14:21   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 10/20] linux-user: Add support for FS_IOC32_<GET|SET>FLAGS ioctls Aleksandar Markovic
2020-01-14 14:24   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 11/20] linux-user: Add support for FS_IOC32_<GET|SET>VERSION ioctls Aleksandar Markovic
2020-01-14 14:24   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 12/20] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls Aleksandar Markovic
2020-01-14 14:29   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 13/20] linux-user: Add support for FITRIM ioctl Aleksandar Markovic
2020-01-14 14:32   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 14/20] linux-user: Add support for FIFREEZE and FITHAW ioctls Aleksandar Markovic
2020-01-14 14:34   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 15/20] linux-user: Add support for FD<SETEMSGTRESH|SETMAXERRS|GETMAXERRS> ioctls Aleksandar Markovic
2020-01-14 14:36   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 16/20] linux-user: Add support for FDFMT<BEG|TRK|END> ioctls Aleksandar Markovic
2020-01-14 14:38   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 17/20] linux-user: Add support for FDGETFDCSTAT ioctl Aleksandar Markovic
2020-01-14 14:42   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 18/20] configure: Detect kcov support and introduce CONFIG_KCOV Aleksandar Markovic
2020-01-14 14:48   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 19/20] linux-user: Add support for KCOV_<ENABLE|DISABLE> ioctls Aleksandar Markovic
2020-01-14 14:49   ` Laurent Vivier
2020-01-13 20:34 ` [PATCH v5 20/20] linux-user: Add support for KCOV_INIT_TRACE ioctl Aleksandar Markovic
2020-01-14 14:53   ` Laurent Vivier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.