aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-10-11update VERSION for v1.2.1v1.2.1Michael Roth
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11pseries: Don't test for MSR_PR for hypercalls under KVMDavid Gibson
PAPR hypercalls should only be invoked from the guest kernel, not guest user programs, that is, with MSR[PR]=0. Currently we check this in spapr_hypercall, returning H_PRIVILEGE if MSR[PR]=1. However, under KVM the state of MSR[PR] is already checked by the host kernel before passing the hypercall to qemu, making this check redundant. Worse, however, we don't generally synchronize KVM and qemu state on the hypercall path, meaning that qemu could incorrectly reject a hypercall because it has a stale MSR value. This patch fixes the problem by moving the privilege test exclusively to the TCG hypercall path. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> CC: qemu-stable@nongnu.org Signed-off-by: Alexander Graf <agraf@suse.de> (cherry picked from commit efcb9383b974114e5f682e531346006f8f2466c0) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11fpu/softfloat.c: Return correctly signed values from uint64_to_float32Peter Maydell
The uint64_to_float32() conversion function was incorrectly always returning numbers with the sign bit set (ie negative numbers). Correct this so we return positive numbers instead. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> (cherry picked from commit e744c06fca438dc08271e626034e632a270c91c8) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11i386: kvm: bit 10 of CPUID[8000_0001].EDX is reservedEduardo Habkost
Bit 10 of CPUID[8000_0001].EDX is not defined as an alias of CPUID[1].EDX[10], so do not duplicate it on kvm_arch_get_supported_cpuid(). Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-By: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Don Slutz <Don@CloudSwitch.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com> (cherry picked from commit b1f4679392a03f2b26a37bfa52e95d6cc4f73d82) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11Versatile Express: Fix NOR flash 0 address and remove flash aliasFrancesco Lavra
In the A series memory map (implemented in the Cortex A15 CoreTile), the first NOR flash bank (flash 0) is mapped to address 0x08000000, while address 0x00000000 can be configured as alias to either the first or the second flash bank. This patch fixes the definition of flash 0 address, and for simplicity removes the alias definition. Signed-off-by: Francesco Lavra <francescolavra.fl@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> (cherry picked from commit 661bafb3e14bfffcb0a7c7910534c7944608ca45) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11hw/armv7m_nvic: Correctly register GIC region when setting up NVICMeador Inge
When setting up the NVIC memory regions the memory range 0x100..0xcff is aliased to an IO memory region that belongs to the ARM GIC. This aliased region should be added to the NVIC memory container, but the actual GIC IO memory region was being added instead. This mixup was causing the wrong IO memory access functions to be called when accessing parts of the NVIC memory. Signed-off-by: Meador Inge <meadori@codesourcery.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> (cherry picked from commit 9892cae39562d2e6c00ccc5966302c00f23be6d4) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11pl190: fix read of VECTADDRBrendan Fennell
Reading VECTADDR was causing us to set the current priority to the wrong value, the most obvious effect of which was that we would return the vector for the wrong interrupt as the result of the read. Signed-off-by: Brendan Fennell <bfennell@skynet.ie> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> (cherry picked from commit 14c126baf1c38607c5bd988878de85a06cefd8cf) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11Clear handler only for valid fdOrit Wasserman
Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 3202becaa2b805497ce9e6faa6edfb83665f91b1) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11Fix address handling in inet_nonblocking_connectOrit Wasserman
getaddrinfo can give us a list of addresses, but we only try to connect to the first one. If that fails we never proceed to the next one. This is common on desktop setups that often have ipv6 configured but not actually working. To fix this make inet_connect_nonblocking retry connection with a different address. callers on inet_nonblocking_connect register a callback function that will be called when connect opertion completes, in case of failure the fd will have a negative value Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 233aa5c2d1cf4655ffe335025a68cf5454f87dad) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11Separate inet_connect into inet_connect (blocking) and inet_nonblocking_connectOrit Wasserman
No need to add non blocking parameters to the blocking inet_connect add block parameter for inet_connect_opts instead of using QemuOpt "block". Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 5db5f44cb4b7f24b9e0efdefc9015e36b7c34881) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11Refactor inet_connect_opts functionMichael S. Tsirkin
refactor address resolution code to fix nonblocking connect remove getnameinfo call Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Amos Kong <akong@redhat.com> Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 05bc1d8a4b2f77df8cc9880a552047e30c16f1f8) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11configure: Allow builds without any system or user emulationStefan Weil
The old code aborted configure when no emulation target was selected. Even after removing the 'exit 1', it tried to read from STDIN when QEMU was configured with configure' '--disable-user' '--disable-system' This is fixed here. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 8bdd3d499fe0ddffa9901c56ab3bc8911d5b8be0) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11block: correctly set the keep_read_only flagJeff Cody
I believe the bs->keep_read_only flag is supposed to reflect the initial open state of the device. If the device is initially opened R/O, then commit operations, or reopen operations changing to R/W, are prohibited. Currently, the keep_read_only flag is only accurate for the active layer, and its backing file. Subsequent images end up always having the keep_read_only flag set. For instance, what happens now: [ base ] kro = 1, ro = 1 | v [ snap-1 ] kro = 1, ro = 1 | v [ snap-2 ] kro = 0, ro = 1 | v [ active ] kro = 0, ro = 0 What we want: [ base ] kro = 0, ro = 1 | v [ snap-1 ] kro = 0, ro = 1 | v [ snap-2 ] kro = 0, ro = 1 | v [ active ] kro = 0, ro = 0 Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit be028adcedd68ca4d78fdc43e7e2fa4f1cdbc653) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11blockdev: preserve readonly and snapshot states across media changesKevin Shanahan
If readonly=on is given at device creation time, the ->readonly flag needs to be set in the block driver state for this device so that readonly-ness is preserved across media changes (qmp change command). Similarly, to preserve the snapshot property requires ->open_flags to be correct. Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com> (cherry picked from commit 80dd1aae3657a902d262f5d20a7a3c655b23705e) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11w32: Add implementation of gmtime_r, localtime_rStefan Weil
Those functions are missing in MinGW. Some versions of MinGW-w64 include defines for gmtime_r and localtime_r. Older versions of these macros are buggy (they return a pointer to a static variable), therefore we don't want them. Newer versions are similar to the code used here, but without the memset. The implementation which is used here is not strictly reentrant, but sufficiently good for QEMU on w32 or w64. Signed-off-by: Stefan Weil <sw@weilnetz.de> [blauwirbel@gmail.com: added comment about locking] Signed-off-by: Blue Swirl <blauwirbel@gmail.com> (cherry picked from commit d3e8f95753114a827f9cd8e819b1d5cc8333f76b) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11w32: Always use standard instead of native format stringsStefan Weil
GLib 2.0 include files use __printf__ for the format attribute which resolves to native format strings on w32 hosts. QEMU wants standard format strings instead of native format strings, so we simply change any declaration with __printf__ to use __gnu_printf__. This works because all basic printf functions support both kinds of format strings. This fixes a compiler warning: qapi/string-output-visitor.c: In function ‘print_type_int’: qapi/string-output-visitor.c:34:5: warning: unknown conversion type character ‘l’ in format [-Wformat] qapi/string-output-visitor.c:34:5: warning: too many arguments for format [-Wformat-extra-args] Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> (cherry picked from commit 95df51a4a02a853af8828c281bce2d4f2a41d6fd) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11net/socket: Fix compiler warning (regression for MinGW)Stefan Weil
Commit 213fd5087e2e4e2da10ad266df0ba950cf7618bf removed a type cast which is needed for MinGW: net/socket.c:136: warning: pointer targets in passing argument 2 of ‘sendto’ differ in signedness /usr/lib/gcc/amd64-mingw32msvc/4.4.4/../../../../amd64-mingw32msvc/include/winsock2.h:1313: note: expected ‘const char *’ but argument is of type ‘const uint8_t *’ Add a 'qemu_sendto' macro which provides that type cast where needed and use the new macro instead of 'sendto'. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> (cherry picked from commit 73062dfe6be0050dbd43ce3516e935ebb2545add) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11linux-user: Remove redundant null check and replace free by g_freeStefan Weil
Report from smatch: linux-user/syscall.c:3632 do_ioctl_dm(220) info: redundant null check on big_buf calling free() 'big_buf' was allocated by g_malloc0, therefore free was also replaced by g_free. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> (cherry picked from commit ad11ad77748bdd8016370db210751683dc038dd6) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11TextConsole: saturate escape parameter in TTY_STATE_CSILaszlo Ersek
Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> (cherry picked from commit c10600af60865ba6c60987be313102ebb5fcee57) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11curses: don't initialize curses when qemu is daemonizedHitoshi Mitake
Current qemu initializes curses even if -daemonize option is passed. This cause problem because shell prompt appears without calling endwin(). This patch adds new function, is_daemonized(), to OS dependent code. With this function, curses_display_init() can check that qemu is daemonized or not. If daemonized, curses_display_init() isn't called and the problem is avoided. Of course, -daemonize && -curses doesn't make sense. Users shouldn't pass the arguments at the same time. But the problem is very painful because Ctrl-C cannot be delivered to the terminal. Cc: Andrzej Zaborowski <balrog@zabor.org> Cc: Stefan Hajnoczi <stefanha@gmail.com> Cc: Anthony Liguori <aliguori@us.ibm.com> Cc: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Hitoshi Mitake <h.mitake@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> (cherry picked from commit 995ee2bf469de6bbe5ce133ec853392b2a4ce34c) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11pflash_cfi01: Fix warning caused by unreachable codeStefan Weil
Report from smatch: hw/pflash_cfi01.c:431 pflash_write(180) info: ignoring unreachable code. Instead of removing the return statement after the switch statement, the patch replaces the return statements in the switch statement by break statements. Other switch statements in the same code do it also like that. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> (cherry picked from commit 12dabc79f976d66755025272f7e2e8e4da31715a) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11ioh3420: Remove unreachable codeStefan Weil
Report from smatch: hw/ioh3420.c:128 ioh3420_initfn(35) info: ignoring unreachable code. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> (cherry picked from commit 997f15672a5ca7714cf310d92f475d2c5fe40970) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11lm4549: Fix buffer overflowStefan Weil
Report from smatch: lm4549.c:234 lm4549_write_samples(14) error: buffer overflow 's->buffer' 1024 <= 1024 There must be enough space to add two entries starting with index s->buffer_level, therefore the old check was wrong. [Peter Maydell <peter.maydell@linaro.org> clarifies the nature of the analyser warning: I don't object to making the change to placate the analyser, but I don't think this is actually a buffer overrun. We always add and remove samples from the buffer two at a time, so it's not possible to get here with s->buffer_level == BUFFER_SIZE-1 (which is the only case where the old and new conditions give different answers).] Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> (cherry picked from commit 8139626643cbe8dc07bd9acc88057effeedf8064) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11cadence_uart: Fix buffer overflowStefan Weil
Report from smatch: hw/cadence_uart.c:413 uart_read(13) error: buffer overflow 's->r' 18 <= 18 This fixes read access to s->r[R_MAX] which is behind the limits of s->r. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> (cherry picked from commit 5d40097fc09fe5d34cf316a411dc27d455ac2cd0) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11qemu-sockets: Fix potential memory leakStefan Weil
The old code leaks variable 'peer'. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> (cherry picked from commit 39b384591fda27d6e1213cea0b11b1ebe0ed4b74) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11qemu-ga: Remove unreachable code after g_errorStefan Weil
Report from smatch: qemu-ga.c:117 register_signal_handlers(11) info: ignoring unreachable code. qemu-ga.c:122 register_signal_handlers(16) info: ignoring unreachable code. g_error calls abort which terminates the program. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> (cherry picked from commit b548828862d3bf7214b7ef9cb361356b153b89c9) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11audio: Fix warning from static code analysisStefan Weil
smatch report: audio/audio_template.h:416 AUD_open_out(18) warn: variable dereferenced before check 'as' (see line 414) Moving the ldebug statement after the statement which checks 'as' fixes that warning. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: malc <av1474@comtv.ru> (cherry picked from commit 93b6599734f81328ee3d608f57667742cafeea72) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11SCSI: Standard INQUIRY data should report HiSup flag as set.Ronnie Sahlberg
QEMU as far as I know only reports LUN numbers using the modes that are described in SAM4. As such, since all LUN numbers generated by the SCSI emulation in QEMU follow SAM4, we should set the HiSup bit in the standard INQUIRY data to indicate such. From SAM4: 4.6.3 LUNs overview All LUN formats described in this standard are hierarchical in structure even when only a single level in that hierarchy is used. The HISUP bit shall be set to one in the standard INQUIRY data (see SPC-4) when any LUN format described in this standard is used. Non-hierarchical formats are outside the scope of this standard. Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com> (cherry picked from commit 1109c894052751df99962c009fd7dbae397721f5) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11scsi-disk: fix check for out-of-range LBAPaolo Bonzini
This fix is needed to correctly handle 0-block read and writes. Without it, a 0-block access at LBA 0 would underflow. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 12ca76fc48081b3a0ad1a70546abfcf198aedfc4) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11scsi-disk: introduce check_lba_rangePaolo Bonzini
Abstract the test for an out-of-range (starting block, block count) pair. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 444bc908611ccaf4512dc37c33ac3b54d873a62b) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11iSCSI: We dont need to explicitely call qemu_notify_event() any moreRonnie Sahlberg
We no longer need to explicitely call qemu_notify_event() any more since this is now done automatically any time the filehandles we listen to change. Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 40a13ca8d28c21062e35b10d9b80e76b92405bdf) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11iSCSI: We need to support SG_IO also from iscsi_ioctl()Ronnie Sahlberg
We need to support SG_IO from the synchronous iscsi_ioctl() since scsi-block uses this to do an INQ to the device to discover its properties This patch makes scsi-block work with iscsi. Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit f1a12821d7df2e4d21be4f2206f84b4640533e53) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11MAINTAINERS: Add entry for QOM CPUAndreas Färber
Signed-off-by: Andreas Färber <afaerber@suse.de> (cherry picked from commit f2ca052414d7eddc10517e98a5a27ba8099b19b1) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11pflash_cfi01: fix vendor specific extended queryAurelien Jarno
pflash_cfi01 announces a version number of 1.1, which implies "Protection Register Information" and "Burst Read information" sections, which are not provided. Decrease the version number to 1.0 so that only the "Protection Register Information" section is needed. Set the number of protection fields (0x3f) to 0x01, as 0x00 means 256 protections field, which makes the CFI table bigger than the current implementation, causing some kernels to fail to read it. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> (cherry picked from commit 262e1eaafabf32d33a9fa0b03b3c8ea426c5ae1b) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11xilinx_timer: Fix a compile error if debug enabledChris Wulff
There was a missing include of qemu-log and a variable name in a printf was out of date. Signed-off-by: Chris Wulff <crwulff@gmail.com> Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com> (cherry picked from commit 8354cd722e0afae63bee3e4cb21c8f0ddb6874c2) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11xilinx.h: Error check when setting linksPeter A. G. Crosthwaite
Assert that the ethernet and dma controller are sucessfully linked to their peers. Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com> (cherry picked from commit 4b5e52101f9ad077d1c016f2b7130e2fdae6d2da) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11xilinx_timer: Send dbg msgs to stderr not stdoutPeter A. G. Crosthwaite
Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com> (cherry picked from commit e03377ae75808d33d0a7afc803b37bcda9f796b3) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11xilinx_timer: Removed comma in device namePeter A. G. Crosthwaite
Fixes an error in a61e4b07a30c062260d2d01771773f14820d1eb7 Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com> (cherry picked from commit c0a1dcb9f0baf9269f8baeb02cbcca8dad75454c) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11arch_init.c: Improve '-soundhw help' for non-HAS_AUDIO_CHOICE archsPeter Maydell
For architectures which don't set HAS_AUDIO_CHOICE, improve the '-soundhw help' message so that it doesn't simply print an empty list, implying no sound support at all. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: malc <av1474@comtv.ru> (cherry picked from commit 55d4fd3c24bd253bd96270c7fdf1bb862f3a3400) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11cpu_physical_memory_write_rom() needs to do TB invalidatesDavid Gibson
cpu_physical_memory_write_rom(), despite the name, can also be used to write images into RAM - and will often be used that way if the machine uses load_image_targphys() into RAM addresses. However, cpu_physical_memory_write_rom(), unlike cpu_physical_memory_rw() doesn't invalidate any cached TBs which might be affected by the region written. This was breaking reset (under full emu) on the pseries machine - we loaded our firmware image into RAM, and while executing it rewrite the code at the entry point (correctly causing a TB invalidate/refresh). When we reset the firmware image was reloaded, but the TB from the rewrite was still active and caused us to get an illegal instruction trap. This patch fixes the bug by duplicating the tb invalidate code from cpu_physical_memory_rw() in cpu_physical_memory_write_rom(). Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 0b57e287138728f72d88b06e69b970c5d745c44a) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11qemu-char: BUGFIX, don't call FD_ISSET with negative fdDavid Gibson
tcp_chr_connect(), unlike for example udp_chr_update_read_handler() does not check if the fd it is using is valid (>= 0) before passing it to qemu_set_fd_handler2(). If using e.g. a TCP serial port, which is not initially connected, this can result in -1 being passed to FD_ISSET, which has undefined behaviour. On x86 it seems to harmlessly return 0, but on PowerPC, it causes a fortify buffer overflow error to be thrown. This patch fixes this by putting an extra test in tcp_chr_connect(), and also adds an assert qemu_set_fd_handler2() to catch other such errors on all platforms, rather than just some. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit bbdd2ad0814ea0911076419ea21b7957505cf1cc) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11Revert 455aa1e08 and c3767ed0ebAnthony Liguori
commit c3767ed0eb5d0bb25fe409ae5dec06e3411ff1b6 qemu-char: (Re-)connect for tcp_chr_write() unconnected writing Has no hope of working because tcp_chr_connect() does not actually connect. 455aa1e08 just fixes the SEGV with server() but the attempt to connect a client socket is still completely broken. This patch reverts both. Reported-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit 6db0fdce02d72546a4c47100a9b2cd0090cf464d) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11configure: properly check if -lrt and -lm is neededNatanael Copa
Fixes build against uClibc. uClibc provides 2 versions of clock_gettime(), one with realtime support and one without (this is so you can avoid linking in -lrt unless actually needed). This means that the clock_gettime() don't need -lrt. We still need it for timer_create() so we check for this function in addition. We also need check if -lm is needed for isnan(). Both -lm and -lrt are needed for libs_qga. Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com> (cherry picked from commit 8bacde8d86a09699207d85d4bab06162aed18dc4) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11configure: fix seccomp checkYann E. MORIN
Currently, if libseccomp is missing but the user explicitly requested seccomp support using --enable-seccomp, configure silently ignores the situation and disables seccomp support. This is unlike all other tests that explicitly fail in such situation. Fix that. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com> (cherry picked from commit e84d5956cc6215d2f098e7b6090fc5ec4cba1be3) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11net: EAGAIN handling for net/socket.c TCPStefan Hajnoczi
Replace spinning send_all() with a proper non-blocking send. When the socket write buffer limit is reached, we should stop trying to send and wait for the socket to become writable again. Non-blocking TCP sockets can return in two different ways when the write buffer limit is reached: 1. ret = -1 and errno = EAGAIN/EWOULDBLOCK. No data has been written. 2. ret < total_size. Short write, only part of the message was transmitted. Handle both cases and keep track of how many bytes have been written in s->send_index. (This includes the 'length' header before the actual payload buffer.) Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> (cherry picked from commit 45a7f54a8bb3928ffa58d522e0d61acaee8277bb) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11net: EAGAIN handling for net/socket.c UDPStefan Hajnoczi
Implement asynchronous send for UDP (or other SOCK_DGRAM) sockets. If send fails with EAGAIN we wait for the socket to become writable again. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> (cherry picked from commit 213fd5087e2e4e2da10ad266df0ba950cf7618bf) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11net: asynchronous send/receive infrastructure for net/socket.cStefan Hajnoczi
The net/socket.c net client is not truly asynchronous. This patch borrows the qemu_set_fd_handler2() code from net/tap.c as the basis for proper asynchronous send/receive. Only read packets from the socket when the peer is able to receive. This avoids needless queuing. Later patches implement asynchronous send. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> (cherry picked from commit 863f678fba4191f3b695620f41056cb7c124425d) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11net: broadcast hub packets if at least one port can receiveStefan Hajnoczi
In commit 60c07d933c66c4b30a83b7ccbc8a0cb3df1b2d0e ("net: fix qemu_can_send_packet logic") the "VLAN" broadcast behavior was changed to queue packets if any net client cannot receive. It turns out that this was not actually the right fix and just hides the real bug that hw/usb/dev-network.c:usbnet_receive() clobbers its receive buffer when called multiple times in a row. The commit also introduced a new bug that "VLAN" packets would not be sent if one of multiple net clients was down. The hw/usb/dev-network.c bug has since been fixed, so this patch reverts broadcast behavior to send packets as long as one net client can receive. Packets simply get queued for the net clients that are temporarily unable to receive. Reported-by: Roy.Li <rongqing.li@windriver.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> (cherry picked from commit 61518a74ca98870e8ff132f91dd5dda252e31f58) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11net: fix usbnet_receive() packet dropsStefan Hajnoczi
The USB network interface has a single buffer which the guest reads from. This patch prevents multiple calls to usbnet_receive() from clobbering the input buffer. Instead we queue packets until buffer space becomes available again. This is inspired by virtio-net and e1000 rxbuf handling. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> (cherry picked from commit 190563f9a90c9df8ad32fc7f3e4b166deda949a6) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2012-10-11net: clean up usbnet_receive()Stefan Hajnoczi
The USB network interface has two code paths depending on whether or not RNDIS mode is enabled. Refactor usbnet_receive() so that there is a common path throughout the function instead of duplicating everything across if (is_rndis(s)) ... else ... code paths. Clean up coding style and 80 character line wrap along the way. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> (cherry picked from commit f237ddbb89142c6948a2257c459e49dee7500a7c) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>