summaryrefslogtreecommitdiffstats
path: root/cpus.c
Commit message (Collapse)AuthorAgeFilesLines
* kvm: Change cpu_synchronize_state() argument to CPUStateAndreas Färber2013-06-281-4/+4
| | | | | | | | Change Monitor::mon_cpu to CPUState as well. Reviewed-by: liguang <lig.fnst@cn.fujitsu.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: use error_setg_file_open()Luiz Capitulino2013-06-171-2/+2
| | | | | Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Acked-by: Kevin Wolf <kwolf@redhat.com>
* cpus: Fix pausing TCG CPUs while in vCPU threadAndreas Färber2013-05-021-1/+2
| | | | | | | | | | | | | | Due to a preceding while loop, no CPU would've been put into stopped state. Reinitialize the variable. This fixes commit d798e97456658ea7605303b7c69b04ec7df95c10 (Allow to use pause_all_vcpus from VCPU context) for non-KVM case. While at it, change a 0 to false, amending commit 4fdeee7cd4c8f90ef765537b9346a195d9483ab5 (cpu: Move stop field to CPUState). Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: Use qemu_for_each_cpu() in TCG threadIgor Mammedov2013-05-011-6/+7
| | | | | | | Replaces an open-coded loop and hides unused CPUArchState. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Introduce cpu_resume(), for single CPUIgor Mammedov2013-05-011-3/+8
| | | | | | | | Also add a stub for it, to make possible to use it in qom/cpu.c, which is shared with user emulators. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* w64: Fix compiler warnings (wrong format specifier)Stefan Weil2013-04-191-2/+2
| | | | | | | | GetLastError() returns a DWORD value which is unsigned long, so the correct format specifier is %lu. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* cpu: Pass CPUState to *cpu_synchronize_post*()Igor Mammedov2013-04-161-2/+2
| | | | | | | | ... so it could be called without requiring CPUArchState. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* Check effective suspension of TCG threadOlivier Hainque2013-04-121-2/+22
| | | | | | | | | | On multi-core systems, SuspendThread does not guaranty immediate thread suspension. We add busy loop to wait for effective thread suspension after call to ThreadSuspend(). Signed-off-by: Fabien Chouteau <chouteau@adacore.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Weil <sw@weilnetz.de>
* cpu: Pass CPUState to cpu_interrupt()Andreas Färber2013-03-121-1/+1
| | | | | | | | Move it to qom/cpu.h to avoid issues with include order. Change pc_acpi_smi_interrupt() opaque to X86CPU. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move halted and interrupt_request fields to CPUStateAndreas Färber2013-03-121-2/+2
| | | | | | | | | | Both fields are used in VMState, thus need to be moved together. Explicitly zero them on reset since they were located before breakpoints. Pass PowerPCCPU to kvmppc_handle_halt(). Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: Replace open-coded CPU loop in qmp_memsave() with qemu_get_cpu()Andreas Färber2013-03-121-8/+3
| | | | | | | | | | | No functional change, just less usages of first_cpu and next_cpu fields. env is passed to cpu_memory_rw_debug(), which in turn passes it to target-specific cpu_get_phys_page_debug(). Changing both would be a larger refactoring, so defer that by using env_ptr for now. Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus.c: Drop unnecessary set_cpu_log()Peter Maydell2013-02-161-12/+0
| | | | | | | | | | | The set_cpu_log() function in cpus.c is a fairly simple wrapper which is only called from one location. Just inline the code into vl.c, since there is no need to indirect it via cpus.c and the handling of the error case is more appropriate to vl.c. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* qemu-log: Rename the public-facing cpu_set_log function to qemu_set_logPeter Maydell2013-02-161-1/+1
| | | | | | | | | | Rename the public-facing function cpu_set_log to qemu_set_log. This requires us to rename the internal-only qemu_set_log() to do_qemu_set_log(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* qemu-log: Rename cpu_str_to_log_mask to qemu_str_to_log_maskPeter Maydell2013-02-161-1/+1
| | | | | | | | | | Rename cpu_str_to_log_mask() to qemu_str_to_log_mask(), since the qemu_log functionality is no longer restricted to TCG CPU debug logging. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* qemu-log: Abstract out "print usage message about valid log categories"Peter Maydell2013-02-161-5/+1
| | | | | | | | | | | | Abstract out the "print a human readable list of all the valid log categories" functionality which is currently duplicated in three separate places. (We leave the monitor.c help_cmd() implementation as-is since it wants to send the message to the monitor and add its own information.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* qemu-log: Unify {cpu_set,set_cpu}_log_filename as qemu_set_log_filenamePeter Maydell2013-02-161-5/+0
| | | | | | | | | | The qemu_log() functionality is no longer specific to TCG CPU debug logs. Rename cpu_set_log_filename() to qemu_set_log_filename() and drop the pointless wrapper set_cpu_log_filename(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* kvm: Pass CPUState to kvm_on_sigbus_vcpu()Andreas Färber2013-01-281-4/+4
| | | | | | | | | | Since commit 20d695a9254c1b086a456d3b79a3c311236643ba (kvm: Pass CPUState to kvm_arch_*) CPUArchState is no longer needed. Allows to change qemu_kvm_eat_signals() argument as well. Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Gleb Natapov <gleb@redhat.com>
* kvm: Pass CPUState to kvm_init_vcpu()Andreas Färber2013-01-151-1/+1
| | | | | | | CPUArchState is no longer needed, and it thereby no longer depends on NEED_CPU_H. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move cpu_index field to CPUStateAndreas Färber2013-01-151-5/+9
| | | | | | | | | | | | | Note that target-alpha accesses this field from TCG, now using a negative offset. Therefore the field is placed last in CPUState. Pass PowerPCCPU to [kvm]ppc_fixup_cpu() to facilitate this change. Move common parts of mips cpu_state_reset() to mips_cpu_reset(). Acked-by: Richard Henderson <rth@twiddle.net> (for alpha) [AF: Rebased onto ppc CPU subclasses and openpic changes] Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move numa_node field to CPUStateAndreas Färber2013-01-151-1/+3
| | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move nr_{cores,threads} fields to CPUStateAndreas Färber2013-01-151-2/+2
| | | | | | | | To facilitate the field movements, pass MIPSCPU to malta_mips_config(); avoid that for mips_cpu_map_tc() since callers only access MIPS Thread Contexts, inside TCG helpers. Signed-off-by: Andreas Färber <afaerber@suse.de>
* softmmu: move include files to include/sysemu/Paolo Bonzini2012-12-191-5/+5
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* misc: move include files to include/qemu/Paolo Bonzini2012-12-191-4/+4
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* monitor: move include files to include/monitor/Paolo Bonzini2012-12-191-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* exec: move include files to include/exec/Paolo Bonzini2012-12-191-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* cpu: Move thread_id to CPUStateAndreas Färber2012-10-311-5/+6
| | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: Pass CPUState to run_on_cpu()Andreas Färber2012-10-311-2/+1
| | | | | | | | CPUArchState is no longer needed. Move the declaration to include/qemu/cpu.h and add documentation. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: Pass CPUState to [qemu_]cpu_has_work()Andreas Färber2012-10-311-1/+1
| | | | | | | | | | For target-mips also change the return type to bool. Make include paths for cpu-qom.h consistent for alpha and unicore32. Signed-off-by: Andreas Färber <afaerber@suse.de> [AF: Updated new target-openrisc function accordingly] Acked-by: Richard Henderson <rth@twiddle.net> (for alpha)
* cpus: Pass CPUState to qemu_wait_io_event_common()Andreas Färber2012-10-311-7/+5
| | | | | | CPUArchState is no longer needed there. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: Pass CPUState to flush_queued_work()Andreas Färber2012-10-311-3/+2
| | | | | | CPUArchState is no longer needed there. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move queued_work_{first,last} to CPUStateAndreas Färber2012-10-311-9/+10
| | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: Pass CPUState to qemu_cpu_kick()Andreas Färber2012-10-311-8/+5
| | | | | | CPUArchState is no longer needed there. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: Pass CPUState to qemu_tcg_init_vcpu()Andreas Färber2012-10-311-5/+2
| | | | | | CPUArchState is no longer needed. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: Pass CPUState to qemu_tcg_cpu_thread_fnAndreas Färber2012-10-311-3/+3
| | | | | | | | | | CPUArchState is no longer needed except for iterating the CPUs. Needed for qemu_tcg_init_vcpu(). KVM and dummy threads still need CPUArchState for cpu_single_env. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move halt_cond to CPUStateAndreas Färber2012-10-311-10/+12
| | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: Pass CPUState to cpu_can_run()Andreas Färber2012-10-311-8/+6
| | | | | | | | CPUArchState is no longer needed there. Also change its return type to bool. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: Pass CPUState to cpu_is_stopped()Andreas Färber2012-10-311-3/+1
| | | | | | | | CPUArchState is no longer needed there. Also change the return type to bool. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move stopped field to CPUStateAndreas Färber2012-10-311-12/+18
| | | | | | Change its type to bool. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move stop field to CPUStateAndreas Färber2012-10-311-9/+18
| | | | | | Change its type to bool. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move created field to CPUStateAndreas Färber2012-10-311-6/+7
| | | | | | Change its type to bool. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: Pass CPUState to qemu_cpu_kick_thread()Andreas Färber2012-10-311-5/+4
| | | | | | | CPUArchState is no longer needed there. Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
* cpus: Pass CPUState to qemu_cpu_is_self()Andreas Färber2012-10-311-7/+5
| | | | | | | | | Change return type to bool, move to include/qemu/cpu.h and add documentation. Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Igor Mammedov <imammedo@redhat.com> [AF: Updated new caller qemu_in_vcpu_thread()]
* cpus: create qemu_in_vcpu_thread()Juan Quintela2012-10-171-2/+7
| | | | | | | Old code used !io_thread to know if a thread was an vcpu or not. That fails when we introduce the iothread. Signed-off-by: Juan Quintela <quintela@redhat.com>
* Merge branch 'target-arm.for-upstream' of ↵Aurelien Jarno2012-10-061-5/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.linaro.org/people/pmaydell/qemu-arm * 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm: target-arm: Drop unused DECODE_CPREG_CRN macro target-arm: use deposit instead of hardcoded version target-arm: mark a few integer helpers const and pure target-arm: convert sar, shl and shr helpers to TCG target-arm: convert add_cc and sub_cc helpers to TCG target-arm: use globals for CC flags target-arm: Reinstate display of VFP registers in cpu_dump_state cpu_dump_state: move DUMP_FPU and DUMP_CCOP flags from x86-only to generic
| * cpu_dump_state: move DUMP_FPU and DUMP_CCOP flags from x86-only to genericPeter Maydell2012-10-051-5/+1
| | | | | | | | | | | | | | | | | | | | | | Move the DUMP_FPU and DUMP_CCOP flags for cpu_dump_state() from being x86-specific flags to being generic ones. This allows us to drop some TARGET_I386 ifdefs in various places, and means that we can (potentially) be more consistent across architectures about which monitor commands or debug abort printouts include FPU register contents and info about QEMU's condition-code optimisations. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* | cpu: Add missing 'static' attribute to qemu_global_mutexStefan Weil2012-10-051-1/+1
|/ | | | | | | | Contrary to its name, 'qemu_global_mutex' is only used locally in cpus.c. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
* Drop cpu_list_id macroPeter Maydell2012-09-211-4/+2
| | | | | | | | | | | | Since the only user of the extended cpu_list_id() format was the x86 ?model/?dump/?cpuid output, we can drop it completely. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* kvm: Decouple 'async interrupt delivery' from 'kernel irqchip'Peter Maydell2012-08-091-1/+2
| | | | | | | | | | | | On x86 userspace delivers interrupts to the kernel asynchronously (and therefore VCPU idle management is done in the kernel) if and only if there is an in-kernel irqchip. On other architectures this isn't necessarily true (they may always send interrupts asynchronously), so define a new kvm_async_interrupts_enabled() function instead of misusing kvm_irqchip_in_kernel(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Avi Kivity <avi@redhat.com>
* Fixes related to processing of qemu's -numa optionChegu Vinod2012-08-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The -numa option to qemu is used to create [fake] numa nodes and expose them to the guest OS instance. There are a couple of issues with the -numa option: a) Max VCPU's that can be specified for a guest while using the qemu's -numa option is 64. Due to a typecasting issue when the number of VCPUs is > 32 the VCPUs don't show up under the specified [fake] numa nodes. b) KVM currently has support for 160VCPUs per guest. The qemu's -numa option has only support for upto 64VCPUs per guest. This patch addresses these two issues. Below are examples of (a) and (b) a) >32 VCPUs are specified with the -numa option: /usr/local/bin/qemu-system-x86_64 \ -enable-kvm \ 71:01:01 \ -net tap,ifname=tap0,script=no,downscript=no \ -vnc :4 ... Upstream qemu : -------------- QEMU 1.1.50 monitor - type 'help' for more information (qemu) info numa 6 nodes node 0 cpus: 0 1 2 3 4 5 6 7 8 9 32 33 34 35 36 37 38 39 40 41 node 0 size: 131072 MB node 1 cpus: 10 11 12 13 14 15 16 17 18 19 42 43 44 45 46 47 48 49 50 51 node 1 size: 131072 MB node 2 cpus: 20 21 22 23 24 25 26 27 28 29 52 53 54 55 56 57 58 59 node 2 size: 131072 MB node 3 cpus: 30 node 3 size: 131072 MB node 4 cpus: node 4 size: 131072 MB node 5 cpus: 31 node 5 size: 131072 MB With the patch applied : ----------------------- QEMU 1.1.50 monitor - type 'help' for more information (qemu) info numa 6 nodes node 0 cpus: 0 1 2 3 4 5 6 7 8 9 node 0 size: 131072 MB node 1 cpus: 10 11 12 13 14 15 16 17 18 19 node 1 size: 131072 MB node 2 cpus: 20 21 22 23 24 25 26 27 28 29 node 2 size: 131072 MB node 3 cpus: 30 31 32 33 34 35 36 37 38 39 node 3 size: 131072 MB node 4 cpus: 40 41 42 43 44 45 46 47 48 49 node 4 size: 131072 MB node 5 cpus: 50 51 52 53 54 55 56 57 58 59 node 5 size: 131072 MB b) >64 VCPUs specified with -numa option: /usr/local/bin/qemu-system-x86_64 \ -enable-kvm \ -cpu Westmere,+rdtscp,+pdpe1gb,+dca,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pclmuldq,+pbe,+tm,+ht,+ss,+acpi,+d-vnc :4 ... Upstream qemu : -------------- only 63 CPUs in NUMA mode supported. only 64 CPUs in NUMA mode supported. QEMU 1.1.50 monitor - type 'help' for more information (qemu) info numa 8 nodes node 0 cpus: 6 7 8 9 38 39 40 41 70 71 72 73 node 0 size: 65536 MB node 1 cpus: 10 11 12 13 14 15 16 17 18 19 42 43 44 45 46 47 48 49 50 51 74 75 76 77 78 79 node 1 size: 65536 MB node 2 cpus: 20 21 22 23 24 25 26 27 28 29 52 53 54 55 56 57 58 59 60 61 node 2 size: 65536 MB node 3 cpus: 30 62 node 3 size: 65536 MB node 4 cpus: node 4 size: 65536 MB node 5 cpus: node 5 size: 65536 MB node 6 cpus: 31 63 node 6 size: 65536 MB node 7 cpus: 0 1 2 3 4 5 32 33 34 35 36 37 64 65 66 67 68 69 node 7 size: 65536 MB With the patch applied : ----------------------- QEMU 1.1.50 monitor - type 'help' for more information (qemu) info numa 8 nodes node 0 cpus: 0 1 2 3 4 5 6 7 8 9 node 0 size: 65536 MB node 1 cpus: 10 11 12 13 14 15 16 17 18 19 node 1 size: 65536 MB node 2 cpus: 20 21 22 23 24 25 26 27 28 29 node 2 size: 65536 MB node 3 cpus: 30 31 32 33 34 35 36 37 38 39 node 3 size: 65536 MB node 4 cpus: 40 41 42 43 44 45 46 47 48 49 node 4 size: 65536 MB node 5 cpus: 50 51 52 53 54 55 56 57 58 59 node 5 size: 65536 MB node 6 cpus: 60 61 62 63 64 65 66 67 68 69 node 6 size: 65536 MB node 7 cpus: 70 71 72 73 74 75 76 77 78 79 Signed-off-by: Chegu Vinod <chegu_vinod@hp.com>, Jim Hull <jim.hull@hp.com>, Craig Hada <craig.hada@hp.com> Tested-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* cpu: Move thread_kicked to CPUStateAndreas Färber2012-08-021-5/+9
| | | | | | Change field type to bool. Signed-off-by: Andreas Färber <afaerber@suse.de>
OpenPOWER on IntegriCloud