* [Qemu-devel] [PULL 00/10] linux-user update for 2.11
@ 2017-10-18 12:33 riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 01/10] linux-user: fix O_TMPFILE handling riku.voipio
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: riku.voipio @ 2017-10-18 12:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio
From: Riku Voipio <riku.voipio@linaro.org>
The following changes since commit 40a1e8ac2e10155b5df13a2508ac080b00cd7e23:
Merge remote-tracking branch 'remotes/elmarco/tags/vu-pull-request' into staging (2017-10-16 10:22:39 +0100)
are available in the git repository at:
git://git.linaro.org/people/riku.voipio/qemu.git tags/pull-linux-user-20171018
for you to fetch changes up to f443e3960d9d3340dd286e5fc0b661bb165a8b22:
linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values (2017-10-17 22:24:02 +0300)
----------------------------------------------------------------
Linux-user updates for Qemu 2.11
----------------------------------------------------------------
Alex Bennée (1):
linux-user/main: support dfilter
Carlo Marcelo Arenas Belón (1):
linux-user: remove duplicate break in syscall
Laurent Vivier (1):
target/m68k,linux-user: manage FP registers in ucontext
Peter Maydell (3):
linux-user: Allow -R values up to 0xffff0000 for 32-bit ARM guests
linux-user: Fix target FS_IOC_GETFLAGS and FS_IOC_SETFLAGS numbers
linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values
Richard Henderson (3):
tcg: Fix off-by-one in assert in page_set_flags
linux-user: Tidy and enforce reserved_va initialization
linux-user/sh4: Reduce TARGET_VIRT_ADDR_SPACE_BITS to 31
Riku Voipio (1):
linux-user: fix O_TMPFILE handling
accel/tcg/translate-all.c | 2 +-
linux-user/arm/target_cpu.h | 4 ++++
linux-user/elfload.c | 2 +-
linux-user/main.c | 45 ++++++++++++++++++++++++++++++++-------------
linux-user/signal.c | 43 +++++++++++++++++++++++++++++++++++++++++++
linux-user/strace.c | 4 ++++
linux-user/syscall.c | 4 +++-
linux-user/syscall_defs.h | 43 +++++++++++++++++++++++++++++++++++++------
target/mips/mips-defs.h | 6 +++++-
target/nios2/cpu.h | 6 +++++-
target/sh4/cpu.h | 6 +++++-
11 files changed, 140 insertions(+), 25 deletions(-)
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Qemu-devel] [PULL 01/10] linux-user: fix O_TMPFILE handling
2017-10-18 12:33 [Qemu-devel] [PULL 00/10] linux-user update for 2.11 riku.voipio
@ 2017-10-18 12:33 ` riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 02/10] target/m68k, linux-user: manage FP registers in ucontext riku.voipio
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: riku.voipio @ 2017-10-18 12:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio
From: Riku Voipio <riku.voipio@linaro.org>
Since O_TMPFILE might differ between guest and host,
add it to the bitmask_transtbl. While at it, fix the definitions
of O_DIRECTORY etc which should arm32 according to kernel sources.
This fixes open14 and openat03 ltp testcases. Fixes:
https://bugs.launchpad.net/qemu/+bug/1709170
---
linux-user/strace.c | 4 ++++
linux-user/syscall.c | 3 +++
linux-user/syscall_defs.h | 8 +++++++-
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/linux-user/strace.c b/linux-user/strace.c
index d821d165ff..bd897a3f20 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -837,6 +837,10 @@ UNUSED static struct flags open_flags[] = {
#endif
#ifdef O_PATH
FLAG_TARGET(O_PATH),
+#endif
+#ifdef O_TMPFILE
+ FLAG_TARGET(O_TMPFILE),
+ FLAG_TARGET(__O_TMPFILE),
#endif
FLAG_END,
};
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9b6364a266..08fbc4d5f7 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -341,6 +341,9 @@ static bitmask_transtbl fcntl_flags_tbl[] = {
#endif
#if defined(O_PATH)
{ TARGET_O_PATH, TARGET_O_PATH, O_PATH, O_PATH },
+#endif
+#if defined(O_TMPFILE)
+ { TARGET_O_TMPFILE, TARGET_O_TMPFILE, O_TMPFILE, O_TMPFILE },
#endif
/* Don't terminate the list prematurely on 64-bit host+guest. */
#if TARGET_O_LARGEFILE != 0 || O_LARGEFILE != 0
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 40c5027e93..6e2287e918 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2416,7 +2416,7 @@ struct target_statfs64 {
#define TARGET_O_CLOEXEC 010000000
#define TARGET___O_SYNC 000100000
#define TARGET_O_PATH 020000000
-#elif defined(TARGET_ARM) || defined(TARGET_M68K)
+#elif defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_AARCH64)
#define TARGET_O_DIRECTORY 040000 /* must be a directory */
#define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
#define TARGET_O_DIRECT 0200000 /* direct disk access hint */
@@ -2513,6 +2513,12 @@ struct target_statfs64 {
#ifndef TARGET_O_PATH
#define TARGET_O_PATH 010000000
#endif
+#ifndef TARGET___O_TMPFILE
+#define TARGET___O_TMPFILE 020000000
+#endif
+#ifndef TARGET_O_TMPFILE
+#define TARGET_O_TMPFILE (TARGET___O_TMPFILE | TARGET_O_DIRECTORY)
+#endif
#ifndef TARGET_O_NDELAY
#define TARGET_O_NDELAY TARGET_O_NONBLOCK
#endif
--
2.14.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [PULL 02/10] target/m68k, linux-user: manage FP registers in ucontext
2017-10-18 12:33 [Qemu-devel] [PULL 00/10] linux-user update for 2.11 riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 01/10] linux-user: fix O_TMPFILE handling riku.voipio
@ 2017-10-18 12:33 ` riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 03/10] linux-user: remove duplicate break in syscall riku.voipio
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: riku.voipio @ 2017-10-18 12:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier
From: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
linux-user/signal.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/linux-user/signal.c b/linux-user/signal.c
index cc0c3fcee9..7a238aaea1 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -5704,6 +5704,24 @@ give_sigsegv:
force_sigsegv(sig);
}
+static inline void target_rt_save_fpu_state(struct target_ucontext *uc,
+ CPUM68KState *env)
+{
+ int i;
+ target_fpregset_t *fpregs = &uc->tuc_mcontext.fpregs;
+
+ __put_user(env->fpcr, &fpregs->f_fpcntl[0]);
+ __put_user(env->fpsr, &fpregs->f_fpcntl[1]);
+ /* fpiar is not emulated */
+
+ for (i = 0; i < 8; i++) {
+ uint32_t high = env->fregs[i].d.high << 16;
+ __put_user(high, &fpregs->f_fpregs[i * 3]);
+ __put_user(env->fregs[i].d.low,
+ (uint64_t *)&fpregs->f_fpregs[i * 3 + 1]);
+ }
+}
+
static inline int target_rt_setup_ucontext(struct target_ucontext *uc,
CPUM68KState *env)
{
@@ -5730,9 +5748,32 @@ static inline int target_rt_setup_ucontext(struct target_ucontext *uc,
__put_user(env->pc, &gregs[16]);
__put_user(sr, &gregs[17]);
+ target_rt_save_fpu_state(uc, env);
+
return 0;
}
+static inline void target_rt_restore_fpu_state(CPUM68KState *env,
+ struct target_ucontext *uc)
+{
+ int i;
+ target_fpregset_t *fpregs = &uc->tuc_mcontext.fpregs;
+ uint32_t fpcr;
+
+ __get_user(fpcr, &fpregs->f_fpcntl[0]);
+ cpu_m68k_set_fpcr(env, fpcr);
+ __get_user(env->fpsr, &fpregs->f_fpcntl[1]);
+ /* fpiar is not emulated */
+
+ for (i = 0; i < 8; i++) {
+ uint32_t high;
+ __get_user(high, &fpregs->f_fpregs[i * 3]);
+ env->fregs[i].d.high = high >> 16;
+ __get_user(env->fregs[i].d.low,
+ (uint64_t *)&fpregs->f_fpregs[i * 3 + 1]);
+ }
+}
+
static inline int target_rt_restore_ucontext(CPUM68KState *env,
struct target_ucontext *uc)
{
@@ -5764,6 +5805,8 @@ static inline int target_rt_restore_ucontext(CPUM68KState *env,
__get_user(temp, &gregs[17]);
cpu_m68k_set_ccr(env, temp);
+ target_rt_restore_fpu_state(env, uc);
+
return 0;
badframe:
--
2.14.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [PULL 03/10] linux-user: remove duplicate break in syscall
2017-10-18 12:33 [Qemu-devel] [PULL 00/10] linux-user update for 2.11 riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 01/10] linux-user: fix O_TMPFILE handling riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 02/10] target/m68k, linux-user: manage FP registers in ucontext riku.voipio
@ 2017-10-18 12:33 ` riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 04/10] linux-user: Allow -R values up to 0xffff0000 for 32-bit ARM guests riku.voipio
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: riku.voipio @ 2017-10-18 12:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Carlo Marcelo Arenas Belón
From: Carlo Marcelo Arenas Belón <carenas@gmail.com>
likely introduced in 3532fa7402cda16f7b95261b0339c58630051f0b
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
linux-user/syscall.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 08fbc4d5f7..a25bbffd16 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3134,7 +3134,6 @@ set_timeout:
case TARGET_SO_RCVLOWAT:
optname = SO_RCVLOWAT;
break;
- break;
default:
goto unimplemented;
}
--
2.14.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [PULL 04/10] linux-user: Allow -R values up to 0xffff0000 for 32-bit ARM guests
2017-10-18 12:33 [Qemu-devel] [PULL 00/10] linux-user update for 2.11 riku.voipio
` (2 preceding siblings ...)
2017-10-18 12:33 ` [Qemu-devel] [PULL 03/10] linux-user: remove duplicate break in syscall riku.voipio
@ 2017-10-18 12:33 ` riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 05/10] tcg: Fix off-by-one in assert in page_set_flags riku.voipio
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: riku.voipio @ 2017-10-18 12:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell
From: Peter Maydell <peter.maydell@linaro.org>
The 32-bit ARM validate_guest_space() check tests whether the
specified -R value leaves enough space for us to put the
commpage in at 0xffff0f00. However it was incorrectly doing
a <= check for the check against (guest_base + guest_size),
which meant that it wasn't permitting the guest space to
butt right up against the commpage.
Fix the comparison, so that -R values all the way up to 0xffff0000
work correctly.
Reviewed-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
linux-user/elfload.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 79062882ba..3b857fbc9c 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -377,7 +377,7 @@ static int validate_guest_space(unsigned long guest_base,
* then there is no way we can allocate it.
*/
if (test_page_addr >= guest_base
- && test_page_addr <= (guest_base + guest_size)) {
+ && test_page_addr < (guest_base + guest_size)) {
return -1;
}
--
2.14.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [PULL 05/10] tcg: Fix off-by-one in assert in page_set_flags
2017-10-18 12:33 [Qemu-devel] [PULL 00/10] linux-user update for 2.11 riku.voipio
` (3 preceding siblings ...)
2017-10-18 12:33 ` [Qemu-devel] [PULL 04/10] linux-user: Allow -R values up to 0xffff0000 for 32-bit ARM guests riku.voipio
@ 2017-10-18 12:33 ` riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 06/10] linux-user: Tidy and enforce reserved_va initialization riku.voipio
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: riku.voipio @ 2017-10-18 12:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson
From: Richard Henderson <rth@twiddle.net>
Most of the users of page_set_flags offset (page, page + len) as
the end points. One might consider this an error, since the other
users do supply an endpoint as the last byte of the region.
However, the first thing that page_set_flags does is round end UP
to the start of the next page. Which means computing page + len - 1
is in the end pointless. Therefore, accept this usage and do not
assert when given the exact size of the vm as the endpoint.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20170708025030.15845-2-rth@twiddle.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
accel/tcg/translate-all.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index c5ce99d549..1b43deb0cd 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -2114,7 +2114,7 @@ void page_set_flags(target_ulong start, target_ulong end, int flags)
guest address space. If this assert fires, it probably indicates
a missing call to h2g_valid. */
#if TARGET_ABI_BITS > L1_MAP_ADDR_SPACE_BITS
- assert(end < ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS));
+ assert(end <= ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS));
#endif
assert(start < end);
assert_memory_lock();
--
2.14.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [PULL 06/10] linux-user: Tidy and enforce reserved_va initialization
2017-10-18 12:33 [Qemu-devel] [PULL 00/10] linux-user update for 2.11 riku.voipio
` (4 preceding siblings ...)
2017-10-18 12:33 ` [Qemu-devel] [PULL 05/10] tcg: Fix off-by-one in assert in page_set_flags riku.voipio
@ 2017-10-18 12:33 ` riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 07/10] linux-user/sh4: Reduce TARGET_VIRT_ADDR_SPACE_BITS to 31 riku.voipio
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: riku.voipio @ 2017-10-18 12:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson
From: Richard Henderson <rth@twiddle.net>
We had a check using TARGET_VIRT_ADDR_SPACE_BITS to make sure
that the allocation coming in from the command-line option was
not too large, but that didn't include target-specific knowledge
about other restrictions on user-space.
Remove several target-specific hacks in linux-user/main.c.
For MIPS and Nios, we can replace them with proper adjustments
to the respective target's TARGET_VIRT_ADDR_SPACE_BITS definition.
For ARM, we had no existing ifdef but I suspect that the current
default value of 0xf7000000 was chosen with this in mind. Define
a workable value in linux-user/arm/, and also document why the
special case is required.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20170708025030.15845-3-rth@twiddle.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
linux-user/arm/target_cpu.h | 4 ++++
linux-user/main.c | 38 +++++++++++++++++++++++++-------------
target/mips/mips-defs.h | 6 +++++-
target/nios2/cpu.h | 6 +++++-
4 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/linux-user/arm/target_cpu.h b/linux-user/arm/target_cpu.h
index d888219150..c3eb4b243d 100644
--- a/linux-user/arm/target_cpu.h
+++ b/linux-user/arm/target_cpu.h
@@ -19,6 +19,10 @@
#ifndef ARM_TARGET_CPU_H
#define ARM_TARGET_CPU_H
+/* We need to be able to map the commpage.
+ See validate_guest_space in linux-user/elfload.c. */
+#define MAX_RESERVED_VA 0xffff0000ul
+
static inline void cpu_clone_regs(CPUARMState *env, target_ulong newsp)
{
if (newsp) {
diff --git a/linux-user/main.c b/linux-user/main.c
index 829f974662..fd54d344bb 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -60,23 +60,38 @@ do { \
} \
} while (0)
-#if (TARGET_LONG_BITS == 32) && (HOST_LONG_BITS == 64)
/*
* When running 32-on-64 we should make sure we can fit all of the possible
* guest address space into a contiguous chunk of virtual host memory.
*
* This way we will never overlap with our own libraries or binaries or stack
* or anything else that QEMU maps.
+ *
+ * Many cpus reserve the high bit (or more than one for some 64-bit cpus)
+ * of the address for the kernel. Some cpus rely on this and user space
+ * uses the high bit(s) for pointer tagging and the like. For them, we
+ * must preserve the expected address space.
*/
-# if defined(TARGET_MIPS) || defined(TARGET_NIOS2)
-/*
- * MIPS only supports 31 bits of virtual address space for user space.
- * Nios2 also only supports 31 bits.
- */
-unsigned long reserved_va = 0x77000000;
+#ifndef MAX_RESERVED_VA
+# if HOST_LONG_BITS > TARGET_VIRT_ADDR_SPACE_BITS
+# if TARGET_VIRT_ADDR_SPACE_BITS == 32 && \
+ (TARGET_LONG_BITS == 32 || defined(TARGET_ABI32))
+/* There are a number of places where we assign reserved_va to a variable
+ of type abi_ulong and expect it to fit. Avoid the last page. */
+# define MAX_RESERVED_VA (0xfffffffful & TARGET_PAGE_MASK)
+# else
+# define MAX_RESERVED_VA (1ul << TARGET_VIRT_ADDR_SPACE_BITS)
+# endif
# else
-unsigned long reserved_va = 0xf7000000;
+# define MAX_RESERVED_VA 0
# endif
+#endif
+
+/* That said, reserving *too* much vm space via mmap can run into problems
+ with rlimits, oom due to page table creation, etc. We will still try it,
+ if directed by the command-line option, but not by default. */
+#if HOST_LONG_BITS == 64 && TARGET_VIRT_ADDR_SPACE_BITS <= 32
+unsigned long reserved_va = MAX_RESERVED_VA;
#else
unsigned long reserved_va;
#endif
@@ -3978,11 +3993,8 @@ static void handle_arg_reserved_va(const char *arg)
unsigned long unshifted = reserved_va;
p++;
reserved_va <<= shift;
- if (((reserved_va >> shift) != unshifted)
-#if HOST_LONG_BITS > TARGET_VIRT_ADDR_SPACE_BITS
- || (reserved_va > (1ul << TARGET_VIRT_ADDR_SPACE_BITS))
-#endif
- ) {
+ if (reserved_va >> shift != unshifted
+ || (MAX_RESERVED_VA && reserved_va > MAX_RESERVED_VA)) {
fprintf(stderr, "Reserved virtual address too big\n");
exit(EXIT_FAILURE);
}
diff --git a/target/mips/mips-defs.h b/target/mips/mips-defs.h
index 047554ee45..d239069975 100644
--- a/target/mips/mips-defs.h
+++ b/target/mips/mips-defs.h
@@ -15,7 +15,11 @@
#else
#define TARGET_LONG_BITS 32
#define TARGET_PHYS_ADDR_SPACE_BITS 40
-#define TARGET_VIRT_ADDR_SPACE_BITS 32
+# ifdef CONFIG_USER_ONLY
+# define TARGET_VIRT_ADDR_SPACE_BITS 31
+# else
+# define TARGET_VIRT_ADDR_SPACE_BITS 32
+#endif
#endif
/* Masks used to mark instructions to indicate which ISA level they
diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h
index 50d803a217..9119eee587 100644
--- a/target/nios2/cpu.h
+++ b/target/nios2/cpu.h
@@ -226,7 +226,11 @@ qemu_irq *nios2_cpu_pic_init(Nios2CPU *cpu);
void nios2_check_interrupts(CPUNios2State *env);
#define TARGET_PHYS_ADDR_SPACE_BITS 32
-#define TARGET_VIRT_ADDR_SPACE_BITS 32
+#ifdef CONFIG_USER_ONLY
+# define TARGET_VIRT_ADDR_SPACE_BITS 31
+#else
+# define TARGET_VIRT_ADDR_SPACE_BITS 32
+#endif
#define cpu_init(cpu_model) cpu_generic_init(TYPE_NIOS2_CPU, cpu_model)
--
2.14.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [PULL 07/10] linux-user/sh4: Reduce TARGET_VIRT_ADDR_SPACE_BITS to 31
2017-10-18 12:33 [Qemu-devel] [PULL 00/10] linux-user update for 2.11 riku.voipio
` (5 preceding siblings ...)
2017-10-18 12:33 ` [Qemu-devel] [PULL 06/10] linux-user: Tidy and enforce reserved_va initialization riku.voipio
@ 2017-10-18 12:33 ` riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 08/10] linux-user: Fix target FS_IOC_GETFLAGS and FS_IOC_SETFLAGS numbers riku.voipio
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: riku.voipio @ 2017-10-18 12:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson
From: Richard Henderson <rth@twiddle.net>
The real kernel has TASK_SIZE as 0x7c000000, due to quirks with
a couple of SH parts. But nominally user-space is limited to 2GB.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20170708025030.15845-4-rth@twiddle.net>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
target/sh4/cpu.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h
index 79f85d3365..123f34783a 100644
--- a/target/sh4/cpu.h
+++ b/target/sh4/cpu.h
@@ -45,7 +45,11 @@
#define TARGET_PAGE_BITS 12 /* 4k XXXXX */
#define TARGET_PHYS_ADDR_SPACE_BITS 32
-#define TARGET_VIRT_ADDR_SPACE_BITS 32
+#ifdef CONFIG_USER_ONLY
+# define TARGET_VIRT_ADDR_SPACE_BITS 31
+#else
+# define TARGET_VIRT_ADDR_SPACE_BITS 32
+#endif
#define SR_MD 30
#define SR_RB 29
--
2.14.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [PULL 08/10] linux-user: Fix target FS_IOC_GETFLAGS and FS_IOC_SETFLAGS numbers
2017-10-18 12:33 [Qemu-devel] [PULL 00/10] linux-user update for 2.11 riku.voipio
` (6 preceding siblings ...)
2017-10-18 12:33 ` [Qemu-devel] [PULL 07/10] linux-user/sh4: Reduce TARGET_VIRT_ADDR_SPACE_BITS to 31 riku.voipio
@ 2017-10-18 12:33 ` riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 09/10] linux-user/main: support dfilter riku.voipio
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: riku.voipio @ 2017-10-18 12:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell
From: Peter Maydell <peter.maydell@linaro.org>
We were defining TARGET_FS_IOC_GETFLAGS and TARGET_FS_IOC_SETFLAGS
using the host 'long' type in the size field, which meant that
they had the wrong values if the host and guest had different
sized longs. Switch to abi_long instead.
This fixes a bug where these ioctls don't work on 32-bit guests
on 64-bit hosts (and makes the LTP test 'setxattr03' pass
where it did not previously.)
Reported-by: pgndev <pgnet.dev@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
linux-user/syscall_defs.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 6e2287e918..447915cf80 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -1101,8 +1101,8 @@ struct target_pollfd {
/* Note that the ioctl numbers claim type "long" but the actual type
* used by the kernel is "int".
*/
-#define TARGET_FS_IOC_GETFLAGS TARGET_IOR('f', 1, long)
-#define TARGET_FS_IOC_SETFLAGS TARGET_IOW('f', 2, long)
+#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_FIEMAP TARGET_IOWR('f',11,struct fiemap)
--
2.14.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [PULL 09/10] linux-user/main: support dfilter
2017-10-18 12:33 [Qemu-devel] [PULL 00/10] linux-user update for 2.11 riku.voipio
` (7 preceding siblings ...)
2017-10-18 12:33 ` [Qemu-devel] [PULL 08/10] linux-user: Fix target FS_IOC_GETFLAGS and FS_IOC_SETFLAGS numbers riku.voipio
@ 2017-10-18 12:33 ` riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 10/10] linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values riku.voipio
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: riku.voipio @ 2017-10-18 12:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Bennée
From: Alex Bennée <alex.bennee@linaro.org>
This adds the -dfilter support to linux-user. There is a minor
checkpatch complaint about formatting which I've ignored for aesthetic
reasons.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
linux-user/main.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/linux-user/main.c b/linux-user/main.c
index fd54d344bb..dde04c769a 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3869,6 +3869,11 @@ static void handle_arg_log(const char *arg)
qemu_set_log(mask);
}
+static void handle_arg_dfilter(const char *arg)
+{
+ qemu_set_dfilter_ranges(arg, NULL);
+}
+
static void handle_arg_log_filename(const char *arg)
{
qemu_set_log_filename(arg, &error_fatal);
@@ -4066,6 +4071,8 @@ static const struct qemu_argument arg_table[] = {
{"d", "QEMU_LOG", true, handle_arg_log,
"item[,...]", "enable logging of specified items "
"(use '-d help' for a list of items)"},
+ {"dfilter", "QEMU_DFILTER", true, handle_arg_dfilter,
+ "range[,...]","filter logging based on address range"},
{"D", "QEMU_LOG_FILENAME", true, handle_arg_log_filename,
"logfile", "write logs to 'logfile' (default stderr)"},
{"p", "QEMU_PAGESIZE", true, handle_arg_pagesize,
--
2.14.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [PULL 10/10] linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values
2017-10-18 12:33 [Qemu-devel] [PULL 00/10] linux-user update for 2.11 riku.voipio
` (8 preceding siblings ...)
2017-10-18 12:33 ` [Qemu-devel] [PULL 09/10] linux-user/main: support dfilter riku.voipio
@ 2017-10-18 12:33 ` riku.voipio
2017-10-19 14:38 ` [Qemu-devel] [PULL 00/10] linux-user update for 2.11 Peter Maydell
2017-10-19 16:55 ` no-reply
11 siblings, 0 replies; 13+ messages in thread
From: riku.voipio @ 2017-10-18 12:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell
From: Peter Maydell <peter.maydell@linaro.org>
The TARGET_MTIOCTOP/TARGET_MTIOCGET/TARGET_MTIOCPOS values
were being defined in terms of host struct types, but
these structures are such that their size might differ
on different hosts. Switch to using a target struct
definition instead.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
linux-user/syscall_defs.h | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 447915cf80..e405d1d31d 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2712,9 +2712,34 @@ struct target_f_owner_ex {
#define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
#define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2)
-#define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop)
-#define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget)
-#define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos)
+struct target_mtop {
+ abi_short mt_op;
+ abi_int mt_count;
+};
+
+#if defined(TARGET_SPARC) || defined(TARGET_MIPS)
+typedef abi_long target_kernel_daddr_t;
+#else
+typedef abi_int target_kernel_daddr_t;
+#endif
+
+struct target_mtget {
+ abi_long mt_type;
+ abi_long mt_resid;
+ abi_long mt_dsreg;
+ abi_long mt_gstat;
+ abi_long mt_erreg;
+ target_kernel_daddr_t mt_fileno;
+ target_kernel_daddr_t mt_blkno;
+};
+
+struct target_mtpos {
+ abi_long mt_blkno;
+};
+
+#define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct target_mtop)
+#define TARGET_MTIOCGET TARGET_IOR('m', 2, struct target_mtget)
+#define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct target_mtpos)
struct target_sysinfo {
abi_long uptime; /* Seconds since boot */
--
2.14.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [PULL 00/10] linux-user update for 2.11
2017-10-18 12:33 [Qemu-devel] [PULL 00/10] linux-user update for 2.11 riku.voipio
` (9 preceding siblings ...)
2017-10-18 12:33 ` [Qemu-devel] [PULL 10/10] linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values riku.voipio
@ 2017-10-19 14:38 ` Peter Maydell
2017-10-19 16:55 ` no-reply
11 siblings, 0 replies; 13+ messages in thread
From: Peter Maydell @ 2017-10-19 14:38 UTC (permalink / raw)
To: Riku Voipio; +Cc: QEMU Developers
On 18 October 2017 at 13:33, <riku.voipio@linaro.org> wrote:
> From: Riku Voipio <riku.voipio@linaro.org>
>
> The following changes since commit 40a1e8ac2e10155b5df13a2508ac080b00cd7e23:
>
> Merge remote-tracking branch 'remotes/elmarco/tags/vu-pull-request' into staging (2017-10-16 10:22:39 +0100)
>
> are available in the git repository at:
>
> git://git.linaro.org/people/riku.voipio/qemu.git tags/pull-linux-user-20171018
>
> for you to fetch changes up to f443e3960d9d3340dd286e5fc0b661bb165a8b22:
>
> linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values (2017-10-17 22:24:02 +0300)
>
> ----------------------------------------------------------------
> Linux-user updates for Qemu 2.11
>
> ----------------------------------------------------------------
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [PULL 00/10] linux-user update for 2.11
2017-10-18 12:33 [Qemu-devel] [PULL 00/10] linux-user update for 2.11 riku.voipio
` (10 preceding siblings ...)
2017-10-19 14:38 ` [Qemu-devel] [PULL 00/10] linux-user update for 2.11 Peter Maydell
@ 2017-10-19 16:55 ` no-reply
11 siblings, 0 replies; 13+ messages in thread
From: no-reply @ 2017-10-19 16:55 UTC (permalink / raw)
To: riku.voipio; +Cc: famz, qemu-devel
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: cover.1508329282.git.riku.voipio@linaro.org
Subject: [Qemu-devel] [PULL 00/10] linux-user update for 2.11
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
t [tag update] patchew/20171018140620.25790-1-berrange@redhat.com -> patchew/20171018140620.25790-1-berrange@redhat.com
Switched to a new branch 'test'
9ba15e5f0c Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20171018' into staging
e7519f2151 linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values
bc68f37ffa linux-user/main: support dfilter
1ef58810fb linux-user: Fix target FS_IOC_GETFLAGS and FS_IOC_SETFLAGS numbers
63e3b96579 linux-user/sh4: Reduce TARGET_VIRT_ADDR_SPACE_BITS to 31
f4fa750ede linux-user: Tidy and enforce reserved_va initialization
70a7fe548c tcg: Fix off-by-one in assert in page_set_flags
720cebab0f linux-user: Allow -R values up to 0xffff0000 for 32-bit ARM guests
68bc7fd626 linux-user: remove duplicate break in syscall
01f2b8a4e4 target/m68k,linux-user: manage FP registers in ucontext
5aca4e3e12 linux-user: fix O_TMPFILE handling
=== OUTPUT BEGIN ===
Checking PATCH 1/11: linux-user: fix O_TMPFILE handling...
Checking PATCH 2/11: target/m68k,linux-user: manage FP registers in ucontext...
Checking PATCH 3/11: linux-user: remove duplicate break in syscall...
Checking PATCH 4/11: linux-user: Allow -R values up to 0xffff0000 for 32-bit ARM guests...
Checking PATCH 5/11: tcg: Fix off-by-one in assert in page_set_flags...
Checking PATCH 6/11: linux-user: Tidy and enforce reserved_va initialization...
Checking PATCH 7/11: linux-user/sh4: Reduce TARGET_VIRT_ADDR_SPACE_BITS to 31...
Checking PATCH 8/11: linux-user: Fix target FS_IOC_GETFLAGS and FS_IOC_SETFLAGS numbers...
Checking PATCH 9/11: linux-user/main: support dfilter...
ERROR: space required after that ',' (ctx:VxV)
#44: FILE: linux-user/main.c:4075:
+ "range[,...]","filter logging based on address range"},
^
total: 1 errors, 0 warnings, 19 lines checked
Your patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
Checking PATCH 10/11: linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values...
Checking PATCH 11/11: Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20171018' into staging...
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-10-22 16:46 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-18 12:33 [Qemu-devel] [PULL 00/10] linux-user update for 2.11 riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 01/10] linux-user: fix O_TMPFILE handling riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 02/10] target/m68k, linux-user: manage FP registers in ucontext riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 03/10] linux-user: remove duplicate break in syscall riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 04/10] linux-user: Allow -R values up to 0xffff0000 for 32-bit ARM guests riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 05/10] tcg: Fix off-by-one in assert in page_set_flags riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 06/10] linux-user: Tidy and enforce reserved_va initialization riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 07/10] linux-user/sh4: Reduce TARGET_VIRT_ADDR_SPACE_BITS to 31 riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 08/10] linux-user: Fix target FS_IOC_GETFLAGS and FS_IOC_SETFLAGS numbers riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 09/10] linux-user/main: support dfilter riku.voipio
2017-10-18 12:33 ` [Qemu-devel] [PULL 10/10] linux-user: Fix TARGET_MTIOCTOP/MTIOCGET/MTIOCPOS values riku.voipio
2017-10-19 14:38 ` [Qemu-devel] [PULL 00/10] linux-user update for 2.11 Peter Maydell
2017-10-19 16:55 ` no-reply
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).