summaryrefslogtreecommitdiffstats
path: root/kvm-all.c
Commit message (Collapse)AuthorAgeFilesLines
* kvm: Change kvm_cpu_synchronize_state() argument to CPUStateAndreas Färber2013-06-281-3/+1
| | | | | | | | | It no longer relies on CPUArchState since 20d695a. Reviewed-by: liguang <lig.fnst@cn.fujitsu.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
* memory: make section size a 128-bit integerPaolo Bonzini2013-06-201-9/+14
| | | | | | | | | | | So far, the size of all regions passed to listeners could fit in 64 bits, because artificial regions (containers and aliases) are eliminated by the memory core, leaving only device regions which have reasonable sizes An IOMMU however cannot be eliminated by the memory core, and may have an artificial size, hence we may need 65 bits to represent its size. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* fix double free the memslot in kvm_set_phys_memXiao Guangrong2013-06-031-1/+2
| | | | | | | | | | | | | | | Luiz Capitulino reported that guest refused to boot and qemu complained with: kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument It is caused by commit 235e8982ad that did double free for the memslot so that the second one raises the -EINVAL error Fix it by reset memory size only if it is needed Reported-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* kvm: support using KVM_MEM_READONLY flag for regionsJordan Justen2013-05-291-9/+28
| | | | | | | | | | | | | | | | | | | | | For readonly memory regions and rom devices in romd_mode, we make use of the KVM_MEM_READONLY. A slot that uses KVM_MEM_READONLY can be read from and code can execute from the region, but writes will exit to qemu. For rom devices with !romd_mode, we force the slot to be removed so reads or writes to the region will exit to qemu. (Note that a memory region in this state is not executable within kvm.) v7: * Update for readable => romd_mode rename (5f9a5ea1) Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> (v4) Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> (v5) Message-id: 1369816047-16384-4-git-send-email-jordan.l.justen@intel.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* kvm: add kvm_readonly_mem_enabledJordan Justen2013-05-291-0/+6
| | | | | | | Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1369816047-16384-3-git-send-email-jordan.l.justen@intel.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* osdep, kvm: rename low-level RAM allocation functionsPaolo Bonzini2013-05-141-3/+3
| | | | | | | | | | This is preparatory to the introduction of a separate freeing API. Reported-by: Amos Kong <akong@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Amos Kong <akong@redhat.com> Message-id: 1368454796-14989-2-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* kvm-all: add kvm_run_exit tracepointKazuya Saito2013-05-031-0/+1
| | | | | | | | | This patch enable us to know exit reason of KVM_RUN. It will help us know where the trouble is caused. Signed-off-by: Kazuya Saito <saito.kazuya@jp.fujitsu.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* kvm-all: add kvm_ioctl, kvm_vm_ioctl, kvm_vcpu_ioctl tracepointsKazuya Saito2013-05-031-0/+4
| | | | | | | | | This patch adds tracepoints at ioctl to kvm. Tracing these ioctl is useful for clarification whether the cause of troubles is qemu or kvm. Signed-off-by: Kazuya Saito <saito.kazuya@jp.fujitsu.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* cpu: Call cpu_synchronize_post_init() from DeviceClass::realize()Igor Mammedov2013-05-011-0/+1
| | | | | | | | If hotplugged, synchronize CPU state to KVM. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* Merge remote-tracking branch 'mst/tags/for_anthony' into stagingAnthony Liguori2013-04-191-65/+68
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pci: add pci test device This adds a new device that we can use for testing PCI PIO and MMIO, with and without ioeventfd in different configurations. FAST_MMIO will be added if/when kvm supports it. Also included are minor cleanups in kvm APIs that it needs. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Mon 15 Apr 2013 05:42:24 PM CDT using RSA key ID D28D5469 # gpg: Can't check signature: public key not found # By Michael S. Tsirkin # Via Michael S. Tsirkin * mst/tags/for_anthony: pci: add pci test device kvm: support non datamatch ioeventfd kvm: support any size for pio eventfd kvm: remove unused APIs Message-id: cover.1366272004.git.mst@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
| * kvm: support non datamatch ioeventfdMichael S. Tsirkin2013-04-141-16/+18
| | | | | | | | | | | | Adding restrictions just adds code. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
| * kvm: support any size for pio eventfdMichael S. Tsirkin2013-04-141-12/+12
| | | | | | | | Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
| * kvm: remove unused APIsMichael S. Tsirkin2013-04-141-53/+54
| | | | | | | | | | | | | | There are only used internally now, move them out of header and out of stub. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | cpu: Pass CPUState to *cpu_synchronize_post*()Igor Mammedov2013-04-161-6/+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>
* cpu: Pass CPUState to cpu_interrupt()Andreas Färber2013-03-121-3/+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-1/+1
| | | | | | | | | | 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>
* cpu: Move exit_request field to CPUStateAndreas Färber2013-02-161-3/+3
| | | | | | Since it was located before breakpoints field, it needs to be reset. Signed-off-by: Andreas Färber <afaerber@suse.de>
* kvm: Pass CPUState to kvm_on_sigbus_vcpu()Andreas Färber2013-01-281-2/+1
| | | | | | | | | | 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: Create kvm_arch_vcpu_id() functionEduardo Habkost2013-01-271-1/+1
| | | | | | | | | This will allow each architecture to define how the VCPU ID is set on the KVM_CREATE_VCPU ioctl call. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* kvm: add stub for kvm_irqchip_update_msi_routeMichael S. Tsirkin2013-01-151-0/+5
| | | | | | | | ppc64 build needs this stub to build with virtio enabled. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* kvm: Pass CPUState to kvm_init_vcpu()Andreas Färber2013-01-151-2/+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-1/+1
| | | | | | | | | | | | | 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>
* Merge branch 'master' of git://git.qemu.org/qemu into qom-cpuAndreas Färber2012-12-231-13/+11
|\ | | | | | | | | | | Adapt header include paths. Signed-off-by: Andreas Färber <afaerber@suse.de>
| * softmmu: move include files to include/sysemu/Paolo Bonzini2012-12-191-2/+2
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * misc: move include files to include/qemu/Paolo Bonzini2012-12-191-5/+5
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * exec: move include files to include/exec/Paolo Bonzini2012-12-191-3/+3
| | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * kvm: do not flush after deleting gsiMichael S. Tsirkin2012-12-171-2/+0
| | | | | | | | | | | | | | Deleting a GSI isn't necessary: it is enough to stop using it. Delay flush until an entry is used. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
| * pci: update all users to look in pci/Michael S. Tsirkin2012-12-171-1/+1
| | | | | | | | | | | | update all users so we can remove the makefile hack. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | cpu: Move kvm_run into CPUStateAndreas Färber2012-12-191-4/+4
| | | | | | | | | | | | Pass CPUState / {X86,S390}CPU to helper functions. Signed-off-by: Andreas Färber <afaerber@suse.de>
* | cpu: Move kvm_state field into CPUStateAndreas Färber2012-12-191-14/+14
| | | | | | | | | | | | Adapt some functions to take CPUState / {PowerPC,S390}CPU argument. Signed-off-by: Andreas Färber <afaerber@suse.de>
* | kvm: Pass CPUState to kvm_vcpu_ioctl()Andreas Färber2012-12-191-7/+7
| | | | | | | | | | | | Adapt helper functions to pass X86CPU / PowerPCCPU / S390CPU. Signed-off-by: Andreas Färber <afaerber@suse.de>
* | kvm: Pass CPUState to kvm_arch_*Andreas Färber2012-12-191-31/+44
| | | | | | | | | | | | | | Move kvm_vcpu_dirty field into CPUState to simplify things and change its type to bool while at it. Signed-off-by: Andreas Färber <afaerber@suse.de>
* | cpu: Move kvm_fd into CPUStateAndreas Färber2012-12-191-3/+5
|/ | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* kvm: fix incorrect length in a loop over kvm dirty pages mapAlexey Kardashevskiy2012-11-261-1/+1
| | | | | | | | | | | | | | | | | QEMU allocates a map enough for 4k pages. However the system page size can be 64K (for example on POWER) and the host kernel uses only a small part of it as one big stores a dirty flag for 16 pages 4K each, the hpratio variable stores this ratio and the kvm_get_dirty_pages_log_range function handles it correctly. However kvm_get_dirty_pages_log_range still goes beyond the data provided by the host kernel which is not correct. It does not cause errors at the moment as the whole bitmap is zeroed before doing KVM ioctl. The patch reduces number of iterations over the map. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Alexander Graf <agraf@suse.de>
* kvm: Actually remove software breakpoints from list on cleanupJan Kiszka2012-11-141-0/+2
| | | | | | | | | So far we only removed them from the guest, leaving its states in the list. This made it impossible for gdb to re-enable breakpoints on the same address after re-attaching. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* cpus: Pass CPUState to run_on_cpu()Andreas Färber2012-10-311-2/+5
| | | | | | | | 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_kick()Andreas Färber2012-10-311-1/+1
| | | | | | CPUArchState is no longer needed there. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpus: Pass CPUState to qemu_cpu_is_self()Andreas Färber2012-10-311-1/+3
| | | | | | | | | 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()]
* Rename target_phys_addr_t to hwaddrAvi Kivity2012-10-231-14/+14
| | | | | | | | | | | | | | | target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are reserved) and its purpose doesn't match the name (most target_phys_addr_t addresses are not target specific). Replace it with a finger-friendly, standards conformant hwaddr. Outstanding patchsets can be fixed up with the command git rebase -i --exec 'find -name "*.[ch]" | xargs s/target_phys_addr_t/hwaddr/g' origin Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* memory: use AddressSpace for MemoryListener filteringAvi Kivity2012-10-221-2/+2
| | | | | | | | Using the AddressSpace type reduces confusion, as you can't accidentally supply the MemoryRegion you're interested in. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: manage coalesced mmio via a MemoryListenerAvi Kivity2012-10-221-10/+10
| | | | | | | | | | | | Instead of calling a global function on coalesced mmio changes, which routes the call to kvm if enabled, add coalesced mmio hooks to MemoryListener and make kvm use that instead. The motivation is support for multiple address spaces (which means we we need to filter the call on the right address space) but the result is cleaner as well. Signed-off-by: Avi Kivity <avi@redhat.com>
* kvm: drop no-op MemoryListener callbacksAvi Kivity2012-10-151-30/+0
| | | | | | Removes quite a bit of useless code. Signed-off-by: Avi Kivity <avi@redhat.com>
* kvm: use separate MemoryListeners for memory and I/OAvi Kivity2012-10-151-39/+44
| | | | | | | | | | | | | | | | The construct if (address_space == get_system_memory()) { // memory thing } else { // io thing } fails if we have more than two address spaces. Use a separate listener for memory and I/O, and utilize MemoryListener's address space filtering to fix this. Signed-off-by: Avi Kivity <avi@redhat.com>
* Merge remote-tracking branch 'stefanha/trivial-patches' into stagingAnthony Liguori2012-09-171-7/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stefanha/trivial-patches: configure: fix seccomp check arch_init.c: add missing '%' symbols before PRIu64 in debug printfs kvm: Fix warning from static code analysis qapi: Fix enumeration typo error console: Clean up bytes per pixel calculation Fix copy&paste typos in documentation comments linux-user: Remove #if 0'd cpu_get_real_ticks() definition ui: Fix spelling in comment (ressource -> resource) Spelling fixes in comments and macro names (ressource -> resource) Fix spelling (licenced -> licensed) in GPL Spelling fixes in comments and documentation srp: Don't use QEMU_PACKED for single elements of a structured type
| * kvm: Fix warning from static code analysisStefan Weil2012-09-141-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Report from smatch: kvm-all.c:1373 kvm_init(135) warn: variable dereferenced before check 's' (see line 1360) 's' cannot by NULL (it was alloced using g_malloc0), so there is no need to check it here. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
* | kvm: Rename irqchip_inject_ioctl to irq_set_ioctlJan Kiszka2012-09-111-5/+5
| | | | | | | | | | | | | | | | | | This variable is no longer bound to irqchip, and the IOCTL sets the IRQ level, does not directly inject it. No functional changes. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* | kvm: Stop flushing coalesced MMIO on vmexitJan Kiszka2012-09-111-2/+0
| | | | | | | | | | | | | | | | The memory subsystem will now take care of flushing whenever affected regions are accessed or the memory mapping changes. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* | kvm-all.c: Move init of irqchip_inject_ioctl out of kvm_irqchip_create()Peter Maydell2012-09-111-4/+5
|/ | | | | | | | | | | Move the init of the irqchip_inject_ioctl field of KVMState out of kvm_irqchip_create() and into kvm_init(), so that kvm_set_irq() can be used even when no irqchip is created (for architectures that support async interrupt notification even without an in kernel irqchip). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* kvm: Introduce kvm_has_intx_set_maskJan Kiszka2012-09-101-0/+8
| | | | | | | | Will be used by PCI device assignment code. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* kvm: Introduce kvm_irqchip_update_msi_routeJan Kiszka2012-09-101-0/+42
| | | | | | | | | | This service allows to update an MSI route without releasing/reacquiring the associated VIRQ. Will be used by PCI device assignment, later on likely also by virtio/vhost and VFIO. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
OpenPOWER on IntegriCloud