aboutsummaryrefslogtreecommitdiff
path: root/linux-user
AgeCommit message (Collapse)AuthorFilesLines
2019-10-24linux-user/arm: Rebuild hflags for TARGET_WORDS_BIGENDIANRichard Henderson1-0/+1
Continue setting, but not relying upon, env->hflags. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20191023150057.25731-24-richard.henderson@linaro.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-10-24linux-user/aarch64: Rebuild hflags for TARGET_WORDS_BIGENDIANRichard Henderson1-0/+1
Continue setting, but not relying upon, env->hflags. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20191023150057.25731-23-richard.henderson@linaro.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-10-24target/arm: Rebuild hflags at EL changesRichard Henderson1-0/+1
Begin setting, but not relying upon, env->hflags. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20191023150057.25731-17-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-10-21linux-user/syscall: Align target_sockaddr fields using ABI typesPhilippe Mathieu-Daudé1-17/+17
Target architectures align types differently for instance m68k aligns on 16bit whereas others on 32bit). Use ABI types to keep alignments good. Suggested-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20191021114857.20538-10-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-10-21linux-user/strace: Let print_sockaddr() have a 'last' argumentPhilippe Mathieu-Daudé1-5/+5
If the format is not the syscall last argument, a comma is append. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20191021114857.20538-9-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-10-21linux-user/strace: Improve bind() outputPhilippe Mathieu-Daudé2-2/+15
Tested-By: Guido Günther <agx@sigxcpu.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20191021114857.20538-8-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-10-21linux-user/strace: Add print_sockfd()Philippe Mathieu-Daudé1-7/+16
Extract common print_sockfd() from various socket related syscalls. Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20191021114857.20538-7-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-10-21linux-user/strace: Dump AF_NETLINK sockaddr contentPhilippe Mathieu-Daudé1-0/+37
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-By: Guido Günther <agx@sigxcpu.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20191021114857.20538-6-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-10-21linux-user/syscall: Introduce target_sockaddr_nlPhilippe Mathieu-Daudé2-2/+11
Tested-By: Guido Günther <agx@sigxcpu.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20191021114857.20538-5-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-10-21linux-user/strace: Improve settimeofday()Philippe Mathieu-Daudé2-1/+14
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-By: Guido Günther <agx@sigxcpu.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20191021114857.20538-4-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-10-21linux-user/strace: Add print_timezone()Philippe Mathieu-Daudé1-0/+20
Suggested-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20191021114857.20538-3-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-10-21linux-user/strace: Display invalid pointer in print_timeval()Philippe Mathieu-Daudé1-1/+3
Suggested-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20191021114857.20538-2-f4bug@amsat.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-10-21Fix unsigned integer underflow in fd-trans.cShu-Chun Weng1-11/+40
In any of these `*_for_each_*` functions, the last entry in the buffer (so the "remaining length in the buffer" `len` is equal to the length of the entry `nlmsg_len`/`nla_len`/etc) has size that is not a multiple of the alignment, the aligned lengths `*_ALIGN(*_len)` will be greater than `len`. Since `len` is unsigned (`size_t`), it underflows and the loop will read pass the buffer. This may manifest as random EINVAL or EOPNOTSUPP error on IO or network system calls. Signed-off-by: Shu-Chun Weng <scw@google.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20191018001920.178283-1-scw@google.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-10-21linux-user: add strace for dup3Andreas Schwab1-0/+3
Signed-off-by: Andreas Schwab <schwab@suse.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <mvmsgoe17l5.fsf@suse.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-30Merge remote-tracking branch ↵Peter Maydell2-6/+0
'remotes/pmaydell/tags/pull-target-arm-20190927' into staging target-arm queue: * Fix the CBAR register implementation for Cortex-A53, Cortex-A57, Cortex-A72 * Fix direct booting of Linux kernels on emulated CPUs which have an AArch32 EL3 (incorrect NSACR settings meant they could not access the FPU) * semihosting cleanup: do more work at translate time and less work at runtime # gpg: Signature made Fri 27 Sep 2019 15:32:43 BST # gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE # gpg: issuer "peter.maydell@linaro.org" # gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@gmail.com>" [ultimate] # gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate] # Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE * remotes/pmaydell/tags/pull-target-arm-20190927: hw/arm/boot: Use the IEC binary prefix definitions hw/arm/boot.c: Set NSACR.{CP11,CP10} for NS kernel boots tests/tcg: add linux-user semihosting smoke test for ARM target/arm: remove run-time semihosting checks for linux-user target/arm: remove run time semihosting checks target/arm: handle A-profile semihosting at translate time target/arm: handle M-profile semihosting at translate time tests/tcg: clean-up some comments after the de-tangling target/arm: fix CBAR register for AArch64 CPUs Signed-off-by: Peter Maydell <peter.maydell@linaro.org> # Conflicts: # tests/tcg/arm/Makefile.target
2019-09-27target/arm: remove run-time semihosting checks for linux-userAlex Bennée2-6/+0
Now we do all our checking at translate time we can make cpu_loop a little bit simpler. We also introduce a simple linux-user semihosting test case to defend the functionality. The out-of-tree softmmu based semihosting tests are still more comprehensive. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 20190913151845.12582-6-alex.bennee@linaro.org Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-09-26target/ppc: fix signal delivery for ppc64abi32Alex Bennée1-1/+3
We were incorrectly using the 64-bit AIX ABI instead of the 32-bit SYSV ABI for setting NIP for the signal handler. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
2019-09-11linux-user: Add support for FDRESET, FDRAWCMD, FDTWADDLE, and FDEJECT ioctlsAleksandar Markovic2-0/+8
FDRESET, FDRAWCMD, FDTWADDLE, and FDEJECT ioctls are misc commands for controlling a floppy drive. Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1567601968-26946-7-git-send-email-aleksandar.markovic@rt-rk.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-11linux-user: Add support for FDMSGON and FDMSGOFF ioctlsAleksandar Markovic2-0/+4
FDMSGON and FDMSGOFF switch informational messages of floppy drives on and off. Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1567601968-26946-6-git-send-email-aleksandar.markovic@rt-rk.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-11linux-user: Add support for FDFLUSH ioctlYunqiang Su3-0/+7
FDFLUSH is used for flushing buffers of floppy drives. Support in QEMU is needed because some of Debian packages use this ioctl while running post-build tests. One such example is 'tar' package. Signed-off-by: Yunqiang Su <ysu@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1567601968-26946-5-git-send-email-aleksandar.markovic@rt-rk.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-11linux-user: Add support for FIOGETOWN and FIOSETOWN ioctlsAleksandar Markovic2-0/+6
FIOGETOWN and FIOSETOWN ioctls have platform-specific definitions, hence non-standard definition in QEMU too. Other than that, they both have a single integer argument, and their functionality is emulated in a straightforward way. Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1567601968-26946-4-git-send-email-aleksandar.markovic@rt-rk.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-11linux-user: Add support for RNDRESEEDCRNG ioctlAleksandar Markovic2-0/+4
RNDRESEEDCRNG is a newer ioctl (added in kernel 4.17), and an "ifdef" guard is used for that reason in this patch. Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1567601968-26946-3-git-send-email-aleksandar.markovic@rt-rk.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-11linux-user: drop redundant handling of environment variablesMax Filippov1-7/+0
QEMU_STRACE and QEMU_RAND_SEED are handled by the parse_args, no need to do it again in main. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20190906165736.5612-1-jcmvbkbc@gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-11target/xtensa: linux-user: add call0 ABI supportMax Filippov2-8/+28
Xtensa binaries built for call0 ABI don't rotate register window on function calls and returns. Invocation of signal handlers from the kernel is therefore different in windowed and call0 ABIs. There's currently no way to determine xtensa ELF binary ABI from the binary itself. Add handler for the -xtensa-abi-call0 command line parameter/QEMU_XTENSA_ABI_CALL0 envitonment variable to the qemu-user and record ABI choice. Use it to initialize PS.WOE in xtensa_cpu_reset. Check PS.WOE in setup_rt_frame to determine how a signal should be delivered. Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Message-Id: <20190906165713.5558-1-jcmvbkbc@gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-11linux-user: Support gdb 'qOffsets' query for ELFJosh Kunz1-0/+2
This is needed to support debugging PIE ELF binaries running under QEMU user mode. Currently, `code_offset` and `data_offset` remain unset for all ELF binaries, so GDB is unable to correctly locate the position of the binary's text and data. The fields `code_offset`, and `data_offset` were originally added way back in 2006 to support debugging of bFMT executables (978efd6aac6), and support was just never added for ELF. Since non-PIE binaries are loaded at exactly the address specified in the binary, GDB does not need to relocate any symbols, so the buggy behavior is not normally observed. http://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html#index-qOffsets-packet Buglink: https://bugs.launchpad.net/qemu/+bug/1528239 Signed-off-by: Josh Kunz <jkz@google.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20190816233422.16715-1-jkz@google.com> [lv: added link to documentation] Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-11linux-user/arm: Adjust MAX_RESERVED_VA for M-profileRichard Henderson1-3/+21
Limit the virtual address space for M-profile cpus to 2GB, so that we avoid all of the magic addresses in the top half of the M-profile system map. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20190822185929.16891-3-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-11linux-user: Pass CPUState to MAX_RESERVED_VARichard Henderson2-19/+26
Turn the scalar macro into a functional macro. Move the creation of the cpu up a bit within main() so that we can pass it to the invocation of MAX_RESERVED_VA. Delay the validation of the -R parameter until MAX_RESERVED_VA is computed. So far no changes to any of the MAX_RESERVED_VA macros to actually use the cpu in any way, but ARM will need it. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20190822185929.16891-2-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-11linux-user: add memfd_createShu-Chun Weng1-0/+12
Add support for the memfd_create syscall. If the host does not have the libc wrapper, translate to a direct syscall with NC-macro. Buglink: https://bugs.launchpad.net/qemu/+bug/1734792 Signed-off-by: Shu-Chun Weng <scw@google.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20190819180947.180725-1-scw@google.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-11linux-user: fail and report on bad dfilter specsAlex Bennée1-1/+1
Just passing NULL means we end up ignoring the bad dfilter spec instead of reporting it and exiting as we should. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20190830143648.2967-1-alex.bennee@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-11linux-user: erroneous fd_trans_unregister callShu-Chun Weng1-1/+0
timer_getoverrun returns the "overrun count" for the timer, which is not a file descriptor and thus should not call fd_trans_unregister on it. Signed-off-by: Shu-Chun Weng <scw@google.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20190819185348.221825-1-scw@google.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-10linux-user: Add AT_HWCAP2 for aarch64-linux-userRichard Henderson1-4/+27
Add the HWCAP2_* bits from kernel version v5.3-rc3. Enable the bits corresponding to ARMv8.5-CondM and ARMv8.5-FRINT. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20190809171156.3476-1-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-10linux-user: remove useless variableLaurent Vivier1-6/+4
filename is only used to open the file if AT_EXECFD is not provided. But exec_path already contains the path of the file to open. Remove filename as it is only used in main.c whereas exec_path is also used in syscall.c. Fixes: d088d664f201 ("linux-user: identify running binary in /proc/self/exe") Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20190714134028.315-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-09-04target/openrisc: Add support for ORFPX64A32Richard Henderson1-1/+1
This is hardware support for double-precision floating-point using pairs of 32-bit registers. Fix latent bugs in the heretofore unused helper_itofd and helper_ftoid. Include the bit for cpu "any". Change the default cpu for linux-user to "any". Reviewed-by: Stafford Horne <shorne@gmail.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2019-08-19target/mips: rationalise softfloat includesAlex Bennée1-0/+1
We should avoid including the whole of softfloat headers in cpu.h and explicitly include it only where we will be calling softfloat functions. We can use the -types.h in cpu.h for the few bits that are global. We also move the restore_snan_bit_mode into internal.h and include -helpers.h there. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2019-08-16Include qemu/queue.h slightly lessMarkus Armbruster4-1/+3
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20190812052359.30071-20-armbru@redhat.com>
2019-07-26linux-user: Make sigaltstack stacks per-threadPeter Maydell5-18/+28
The alternate signal stack set up by the sigaltstack syscall is supposed to be per-thread. We were incorrectly implementing it as process-wide. This causes problems for guest binaries that rely on this. Notably the Go runtime does, and so we were seeing crashes caused by races where two guest threads might incorrectly both execute on the same stack simultaneously. Replace the global target_sigaltstack_used with a field sigaltstack_used in the TaskState, and make all the references to the old global instead get a pointer to the TaskState and use the field. Fixes: https://bugs.launchpad.net/qemu/+bug/1696773 Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20190725131645.19501-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-07-19linux-user: fix to handle variably sized SIOCGSTAMP with new kernelsDaniel P. Berrangé4-38/+159
The SIOCGSTAMP symbol was previously defined in the asm-generic/sockios.h header file. QEMU sees that header indirectly via sys/socket.h In linux kernel commit 0768e17073dc527ccd18ed5f96ce85f9985e9115 the asm-generic/sockios.h header no longer defines SIOCGSTAMP. Instead it provides only SIOCGSTAMP_OLD, which only uses a 32-bit time_t on 32-bit architectures. The linux/sockios.h header then defines SIOCGSTAMP using either SIOCGSTAMP_OLD or SIOCGSTAMP_NEW as appropriate. If SIOCGSTAMP_NEW is used, then the tv_sec field is 64-bit even on 32-bit architectures To cope with this we must now convert the old and new type from the target to the host one. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Message-Id: <20190718130641.15294-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-07-18linux-user: check valid address in access_ok()Rémi Denis-Courmont1-1/+3
Fix a crash with LTP testsuite and aarch64: tst_test.c:1015: INFO: Timeout per run is 0h 05m 00s qemu-aarch64: .../qemu/accel/tcg/translate-all.c:2522: page_check_range: Assertion `start < ((target_ulong)1 << L1_MAP_ADDR_SPACE_BITS)' failed. qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x60001554 page_check_range() should never be called with address outside the guest address space. This patch adds a guest_addr_valid() check in access_ok() to only call page_check_range() with a valid address. Fixes: f6768aa1b4c6 ("target/arm: fix AArch64 virtual address space size") Signed-off-by: Rémi Denis-Courmont <remi@remlab.net> Signed-off-by: Laurent Vivier <lvivier@redhat.com> Message-Id: <20190704084115.24713-1-lvivier@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-07-16linux-user: Fix structure target_ucontext for MIPSAleksandar Markovic1-3/+2
Structure ucontext for MIPS is defined in the following way in Linux kernel: (arch/mips/include/uapi/asm/ucontext.h, lines 54-64) struct ucontext { /* Historic fields matching asm-generic */ unsigned long uc_flags; struct ucontext *uc_link; stack_t uc_stack; struct sigcontext uc_mcontext; sigset_t uc_sigmask; /* Extended context structures may follow ucontext */ unsigned long long uc_extcontext[0]; }; Fix the structure target_ucontext for MIPS to reflect the definition above, except the correction for field uc_extcontext, which will follow at some later time. Fixes: 94c5495d Reported-by: Dragan Mladjenovic <dmladjenovic@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1562931470-3700-2-git-send-email-aleksandar.markovic@rt-rk.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-07-04Merge remote-tracking branch ↵Peter Maydell1-1/+14
'remotes/palmer/tags/riscv-for-master-4.1-sf1-v3' into staging RISC-V Patches for the 4.1 Soft Freeze, Part 2 v3 This pull request contains a handful of patches that I'd like to target for the 4.1 soft freeze. There are a handful of new features: * Support for the 1.11.0, the latest privileged specification. * Support for reading and writing the PRCI registers. * Better control over the ISA of the target machine. * Support for the cpu-topology device tree node. Additionally, there are a handful of bug fixes including: * Load reservations are now broken by both store conditional and by scheduling, which fixes issues with parallel applications. * Various fixes to the PMP implementation. * Fixes to the 32-bit linux-user syscall ABI. * Various fixes for instruction decodeing. * A fix to the PCI device tree "bus-range" property. This boots 32-bit and 64-bit OpenEmbedded. Changes since v2 [riscv-for-master-4.1-sf1-v2]: * Dropped OpenSBI. Changes since v1 [riscv-for-master-4.1-sf1]: * Contains a fix to the sifive_u OpenSBI integration. # gpg: Signature made Wed 03 Jul 2019 09:39:09 BST # gpg: using RSA key 00CE76D1834960DFCE886DF8EF4CA1502CCBAB41 # gpg: issuer "palmer@dabbelt.com" # gpg: Good signature from "Palmer Dabbelt <palmer@dabbelt.com>" [unknown] # gpg: aka "Palmer Dabbelt <palmer@sifive.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 00CE 76D1 8349 60DF CE88 6DF8 EF4C A150 2CCB AB41 * remotes/palmer/tags/riscv-for-master-4.1-sf1-v3: (32 commits) hw/riscv: Extend the kernel loading support hw/riscv: Add support for loading a firmware hw/riscv: Split out the boot functions riscv: sifive_u: Update the plic hart config to support multicore riscv: sifive_u: Do not create hard-coded phandles in DT disas/riscv: Fix `rdinstreth` constraint disas/riscv: Disassemble reserved compressed encodings as illegal riscv: virt: Add cpu-topology DT node. RISC-V: Update syscall list for 32-bit support. RISC-V: Clear load reservations on context switch and SC RISC-V: Add support for the Zicsr extension RISC-V: Add support for the Zifencei extension target/riscv: Add support for disabling/enabling Counters target/riscv: Remove user version information target/riscv: Require either I or E base extension qemu-deprecated.texi: Deprecate the RISC-V privledge spec 1.09.1 target/riscv: Set privledge spec 1.11.0 as default target/riscv: Add the mcountinhibit CSR target/riscv: Add the privledge spec version 1.11.0 target/riscv: Restructure deprecatd CPUs ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-07-02linux-user: move QEMU_IFLA_BR_MULTI_BOOLOPT to the good functionLaurent Vivier1-6/+6
QEMU_IFLA_BR_MULTI_BOOLOPT has been added to the wrong function host_to_target_slave_data_bridge_nlattr(). Move it to host_to_target_data_bridge_nlattr(). This fixes following error: Unknown QEMU_IFLA_BR type 46 Fixes: 61b463fbf6cb ("linux-user: add new netlink types") Message-Id: <20190626150855.27446-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-07-02linux-user: Handle EXCP_FPE properly for MIPSAleksandar Markovic1-0/+17
Handle EXCP_FPE properly for MIPS in cpu loop. Note that a vast majority of FP instructions are not affected by the absence of the code in this patch, as they use alternative code paths for handling floating point exceptions (see, for example, invocations of update_fcr31()) - they rely on softfloat library for keeping track on exceptions that needs to be raised. However, there are few MIPS FP instructions (an example is CTC1) that use function do_raise_exception() directly, and they need the case that is added in this patch to propagate the FPE exception as designed. The code is based on kernel's function force_fcr31_sig() in arch/mips/kernel.traps.c. Reported-by: Yunqiang Su <ysu@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1561718618-20218-6-git-send-email-aleksandar.markovic@rt-rk.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-07-02linux-user: Introduce TARGET_HAVE_ARCH_STRUCT_FLOCKAleksandar Markovic2-7/+18
Bring target_flock definitions to be more in sync with the way flock is defined in kernel. Basically, the rules from the kernel are: 1. Majority of architectures have a common flock definition. 2. Architectures with 32-bit MIPS ABIs have a sligtly different flock definition; those architectures are the only arcitectures that have HAVE_ARCH_STRUCT_FLOCK defined, and that preprocessor constant is used in the common header as a flag for including or not including common flock definition. 3. Sparc architectures also have a sligtly different flock definition, but the difference is only the padding at the end of the structure. The presence of that padding is determined by preprocessor constants __ARCH_FLOCK6_PAD and __ARCH_FLOCK64_PAD. QEMU linux-user already implements rules 1. and 3. in a very similar way as they are implemented in kernel. However, rule 2. is implemented in a dissimilar way (for example, the constant TARGET_HAVE_ARCH_STRUCT_FLOCK is missing), and this patch brings QEMU implementation much closer to the kernel implementation. TARGET_HAVE_ARCH_STRUCT_FLOCK64 constant is also introduced to mimic HAVE_ARCH_STRUCT_FLOCK64 from kernel, but it is not defined anywhere, however, this is the case with HAVE_ARCH_STRUCT_FLOCK64 in kernel as well. Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1561718618-20218-5-git-send-email-aleksandar.markovic@rt-rk.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-07-02linux-user: Fix target_flock structure for MIPS O64 ABIAleksandar Markovic2-1/+5
Among MIPS ABIs, only MIPS O32 and N32 have special (different than other architectures) definition of structure flock in kernel. Bring target_flock definition in QEMU for MIPS O64 ABI to the correct state, which is currently different than the most common definition, and it should actually be the same. Reported-by: Dragan Mladjenovic <dmladjenovic@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1561718618-20218-4-git-send-email-aleksandar.markovic@rt-rk.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-07-02linux-user: Add support for strace for statx() syscallJim Wilson2-0/+89
All of the flags need to be conditional as old systems don't have statx support. Otherwise it works the same as other stat family syscalls. This requires the pending patch to add statx support. Tested on Ubuntu 16.04 (no host statx) and Ubuntu 19.04 (with host statx) using a riscv32-linux toolchain. Signed-off-by: Jim Wilson <jimw@sifive.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1561718618-20218-3-git-send-email-aleksandar.markovic@rt-rk.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-07-02linux-user: Add support for translation of statx() syscallAleksandar Rikalo2-1/+151
Implement support for translation of system call statx(). The implementation is based on "best effort" approach: if host is capable of executing statx(), host statx() is used. If not, the implementation includes invoking a more mature system call fstatat() on the host side to achieve as close as possible functionality. Support for statx() in kernel and glibc was, however, introduced at different points of time (the difference is more than a year): - kernel: Linux 4.11 (30 April 2017) - glibc: glibc 2.28 (1 Aug 2018) In this patch, the availability of statx() support is established via __NR_statx (if it is defined, statx() is considered available). This coincedes with statx() introduction in kernel. However, the structure statx definition may not be available in any header for hosts with glibc older than 2.28 (and it is, by design, to be defined in one of glibc headers), even though the full statx() functionality may be supported in kernel. Hence, a structure "target_statx" is defined in this patch, to remove that dependency on glibc headers, and to use statx() functionality as soon as the host kernel is capable of supporting it. Such statx structure definition is used for both target and host structures statx (of course, this doesn't mean the endian arrangement is the same on target and host - the endian conversion is done in all necessary cases). Signed-off-by: Aleksandar Rikalo <arikalo@wavecomp.com> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <1561718618-20218-2-git-send-email-aleksandar.markovic@rt-rk.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-07-01Merge remote-tracking branch 'remotes/vivier/tags/m68k-next-pull-request' ↵Peter Maydell5-183/+1
into staging remove m68k simulator syscall interface Fix comments format Fix gdbstub # gpg: Signature made Wed 26 Jun 2019 17:20:41 BST # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/vivier/tags/m68k-next-pull-request: linux-user/m68k: remove simulator syscall interface m68k comments break patch submission due to being incorrectly formatted The m68k gdbstub SR reg request doesnt include Condition-Codes Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-06-26linux-user/m68k: remove simulator syscall interfaceLaurent Vivier5-183/+1
This interface has been introduced in 2005 with the coldfire implementation (e6e5906b6e ColdFire target.) and looks like to do what the linux-user interface already does with the TRAP exception rather than the ILLEGAL exception. This interface has not been maintained since that. The semi-hosting interface is not removed so coldfire kernel with semi-hosting is always supported. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20190524162049.806-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2019-06-25RISC-V: Update syscall list for 32-bit support.Jim Wilson1-1/+14
32-bit RISC-V uses _llseek instead of lseek as syscall number 62. Update syscall list from open-embedded build, primarily because 32-bit RISC-V requires statx support. Tested with cross gcc testsuite runs for rv32 and rv64, with the pending statx patch also applied. Signed-off-by: Jim Wilson <jimw@sifive.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
2019-06-24linux-user: set default PPC64 CPULaurent Vivier1-1/+1
The default CPU for pseries has been set to POWER9 by default. We can use the same default for linux-user Signed-off-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20190609143521.19374-2-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>