summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-06-07rewrite iov_* functionsMichael Tokarev4-54/+204
This changes implementations of all iov_* functions, completing the previous step. All iov_* functions now ensure that this offset argument is within the iovec (using assertion), but lets to specify `bytes' value larger than actual length of the iovec - in this case they stops at the actual end of iovec. It is also suggested to use convinient `-1' value as `bytes' to mean just this -- "up to the end". There's one very minor semantic change here: new requiriment is that `offset' points to inside of iovec. This is checked just at the end of functions (assert()), it does not actually need to be enforced, but using any of these functions with offset pointing past the end of iovec is wrong anyway. Note: the new code in iov.c uses arithmetic with void pointers. I thought this is not supported everywhere and is a GCC extension (indeed, the C standard does not define void arithmetic). However, the original code already use void arith in iov_from_buf() function: (memcpy(..., buf + buf_off,...) which apparently works well so far (it is this way in qemu 1.0). So I left it this way and used it in other places. While at it, add a unit-test file test-iov.c, to check various corner cases with iov_from_buf(), iov_to_buf() and iov_memset(). Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-06-07change iov_* function prototypes to be more appropriateMichael Tokarev8-24/+56
Reorder arguments to be more natural, readable and consistent with other iov_* functions, and change argument names, from: iov_from_buf(iov, iov_cnt, buf, iov_off, size) to iov_from_buf(iov, iov_cnt, offset, buf, bytes) The result becomes natural English: copy data to this `iov' vector with `iov_cnt' elements starting at byte offset `offset' from memory buffer `buf', processing `bytes' bytes max. (Try to read the original prototype this way). Also change iov_clear() to more general iov_memset() (it uses memset() internally anyway). While at it, add comments to the header file describing what the routines actually does. The patch only renames argumens in the header, but keeps old names in the implementation. The next patch will touch actual code to match. Now, it might look wrong to pay so much attention to so small things. But we've so many badly designed interfaces already so the whole thing becomes rather confusing or error prone. One example of this is previous commit and small discussion which emerged from it, with an outcome that the utility functions like these aren't well-understdandable, leading to strange usage cases. That's why I paid quite some attention to this set of functions and a few others in subsequent patches. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-06-07virtio-serial-bus: use correct lengths in control_out() messageMichael Tokarev1-3/+3
Original code has one thing to process (cur_len), requests to convert from iovec to buf another thing (len which is actually max_len), and processes something else (copied). Whole thing is very difficult to understand, even if it does a right thing. The iov_to_buf() conversion in this case will always return cur_len, because it is the length of the iovec it was asked to process, and the size we asked to convert is the same or larger, and iov_to_buf() will stop at reaching either iov or buf. Make the code saner by doing the only sane thing: dropping `copied' which is always the same as `cur_len' but just introduces questions. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-06-07target-microblaze: fix swx build breakagePeter A. G. Crosthwaite1-5/+6
The lazy initialisation of r_check was throwing an error on --enable-debug. Removed the lazy initialisation of r_check and swx_addr. Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2012-06-06Merge remote-tracking branch 'qmp/queue/qmp' into stagingAnthony Liguori49-247/+2685
* qmp/queue/qmp: (29 commits) Add 'query-events' command to QMP to query async events qapi: convert netdev_del qapi: convert netdev_add net: net_client_init(): use error_set() net: purge the monitor object from all init functions qemu-config: introduce qemu_find_opts_err() qemu-config: find_list(): use error_set() qerror: introduce QERR_INVALID_OPTION_GROUP qemu-option: qemu_opts_from_qdict(): use error_set() qemu-option: introduce qemu_opt_set_err() qemu-option: opt_set(): use error_set() qemu-option: qemu_opts_validate(): use error_set() qemu-option: qemu_opt_parse(): use error_set() qemu-option: parse_option_size(): use error_set() qemu-option: parse_option_bool(): use error_set() qemu-option: parse_option_number(): use error_set() qemu-option: qemu_opts_create(): use error_set() introduce a new monitor command 'dump-guest-memory' to dump guest's memory make gdb_id() generally avialable and rename it to cpu_index() target-i386: Add API to get note's size ...
2012-06-06Merge remote-tracking branch 'afaerber-or/qom-cpu-3' into stagingAnthony Liguori73-390/+517
* afaerber-or/qom-cpu-3: (74 commits) Kill off cpu_state_reset() linux-user: Use cpu_reset() after cpu_init() / cpu_copy() bsd-user: Use cpu_reset() in after cpu_init() leon3: Store SPARCCPU in ResetData leon3: Use cpu_sparc_init() to obtain SPARCCPU sun4u: Store SPARCCPU in ResetData sun4u: Let cpu_devinit() return SPARCCPU sun4u: Use cpu_sparc_init() to obtain SPARCCPU sun4m: Pass SPARCCPU to {main,secondary}_cpu_reset() sun4m: Use cpu_sparc_init() to obtain SPARCCPU target-sparc: Let cpu_sparc_init() return SPARCCPU cpu-exec: Use cpu_reset() in cpu_exec() for TARGET_PPC virtex_ml507: Pass PowerPCCPU to main_cpu_reset() virtex_ml507: Let ppc440_init_xilinx() return PowerPCCPU virtex_ml507: Use cpu_ppc_init() to obtain PowerPCCPU ppc_prep: Pass PowerPCCPU to ppc_prep_reset() ppc_prep: Use cpu_ppc_init() to obtain PowerPCCPU ppc_oldworld: Pass PowerPCCPU to ppc_heathrow_reset() ppc_oldworld: Use cpu_ppc_init() to obtain PowerPCCPU ppc_newworld: Pass PowerPCCPU to ppc_core99_reset() ...
2012-06-06Merge remote-tracking branch 'qemu-kvm/uq/master' into stagingAnthony Liguori1-5/+11
* qemu-kvm/uq/master: kvm: Fix build for non-CAP_IRQ_ROUTING targets
2012-06-06kvm: Fix build for non-CAP_IRQ_ROUTING targetsJan Kiszka1-5/+11
A type definition and a KVMState field initialization escaped the required wrapping with KVM_CAP_IRQ_ROUTING. Also, we need to provide a dummy kvm_irqchip_release_virq as virtio-pci references (but does not use) it. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Ben Collins <bcollins@ubuntu.com> Tested-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
2012-06-05Revert "Revert "rtl8139: do the network/host communication only in normal ↵Anthony Liguori1-0/+9
operating mode"" This reverts commit 9c92bf7f6c3f675e60b8ba8a5287bb88ea1eac36. Per Jason's request. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-06-04Kill off cpu_state_reset()Andreas Färber13-61/+4
In commit 1bba0dc932e8826a7d030df3767daf0bc339f9a2 cpu_reset() was renamed to cpu_state_reset(), to allow introducing a new cpu_reset() that would operate on QOM objects. All callers have been updated except for one in target-mips, so drop all implementations except for the one in target-mips and move the declaration there until MIPSCPU reset can be fully QOM'ified. Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Michael Walle <michael@walle.cc> (for lm32) Acked-by: Max Filippov <jcmvbkbc@gmail.com> (for xtensa) Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> (for mb + cris) Acked-by: Alexander Graf <agraf@suse.de> (for ppc) Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04linux-user: Use cpu_reset() after cpu_init() / cpu_copy()Andreas Färber2-2/+2
Eliminates cpu_state_reset() usage. Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04bsd-user: Use cpu_reset() in after cpu_init()Andreas Färber1-1/+1
Eliminates cpu_state_reset() usage. Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04leon3: Store SPARCCPU in ResetDataAndreas Färber1-4/+4
Allows us to use cpu_reset() in place of cpu_state_reset() in main_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04leon3: Use cpu_sparc_init() to obtain SPARCCPUAndreas Färber1-2/+4
Needed for main_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04sun4u: Store SPARCCPU in ResetDataAndreas Färber1-4/+4
We can now use cpu_reset() in place of cpu_state_reset() in main_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04sun4u: Let cpu_devinit() return SPARCCPUAndreas Färber1-3/+5
Needed for main_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04sun4u: Use cpu_sparc_init() to obtain SPARCCPUAndreas Färber1-3/+6
This prepares using it in sun4uv_init(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04sun4m: Pass SPARCCPU to {main,secondary}_cpu_reset()Andreas Färber1-6/+8
We can now use cpu_reset() in place of cpu_state_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04sun4m: Use cpu_sparc_init() to obtain SPARCCPUAndreas Färber1-2/+4
Needed for {main,secondary}_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04target-sparc: Let cpu_sparc_init() return SPARCCPUAndreas Färber2-5/+16
Make include paths for cpu-qom.h consistent, so that SPARCCPU can be used in cpu.h. Turn cpu_init macro into a static inline function returning CPUSPARCState for backwards compatibility. Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04cpu-exec: Use cpu_reset() in cpu_exec() for TARGET_PPCAndreas Färber1-1/+4
CPUState will be needed for all targets in the future, so place it into the main variable declaration block. Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04virtex_ml507: Pass PowerPCCPU to main_cpu_reset()Andreas Färber1-3/+4
Allows us to call cpu_reset() in place of cpu_state_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04virtex_ml507: Let ppc440_init_xilinx() return PowerPCCPUAndreas Färber1-6/+8
Needed for main_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04virtex_ml507: Use cpu_ppc_init() to obtain PowerPCCPUAndreas Färber1-2/+4
Needed to change ppc440_init_xilinx() return type. Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04ppc_prep: Pass PowerPCCPU to ppc_prep_reset()Andreas Färber1-3/+3
Allows us to use cpu_reset() in place of cpu_state_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04ppc_prep: Use cpu_ppc_init() to obtain PowerPCCPUAndreas Färber1-2/+5
Needed for ppc_prep_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04ppc_oldworld: Pass PowerPCCPU to ppc_heathrow_reset()Andreas Färber1-3/+3
Allows us to use cpu_reset() in place of cpu_state_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04ppc_oldworld: Use cpu_ppc_init() to obtain PowerPCCPUAndreas Färber1-2/+5
Needed for ppc_heathrow_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04ppc_newworld: Pass PowerPCCPU to ppc_core99_reset()Andreas Färber1-3/+3
Allows us to use cpu_reset() in place of cpu_state_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04ppc_newworld: Use cpu_ppc_init() to obtain PowerPCCPUAndreas Färber1-2/+5
Needed for ppc_core99_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04ppc4xx_devs: Pass PowerPCCPU to ppc4xx_reset()Andreas Färber1-3/+3
Allows us to use cpu_reset() in place of cpu_state_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04ppc4xx_devs: Use cpu_ppc_init() to obtain PowerPCCPUAndreas Färber1-2/+5
Needed for ppc4xx_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04ppc440_bamboo: Pass PowerPCCPU to main_cpu_reset()Andreas Färber1-3/+4
Allows us to use cpu_reset() in place of cpu_state_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04ppc440_bamboo: Use cpu_ppc_init() to obtain PowerPCCPUAndreas Färber1-2/+4
Needed for main_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04spapr: Pass PowerPCCPU to spapr_cpu_reset()Andreas Färber1-3/+3
Allows us to use cpu_reset() in place of cpu_state_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04spapr: Use cpu_ppc_init() to obtain PowerPCCPUAndreas Färber1-3/+5
Needed for spapr_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04ppce500_mpc8544ds: Pass PowerPCCPU to mpc8544ds_cpu_reset[_sec]Andreas Färber1-6/+8
Allows us to use cpu_reset() in place of cpu_state_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04target-ppc: Let cpu_ppc_init() return PowerPCCPUAndreas Färber3-6/+17
Adapt e500 mpc8544ds machine accordingly. Turn cpu_init() into a static inline function returning CPUPPCState for backwards compatibility. Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04mips_r4k: Store MIPSCPU in ResetDataAndreas Färber1-4/+4
Allows us to use cpu_reset() in place of cpu_state_reset() in main_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04mips_r4k: Use cpu_mips_init() to obtain MIPSCPUAndreas Färber1-2/+5
Needed for main_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04mips_mipssim: Store MIPSCPU in ResetDataAndreas Färber1-4/+4
Allows us to use cpu_reset() in place of cpu_state_reset() in main_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04mips_mipssim: Use cpu_mips_init() to obtain MIPSCPUAndreas Färber1-2/+5
Needed for main_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04mips_malta: Pass MIPSCPU to main_cpu_reset()Andreas Färber1-3/+5
Allows us to use cpu_reset() in place of cpu_state_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04mips_malta: Use cpu_mips_init() to obtain MIPSCPUAndreas Färber1-2/+5
Needed for main_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04mips_jazz: Pass MIPSCPU to main_cpu_reset()Andreas Färber1-3/+4
Allows us to use cpu_reset() in place of cpu_state_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Hervé Poussineau <hpoussin@reactos.org>
2012-06-04mips_jazz: Use cpu_mips_init() to obtain MIPSCPUAndreas Färber1-2/+4
Needed for main_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de> Acked-by: Hervé Poussineau <hpoussin@reactos.org>
2012-06-04mips_fulong2e: Pass MIPSCPU to main_cpu_reset()Andreas Färber1-3/+4
Allows us to use cpu_reset() in place of cpu_state_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04mips_fulong2e: Use cpu_mips_cpu() to obtain MIPSCPUAndreas Färber1-2/+4
Needed for main_cpu_reset(). Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04target-mips: Let cpu_mips_init() return MIPSCPUAndreas Färber2-4/+12
Turn cpu_init macro into a static inline function returning CPUMIPSState for backwards compatibility. Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04target-mips: Use cpu_reset() in do_interrupt()Andreas Färber1-1/+2
Signed-off-by: Andreas Färber <afaerber@suse.de>