aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-10-24char: rename chr_close/chr_freeMarc-André Lureau
The function is used to free the backend opaque pointer, let's name it accordingly. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-23-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char: move front end handlers in CharBackendMarc-André Lureau
Since the hanlders are associated with a CharBackend, rather than the CharDriverState, it is more appropriate to store in CharBackend. This avoids the handler copy dance in qemu_chr_fe_set_handlers() then mux_chr_update_read_handler(), by storing the CharBackend pointer directly. Also a mux CharDriver should go through mux->backends[focused], since chr->be will stay NULL. Before that, it was possible to call chr->handler by mistake with surprising results, for ex through qemu_chr_be_can_write(), which would result in calling the last set handler front end, not the one with focus. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-22-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24tests: start chardev unit testsMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-21-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char: make some qemu_chr_fe skip if no driverMarc-André Lureau
In most cases, front ends do not care about the side effect of CharBackend, so we can simply skip the checks and call the qemu_chr_fe functions even without associated CharDriver. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-20-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char: replace qemu_chr_claim/release with qemu_chr_fe_init/deinitMarc-André Lureau
Now that all front end use qemu_chr_fe_init(), we can move chardev claiming in init(), and add a function deinit() to release the chardev and cleanup handlers. The qemu_chr_fe_claim_no_fail() for property are gone, since the property will raise an error instead. In other cases, where there is already an error path, an error is raised instead. Finally, other cases are handled by &error_abort in qemu_chr_fe_init(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-19-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24vhost-user: only initialize queue 0 CharBackendMarc-André Lureau
All the queues share the same chardev. Initialize only the first queue CharBackend, and pass it to other queues. This will allow to claim the chardev only once in a later change. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-18-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char: fold qemu_chr_set_handlers in qemu_chr_fe_set_handlersMarc-André Lureau
qemu_chr_add_handlers*() have been removed in previous change, so the common qemu_chr_set_handlers() is no longer needed. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-17-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char: use qemu_chr_fe* functions with CharBackend argumentMarc-André Lureau
This also switches from qemu_chr_add_handlers() to qemu_chr_fe_set_handlers(). Note that qemu_chr_fe_set_handlers() now takes the focus when fe_open (qemu_chr_add_handlers() did take the focus) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-16-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24colo: claim in find_and_check_chardevMarc-André Lureau
This factors out claiming of chardev, and changes the call to non-fatal to return an error like the rest of the chardev checks. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-15-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char: rename some frontend functionsMarc-André Lureau
qemu_chr_accept_input() and qemu_chr_disconnect() are only used by frontend, so use qemu_chr_fe prefix. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-14-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char: remaining switch to CharBackend in frontendMarc-André Lureau
Similar to previous change, for the remaining CharDriverState front ends users. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-13-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char: replace PROP_CHR with CharBackendMarc-André Lureau
Store the property in a CharBackend instead of CharDriverState*. This also replace systematically chr by chr.chr to access the CharDriverState*. The following patches will replace it with calls to qemu_chr_fe CharBackend functions. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-12-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char: start converting mux driver to use CharBackendMarc-André Lureau
Start using qemu_chr_fe* CharBackend functions: initialize a CharBackend and use qemu_chr_fe_set_handlers(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-11-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char: introduce CharBackendMarc-André Lureau
This new structure is meant to keep the details associated with a char driver usage. On initialization, it gets a tag from the mux backend. It can change its handlers thanks to qemu_chr_fe_set_handlers(). This structure is introduced so that all frontend will be moved to hold and use a CharBackend. This will allow to better track char usage and allocation, and help prevent some memory leaks or corruption. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-10-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24mux: split mux_chr_update_read_handler()Marc-André Lureau
Make qemu_chr_add_handlers_full() aware of mux handling. This allows introduction of a tag associated with the fe handlers and a qemu_chr_set_handlers() function to set the handler for a particular tag. That will allow to get rid of qemu_chr_add_handlers*() in later changes, in favor of qemu_chr_fe_set_handler(). To this end, chr_update_read_handler callback is enhanced with a tag argument, and mux_chr_update_read_handler() is splitted in new functions: mux_chr_new_handler_tag(), mux_chr_set_handlers(), mux_set_focus(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-9-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24xilinx: fix buffer overflow on realizePaolo Bonzini
ASAN complains about buffer overflow when running: aarch64-softmmu/qemu-system-aarch64 -machine xilinx-zynq-a9 ==476==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000035e38 at pc 0x000000f75253 bp 0x7ffc597e0ec0 sp 0x7ffc597e0eb0 READ of size 8 at 0x602000035e38 thread T0 #0 0xf75252 in xilinx_spips_realize hw/ssi/xilinx_spips.c:623 #1 0xb9ef6c in device_set_realized hw/core/qdev.c:918 #2 0x129ae01 in property_set_bool qom/object.c:1854 #3 0x1296e70 in object_property_set qom/object.c:1088 #4 0x129dd1b in object_property_set_qobject qom/qom-qobject.c:27 #5 0x1297168 in object_property_set_bool qom/object.c:1157 #6 0xb9aeac in qdev_init_nofail hw/core/qdev.c:358 #7 0x78a5bf in zynq_init_spi_flashes /home/elmarco/src/qemu/hw/arm/xilinx_zynq.c:125 #8 0x78af60 in zynq_init /home/elmarco/src/qemu/hw/arm/xilinx_zynq.c:238 #9 0x998eac in main /home/elmarco/src/qemu/vl.c:4534 #10 0x7f96ed692730 in __libc_start_main (/lib64/libc.so.6+0x20730) #11 0x41d0a8 in _start (/home/elmarco/src/qemu/aarch64-softmmu/qemu-system-aarch64+0x41d0a8) 0x602000035e38 is located 0 bytes to the right of 8-byte region [0x602000035e30,0x602000035e38) allocated by thread T0 here: #0 0x7f970b014e60 in malloc (/lib64/libasan.so.3+0xc6e60) #1 0x7f96f15b0e18 in g_malloc (/lib64/libglib-2.0.so.0+0x4ee18) #2 0xb9ef6c in device_set_realized hw/core/qdev.c:918 #3 0x129ae01 in property_set_bool qom/object.c:1854 #4 0x1296e70 in object_property_set qom/object.c:1088 #5 0x129dd1b in object_property_set_qobject qom/qom-qobject.c:27 #6 0x1297168 in object_property_set_bool qom/object.c:1157 #7 0xb9aeac in qdev_init_nofail hw/core/qdev.c:358 #8 0x78a5bf in zynq_init_spi_flashes /home/elmarco/src/qemu/hw/arm/xilinx_zynq.c:125 #9 0x78af60 in zynq_init /home/elmarco/src/qemu/hw/arm/xilinx_zynq.c:238 #10 0x998eac in main /home/elmarco/src/qemu/vl.c:4534 #11 0x7f96ed692730 in __libc_start_main (/lib64/libc.so.6+0x20730) s->spi is allocated with the size of num_busses which may be 1 (by default). Change to use a loop up to s->num_busses also for the call to ssi_auto_connect_slaves(). Reported-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char: remove init callbackMarc-André Lureau
The CharDriverState.init() callback is no longer set since commit a61ae7f88ce and thus unused. The only user, the malta FGPA display has been converted to use an event "opened" callback instead. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-7-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24malta: replace chr init by CHR_EVENT_OPENED handlerMarc-André Lureau
The CharDriverState.init() callback was introduced in commit ceecf1d158. It is only called from text_console_do_init(), but it is no longer set since commit a61ae7f88 (init assignment has been removed by accident). It seems correct to use an event callback instead and print the console text on CHR_EVENT_OPENED. That way we can remove the single user of CharDriverState init(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-6-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24sun4uv: fix serial initialization regressionMarc-André Lureau
Since commit b6607a1a204d, serial_hds_isa_init() was introduced to factor out serial_isa_init() loops. However, sun4uv shouldn't start from 0 when there is a mm serial on 0 already. Add a "from" argument to serial_hds_isa_init(). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-5-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24ringbuf: fix chr_write return valueMarc-André Lureau
It should return the number of written bytes. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-4-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char: remove use-after-free on win-stdioMarc-André Lureau
Found by reviewing the code, win_stdio_close() is called by qemu_chr_free() which then call qemu_chr_free_common() taking care of freeing CharDriverState*. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-3-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24rng: remove unused included headerMarc-André Lureau
DEFINE_PROP_CHR is not used (rng is not of TYPE_DEVICE) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-2-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char.h: misc doc fixMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161011152012.3228-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24char: serial: check divider value against baud basePrasad J Pandit
16550A UART device uses an oscillator to generate frequencies (baud base), which decide communication speed. This speed could be changed by dividing it by a divider. If the divider is greater than the baud base, speed is set to zero, leading to a divide by zero error. Add check to avoid it. Reported-by: Huawei PSIRT <psirt@huawei.com> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Message-Id: <1476251888-20238-1-git-send-email-ppandit@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24memory: optimize memory_region_sync_dirty_bitmapPaolo Bonzini
Avoid walking the FlatView of all address spaces. Most of the address spaces will have no log_sync callback on their listeners. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24memory: optimize memory_global_dirty_log_syncPaolo Bonzini
Only return a nonzero dirty_log_mask for RAM/ROM memory regions. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24memory: add a per-AddressSpace list of listenersPaolo Bonzini
This speeds up MEMORY_LISTENER_CALL noticeably. Right now, with many PCI devices you have N regions added to M AddressSpaces (M = # PCI devices with bus-master enabled) and each call looks up the whole listener list, with at least M listeners in it. Because most of the regions in N are BARs, which are also roughly proportional to M, the whole thing is O(M^3). This changes it to O(M^2), which is the best we can do without rewriting the whole thing. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24memory: eliminate global MemoryListenersPaolo Bonzini
There is none, so just drop the code. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24tcg: try sti when moving a constant into a dead memory tempPaolo Bonzini
This comes from free from unifying tcg_reg_alloc_mov and tcg_reg_alloc_movi's handling of TEMP_VAL_CONST. It triggers often on moves to cc_dst, such as the following translation of "sub $0x3c,%esp": before: after: subl $0x3c,%ebp subl $0x3c,%ebp movl %ebp,0x10(%r14) movl %ebp,0x10(%r14) movl $0x3c,%ebx movl $0x3c,0x2c(%r14) movl %ebx,0x2c(%r14) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1473945360-13663-1-git-send-email-pbonzini@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24target-i386: fix 32-bit addresses in LEAPaolo Bonzini
This was found with test-i386. The issue is that instructions such as addr32 lea (%eax), %rax did not perform a 32-bit extension, because the LEA translation skipped the gen_lea_v_seg step. That step does not just add segments, it also takes care of extending from address size to pointer size. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24test-i386: fix bitrot for 64-bitPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24qht-bench: relax test_start/stop atomic accessesEmilio G. Cota
test_start/stop are used only as flags to loop on. Barriers are unnecessary, since no dependent data is transferred among threads apart from the flags themselves. This commit relaxes the three accesses to test_start/stop that were not yet relaxed. Signed-off-by: Emilio G. Cota <cota@braap.org>
2016-10-24atomic: base mb_read/mb_set on load-acquire and store-releasePaolo Bonzini
This introduces load-acquire and store-release operations in QEMU. For now, just use them as an implementation detail of atomic_mb_read and atomic_mb_set. Since docs/atomics.txt documents that atomic_mb_read only synchronizes with an atomic_mb_set of the same variable, we can use the new implementation everywhere instead of seq-cst loads and stores. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24rcu: simplify memory barriersPaolo Bonzini
Thanks to the acquire semantics of qemu_event_reset and qemu_event_wait, some memory barriers can be removed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24qemu-thread: use acquire/release to clarify semantics of QemuEventPaolo Bonzini
Do not use the somewhat mysterious atomic_mb_read/atomic_mb_set, instead make sure that the operations on QemuEvent are annotated with the desired acquire and release semantics. In particular, qemu_event_set wakes up the waiting thread, so it must be a release from the POV of the waker (compare with qemu_mutex_unlock). And it actually needs a full barrier, because that's the only thing that provides something like a "load-release". Use smp_mb_acquire until we have atomic_load_acquire and atomic_store_release in atomic.h. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24atomic: introduce smp_mb_acquire and smp_mb_releasePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24Put the copyright information on a separate lineThomas Huth
The output string QEMU with "--version" is very long, it does not fit into a normal line of a terminal window anymore. By putting the copyright information on a separate line instead, the output looks much nicer. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1475661284-30153-1-git-send-email-thuth@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24block/iscsi: Adding new iSER transport layer optionRoy Shterman
iSER is a new transport layer supported in Libiscsi, iSER provides a zero-copy RDMA capable interface that can improve performance. In order to use the new iSER transport one need to have RDMA supported HW and to choose iser as the protocol name in Libiscsi URI. For now iSER memory buffers are pre-allocated and pre-registered, hence in order to work with iSER from QEMU, one need to enable MEMLOCK attribute in the VM to be large enough for all iSER buffers and RDMA resources. Signed-off-by: Roy Shterman <roysh@mellanox.com> Message-Id: <1476000896-18632-3-git-send-email-roysh@mellanox.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-24block/iscsi: Introducing new zero-copy APIRoy Shterman
A new API to deploy zero-copy command submission. The new API takes I/O vectors list and number of I/O vectors to submit as input parameters when initiating the command. New API must be used if working with iSER transport option. Signed-off-by: Roy Shterman <roysh@mellanox.com> Message-Id: <1476000896-18632-2-git-send-email-roysh@mellanox.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-23rbd: shift byte count as a 64-bit valuePaolo Bonzini
Otherwise, reads of more than 2GB fail. Until commit 7bbca9e290a9c7c217b5a24fc6094e91e54bd05d, reads of 2^41 bytes succeeded at least theoretically. In fact, pdiscard ought to receive a 64-bit integer as the count for the same reason. Reported by Coverity. Fixes: 7bbca9e290a9c7c217b5a24fc6094e91e54bd05d Cc: qemu-stable@nongnu.org Cc: kwolf@redhat.com Cc: eblake@redhat.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-23kvm-all: don't use stale dbg_data->cpuAlex Bennée
The changes to run_on_cpu and friends mean that all helpers are passed the CPUState of vCPU they are running on. The conversion missed the field in commit e0eeb4a21a3ca4b296220ce4449d8acef9de9049 which introduced bugs. Reported-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com> Tested-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20161010154625.14881-1-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-10-21Merge remote-tracking branch 'remotes/riku/tags/pull-linux-user-20160921' ↵Peter Maydell
into staging Linux-user changes, mostly bugfixes and adding support for some new syscalls and some obscure syscalls as well. Includes some missed patches from earlier rounds, and dropping unicore32 target. v2: fix the syslog patch and test build with clang-3.8 v3: drop ustat patch # gpg: Signature made Fri 21 Oct 2016 13:38:06 BST # gpg: using RSA key 0xB44890DEDE3C9BC0 # gpg: Good signature from "Riku Voipio <riku.voipio@iki.fi>" # gpg: aka "Riku Voipio <riku.voipio@linaro.org>" # Primary key fingerprint: FF82 03C8 C391 98AE 0581 41EF B448 90DE DE3C 9BC0 * remotes/riku/tags/pull-linux-user-20160921: (21 commits) linux-user: disable unicore32 linux-user build linux-user: added support for pwritev() system call. linux-user: added support for preadv() system call. linux-user: Fix fadvise64() syscall support for Mips32 linux-user: Redirect termbits.h for Mips64 to termbits.h for Mips32 linux-user: Update ioctls definitions for Mips32 linux-user: Update mips_syscall_args[] array in main.c linux-user: Add support for syncfs() syscall linux-user: Add support for clock_adjtime() syscall linux-user: Fix definition of target_sigevent for 32-bit guests linux-user: use libc wrapper instead of direct mremap syscall linux-user: Don't use alloca() for epoll_wait's epoll event array linux-user: add RTA_PRIORITY in netlink linux-user: add kcmp() syscall linux-user: sparc64: Use correct target SHMLBA in shmat() linux-user: Remove a duplicate item from strace.list linux-user: Fix syslog() syscall support linux-user: Fix socketcall() syscall support linux-user: Fix msgrcv() and msgsnd() syscalls support linux-user: Fix mq_open() syscall support ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-10-21linux-user: disable unicore32 linux-user buildRiku Voipio
In order to cleanup linux-user, we need support for most relatively modern syscalls. unicore32 lacks support for syscalls like epoll_pwait, preventing cleaning up the CONFIG_EPOLL mess. This patch can be reverted when unicore32 starts either supporting the syscalls as defined in mainline kernel, or the oldabi interface gains support for syscalls supported since at kernel 2.6.19 / glibc 2.6 Cc: MPRC <zhangheng@mprc.pku.edu.cn> Cc: Xuetao Guan <gxt@mprc.pku.edu.cn> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-10-21linux-user: added support for pwritev() system call.Dejan Jovicevic
This system call performs the same task as the writev() system call, with the exception of having the fourth argument, offset, which specifes the file offset at which the input operation is to be performed. Because of this, the pwritev() implementation is based on the writev() implementation in linux-user mode. But, since pwritev() is implemented in the kernel as a 5-argument syscall, 5 arguments are needed to be handled as input and passed to the host syscall. The pos_l and pos_h argument of the safe_pwritev() are of type unsigned long, which can be of different sizes on different platforms. The input arguments are converted to the appropriate host size when passed to safe_pwritev(). Signed-off-by: Dejan Jovicevic <dejan.jovicevic@rt-rk.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-10-21linux-user: added support for preadv() system call.Dejan Jovicevic
This system call performs the same task as the readv() system call, with the exception of having the fourth argument, offset, which specifes the file offset at which the input operation is to be performed. Because of this, the preadv() implementation is based on the readv() implementation in linux-user mode. But, since preadv() is implemented in the kernel as a 5-argument syscall, 5 arguments are needed to be handled as input and passed to the host syscall. The pos_l and pos_h argument of the safe_preadv() are of type unsigned long, which can be of different sizes on different platforms. The input arguments are converted to the appropriate host size when passed to safe_preadv(). Signed-off-by: Dejan Jovicevic <dejan.jovicevic@rt-rk.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-10-21linux-user: Fix fadvise64() syscall support for Mips32Aleksandar Markovic
By looking at the file arch/mips/kernel/scall32-o32.S in Linux kernel, it can be deduced that, for Mips32 platform, syscall corresponding to number _NR_fadvise64 as defined in kernel file arch/mips/include/uapi/asm/unistd.h translates to kernel function sys_fadvise64_64, and that argument layout for this system call is as follows: 0 32 0 32 +----------------+----------------+ (arg1) | fd | __pad | (arg2) +----------------+----------------+ (arg3) | buffer | (arg4) +----------------+----------------+ (arg5) | len | (arg6) +----------------+----------------+ (arg7) | advise | not used | (arg8) +----------------+----------------+ The same argument layout can be deduced from glibc code, and relevant commit messages in linux kernel and glibc. The fix is to change TARGET_NR_fadvise64 to TARGET_NR_fadvise64_64 in Mips32 syscall numbers table. Array mips_syscall_args[] in linux-user/main.c also already have "fadvise64_64" (and not "fadvise64") in corresponding place for the syscall number in question, so no change for linux-user/main.c. This patch also fixes the failure LTP test posix_fadvise03, if executed on Qemu-emulated Mips32 platform (user mode). Signed-off-by: Aleksandar Rikalo <aleksandar.rikalo@imgtec.com> Signed-off-by: Miroslav Tisma <miroslav.tisma@imgtec.com> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-10-21linux-user: Redirect termbits.h for Mips64 to termbits.h for Mips32Aleksandar Markovic
linux-user/mips64/termbits.h and linux-user/mips/termbits.h originate from the same files in Linux kernel. There is no plan to split original headers in Linux kernel into Mips32 and Mips64 versions any time soon. Therefore, it is better not to have separate Mips32 and Mips64 variants in Qemu. This patch makes these two files effectively the same, allowing the mainenance by changing only a single file. (This is already done in the same fashion for some other headers in same directories.) Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-10-21linux-user: Update ioctls definitions for Mips32Aleksandar Markovic
Update linux-user/mips/termbits.h with ioctl definitions from kernel file arch/mips/include/uapi/asm/ioctls.h. Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-10-21linux-user: Update mips_syscall_args[] array in main.cAleksandar Markovic
Array mips_syscall_args[] determines number of arguments for each syscall on Mips32. It wasn't updated with newer syscalls. Also, preadv and pwritev have 5 arguments, not 6. Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2016-10-21linux-user: Add support for syncfs() syscallAleksandar Markovic
This patch implements Qemu user mode syncfs() syscall support. Syscall syncfs() syncs the filesystem containing file determined by the open file descriptor passed as the argument to syncfs(). The implementation consists of a straightforward invocation of host's syncfs(). Configure and strace support is included as well. Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>