qdev: allow multiple qdev_init_gpio_in() calls
Allow multiple qdev_init_gpio_in() calls for the one device. The first call willdefine GPIOs 0-N-1, the next GPIOs N- ... . Allows different GPIOs to be handledwith different handlers. Needed when two levels of the QOM class heirachy both...
stellaris: Removed SSI mux
Removed the explicit SSI mux and wired the CS line directly up to the SSIdevices.
Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
hw: Added generic FIFO API.
Added a FIFO API that can be used to create and operate byte FIFOs.
m25p80: Initial implementation of SPI flash device
Added device model for m25p80 style SPI flash family.
xilinx_spi: Initial impl. of Xilinx SPI controller
Device model for xilinx XPS SPI controller (v2.0)
petalogix-ml605: added SPI controller with n25q128
Added SPI controller to the reference design, with two n25q128 spi-flashesconnected.
Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>Acked-by: Peter Maydell <peter.maydell@linaro.org>
xilinx_spips: Xilinx Zynq SPI cntrlr device model
Added device model for the Xilinx Zynq SPI controller (SPIPS).
ssi: Support for multiple attached devices
Removed assertion that only one device is attached to the SSI bus.
When multiple devices are attached, all slaves have their transfer functioncalled for transfers. Each device is responsible for knowing whether or not its...
ssi: Implemented CS behaviour
Added default CS behaviour for SSI slaves. SSI devices can set a propertyto enable CS behaviour which will create a GPIO on the device which is theCS. Tristating of the bus on SSI transfers is implemented.
Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>...
ssi: Added create_slave_no_init()
Slave creation function that can be used to create an SSI slave withoutqdev_init() being called. This give machine models a chance to set properties.
Merge branch 'master' of git.qemu.org:/pub/git/qemu
qemu-barrier: Fix compilation on i386 hosts
Commit 1d31fca470648ec66afd8743491bfb5846306341 tried to fix bugintroduced by 610b823ef66b993660f1ab1447a769f190e4f3b3 by includingqemu-common.h, which breaks the build further.
Include compiler.h instead, as suggested by Blue Swirl....
target-sparc: Use movcond for FMOV*R
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
target-sparc: Cleanup "global" temporary allocation
There are 6 temporaries that disas_sparc_insn relies on having beenallocated. Now that they are no longer referenced across branches,they need not be allocated as local temps.
Move the allocation/free of these temporaries to make it clear that...
target-sparc: Fall through from not-taken trap
Now that we've cleaned up global temporary allocation, we cancontinue translating the fallthru path of a conditional trap.
target-sparc: Optimize conditionals using SUBCC
Aka "normal" comparisons. We now have the infrastructure topass back non-boolean results from gen_compare. This willautomatically get used by both branches and conditional moves.
Signed-off-by: Richard Henderson <rth@twiddle.net>...
target-sparc: Move sdivx and udivx out of line
The branches around the exception are maintaining an otherwiseunnecessary use of local temps for the cpu destination.
target-sparc: Tidy Tcc
Share more code between unconditional and conditional paths.
Move the computation of the trap number into the conditional BB;avoid using temporaries that have gone out of scope (cpu_tmp32)or rely on local temps (cpu_dst).
Fully fold the exception number when the trap number is %g0+imm....
target-sparc: Move taddcctv and tsubcctv out of line
Note that gen_op_t{add,sub}_cc were identical to gen_op_{add,sub}_cc.
target-sparc: Use movcond in mulscc
target-sparc: Use DisasCompare and movcond in FMOVR, FMOVCC
target-sparc: Use DisasCompare and movcond in MOVCC
target-sparc: Use DisasCompare and movcond in MOVR
target-sparc: Use movcond in gen_generic_branch
target-sparc: Tidy save_npc interface
Use the cpu_cond global register directly instead of passing it down.
target-sparc: Tidy gen_generic_branch interface
The arguments passed are always the same.Pass down just DisasContext instead.
target-sparc: Introduce DisasCompare and functions to generate it
For the moment gen_cond et al retain their existing interface,using setcond to turn a (potential) comparison back into a boolean.
target-sparc: Use DisasCompare in Tcc
target-sparc: Tidy flush_cond interface
We always pass cpu_cond to the cond parameter. Use that globalregister directly instead of passing it down.
target-sparc: Tidy gen_trap_ifnofpu interface
target-sparc: Tidy save_state interface
target-sparc: Tidy gen_mov_pc_npc interface
target-sparc: Tidy cpu_dump_state
We don't really need to be told that %g are general register, etc.Issue a trailing newline to separate blocks.
target-sparc: Make CPU_LOG_INT useful by default
No need for ifdefs when the log mask does just as well.No need to print pc/npc when we're dumping the whole cpu state.
target-sparc: Tidy do_branch interfaces
We always pass cpu_cond to the r_cond parameter. Use that globalregister directly instead of passing it down.
tcg: Remove redundant pointer from TCGContext
The pointer entry 'temps' always refers to the array entry 'static_temps'.Removing the pointer and renaming 'static_temps' to 'temps' reduces thesize of TCGContext (4 or 8 byte) and allows better code generation....
Merge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Merge branch 'trivial-patches' of git://github.com/stefanha/qemu
Merge branch 'ppc-for-upstream' of git://repo.or.cz/qemu/agraf
Commit 610b823ef66b993660f1ab1447a769f190e4f3b3 uses QEMU_GNUC_PREREQon i386 hosts.
That macro is defined in qemu-common.h which is not always includedbefore qemu-barrier.h, so compilation on i386 hosts was broken....
tcg: Add TCG_COND_NEVER, TCG_COND_ALWAYS
There are several cases that can be handled easier inside bothtranslators and code generators if we have out-of-band valuesfor conditions. It's easy enough to handle ALWAYS and NEVER inthe natural way inside the tcg middle-end....
tcg: Add tcg_high_cond
The table that was recently added for hppa is generally usable.And with the renumbering of the TCG_COND constants it's not toodifficult to compute rather than have a table.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
ppc/prep: use the new pci_vga_init() function
As a bonus it allows new vga card types (including none).
Acked-by: Andreas Färber <andreas.faerber@web.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
ppc/pSeries: use the new pci_vga_init() function
Keep the case to prevent some vga card to be selected.
Cc: Alexander Graf <agraf@suse.de>Cc: David Gibson <david@gibson.dropbear.id.au>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
sun/sun4u: use the new pci_vga_init() function
Acked-by: Blue Swirl <blauwirbel@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
pc: use the new pci_vga_init() and isa_vga_init() functions
The CONFIG_SPICE is now tested in vl.c and thus not needed anymore.
Cc: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
mips/r4k: use the new is_vga_init() function
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
vga: cleanup after isa_vga_init() and pci_vga_init() conversion
Now that all machines call isa_vga_init() or pci_vga_init(), some unusedcode can be removed.
tcg: Add is_unsigned_cond
Before we rearrange the TCG_COND enumeration, add a predicate forthe (single) use of comparisons vs TCGCond.
vl.c: check for qxl availability
Check for qxl availability in vl.c. This will allow to remove #ifdefCONFIG_SPICE .. #endif later in this series
Cc: Anthony Liguori <aliguori@us.ibm.com>Cc: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
vl.c: default to std if cirrus is not available
pci: add a pci_vga_init() function
This function create a PCI VGA device according to the value ofvga_interface_type. It returns a PCIDevice (and not a DeviceState).
isa: add a isa_vga_init() function
This function create a ISA VGA device according to the value ofvga_interface_type. It returns a ISADevice (and not a DeviceState).
mips/malta: use the new pci_vga_init() function
alpha: use the new pci_vga_init() function
This remove the fallback to std-vga in case, as availability of therequested vga device is now tested in vl.c, and returns an error messageto the user.
Acked-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
ppc/newworld: use the new pci_vga_init() function
Cc: Alexander Graf <agraf@suse.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
ppc/oldworld: use the new pci_vga_init() function
vga: rename pci_vga_init() into pci_std_vga_init()
This better explains what is this function about. Adjust all callers.
Cc: Alexander Graf <agraf@suse.de>Cc: Andreas Färber <andreas.faerber@web.de>Cc: David Gibson <david@gibson.dropbear.id.au>Cc: Anthony Liguori <aliguori@us.ibm.com>...
vga: rename isa_vga_init() to isa_std_vga_init()
vl.c: convert *vga_enabled functions to QOM
And get rid of qdev_exists().
tcg: remove obsolete jmp op
The TCG jmp operation doesn't really make sense in the QEMU context, itis unused, it is not implemented by some targets, and it is wronglyimplemented by some others.
This patch simply removes it.
Reviewed-by: Richard Henderson <rth@twiddle.net>...
target-xtensa: de-optimize EXTUI
Now that "and" with 0xff, 0xffff and 0xffffffff and "shr" with 0 shiftare optimized in tcg/tcg-op.h there is no need to do it intarget-xtensa/translate.c.
Acked-by: Max Filippov <jcmvbkbc@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Remove libhw
The entries for libhw* are no longer needed in .gitignore.
There is also no longer a difference between common-obj-y andhw-obj-y, so one of those two macros is sufficient.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
target-arm: mark a few integer helpers const and pure
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target-arm: use deposit instead of hardcoded version
Use the deposit op instead of and hardcoded bit field insertion. Itallows the host to emit the corresponding instruction if available.
target-arm: Drop unused DECODE_CPREG_CRN macro
This macro snuck through code review despite being unused; drop it.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target-arm: Reinstate display of VFP registers in cpu_dump_state
Reinstate the display of VFP registers in cpu_dump_state(), ifthe CPU has them (this code had been #if 0'd out a for a long time).We drop the attempt ot display the values as floating point, since...
target-arm: use globals for CC flags
Use globals for CC flags instead of loading/storing them each they areaccessed. This allows some optimizations to be performed by the TCGoptimization passes.
target-arm: convert add_cc and sub_cc helpers to TCG
Now that the setcond TCG op is available, it's possible to replaceadd_cc and sub_cc helpers by TCG code. The code generated by TCG isactually very close to the one generated by GCC for the helper, and...
target-arm: convert sar, shl and shr helpers to TCG
Now that the movcond TCG op is available, it's possible to replaceshl and shr helpers by TCG code. The code generated by TCG is slightlylonger than the code generated by GCC for the helper but is still worth...
cpu_dump_state: move DUMP_FPU and DUMP_CCOP flags from x86-only to generic
Move the DUMP_FPU and DUMP_CCOP flags for cpu_dump_state() from beingx86-specific flags to being generic ones. This allows us to drop someTARGET_I386 ifdefs in various places, and means that we can (potentially)...
versatilepb: Use symbolic indices for ARM PIC
It is more readable, and all other code does it like that, too.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
qdev: kill bogus comment
When the DeviceInfo code was removed, the comment describingqdev_subclass_init() was left in the code by mistake. Remove it.
Cc: qemu-trivial@nongnu.orgSigned-off-by: Eduardo Habkost <ehabkost@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
qemu-barrier: Fix compiler version check for future gcc versions
The current check will give a wrong result for gcc-5.x with x < 4.Using QEMU_GNUC_PREREQ is simpler and fixes that issue.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
hw: Add missing 'static' attribute for QEMUMachine
It was missing for leon3 and mips_fulong2e.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Reviewed-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
cleanup useless return sentence
This patch cleans up return sentences in the end of void functions.
Reported-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Amos Kong <akong@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
rtc: fix overflow in mktimegm
When setting a date in 1980, Linux is actually disregarding the centurybyte and setting the year to 2080. This causes a year-2038 overflowin mktimegm. Fix this by doing the days-to-seconds computation in64-bit math.
Reported-by: Lucas Meneghel Rodrigues <lookkas@gmail.com>...
rtc: map CMOS index 0x37 to 0x32 on read and writes
QEMU's attempt to implement the century byte cover two possible placesfor the byte. A common one on modern chipsets is 0x32, but QEMU alsostores the value in 0x37 (apparently for IBM PS/2 compatibility---it's...
rtc: implement century byte
Implement the century byte in the RTC emulation, and test that it works.This leads to some annoying compatibility code because we need to treata value of 2000 for the base_year property as "use the century byteproperly" (which would be a value of 0)....
qtest: implement QTEST_STOP
It is quite difficult to debug qtest test cases without extra wrapperscripts for QEMU or similar. This patch adds a simple environmentvariable-based trigger that sends a STOP signal to the QEMU instanceunder test, before attempting to connect to its QMP session....
libcacard/vcard_emul_nss: use pstrcpy in place of strncpy
Replace strncpy+NUL-terminate use with use of pstrcpy.This requires linking with cutils.o (or else vssclient doesn't link),so add that in the Makefile.
Acked-by: Alon Levy <alevy@redhat.com>Signed-off-by: Jim Meyering <meyering@redhat.com>...
acpi: remove strzcpy (strncpy-identical) function; just use strncpy
Adjust all uses s/strzcpy/strncpy/ and mark these usesof strncpy as "ok".
Signed-off-by: Jim Meyering <meyering@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qcow2: mark this file's sole strncpy use as justified
Acked-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Jim Meyering <meyering@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/r2d: add comment: this strncpy use is ok
doc: update HACKING wrt strncpy/pstrcpy
Reword the section on strncpy: its NUL-filling is importantin some cases. Mention that pstrcpy's signature is different.
hw/9pfs: avoid buffer overrun
v9fs_add_dir_node and qemu_v9fs_synth_add_file used strncpyto form node->name, which requires NUL-termination, butstrncpy does not ensure NUL-termination.Use pstrcpy, which does.
Acked-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>...
lm32: avoid buffer overrun
Actually do what the comment says, using pstrcpy NUL-terminate:strncpy does not always do that.
os-posix: avoid buffer overrun
os_set_proc_name: Use pstrcpy, in place of strncpy and theineffectual preceding assignment: name[sizeof(name) - 1] = 0;
ppc: avoid buffer overrun: use pstrcpy, not strncpy
A terminal NUL is required by caller's use of strchr.It's better not to use strncpy at all, since there is no needto zero out hundreds of trailing bytes for each iteration.
Signed-off-by: Jim Meyering <meyering@redhat.com>...
linux-user: remove two unchecked uses of strdup
Remove two uses of strdup (use g_path_get_basename instead),and add a comment that this strncpy use is ok.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Jim Meyering <meyering@redhat.com>...
ui/vnc: simplify and avoid strncpy
Don't bother with strncpy. There's no need for its zero-fill.Use g_strndup in place of g_malloc+strncpy+NUL-terminate.
bt: replace fragile snprintf use and unwarranted strncpy
In bt_hci_name_req a failed snprintf could return len larger thansizeof(params.name), which means the following memset call wouldhave a "length" value of (size_t)-1, -2, etc... Sounds scary.But currently, one can deduce that there is no problem:...
virtio-9p: avoid unwarranted uses of strncpy
In all of these cases, the uses of strncpy were unnecessary, sinceat each point of use we know that the NUL-terminated source bytesfit in the destination buffer. Use memcpy in place of strncpy.
vscsi: avoid unwarranted strncpy
Don't use strncpy when the source string is known to fitin the destination buffer. Use equivalent memcpy.We could even use strcpy, here, but some static analyzerswarn about that, so don't add new uses.
Acked-by: David Gibson <david@gibson.dropbear.id.au>...
qemu-ga: prefer pstrcpy: consistently NUL-terminate ifreq.ifr_name
NUL-termination of the .ifr_name field is not required, but is fine(and preferable to using strncpy and leaving the reader to wonder),since the first thing the linux kernel does is to clear the last byte....
sparc: use g_strdup in place of unchecked strdup
This avoids a NULL-deref upon strdup failure.Also update matching free to g_free.
block: avoid buffer overrun by using pstrcpy, not strncpy
Also, use PATH_MAX, rather than the arbitrary 1024.Using PATH_MAX is more consistent with other filename-relatedvariables in this file, like backing_filename and tmp_filename.
Acked-by: Kevin Wolf <kwolf@redhat.com>...
sheepdog: avoid a few buffer overruns
vmdk: relative_path: use pstrcpy in place of strncpy
Avoid strncpy+manual-NUL-terminate. Use pstrcpy instead.