configure: Allow builds without any system or user emulation
The old code aborted configure when no emulation target was selected.Even after removing the 'exit 1', it tried to read from STDINwhen QEMU was configured with
configure' '--disable-user' '--disable-system'...
add pc-1.3 machine type
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
compat: turn off msi/msix on xhci for old machine types
ivshmem: add 64bit option
This patch adds a "use64" property which will make the ivshmem driverregister a 64bit memory bar when set, so you have something to play withwhen testing 64bit pci bits. It also allows to have quite big sharedmemory regions, like this:...
Introduce powerdown_notifiers
Notifier will be used for signaling powerdown request to guest ina more general way and intended to replace very specificqemu_irq_rise(qemu_system_powerdown) and will allow to remove globalvariable qemu_system_powerdown....
acpi: use notifier for signaling guest system_powerdown command
In addition, there is no need to allocate an extra irq just forrising SCI in irq handler. Just rise SCI right from notifierhandler instead.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>...
target-arm: use notifier for signaling guest system_powerdown command
Acked-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Igor Mammedov <imammedo@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
target-sparc: use notifier for signaling guest system_powerdown command
Signed-off-by: Igor Mammedov <imammedo@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Cleanup unused global var qemu_system_powerdown
All deps that used global qemu_system_powerdown var are now convertedto notifiers, so remove it.
Merge remote-tracking branch 'origin/master' into staging
tcg/i386: fix build with -march < i686
The movcond_i32 op has to be protected with TCG_TARGET_HAS_movcond_i32to fix the build with -march < i686.
Thanks to Richard Henderson for the hint.
Reported-by: Alex Barcelo <abarcelo@ac.upc.edu>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg: Sanity check goto_tb input
Checking that we don't try for idx != [01] is trivial. Checkingthat we don't issue more than one of any index requires a tadmore data and some ifdefs protecting that new variable.
Signed-off-by: Richard Henderson <rth@twiddle.net>...
tcg: Streamline movcond_i64 using 32-bit arithmetic
Avoiding 64-bit arithmetic (outside of the compare) reduces thegenerated op count from 15 to 12, and the generated code size oni686 from 105 to 88 bytes.
tcg: Streamline movcond_i64 using movcond_i32
When movcond_i32 is available we can further reduce the generatedop count from 12 to 6, and the generated code size on i686 from88 to 74 bytes.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg/mips: fix MIPS32 detection
Fix the MIPS32 cpu detection so that it also works with-march=octeon. Thanks to Andrew Pinski for the hint.
Cc: Andrew Pinski <apinski@cavium.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg: Adjust descriptions of *cond opcodes
The README file documented the operand ordering of the tcg_gen_*functions. Since we're documenting opcodes here, use the trueoperand ordering.
Signed-off-by: Richard Henderson <rth@twiddle.net>Cc: malc <av1474@comtv.ru>...
tcg: Emit ANDI as EXTU for appropriate constants
Note that andi_i64 failed to perform even the minimaloptimizations promised by the README.
tcg: Optimize initial inputs for ori_i64
Copy the same optimizations from ori_i32.
tcg: Emit XORI as NOT for appropriate constants
Note that xori_i64 failed to perform even the minimaloptimizations promised by the README.
tcg: Implement concat*_i64 with deposit_i64
For tcg_gen_concat_i32_i64 we only use deposit if the host supports it.For tcg_gen_concat32_i64 even if the host does not, as we get identicalcode before and after.
Note that this relies on the ANDI -> EXTU patch for the identity claim....
tcg: Add tcg_debug_assert
Like the C assert macro, except only enabled for CONFIG_DEBUG_TCG,and without having to set _NDEBUG and disable all other asserts atthe same time.
The use of __builtin_unreachable (when available) gives the compilerthe same information, which may (or may not) help it optimize better....
tcg: Sanity check deposit inputs
Given these are constants, checking once here means everythingafter can assume they're correct.
Merge remote-tracking branch 'bonzini/scsi-next' into staging
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
Merge remote-tracking branch 'kwolf/for-anthony' into staging
Merge remote-tracking branch 'bonzini/nbd-next' into staging
block: remove keep_read_only flag from BlockDriverState struct
The keep_read_only flag is no longer used, in favor of the bdrvflag BDRV_O_ALLOW_RDWR.
Signed-off-by: Jeff Cody <jcody@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: purge s->aligned_buf and s->aligned_buf_size from raw-posix.c
The aligned_buf pointer and aligned_buf size are no longer used inraw_posix.c, so remove all references to them.
block: raw-posix image file reopen
This is derived from the Supriya Kannery's reopen patches.
This contains the raw-posix driver changes for the bdrv_reopen_*functions. All changes are staged into a temporary scratch bufferduring the prepare() stage, and copied over to the live structure...
block: raw image file reopen
These are the stubs for the file reopen drivers for the raw format.
There is currently nothing that needs to be done by the raw driverin reopen.
block: qed image file reopen
These are the stubs for the file reopen drivers for the qed format.
There is currently nothing that needs to be done by the qed driverin reopen.
block: qcow2 image file reopen
These are the stubs for the file reopen drivers for the qcow2 format.
There is currently nothing that needs to be done by the qcow2 driverin reopen.
block: qcow image file reopen
These are the stubs for the file reopen drivers for the qcow format.
There is currently nothing that needs to be done by the qcow driverin reopen.
block: vmdk image file reopen
This patch supports reopen for VMDK image files. VMDK extents are addedto the existing reopen queue, so that the transactional model of reopenis maintained with multiple image files.
Signed-off-by: Jeff Cody <jcody@redhat.com>...
block: vdi image file reopen
There is currently nothing that needs to be done for VDI reopen.
block: vpc image file reopen
There is currently nothing that needs to be done for VPC imagefile reopen.
block: convert bdrv_commit() to use bdrv_reopen()
Currently, bdrv_commit() reopens images r/w itself, via risky_delete() and _open() calls. Use the new safe method for drive reopen.
blockdev: preserve readonly and snapshot states across media changes
If readonly=on is given at device creation time, the ->readonly flagneeds to be set in the block driver state for this device so thatreadonly-ness is preserved across media changes (qmp change command)....
block: correctly set the keep_read_only flag
I believe the bs->keep_read_only flag is supposed to reflectthe initial open state of the device. If the device is initiallyopened R/O, then commit operations, or reopen operations changingto R/W, are prohibited....
block: make bdrv_set_enable_write_cache() modify open_flags
bdrv_set_enable_write_cache() sets the bs->enable_write_cache flag,but without the flag recorded in bs->open_flags, then next timea reopen() is performed the enable_write_cache setting may beinadvertently lost....
block: Framework for reopening files safely
This is based on Supriya Kannery's bdrv_reopen() patch series.
This provides a transactional method to reopen multipleimages files safely.
Image files are queue for reopen via bdrv_reopen_queue(), and thereopen occurs when bdrv_reopen_multiple() is called. Changes are...
block: move aio initialization into a helper function
Move AIO initialization for raw-posix block driver into a helper function.
In addition to just code motion, the aio_ctx pointer is checked for NULL,prior to calling laio_init(), to make sure laio_init() is only run once....
block: move open flag parsing in raw block drivers to helper functions
Code motion, to move parsing of open flags into a helper function.
block: do not parse BDRV_O_CACHE_WB in block drivers
Block drivers should ignore BDRV_O_CACHE_WB in .bdrv_open flags,and in the bs->open_flags.
This patch removes the code, leaving the behaviour behind as ifBDRV_O_CACHE_WB was set.
block: use BDRV_O_NOCACHE instead of s->aligned_buf in raw-posix.c
Rather than check for a non-NULL aligned_buf to determine ifraw_aio_submit needs to check for alignment, check for the presenceof BDRV_O_NOCACHE in the bs->open_flags.
w32: Add implementation of gmtime_r, localtime_r
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 astatic variable), therefore we don't want them. Newer versions are...
w32: Always use standard instead of native format strings
GLib 2.0 include files use printf for the format attributewhich resolves to native format strings on w32 hosts.
QEMU wants standard format strings instead of native formatstrings, so we simply change any declaration with printf...
net/socket: Fix compiler warning (regression for MinGW)
Commit 213fd5087e2e4e2da10ad266df0ba950cf7618bf removed a type castwhich 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:...
linux-user: Remove redundant null check and replace free by g_free
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 alsoreplaced by g_free....
qemu-timer: simplify qemu_run_timers
ptimer_head is an invariant pointer to clock->active_timers.Remove it, and just reference clock->active_timers directly.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
qemu-ga: Remove unreachable code after g_error
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....
qemu-sockets: Fix potential memory leak
The old code leaks variable 'peer'.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
cadence_uart: Fix buffer overflow
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.
lm4549: Fix buffer overflow
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 indexs->buffer_level, therefore the old check was wrong....
ioh3420: Remove unreachable code
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>
pflash_cfi01: Fix warning caused by unreachable code
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...
dtrace backend: add function to reserved words
Signed-off-by: Alon Levy <alevy@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
curses: don't initialize curses when qemu is daemonized
Current qemu initializes curses even if -daemonize option ispassed. This cause problem because shell prompt appears withoutcalling endwin().
This patch adds new function, is_daemonized(), to OS dependent...
TextConsole: saturate escape parameter in TTY_STATE_CSI
Signed-off-by: Laszlo Ersek <lersek@redhat.com>Reviewed-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
target-i386: Allow tsc-frequency to be larger then 2.147G
The check using INT_MAX (2147483647) is wrong in this case.
Signed-off-by: Fred Oliveira <foliveira@cloudswitch.com>Signed-off-by: Don Slutz <Don@CloudSwitch.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
audio: Fix warning from static code analysis
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>...
Merge branch 'tcg-sparc' of git://repo.or.cz/qemu/rth
target-xtensa: implement FP1 group
These are comparison and conditional move opcodes.See ISA, 4.3.10 for more details.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
target-xtensa: implement coprocessor context option
In case Coprocessor Context option is enabled CPENABLE SR bits controlwhether access to coprocessors is allowed or would rise one ofCoprocessorXDisabled exceptions.
See ISA, 4.4.5 for more details.
FP is coprocessor 0....
softfloat: make float_muladd_negate_* flags independent
Flags passed into float{32,64}_muladd are treated as bits; assignindependent bits to float_muladd_negate_* to allow precise control overwhat gets negated in float{32,64}_muladd.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>...
softfloat: add NO_SIGNALING_NANS
Architectures that don't have signaling NaNs can defineNO_SIGNALING_NANS, it will make float*_is_quiet_nan return 1 for any NaNand float*_is_signaling_nan always return 0.
target-xtensa: handle boolean option in overlays
target-xtensa: specialize softfloat NaN rules
NaN propagation rule: leftmost NaN in the expression gets propagated tothe result.
target-xtensa: add FP registers
There are 16 32-bit FP registers (f0 - f15), control and status userregisters (fcr, fsr).
See ISA, 4.3.10 for more details.
target-xtensa: implement LSCX and LSCI groups
These are load/store instructions for FP registers with immediate orregister index and optional base post-update.See ISA, 4.3.10 for more details.
target-xtensa: implement FP0 arithmetic
These are FP arithmetic opcodes.See ISA, 4.3.10 for more details.
target-xtensa: implement FP0 conversions
These are FP to integer and integer to FP conversion opcodes.See ISA, 4.3.10 for more details.
Note that ISA description for utrunc.s is currently incorrect and willbe fixed in future revisions.
Revert "tcg/mips"
This reverts commit ad49d1f75115663731bfe06dec61eed6775526ad.
This commit was not supposed to be pushed.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg/ppc32: Implement movcond32
Thanks to Richard Henderson
Signed-off-by: malc <av1474@comtv.ru>
tcg/mips
tcg/i386: Add shortcuts for registers used in L constraint
While 64 bit hosts use the first three registers which are also usedas function input parameters, 32 bit hosts use TCG_REG_EAX andTCG_REG_EDX which are not used in parameter passing.
After defining new register macros for the registers used in L...
tcg/i386: Remove unused registers from tcg_target_call_iarg_regs
32 bit x86 hosts don't need registers for helper function argumentsbecause they use the default stack based calling convention.
Removing the registers allows simpler code for functiontcg_target_get_call_iarg_regs_count....
tcg: Remove tcg_target_get_call_iarg_regs_count
The TCG targets no longer need individual implementations.
Since commit 6a18ae2d2947532d5c26439548afa0481c4529f9,'flags' is no longer used in tcg_target_get_call_iarg_regs_count.
The remaining tcg_target_get_call_iarg_regs_count is trivial and only...
tcg-hppa: Implement movcond
tcg/README: document tcg_gen_goto_tb restrictions
Seehttp://lists.nongnu.org/archive/html/qemu-devel/2012-09/msg03196.htmlfor the whole story.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
w64: Fix TCG helper functions with 5 arguments
TCG uses 6 registers for function arguments on 64 bit Linux hosts,but only 4 registers on W64 hosts.
Commit 2999a0b20074a7e4a58f56572bb1436749368f59 increased the numberof arguments for some important helper functions from 4 to 5...
tcg/optimize: rework copy progagation
The copy propagation pass tries to keep track what is a copy of whatand what has copy of what, and in addition it keep a circular list ofof all the copies. Unfortunately this doesn't fully work: a mov froma temp which has a state "COPY" changed it into a state "HAS_COPY"....
tcg/optimize: do copy propagation for all operations
It is possible to due copy propagation for all operations, even the onethat have side effects or clobber arguments (it only concerns inputarguments). That said, the call operation should be handled differently...
tcg/optimize: optimize "op r, a, a => mov r, a"
Now that we can easily detect all copies, we can optimize the"op r, a, a => mov r, a" case a bit more.
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg/optimize: optimize "op r, a, a => movi r, 0"
Now that it's possible to detect copies, we can optimize the casethe "op r, a, a => movi r, 0". This helps in the computation ofoverflow flags when one of the two args is 0.
Reviewed-by: Richard Henderson <rth@twiddle.net>...
tcg/optimize: further optimize brcond/movcond/setcond
When both argument of brcond/movcond/setcond are the same or when oneof the two values is a constant equal to zero, it's possible to dofurther optimizations.
tcg/optimize: prefer the "op a, a, b" form for commutative ops
The "op a, a, b" form is better handled on non-RISC host than the "opa, b, a" form, so swap the arguments to this form when possible, andwhen b is not a constant.
This reduces the number of generated instructions by a tiny bit....
tcg: remove #ifdef #endif around TCGOpcode tests
Commit 25c4d9cc changed all TCGOpcode enums to be available, so we don'tneed to #ifdef #endif the one that are available only on some targets.This makes the code easier to read.
tcg/optimize: add constant folding for deposit
tcg/mips: optimize brcond arg, 0
MIPS has some conditional branch instructions when comparing with zero.Use them.
tcg/mips: optimize bswap{16,16s,32} on MIPS32R2
bswap operations can be optimized on MIPS32 Release 2 using the ROTR,WSBH and SEH instructions. We can't use the non-R2 code to implement theops due to registers constraints, so don't define the corresponding...
tcg/mips: implement rotl/rotr ops on MIPS32R2
rotr operations can be optimized on MIPS32 Release 2 using the ROTR andROTRV instructions. Also implemented rotl operations by subtracting theshift from 32.
tcg/mips: implement deposit op on MIPS32R2
deposit operations can be optimized on MIPS32 Release 2 using the INSinstruction.
tcg/mips: implement movcond op on MIPS32R2
movcond operation can be implemented on MIPS32 Release 2 using the MOVN,MOVZ, SLT and SLTU instructions.
tcg/optimize: remove TCG_TEMP_ANY
TCG_TEMP_ANY has no different meaning than TCG_TEMP_UNDEF, so usethe later instead.
tcg/optimize: check types in copy propagation
The copy propagation doesn't check the types of the temps during copypropagation. However TCG is using the mov_i32 for the i64 to i32conversion and thus the two are not equivalent.
With this patch tcg_opt_gen_mov() doesn't consider two temps of...
tcg/mips: use TCGArg or TCGReg instead of int
Instead of int, use the correct TCGArg and TCGReg type: TCGReg whenrepresenting a TCG target register, TCGArg when representing the latteror a constant.
tcg/mips: don't use global pointer
Don't use the global pointer in TCG, in case helpers try access globalvariables.
tcg/mips: use stack for TCG temps
Use stack instead of temp_buf array in CPUState for TCGtemps.