All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v6 0/7] linux-user: Fix miscellaneous Mips-specific issues
@ 2016-09-16 11:14 Aleksandar Markovic
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 1/7] linux-user: Fix TARGET_SIOCATMARK definition for Mips Aleksandar Markovic
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Aleksandar Markovic @ 2016-09-16 11:14 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, aurelien, leon.alrae,
	petar.jovanovic, miodrag.dinic, aleksandar.rikalo,
	aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

v5->v6:

  - Corrected two instances of wrong field type in the patch on target_flock.
  - Added a patch that corrects handling of EDQUOT error code for Mips.
  - Added a patch that adds missing Mips-related items in strace.list.

v4->v5:

  - Commit messages improved.

v3->v4:

  - Added a patch on agrument rearangement.

v2->v3:

  - Minor fixes in the commit messages.

v1->v2:

  - Improved a comment in the patch about target_semid64_ds (now 4/4).
  - Added a patch that fixes TARGET_SIOCATMARK for Mips.
  - Changed order of patches to be more structured.

This series fixes several wrong definitions of preprocessor constants and
structures in Qemu user mode, as well as two other Mips-related problems.

Aleksandar Markovic (7):
  linux-user: Fix TARGET_SIOCATMARK definition for Mips
  linux-user: Fix TARGET_F_GETOWN definition for Mips
  linux-user: Fix structure target_flock definition for Mips
  linux-user: Fix structure target_semid64_ds definition for Mips
  linux-user: Fix certain argument alignment cases for Mips64
  linux-user: Add missing TARGET_EDQUOT error code for Mips
  linux-user: Add missing Mips syscalls items in strace.list

 linux-user/mips/target_structs.h   |  16 ++++++
 linux-user/mips/target_syscall.h   |   2 +
 linux-user/mips64/target_syscall.h |   2 +
 linux-user/strace.list             | 114 +++++++++++++++++++++++++++++++++++++
 linux-user/syscall.c               |  10 +++-
 linux-user/syscall_defs.h          |  12 +++-
 6 files changed, 154 insertions(+), 2 deletions(-)

-- 
2.9.3

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

* [Qemu-devel] [PATCH v6 1/7] linux-user: Fix TARGET_SIOCATMARK definition for Mips
  2016-09-16 11:14 [Qemu-devel] [PATCH v6 0/7] linux-user: Fix miscellaneous Mips-specific issues Aleksandar Markovic
@ 2016-09-16 11:14 ` Aleksandar Markovic
  2016-09-16 18:22   ` Laurent Vivier
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 2/7] linux-user: Fix TARGET_F_GETOWN " Aleksandar Markovic
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Aleksandar Markovic @ 2016-09-16 11:14 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, aurelien, leon.alrae,
	petar.jovanovic, miodrag.dinic, aleksandar.rikalo,
	aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

This patch fixes wrong definition of TARGET_SIOCATMARK for Mips.

The current definition is:

  #define SIOCATMARK      0x8905

while the correct definition is:

  #define SIOCATMARK      TARGET_IOR('s', 7, int)

See Linux kernel source file arch/mips/include/uapi/asm/sockios.h#L19
for reference.

This patch also a fixes LTP test failure for test sockioctl01, for Mips.

Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/syscall_defs.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 7835654..cf89f16 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -898,7 +898,11 @@ struct target_pollfd {
 #define TARGET_KDSETLED        0x4B32	/* set led state [lights, not flags] */
 #define TARGET_KDSIGACCEPT     0x4B4E
 
+#if defined(TARGET_MIPS)
+#define TARGET_SIOCATMARK      TARGET_IOR('s', 7, int)
+#else
 #define TARGET_SIOCATMARK      0x8905
+#endif
 
 /* Networking ioctls */
 #define TARGET_SIOCADDRT       0x890B          /* add routing table entry */
-- 
2.9.3

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

* [Qemu-devel] [PATCH v6 2/7] linux-user: Fix TARGET_F_GETOWN definition for Mips
  2016-09-16 11:14 [Qemu-devel] [PATCH v6 0/7] linux-user: Fix miscellaneous Mips-specific issues Aleksandar Markovic
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 1/7] linux-user: Fix TARGET_SIOCATMARK definition for Mips Aleksandar Markovic
@ 2016-09-16 11:14 ` Aleksandar Markovic
  2016-09-16 18:30   ` Laurent Vivier
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 3/7] linux-user: Fix structure target_flock " Aleksandar Markovic
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Aleksandar Markovic @ 2016-09-16 11:14 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, aurelien, leon.alrae,
	petar.jovanovic, miodrag.dinic, aleksandar.rikalo,
	aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

For some reason, Qemu's TARGET_F_GETOWN constant for Mips does not
match the correct value of correspondant F_GETOWN. This patch fixes
this problem.

For reference, see Mips' F_GETOWN definition in Linux kernel at
arch/mips/include/uapi/asm/fcntl.h#L44.

This patch also fixes some fcntl()-related LTP tests for Qemu
user mode for Mips.

Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/syscall_defs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index cf89f16..44b1197 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2158,7 +2158,7 @@ struct target_statfs64 {
 #define TARGET_F_SETLK         6
 #define TARGET_F_SETLKW        7
 #define TARGET_F_SETOWN        24       /*  for sockets. */
-#define TARGET_F_GETOWN        25       /*  for sockets. */
+#define TARGET_F_GETOWN        23       /*  for sockets. */
 #else
 #define TARGET_F_GETLK         5
 #define TARGET_F_SETLK         6
-- 
2.9.3

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

* [Qemu-devel] [PATCH v6 3/7] linux-user: Fix structure target_flock definition for Mips
  2016-09-16 11:14 [Qemu-devel] [PATCH v6 0/7] linux-user: Fix miscellaneous Mips-specific issues Aleksandar Markovic
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 1/7] linux-user: Fix TARGET_SIOCATMARK definition for Mips Aleksandar Markovic
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 2/7] linux-user: Fix TARGET_F_GETOWN " Aleksandar Markovic
@ 2016-09-16 11:14 ` Aleksandar Markovic
  2016-09-16 18:42   ` Laurent Vivier
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 4/7] linux-user: Fix structure target_semid64_ds " Aleksandar Markovic
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Aleksandar Markovic @ 2016-09-16 11:14 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, aurelien, leon.alrae,
	petar.jovanovic, miodrag.dinic, aleksandar.rikalo,
	aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

Structure flock is defined for Mips in a way different from any
other platform. For reference, see Linux kernel source code files:

arch/mips/include/uapi/asm/fcntl.h, line 63 (for Mips)
include/uapi/asm-generic/fcntl.h, line 195 (for all other platforms)

This patch fix this problem, by amending structure target_flock,
for Mips only.

Besides, this patch fixes LTP tests fcntl11, fcntl17, fcntl19, fcntl20,
and fcntl21, which are currently failing, if executed in Qemu user mode
for Mips platforms.

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
---
 linux-user/syscall_defs.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 44b1197..14a1425 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2327,7 +2327,13 @@ struct target_flock {
     short l_whence;
     abi_long l_start;
     abi_long l_len;
+#if defined(TARGET_MIPS)
+    abi_long l_sysid;
+#endif
     int l_pid;
+#if defined(TARGET_MIPS)
+    abi_long pad[4];
+#endif
 };
 
 struct target_flock64 {
-- 
2.9.3

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

* [Qemu-devel] [PATCH v6 4/7] linux-user: Fix structure target_semid64_ds definition for Mips
  2016-09-16 11:14 [Qemu-devel] [PATCH v6 0/7] linux-user: Fix miscellaneous Mips-specific issues Aleksandar Markovic
                   ` (2 preceding siblings ...)
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 3/7] linux-user: Fix structure target_flock " Aleksandar Markovic
@ 2016-09-16 11:14 ` Aleksandar Markovic
  2016-09-16 19:00   ` Laurent Vivier
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 5/7] linux-user: Fix certain argument alignment cases for Mips64 Aleksandar Markovic
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Aleksandar Markovic @ 2016-09-16 11:14 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, aurelien, leon.alrae,
	petar.jovanovic, miodrag.dinic, aleksandar.rikalo,
	aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

This patch corrects target_semid64_ds structure definition for Mips.

See, for example definition of semid64_ds for Mips in Linux kernel:
arch/mips/include/uapi/asm/sembuf.h#L13.

This patch will also fix certain semaphore-related LTP tests for Mips,
if they are executed in Qemu user mode for any Mips platform.

Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/mips/target_structs.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/linux-user/mips/target_structs.h b/linux-user/mips/target_structs.h
index fbd9955..5ba124d 100644
--- a/linux-user/mips/target_structs.h
+++ b/linux-user/mips/target_structs.h
@@ -45,4 +45,20 @@ struct target_shmid_ds {
     abi_ulong __unused2;
 };
 
+#define TARGET_SEMID64_DS
+
+/*
+ * The semid64_ds structure for the MIPS architecture.
+ * Note extra padding because this structure is passed back and forth
+ * between kernel and user space.
+ */
+struct target_semid64_ds {
+    struct target_ipc_perm sem_perm;
+    abi_ulong sem_otime;
+    abi_ulong sem_ctime;
+    abi_ulong sem_nsems;
+    abi_ulong __unused3;
+    abi_ulong __unused4;
+};
+
 #endif
-- 
2.9.3

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

* [Qemu-devel] [PATCH v6 5/7] linux-user: Fix certain argument alignment cases for Mips64
  2016-09-16 11:14 [Qemu-devel] [PATCH v6 0/7] linux-user: Fix miscellaneous Mips-specific issues Aleksandar Markovic
                   ` (3 preceding siblings ...)
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 4/7] linux-user: Fix structure target_semid64_ds " Aleksandar Markovic
@ 2016-09-16 11:14 ` Aleksandar Markovic
  2016-09-16 19:29   ` Laurent Vivier
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 6/7] linux-user: Add missing TARGET_EDQUOT error code for Mips Aleksandar Markovic
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 7/7] linux-user: Add missing Mips syscalls items in strace.list Aleksandar Markovic
  6 siblings, 1 reply; 19+ messages in thread
From: Aleksandar Markovic @ 2016-09-16 11:14 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, aurelien, leon.alrae,
	petar.jovanovic, miodrag.dinic, aleksandar.rikalo,
	aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

The function that is changed in this patch is supposed to indicate that
there was certaing argument rearangement related to 64-bit arguments on
32-bit platforms. The background on such rearangements can be found,
for example, in the man page for syscall(2).

However, for 64-bit Mips architectures there is no such rearangement,
and this patch reflects it.

Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com>
Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/syscall.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ca06943..ee23b29 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -620,7 +620,14 @@ static inline int regpairs_aligned(void *cpu_env) {
     return ((((CPUARMState *)cpu_env)->eabi) == 1) ;
 }
 #elif defined(TARGET_MIPS)
-static inline int regpairs_aligned(void *cpu_env) { return 1; }
+static inline int regpairs_aligned(void *cpu_env)
+{
+#if TARGET_ABI_BITS == 32
+    return 1;
+#else
+    return 0;
+#endif
+}
 #elif defined(TARGET_PPC) && !defined(TARGET_PPC64)
 /* SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pairs
  * of registers which translates to the same as ARM/MIPS, because we start with
-- 
2.9.3

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

* [Qemu-devel] [PATCH v6 6/7] linux-user: Add missing TARGET_EDQUOT error code for Mips
  2016-09-16 11:14 [Qemu-devel] [PATCH v6 0/7] linux-user: Fix miscellaneous Mips-specific issues Aleksandar Markovic
                   ` (4 preceding siblings ...)
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 5/7] linux-user: Fix certain argument alignment cases for Mips64 Aleksandar Markovic
@ 2016-09-16 11:14 ` Aleksandar Markovic
  2016-09-16 19:22   ` Laurent Vivier
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 7/7] linux-user: Add missing Mips syscalls items in strace.list Aleksandar Markovic
  6 siblings, 1 reply; 19+ messages in thread
From: Aleksandar Markovic @ 2016-09-16 11:14 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, aurelien, leon.alrae,
	petar.jovanovic, miodrag.dinic, aleksandar.rikalo,
	aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

EDQUOT is defined for Mips platform in Linux kernel in such a way
that it has different value than on most other platforms. However,
correspondant TARGET_EDQUOT for Mips is missing in Qemu code. Moreover,
TARGET_EDQUOT is missing from the table for conversion of error codes
from host to target. This patch fixes these problems.

Without this patch, syscalls add_key(), keyctl(), link(), mkdir(), mknod(),
open(), rename(), request_key(), setxattr(), symlink(), and write() will not
be able to return the right error code in some scenarios on Mips platform.
(Some of these syscalls are not yet supported in Qemu, but once they are
supported, they will need correct EDQUOT handling.)

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/mips/target_syscall.h   | 2 ++
 linux-user/mips64/target_syscall.h | 2 ++
 linux-user/syscall.c               | 1 +
 3 files changed, 5 insertions(+)

diff --git a/linux-user/mips/target_syscall.h b/linux-user/mips/target_syscall.h
index 2b4f390..827799f 100644
--- a/linux-user/mips/target_syscall.h
+++ b/linux-user/mips/target_syscall.h
@@ -221,6 +221,8 @@ struct target_pt_regs {
 #undef TARGET_ENOTRECOVERABLE
 #define TARGET_ENOTRECOVERABLE 166     /* State not recoverable */
 
+#undef TARGET_EDQUOT
+#define TARGET_EDQUOT          1133    /* Quota exceeded */
 
 #define UNAME_MACHINE "mips"
 #define UNAME_MINIMUM_RELEASE "2.6.32"
diff --git a/linux-user/mips64/target_syscall.h b/linux-user/mips64/target_syscall.h
index 8da9c1f..29c1983 100644
--- a/linux-user/mips64/target_syscall.h
+++ b/linux-user/mips64/target_syscall.h
@@ -218,6 +218,8 @@ struct target_pt_regs {
 #undef TARGET_ENOTRECOVERABLE
 #define TARGET_ENOTRECOVERABLE 166     /* State not recoverable */
 
+#undef TARGET_EDQUOT
+#define TARGET_EDQUOT          1133    /* Quota exceeded */
 
 #define UNAME_MACHINE "mips64"
 #define UNAME_MINIMUM_RELEASE "2.6.32"
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ee23b29..e4bd40d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -725,6 +725,7 @@ static uint16_t host_to_target_errno_table[ERRNO_TABLE_SIZE] = {
     [ENAVAIL]		= TARGET_ENAVAIL,
     [EISNAM]		= TARGET_EISNAM,
     [EREMOTEIO]		= TARGET_EREMOTEIO,
+    [EDQUOT]            = TARGET_EDQUOT,
     [ESHUTDOWN]		= TARGET_ESHUTDOWN,
     [ETOOMANYREFS]	= TARGET_ETOOMANYREFS,
     [ETIMEDOUT]		= TARGET_ETIMEDOUT,
-- 
2.9.3

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

* [Qemu-devel] [PATCH v6 7/7] linux-user: Add missing Mips syscalls items in strace.list
  2016-09-16 11:14 [Qemu-devel] [PATCH v6 0/7] linux-user: Fix miscellaneous Mips-specific issues Aleksandar Markovic
                   ` (5 preceding siblings ...)
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 6/7] linux-user: Add missing TARGET_EDQUOT error code for Mips Aleksandar Markovic
@ 2016-09-16 11:14 ` Aleksandar Markovic
  2016-09-16 19:35   ` Laurent Vivier
  6 siblings, 1 reply; 19+ messages in thread
From: Aleksandar Markovic @ 2016-09-16 11:14 UTC (permalink / raw)
  To: qemu-devel, riku.voipio, peter.maydell, aurelien, leon.alrae,
	petar.jovanovic, miodrag.dinic, aleksandar.rikalo,
	aleksandar.markovic

From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

Without this patch, a number of Mips syscalls will be logged in the following
way (in this examople, this is an invocation of accept4()):

  86906 Unknown syscall 4334

This patch provides standard Qemu's strace output for such cases, like this:

  95861 accept4(3,1996486000,1996486016,128,0,0) = 5

Such output may be further improvad by providing strace-related functions
that handle only particular syscalls, but this is beyond the scope of
this patch.

Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
---
 linux-user/strace.list | 114 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 114 insertions(+)

diff --git a/linux-user/strace.list b/linux-user/strace.list
index aa967a2..608f7e0 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -6,6 +6,9 @@
 #ifdef TARGET_NR_accept
 { TARGET_NR_accept, "accept" , NULL, print_accept, NULL },
 #endif
+#ifdef TARGET_NR_accept4
+{ TARGET_NR_accept4, "accept4" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_access
 { TARGET_NR_access, "access" , NULL, print_access, NULL },
 #endif
@@ -39,6 +42,9 @@
 #ifdef TARGET_NR_bind
 { TARGET_NR_bind, "bind" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_bpf
+{ TARGET_NR_bpf, "bpf" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_break
 { TARGET_NR_break, "break" , NULL, NULL, NULL },
 #endif
@@ -123,18 +129,30 @@
 #ifdef TARGET_NR_epoll_ctl_old
 { TARGET_NR_epoll_ctl_old, "epoll_ctl_old" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_epoll_pwait
+{ TARGET_NR_epoll_pwait, "epoll_pwait" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_epoll_wait
 { TARGET_NR_epoll_wait, "epoll_wait" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_epoll_wait_old
 { TARGET_NR_epoll_wait_old, "epoll_wait_old" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_eventfd
+{ TARGET_NR_eventfd, "eventfd" , NULL, NULL, NULL },
+#endif
+#ifdef TARGET_NR_eventfd2
+{ TARGET_NR_eventfd2, "eventfd2" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_execv
 { TARGET_NR_execv, "execv" , NULL, print_execv, NULL },
 #endif
 #ifdef TARGET_NR_execve
 { TARGET_NR_execve, "execve" , NULL, print_execve, NULL },
 #endif
+#ifdef TARGET_NR_execveat
+{ TARGET_NR_execveat, "execveat" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_exec_with_loader
 { TARGET_NR_exec_with_loader, "exec_with_loader" , NULL, NULL, NULL },
 #endif
@@ -156,6 +174,15 @@
 #ifdef TARGET_NR_fadvise64_64
 { TARGET_NR_fadvise64_64, "fadvise64_64" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_fallocate
+{ TARGET_NR_fallocate, "fallocate" , NULL, NULL, NULL },
+#endif
+#ifdef TARGET_NR_fanotify_init
+{ TARGET_NR_fanotify_init, "fanotify_init" , NULL, NULL, NULL },
+#endif
+#ifdef TARGET_NR_fanotify_mark
+{ TARGET_NR_fanotify_mark, "fanotify_mark" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_fchdir
 { TARGET_NR_fchdir, "fchdir" , NULL, NULL, NULL },
 #endif
@@ -186,6 +213,9 @@
 #ifdef TARGET_NR_fgetxattr
 { TARGET_NR_fgetxattr, "fgetxattr" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_finit_module
+{ TARGET_NR_finit_module, "finit_module" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_flistxattr
 { TARGET_NR_flistxattr, "flistxattr" , NULL, NULL, NULL },
 #endif
@@ -231,6 +261,9 @@
 #ifdef TARGET_NR_futimesat
 { TARGET_NR_futimesat, "futimesat" , NULL, print_futimesat, NULL },
 #endif
+#ifdef TARGET_NR_getcpu
+{ TARGET_NR_getcpu, "getcpu" , "%s(%p,%d)", NULL, NULL },
+#endif
 #ifdef TARGET_NR_getcwd
 { TARGET_NR_getcwd, "getcwd" , "%s(%p,%d)", NULL, NULL },
 #endif
@@ -306,6 +339,9 @@
 #ifdef TARGET_NR_getpriority
 { TARGET_NR_getpriority, "getpriority", "%s(%#x,%#x)", NULL, NULL },
 #endif
+#ifdef TARGET_NR_getrandom
+{ TARGET_NR_getrandom, "getrandom", NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_getresgid
 { TARGET_NR_getresgid, "getresgid" , NULL, NULL, NULL },
 #endif
@@ -379,6 +415,9 @@
 #ifdef TARGET_NR_inotify_init
 { TARGET_NR_inotify_init, "inotify_init" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_inotify_init1
+{ TARGET_NR_inotify_init1, "inotify_init1" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_inotify_rm_watch
 { TARGET_NR_inotify_rm_watch, "inotify_rm_watch" , NULL, NULL, NULL },
 #endif
@@ -415,6 +454,9 @@
 #ifdef TARGET_NR_ipc
 { TARGET_NR_ipc, "ipc" , NULL, print_ipc, NULL },
 #endif
+#ifdef TARGET_NR_kcmp
+{ TARGET_NR_kcmp, "kcmp" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_kexec_load
 { TARGET_NR_kexec_load, "kexec_load" , NULL, NULL, NULL },
 #endif
@@ -484,6 +526,12 @@
 #ifdef TARGET_NR_mbind
 { TARGET_NR_mbind, "mbind" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_membarrier
+{ TARGET_NR_membarrier, "membarrier" , NULL, NULL, NULL },
+#endif
+#ifdef TARGET_NR_memfd_create
+{ TARGET_NR_memfd_create, "memfd_create" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_memory_ordering
 { TARGET_NR_memory_ordering, "memory_ordering" , NULL, NULL, NULL },
 #endif
@@ -511,6 +559,9 @@
 #ifdef TARGET_NR_mlock
 { TARGET_NR_mlock, "mlock" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_mlock2
+{ TARGET_NR_mlock2, "mlock2" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_mlockall
 { TARGET_NR_mlockall, "mlockall" , NULL, NULL, NULL },
 #endif
@@ -583,6 +634,9 @@
 #ifdef TARGET_NR_munmap
 { TARGET_NR_munmap, "munmap" , NULL, print_munmap, NULL },
 #endif
+#ifdef TARGET_NR_name_to_handle_at
+{ TARGET_NR_name_to_handle_at, "name_to_handle_at" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_nanosleep
 { TARGET_NR_nanosleep, "nanosleep" , NULL, NULL, NULL },
 #endif
@@ -952,6 +1006,9 @@
 #ifdef TARGET_NR_pciconfig_write
 { TARGET_NR_pciconfig_write, "pciconfig_write" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_perf_event_open
+{ TARGET_NR_perf_event_open, "perf_event_open" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_perfctr
 { TARGET_NR_perfctr, "perfctr" , NULL, NULL, NULL },
 #endif
@@ -976,6 +1033,18 @@
 #ifdef TARGET_NR_pread64
 { TARGET_NR_pread64, "pread64" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_preadv
+{ TARGET_NR_preadv, "preadv" , NULL, NULL, NULL },
+#endif
+#ifdef TARGET_NR_prlimit64
+{ TARGET_NR_prlimit64, "prlimit64" , NULL, NULL, NULL },
+#endif
+#ifdef TARGET_NR_process_vm_readv
+{ TARGET_NR_process_vm_readv, "process_vm_readv" , NULL, NULL, NULL },
+#endif
+#ifdef TARGET_NR_process_vm_writev
+{ TARGET_NR_process_vm_writev, "process_vm_writev" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_prof
 { TARGET_NR_prof, "prof" , NULL, NULL, NULL },
 #endif
@@ -994,6 +1063,9 @@
 #ifdef TARGET_NR_pwrite64
 { TARGET_NR_pwrite64, "pwrite64" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_pwritev
+{ TARGET_NR_pwritev, "pwritev" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_query_module
 { TARGET_NR_query_module, "query_module" , NULL, NULL, NULL },
 #endif
@@ -1027,6 +1099,9 @@
 #ifdef TARGET_NR_recvfrom
 { TARGET_NR_recvfrom, "recvfrom" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_recvmmsg
+{ TARGET_NR_recvmmsg, "recvmmsg" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_recvmsg
 { TARGET_NR_recvmsg, "recvmsg" , NULL, NULL, NULL },
 #endif
@@ -1042,9 +1117,18 @@
 #ifdef TARGET_NR_renameat
 { TARGET_NR_renameat, "renameat" , NULL, print_renameat, NULL },
 #endif
+#ifdef TARGET_NR_renameat2
+{ TARGET_NR_renameat2, "renameat2" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_request_key
 { TARGET_NR_request_key, "request_key" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_reserved177
+{ TARGET_NR_reserved177, "reserved177" , NULL, NULL, NULL },
+#endif
+#ifdef TARGET_NR_reserved193
+{ TARGET_NR_reserved193, "reserved193" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_reserved221
 { TARGET_NR_reserved221, "reserved221" , NULL, NULL, NULL },
 #endif
@@ -1078,12 +1162,18 @@
 #ifdef TARGET_NR_rt_sigtimedwait
 { TARGET_NR_rt_sigtimedwait, "rt_sigtimedwait" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_rt_tgsigqueueinfo
+{ TARGET_NR_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_sched_getaffinity
 { TARGET_NR_sched_getaffinity, "sched_getaffinity" , NULL, NULL, NULL },
 #endif
 #ifdef TARGET_NR_sched_get_affinity
 { TARGET_NR_sched_get_affinity, "sched_get_affinity" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_sched_getattr
+{ TARGET_NR_sched_getattr, "sched_getattr" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_sched_getparam
 { TARGET_NR_sched_getparam, "sched_getparam" , NULL, NULL, NULL },
 #endif
@@ -1102,6 +1192,9 @@
 #ifdef TARGET_NR_sched_setaffinity
 { TARGET_NR_sched_setaffinity, "sched_setaffinity" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_sched_setatt
+{ TARGET_NR_sched_setatt, "sched_setatt" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_sched_set_affinity
 { TARGET_NR_sched_set_affinity, "sched_set_affinity" , NULL, NULL, NULL },
 #endif
@@ -1114,6 +1207,9 @@
 #ifdef TARGET_NR_sched_yield
 { TARGET_NR_sched_yield, "sched_yield" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_seccomp
+{ TARGET_NR_seccomp, "seccomp" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_security
 { TARGET_NR_security, "security" , NULL, NULL, NULL },
 #endif
@@ -1141,6 +1237,9 @@
 #ifdef TARGET_NR_sendfile64
 { TARGET_NR_sendfile64, "sendfile64" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_sendmmsg
+{ TARGET_NR_sendmmsg, "sendmmsg" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_sendmsg
 { TARGET_NR_sendmsg, "sendmsg" , NULL, NULL, NULL },
 #endif
@@ -1280,6 +1379,12 @@
 #ifdef TARGET_NR_signal
 { TARGET_NR_signal, "signal" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_signalfd
+{ TARGET_NR_signalfd, "signalfd" , NULL, NULL, NULL },
+#endif
+#ifdef TARGET_NR_signalfd4
+{ TARGET_NR_signalfd4, "signalfd4" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_sigpending
 { TARGET_NR_sigpending, "sigpending" , NULL, NULL, NULL },
 #endif
@@ -1352,6 +1457,9 @@
 #ifdef TARGET_NR_sync_file_range
 { TARGET_NR_sync_file_range, "sync_file_range" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_syncfs
+{ TARGET_NR_syncfs, "syncfs" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_syscall
 { TARGET_NR_syscall, "syscall" , NULL, NULL, NULL },
 #endif
@@ -1409,6 +1517,9 @@
 #ifdef TARGET_NR_timer_settime
 { TARGET_NR_timer_settime, "timer_settime" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_timerfd
+{ TARGET_NR_timerfd, "timerfd" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_timerfd_create
 { TARGET_NR_timerfd_create, "timerfd_create" , NULL, NULL, NULL },
 #endif
@@ -1460,6 +1571,9 @@
 #ifdef TARGET_NR_unshare
 { TARGET_NR_unshare, "unshare" , NULL, NULL, NULL },
 #endif
+#ifdef TARGET_NR_userfaultfd
+{ TARGET_NR_userfaultfd, "userfaultfd" , NULL, NULL, NULL },
+#endif
 #ifdef TARGET_NR_unused109
 { TARGET_NR_unused109, "unused109" , NULL, NULL, NULL },
 #endif
-- 
2.9.3

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

* Re: [Qemu-devel] [PATCH v6 1/7] linux-user: Fix TARGET_SIOCATMARK definition for Mips
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 1/7] linux-user: Fix TARGET_SIOCATMARK definition for Mips Aleksandar Markovic
@ 2016-09-16 18:22   ` Laurent Vivier
  2016-09-19  8:31     ` Aleksandar Markovic
  0 siblings, 1 reply; 19+ messages in thread
From: Laurent Vivier @ 2016-09-16 18:22 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel, riku.voipio, peter.maydell,
	aurelien, leon.alrae, petar.jovanovic, miodrag.dinic,
	aleksandar.rikalo, aleksandar.markovic



Le 16/09/2016 à 13:14, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> 
> This patch fixes wrong definition of TARGET_SIOCATMARK for Mips.
> 
> The current definition is:
> 
>   #define SIOCATMARK      0x8905
> 
> while the correct definition is:
> 
>   #define SIOCATMARK      TARGET_IOR('s', 7, int)

According to linux sources, it seems true also for alpha and sh4.

Perhaps you can add them to the patch?
Do you have something to test it doesn't break anything?

Thanks,
Laurent

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

* Re: [Qemu-devel] [PATCH v6 2/7] linux-user: Fix TARGET_F_GETOWN definition for Mips
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 2/7] linux-user: Fix TARGET_F_GETOWN " Aleksandar Markovic
@ 2016-09-16 18:30   ` Laurent Vivier
  0 siblings, 0 replies; 19+ messages in thread
From: Laurent Vivier @ 2016-09-16 18:30 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel, riku.voipio, peter.maydell,
	aurelien, leon.alrae, petar.jovanovic, miodrag.dinic,
	aleksandar.rikalo, aleksandar.markovic



Le 16/09/2016 à 13:14, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> 
> For some reason, Qemu's TARGET_F_GETOWN constant for Mips does not
> match the correct value of correspondant F_GETOWN. This patch fixes
> this problem.
> 
> For reference, see Mips' F_GETOWN definition in Linux kernel at
> arch/mips/include/uapi/asm/fcntl.h#L44.
> 
> This patch also fixes some fcntl()-related LTP tests for Qemu
> user mode for Mips.
> 
> Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

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

> ---
>  linux-user/syscall_defs.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index cf89f16..44b1197 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2158,7 +2158,7 @@ struct target_statfs64 {
>  #define TARGET_F_SETLK         6
>  #define TARGET_F_SETLKW        7
>  #define TARGET_F_SETOWN        24       /*  for sockets. */
> -#define TARGET_F_GETOWN        25       /*  for sockets. */
> +#define TARGET_F_GETOWN        23       /*  for sockets. */
>  #else
>  #define TARGET_F_GETLK         5
>  #define TARGET_F_SETLK         6
> 

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

* Re: [Qemu-devel] [PATCH v6 3/7] linux-user: Fix structure target_flock definition for Mips
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 3/7] linux-user: Fix structure target_flock " Aleksandar Markovic
@ 2016-09-16 18:42   ` Laurent Vivier
  0 siblings, 0 replies; 19+ messages in thread
From: Laurent Vivier @ 2016-09-16 18:42 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel, riku.voipio, peter.maydell,
	aurelien, leon.alrae, petar.jovanovic, miodrag.dinic,
	aleksandar.rikalo, aleksandar.markovic



Le 16/09/2016 à 13:14, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> 
> Structure flock is defined for Mips in a way different from any
> other platform. For reference, see Linux kernel source code files:
> 
> arch/mips/include/uapi/asm/fcntl.h, line 63 (for Mips)
> include/uapi/asm-generic/fcntl.h, line 195 (for all other platforms)
> 
> This patch fix this problem, by amending structure target_flock,
> for Mips only.
> 
> Besides, this patch fixes LTP tests fcntl11, fcntl17, fcntl19, fcntl20,
> and fcntl21, which are currently failing, if executed in Qemu user mode
> for Mips platforms.
> 
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>

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

> ---
>  linux-user/syscall_defs.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 44b1197..14a1425 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -2327,7 +2327,13 @@ struct target_flock {
>      short l_whence;
>      abi_long l_start;
>      abi_long l_len;
> +#if defined(TARGET_MIPS)
> +    abi_long l_sysid;
> +#endif
>      int l_pid;
> +#if defined(TARGET_MIPS)
> +    abi_long pad[4];
> +#endif
>  };
>  
>  struct target_flock64 {
> 

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

* Re: [Qemu-devel] [PATCH v6 4/7] linux-user: Fix structure target_semid64_ds definition for Mips
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 4/7] linux-user: Fix structure target_semid64_ds " Aleksandar Markovic
@ 2016-09-16 19:00   ` Laurent Vivier
  2016-09-19  8:32     ` Aleksandar Markovic
  0 siblings, 1 reply; 19+ messages in thread
From: Laurent Vivier @ 2016-09-16 19:00 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel, riku.voipio, peter.maydell,
	aurelien, leon.alrae, petar.jovanovic, miodrag.dinic,
	aleksandar.rikalo, aleksandar.markovic



Le 16/09/2016 à 13:14, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> 
> This patch corrects target_semid64_ds structure definition for Mips.
> 
> See, for example definition of semid64_ds for Mips in Linux kernel:
> arch/mips/include/uapi/asm/sembuf.h#L13.
> 
> This patch will also fix certain semaphore-related LTP tests for Mips,
> if they are executed in Qemu user mode for any Mips platform.
> 
> Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  linux-user/mips/target_structs.h | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/linux-user/mips/target_structs.h b/linux-user/mips/target_structs.h
> index fbd9955..5ba124d 100644
> --- a/linux-user/mips/target_structs.h
> +++ b/linux-user/mips/target_structs.h
> @@ -45,4 +45,20 @@ struct target_shmid_ds {
>      abi_ulong __unused2;
>  };
>  
> +#define TARGET_SEMID64_DS
> +
> +/*
> + * The semid64_ds structure for the MIPS architecture.
> + * Note extra padding because this structure is passed back and forth
> + * between kernel and user space.
> + */
> +struct target_semid64_ds {
> +    struct target_ipc_perm sem_perm;
> +    abi_ulong sem_otime;
> +    abi_ulong sem_ctime;
> +    abi_ulong sem_nsems;
> +    abi_ulong __unused3;
> +    abi_ulong __unused4;
> +};

Perhaps you can call them __unused1 and __unused2, like they are in the
kernel?

Anyway:

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

Laurent

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

* Re: [Qemu-devel] [PATCH v6 6/7] linux-user: Add missing TARGET_EDQUOT error code for Mips
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 6/7] linux-user: Add missing TARGET_EDQUOT error code for Mips Aleksandar Markovic
@ 2016-09-16 19:22   ` Laurent Vivier
  0 siblings, 0 replies; 19+ messages in thread
From: Laurent Vivier @ 2016-09-16 19:22 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel, riku.voipio, peter.maydell,
	aurelien, leon.alrae, petar.jovanovic, miodrag.dinic,
	aleksandar.rikalo, aleksandar.markovic



Le 16/09/2016 à 13:14, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> 
> EDQUOT is defined for Mips platform in Linux kernel in such a way
> that it has different value than on most other platforms. However,
> correspondant TARGET_EDQUOT for Mips is missing in Qemu code. Moreover,
> TARGET_EDQUOT is missing from the table for conversion of error codes
> from host to target. This patch fixes these problems.
> 
> Without this patch, syscalls add_key(), keyctl(), link(), mkdir(), mknod(),
> open(), rename(), request_key(), setxattr(), symlink(), and write() will not
> be able to return the right error code in some scenarios on Mips platform.
> (Some of these syscalls are not yet supported in Qemu, but once they are
> supported, they will need correct EDQUOT handling.)
> 
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>

> ---
>  linux-user/mips/target_syscall.h   | 2 ++
>  linux-user/mips64/target_syscall.h | 2 ++
>  linux-user/syscall.c               | 1 +
>  3 files changed, 5 insertions(+)
> 
> diff --git a/linux-user/mips/target_syscall.h b/linux-user/mips/target_syscall.h
> index 2b4f390..827799f 100644
> --- a/linux-user/mips/target_syscall.h
> +++ b/linux-user/mips/target_syscall.h
> @@ -221,6 +221,8 @@ struct target_pt_regs {
>  #undef TARGET_ENOTRECOVERABLE
>  #define TARGET_ENOTRECOVERABLE 166     /* State not recoverable */
>  
> +#undef TARGET_EDQUOT
> +#define TARGET_EDQUOT          1133    /* Quota exceeded */
>  
>  #define UNAME_MACHINE "mips"
>  #define UNAME_MINIMUM_RELEASE "2.6.32"
> diff --git a/linux-user/mips64/target_syscall.h b/linux-user/mips64/target_syscall.h
> index 8da9c1f..29c1983 100644
> --- a/linux-user/mips64/target_syscall.h
> +++ b/linux-user/mips64/target_syscall.h
> @@ -218,6 +218,8 @@ struct target_pt_regs {
>  #undef TARGET_ENOTRECOVERABLE
>  #define TARGET_ENOTRECOVERABLE 166     /* State not recoverable */
>  
> +#undef TARGET_EDQUOT
> +#define TARGET_EDQUOT          1133    /* Quota exceeded */
>  
>  #define UNAME_MACHINE "mips64"
>  #define UNAME_MINIMUM_RELEASE "2.6.32"
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index ee23b29..e4bd40d 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -725,6 +725,7 @@ static uint16_t host_to_target_errno_table[ERRNO_TABLE_SIZE] = {
>      [ENAVAIL]		= TARGET_ENAVAIL,
>      [EISNAM]		= TARGET_EISNAM,
>      [EREMOTEIO]		= TARGET_EREMOTEIO,
> +    [EDQUOT]            = TARGET_EDQUOT,
>      [ESHUTDOWN]		= TARGET_ESHUTDOWN,
>      [ETOOMANYREFS]	= TARGET_ETOOMANYREFS,
>      [ETIMEDOUT]		= TARGET_ETIMEDOUT,
> 

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

* Re: [Qemu-devel] [PATCH v6 5/7] linux-user: Fix certain argument alignment cases for Mips64
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 5/7] linux-user: Fix certain argument alignment cases for Mips64 Aleksandar Markovic
@ 2016-09-16 19:29   ` Laurent Vivier
  2016-09-19  8:33     ` Aleksandar Markovic
  0 siblings, 1 reply; 19+ messages in thread
From: Laurent Vivier @ 2016-09-16 19:29 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel, riku.voipio, peter.maydell,
	aurelien, leon.alrae, petar.jovanovic, miodrag.dinic,
	aleksandar.rikalo, aleksandar.markovic



Le 16/09/2016 à 13:14, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> 
> The function that is changed in this patch is supposed to indicate that
> there was certaing argument rearangement related to 64-bit arguments on
> 32-bit platforms. The background on such rearangements can be found,
> for example, in the man page for syscall(2).
> 
> However, for 64-bit Mips architectures there is no such rearangement,
> and this patch reflects it.
> 
> Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com>
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> ---
>  linux-user/syscall.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index ca06943..ee23b29 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -620,7 +620,14 @@ static inline int regpairs_aligned(void *cpu_env) {
>      return ((((CPUARMState *)cpu_env)->eabi) == 1) ;
>  }
>  #elif defined(TARGET_MIPS)
> -static inline int regpairs_aligned(void *cpu_env) { return 1; }
> +static inline int regpairs_aligned(void *cpu_env)
> +{
> +#if TARGET_ABI_BITS == 32
> +    return 1;
> +#else
> +    return 0;
> +#endif
> +}
>  #elif defined(TARGET_PPC) && !defined(TARGET_PPC64)
>  /* SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pairs
>   * of registers which translates to the same as ARM/MIPS, because we start with
> 

To mimic PPC, would be cleaner with:

...
#elif defined(TARGET_MIPS) && TARGET_ABI_BITS == 32
static inline int regpairs_aligned(void *cpu_env) { return 1; }
#else
...

Laurent

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

* Re: [Qemu-devel] [PATCH v6 7/7] linux-user: Add missing Mips syscalls items in strace.list
  2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 7/7] linux-user: Add missing Mips syscalls items in strace.list Aleksandar Markovic
@ 2016-09-16 19:35   ` Laurent Vivier
  2016-09-19  8:38     ` Aleksandar Markovic
  0 siblings, 1 reply; 19+ messages in thread
From: Laurent Vivier @ 2016-09-16 19:35 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel, riku.voipio, peter.maydell,
	aurelien, leon.alrae, petar.jovanovic, miodrag.dinic,
	aleksandar.rikalo, aleksandar.markovic



Le 16/09/2016 à 13:14, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> 
> Without this patch, a number of Mips syscalls will be logged in the following
> way (in this examople, this is an invocation of accept4()):
> 
>   86906 Unknown syscall 4334
> 
> This patch provides standard Qemu's strace output for such cases, like this:
> 
>   95861 accept4(3,1996486000,1996486016,128,0,0) = 5
> 
> Such output may be further improvad by providing strace-related functions
> that handle only particular syscalls, but this is beyond the scope of
> this patch.
> 
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> ---
>  linux-user/strace.list | 114 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 114 insertions(+)

Nice work, we should update strace.list each time we add a syscall (and
personally I don't, it's bad).

How did you choose the list of syscalls to add in this list as some of
them are not implemented in syscall.c?
[for instance "kcmp", I have the patch for it but I don't think I've
already sent it]

Laurent

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

* Re: [Qemu-devel] [PATCH v6 1/7] linux-user: Fix TARGET_SIOCATMARK definition for Mips
  2016-09-16 18:22   ` Laurent Vivier
@ 2016-09-19  8:31     ` Aleksandar Markovic
  0 siblings, 0 replies; 19+ messages in thread
From: Aleksandar Markovic @ 2016-09-19  8:31 UTC (permalink / raw)
  To: Laurent Vivier, Aleksandar Markovic, qemu-devel, riku.voipio,
	peter.maydell, aurelien, Leon Alrae, Petar Jovanovic,
	Miodrag Dinic, Aleksandar Rikalo

Thanks a lot for the review, Laurent, I am going to add TARGET_SH4 and TARGET_ALPHA to this change.

I test LTP syscall test set on mips, arm and intel platforms as my regression tests, but also some number of individual LTP tests (the choice of tests depends on the change) on more platforms, and minimal test examples illustrating the bug and the fix as well.

Aleksandar
________________________________________
From: Laurent Vivier [laurent@vivier.eu]
Sent: Friday, September 16, 2016 11:22 AM
To: Aleksandar Markovic; qemu-devel@nongnu.org; riku.voipio@iki.fi; peter.maydell@linaro.org; aurelien@aurel32.net; Leon Alrae; Petar Jovanovic; Miodrag Dinic; Aleksandar Rikalo; Aleksandar Markovic
Subject: Re: [Qemu-devel] [PATCH v6 1/7] linux-user: Fix TARGET_SIOCATMARK definition for Mips

Le 16/09/2016 à 13:14, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
>
> This patch fixes wrong definition of TARGET_SIOCATMARK for Mips.
>
> The current definition is:
>
>   #define SIOCATMARK      0x8905
>
> while the correct definition is:
>
>   #define SIOCATMARK      TARGET_IOR('s', 7, int)

According to linux sources, it seems true also for alpha and sh4.

Perhaps you can add them to the patch?
Do you have something to test it doesn't break anything?

Thanks,
Laurent

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

* Re: [Qemu-devel] [PATCH v6 4/7] linux-user: Fix structure target_semid64_ds definition for Mips
  2016-09-16 19:00   ` Laurent Vivier
@ 2016-09-19  8:32     ` Aleksandar Markovic
  0 siblings, 0 replies; 19+ messages in thread
From: Aleksandar Markovic @ 2016-09-19  8:32 UTC (permalink / raw)
  To: Laurent Vivier, Aleksandar Markovic, qemu-devel, riku.voipio,
	peter.maydell, aurelien, Leon Alrae, Petar Jovanovic,
	Miodrag Dinic, Aleksandar Rikalo

The naming in this patch will be synced with that from the kernel in v7. Thanks!

________________________________________
From: Laurent Vivier [laurent@vivier.eu]
Sent: Friday, September 16, 2016 12:00 PM
To: Aleksandar Markovic; qemu-devel@nongnu.org; riku.voipio@iki.fi; peter.maydell@linaro.org; aurelien@aurel32.net; Leon Alrae; Petar Jovanovic; Miodrag Dinic; Aleksandar Rikalo; Aleksandar Markovic
Subject: Re: [Qemu-devel] [PATCH v6 4/7] linux-user: Fix structure target_semid64_ds definition for Mips

Le 16/09/2016 à 13:14, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
>
> This patch corrects target_semid64_ds structure definition for Mips.
>
> See, for example definition of semid64_ds for Mips in Linux kernel:
> arch/mips/include/uapi/asm/sembuf.h#L13.
>
> This patch will also fix certain semaphore-related LTP tests for Mips,
> if they are executed in Qemu user mode for any Mips platform.
>
> Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  linux-user/mips/target_structs.h | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/linux-user/mips/target_structs.h b/linux-user/mips/target_structs.h
> index fbd9955..5ba124d 100644
> --- a/linux-user/mips/target_structs.h
> +++ b/linux-user/mips/target_structs.h
> @@ -45,4 +45,20 @@ struct target_shmid_ds {
>      abi_ulong __unused2;
>  };
>
> +#define TARGET_SEMID64_DS
> +
> +/*
> + * The semid64_ds structure for the MIPS architecture.
> + * Note extra padding because this structure is passed back and forth
> + * between kernel and user space.
> + */
> +struct target_semid64_ds {
> +    struct target_ipc_perm sem_perm;
> +    abi_ulong sem_otime;
> +    abi_ulong sem_ctime;
> +    abi_ulong sem_nsems;
> +    abi_ulong __unused3;
> +    abi_ulong __unused4;
> +};

Perhaps you can call them __unused1 and __unused2, like they are in the
kernel?

Anyway:

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

Laurent

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

* Re: [Qemu-devel] [PATCH v6 5/7] linux-user: Fix certain argument alignment cases for Mips64
  2016-09-16 19:29   ` Laurent Vivier
@ 2016-09-19  8:33     ` Aleksandar Markovic
  0 siblings, 0 replies; 19+ messages in thread
From: Aleksandar Markovic @ 2016-09-19  8:33 UTC (permalink / raw)
  To: Laurent Vivier, Aleksandar Markovic, qemu-devel, riku.voipio,
	peter.maydell, aurelien, Leon Alrae, Petar Jovanovic,
	Miodrag Dinic, Aleksandar Rikalo

So true. In v7, I am going to use the style that you suggested.

________________________________________
From: Laurent Vivier [laurent@vivier.eu]
Sent: Friday, September 16, 2016 12:29 PM
To: Aleksandar Markovic; qemu-devel@nongnu.org; riku.voipio@iki.fi; peter.maydell@linaro.org; aurelien@aurel32.net; Leon Alrae; Petar Jovanovic; Miodrag Dinic; Aleksandar Rikalo; Aleksandar Markovic
Subject: Re: [Qemu-devel] [PATCH v6 5/7] linux-user: Fix certain argument alignment cases for Mips64

Le 16/09/2016 à 13:14, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
>
> The function that is changed in this patch is supposed to indicate that
> there was certaing argument rearangement related to 64-bit arguments on
> 32-bit platforms. The background on such rearangements can be found,
> for example, in the man page for syscall(2).
>
> However, for 64-bit Mips architectures there is no such rearangement,
> and this patch reflects it.
>
> Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com>
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> ---
>  linux-user/syscall.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index ca06943..ee23b29 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -620,7 +620,14 @@ static inline int regpairs_aligned(void *cpu_env) {
>      return ((((CPUARMState *)cpu_env)->eabi) == 1) ;
>  }
>  #elif defined(TARGET_MIPS)
> -static inline int regpairs_aligned(void *cpu_env) { return 1; }
> +static inline int regpairs_aligned(void *cpu_env)
> +{
> +#if TARGET_ABI_BITS == 32
> +    return 1;
> +#else
> +    return 0;
> +#endif
> +}
>  #elif defined(TARGET_PPC) && !defined(TARGET_PPC64)
>  /* SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pairs
>   * of registers which translates to the same as ARM/MIPS, because we start with
>

To mimic PPC, would be cleaner with:

...
#elif defined(TARGET_MIPS) && TARGET_ABI_BITS == 32
static inline int regpairs_aligned(void *cpu_env) { return 1; }
#else
...

Laurent

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

* Re: [Qemu-devel] [PATCH v6 7/7] linux-user: Add missing Mips syscalls items in strace.list
  2016-09-16 19:35   ` Laurent Vivier
@ 2016-09-19  8:38     ` Aleksandar Markovic
  0 siblings, 0 replies; 19+ messages in thread
From: Aleksandar Markovic @ 2016-09-19  8:38 UTC (permalink / raw)
  To: Laurent Vivier, Aleksandar Markovic, qemu-devel, riku.voipio,
	peter.maydell, aurelien, Leon Alrae, Petar Jovanovic,
	Miodrag Dinic, Aleksandar Rikalo

Thanks, I did it hard way: by copying the content of strace.list and headers in into columns of a spreadsheet, than processing the content so that each syscall has its own row, and after that doing numerous copying and pasting for syscalls that did not appear to have support in strace.list. In hindsight, I think devising a script or even a set of command lines would be much faster and better way of doing this.

Aleksandar
________________________________________
From: Laurent Vivier [laurent@vivier.eu]
Sent: Friday, September 16, 2016 12:35 PM
To: Aleksandar Markovic; qemu-devel@nongnu.org; riku.voipio@iki.fi; peter.maydell@linaro.org; aurelien@aurel32.net; Leon Alrae; Petar Jovanovic; Miodrag Dinic; Aleksandar Rikalo; Aleksandar Markovic
Subject: Re: [Qemu-devel] [PATCH v6 7/7] linux-user: Add missing Mips syscalls items in strace.list

Le 16/09/2016 à 13:14, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
>
> Without this patch, a number of Mips syscalls will be logged in the following
> way (in this examople, this is an invocation of accept4()):
>
>   86906 Unknown syscall 4334
>
> This patch provides standard Qemu's strace output for such cases, like this:
>
>   95861 accept4(3,1996486000,1996486016,128,0,0) = 5
>
> Such output may be further improvad by providing strace-related functions
> that handle only particular syscalls, but this is beyond the scope of
> this patch.
>
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
> ---
>  linux-user/strace.list | 114 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 114 insertions(+)

Nice work, we should update strace.list each time we add a syscall (and
personally I don't, it's bad).

How did you choose the list of syscalls to add in this list as some of
them are not implemented in syscall.c?
[for instance "kcmp", I have the patch for it but I don't think I've
already sent it]

Laurent

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

end of thread, other threads:[~2016-09-19  8:39 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-16 11:14 [Qemu-devel] [PATCH v6 0/7] linux-user: Fix miscellaneous Mips-specific issues Aleksandar Markovic
2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 1/7] linux-user: Fix TARGET_SIOCATMARK definition for Mips Aleksandar Markovic
2016-09-16 18:22   ` Laurent Vivier
2016-09-19  8:31     ` Aleksandar Markovic
2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 2/7] linux-user: Fix TARGET_F_GETOWN " Aleksandar Markovic
2016-09-16 18:30   ` Laurent Vivier
2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 3/7] linux-user: Fix structure target_flock " Aleksandar Markovic
2016-09-16 18:42   ` Laurent Vivier
2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 4/7] linux-user: Fix structure target_semid64_ds " Aleksandar Markovic
2016-09-16 19:00   ` Laurent Vivier
2016-09-19  8:32     ` Aleksandar Markovic
2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 5/7] linux-user: Fix certain argument alignment cases for Mips64 Aleksandar Markovic
2016-09-16 19:29   ` Laurent Vivier
2016-09-19  8:33     ` Aleksandar Markovic
2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 6/7] linux-user: Add missing TARGET_EDQUOT error code for Mips Aleksandar Markovic
2016-09-16 19:22   ` Laurent Vivier
2016-09-16 11:14 ` [Qemu-devel] [PATCH v6 7/7] linux-user: Add missing Mips syscalls items in strace.list Aleksandar Markovic
2016-09-16 19:35   ` Laurent Vivier
2016-09-19  8:38     ` Aleksandar Markovic

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.