summaryrefslogtreecommitdiffstats
path: root/include/sysemu/kvm.h
Commit message (Collapse)AuthorAgeFilesLines
* KVM: add support for any length io eventfdJason Wang2015-11-121-0/+8
| | | | | | | Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
* Revert "Introduce cpu_clean_all_dirty"Liang Li2015-11-051-8/+0
| | | | | | | | | | | | | This reverts commit de9d61e83d43be9069e6646fa9d57a3f47779d28. Now 'cpu_clean_all_dirty' is useless, we can revert the related code. Conflicts: include/sysemu/kvm.h Signed-off-by: Liang Li <liang.z.li@intel.com> Message-Id: <1446695464-27116-3-git-send-email-liang.z.li@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm: Move x86-specific functions into target-i386/kvm.cThomas Huth2015-10-191-2/+0
| | | | | | | | | The functions for checking xcrs, xsave and pit_state2 are only used on x86, so they should reside in target-i386/kvm.c. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1444933820-6968-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm: Pass PCI device pointer to MSI routing functionsPavel Fedin2015-10-191-3/+4
| | | | | | | | | | | | | | | | | In-kernel ITS emulation on ARM64 will require to supply requester IDs. These IDs can now be retrieved from the device pointer using new pci_requester_id() function. This patch adds pci_dev pointer to KVM GSI routing functions and makes callers passing it. x86 architecture does not use requester IDs, but hw/i386/kvm/pci-assign.c also made passing PCI device pointer instead of NULL for consistency with the rest of the code. Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Message-Id: <ce081423ba2394a4efc30f30708fca07656bc500.1444916432.git.p.fedin@samsung.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm: Make KVM_CAP_SIGNAL_MSI globally availablePavel Fedin2015-10-191-0/+9
| | | | | | | | | This capability is useful to determine whether we can use KVM ITS emulation on ARM Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Message-Id: <ff4ccb09b837d37defd639b885526949a25276de.1444916432.git.p.fedin@samsung.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* exec: remove non-TCG stuff from exec-all.h header.Paolo Bonzini2015-10-121-0/+4
| | | | | | | | The header is included from basically everywhere, thanks to cpu.h. It should be moved to the (TCG only) files that actually need it. As a start, remove non-TCG stuff. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* intc/gic: Extract some reusable vGIC codePavel Fedin2015-09-241-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some functions previously used only by vGICv2 are useful also for vGICv3 implementation. Untie them from GICState and make accessible from within other modules: - kvm_arm_gic_set_irq() - kvm_gic_supports_attr() - moved to common code and renamed to kvm_device_check_attr() - kvm_gic_access() - turned into GIC-independent kvm_device_access(). Data pointer changed to void * because some GICv3 registers are 64-bit wide Some of these changes are not used right now, but they will be helpful for implementing live migration. Actually kvm_dist_get() and kvm_dist_put() could also be made reusable, but they would require two extra parameters (s->dev_fd and s->num_cpu) as well as lots of typecasts of 's' to DeviceState * and back to GICState *. This makes the code very ugly so i decided to stop at this point. I tried also an approach with making a base class for all possible GICs, but it would contain only three variables (dev_fd, cpu_num and irq_num), and accessing them through the rest of the code would be again tedious (either ugly casts or qemu-style separate object pointer). So i disliked it too. Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Tested-by: Ashok kumar <ashoks@broadcom.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 2ef56d1dd64ffb75ed02a10dcdaf605e5b8ff4f8.1441784344.git.p.fedin@samsung.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* kvm: some fixes to kvm_resamplefds_allowedEric Auger2015-07-061-0/+1
| | | | | | | | | | | | Commit f41389ae3c54b introduced kvm_resamplefds_enabled() and associated kvm_resamplefds_allowed boolean. This patch adds non-KVM version for kvm_resamplefds_enabled and also declares kvm_resamplefds_allowed in kvm-stub as it is done for fellow kvm_irqfds_allowed. Signed-off-by: Eric Auger <eric.auger@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
* kvm-all.c: add qemu_irq/gsi hash table and utility routinesEric Auger2015-07-061-0/+6
| | | | | | | | | | | | | | | | | | | VFIO platform device needs to setup irqfd but it does not know the gsi corresponding to the device qemu_irq. This patch proposes to store a hash table in kvm_state using the qemu_irq as key and the gsi as a value. kvm_irqchip_set_qemuirq_gsi allows to insert such a pair. The interrupt controller is supposed to use it. kvm_irqchip_[add, remove]_irqfd_notifier allows to setup/tear down irqfd directly from the qemu_irq. Signed-off-by: Eric Auger <eric.auger@linaro.org> Tested-by: Vikram Sethi <vikrams@codeaurora.org> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
* kvm: rename kvm_irqchip_[add,remove]_irqfd_notifier with gsi suffixEric Auger2015-07-061-3/+4
| | | | | | | | | | | Anticipating for the introduction of new add/remove functions taking a qemu_irq parameter, let's rename existing ones with a gsi suffix. Signed-off-by: Eric Auger <eric.auger@linaro.org> Tested-by: Vikram Sethi <vikrams@codeaurora.org> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
* kvm: introduce kvm_arch_msi_data_to_gsiEric Auger2015-06-021-0/+2
| | | | | | | | | | | On ARM the MSI data corresponds to the shared peripheral interrupt (SPI) ID. This latter equals to the SPI index + 32. to retrieve the SPI index, matching the gsi, an architecture specific function is introduced. Signed-off-by: Eric Auger <eric.auger@linaro.org> Acked-by: Christoffer Dall <christoffer.dall@linaro.org> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* kvm: add support for memory transaction attributesPaolo Bonzini2015-04-301-1/+2
| | | | | | | Let kvm_arch_post_run convert fields in the kvm_run struct to MemTxAttrs. These are then passed to address_space_rw. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm: encapsulate HAS_DEVICE for vm attrsDominik Dingel2015-03-161-0/+12
| | | | | | | | | | | | | | | | | | More and more virtual machine specifics between kvm and qemu will be transferred with vm attributes. So we encapsulate the common logic in a generic function. Additionally we need only to check during initialization if kvm supports virtual machine attributes. Cc: Paolo Bonzini <pbonzini@redhat.com> Suggested-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Dominik Dingel <dingel@linux.vnet.ibm.com> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Message-Id: <1426164834-38648-2-git-send-email-jfrei@linux.vnet.ibm.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
* kvm: add machine state to kvm_arch_initMarcel Apfelbaum2015-03-111-1/+1
| | | | | | | | | Needed to query machine's properties. Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm: extend kvm_irqchip_add_msi_route to work on s390Frank Blaschka2015-01-121-0/+4
| | | | | | | | | | | on s390 MSI-X irqs are presented as thin or adapter interrupts for this we have to reorganize the routing entry to contain valid information for the adapter interrupt code on s390. To minimize impact on existing code we introduce an architecture function to fixup the routing entry. Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
* KVM_CAP_IRQFD and KVM_CAP_IRQFD_RESAMPLE checksEric Auger2014-12-151-0/+10
| | | | | | | | | | | | | | | | | | | | | | | Compute kvm_irqfds_allowed by checking the KVM_CAP_IRQFD extension. Remove direct settings in architecture specific files. Add a new kvm_resamplefds_allowed variable, initialized by checking the KVM_CAP_IRQFD_RESAMPLE extension. Add a corresponding kvm_resamplefds_enabled() function. A special notice for s390 where KVM_CAP_IRQFD was not immediatly advirtised when irqfd capability was introduced in the kernel. KVM_CAP_IRQ_ROUTING was advertised instead. This was fixed in "KVM: s390: announce irqfd capability", ebc3226202d5956a5963185222982d435378b899 whereas irqfd support was brought in 84223598778ba08041f4297fda485df83414d57e, "KVM: s390: irq routing for adapter interrupts". Both commits first appear in 3.15 so there should not be any kernel version impacted by this QEMU modification. Signed-off-by: Eric Auger <eric.auger@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* pc: kvm: check if KVM has free memory slots to avoid abort()Igor Mammedov2014-11-231-0/+1
| | | | | | | | | | | | | | | | When more memory devices are used than available KVM memory slots, QEMU crashes with: kvm_alloc_slot: no free slot available Aborted (core dumped) Fix this by checking that KVM has a free slot before attempting to map memory in guest address space. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* accel: Move KVM accel registration to kvm-all.cEduardo Habkost2014-10-041-2/+0
| | | | | | | | | | | | | | | | Note that this has an user-visible side-effect: instead of reporting "KVM is not supported for this target", QEMU binaries not supporting KVM will report "kvm accelerator does not exist". As kvm_availble() always return 1 when CONFIG_KVM is enabled, we don't need to set AccelClass.available anymore. kvm_enabled() is not being completely removed yet only because qmp_query_kvm() still uses it. This also allows us to make kvm_init() static. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Introduce cpu_clean_all_dirtyMarcelo Tosatti2014-09-161-0/+8
| | | | | | | | | Introduce cpu_clean_all_dirty, to force subsequent cpu_synchronize_all_states to read in-kernel register state. Cc: qemu-stable@nongnu.org Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* KVM: Add helper to run KVM_CHECK_EXTENSION on vm fdAlexander Graf2014-09-081-0/+2
| | | | | | | | | | We now can call KVM_CHECK_EXTENSION on the kvm fd or on the vm fd, whereas the vm version is more accurate when it comes to PPC KVM. Add a helper to make the vm version available that falls back to the non-vm variant if the vm one is not available yet to stay compatible. Signed-off-by: Alexander Graf <agraf@suse.de>
* Merge remote-tracking branch 'remotes/kvm/uq/master' into stagingPeter Maydell2014-06-201-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * remotes/kvm/uq/master: hw/mips: malta: Don't boot from flash with KVM T&E MAINTAINERS: Add entry for MIPS KVM target-mips: Enable KVM support in build system hw/mips: malta: Add KVM support hw/mips: In KVM mode, inject IRQ2 (I/O) interrupts via ioctls target-mips: Call kvm_mips_reset_vcpu() from mips_cpu_reset() target-mips: kvm: Add main KVM support for MIPS kvm: Allow arch to set sigmask length target-mips: get_physical_address: Add KVM awareness target-mips: get_physical_address: Add defines for segment bases hw/mips: Add API to convert KVM guest KSEG0 <-> GPA hw/mips/cputimer: Don't start periodic timer in KVM mode target-mips: Reset CPU timer consistently KVM: Fix GSI number space limit Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * kvm: Allow arch to set sigmask lengthJames Hogan2014-06-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MIPS/Linux is unusual in having 128 signals rather than just 64 like most other architectures. This means its sigmask is 16 bytes instead of 8, so allow arches to override the sigmask->len value passed to the KVM_SET_SIGNAL_MASK ioctl in kvm_set_signal_mask() by calling kvm_set_sigmask_len() from kvm_arch_init(). Otherwise default to 8 bytes. Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Sanjay Lal <sanjayl@kymasys.com> Cc: Gleb Natapov <gleb@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* | Add kvm_eventfds_enabled functionNikolay Nikolaev2014-06-191-0/+11
|/ | | | | | | | | | | Add a function to check if the eventfd capability is present in KVM in the host kernel. Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com> Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
* s390x/virtio-ccw: wire up irq routing and irqfdsCornelia Huck2014-05-201-0/+2
| | | | | | | | | | | | | | Make use of the new s390 adapter irq routing support to enable real in-kernel irqfds for virtio-ccw with adapter interrupts. Note that s390 doesn't provide the common KVM_CAP_IRQCHIP capability, but rather needs KVM_CAP_S390_IRQCHIP to be enabled. This is to ensure backward compatibility. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
* kvm: Fix enable_cap helpers on older gccAlexander Graf2014-05-201-2/+2
| | | | | | | | | | | | | | | | | | | Commit 40f1ee27aa1 introduced handy helpers for enable_cap calls on vcpu and vm level. Unfortunately some older gcc versions (4.7.1, 4.6) seem to choke on signedness detection in inline created variables: target-ppc/kvm.c: In function 'kvmppc_booke_watchdog_enable': target-ppc/kvm.c:1302:21: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] target-ppc/kvm.c: In function 'kvmppc_set_papr': target-ppc/kvm.c:1504:21: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] However - thanks to Thomas Huth for the suggestion - we can just cast the offending potentially 0 value to a signed type, making the comparison signed. Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
* kvm: reset state from the CPU's reset methodPaolo Bonzini2014-05-131-2/+0
| | | | | | | | | | | | | | | | | | | Now that we have a CPU object with a reset method, it is better to keep the KVM reset close to the CPU reset. Using qemu_register_reset as we do now keeps them far apart. With this patch, PPC no longer calls the kvm_arch_ function, so it can get removed there. Other arches call it from their CPU reset handler, and the function gets an ARMCPU/X86CPU/S390CPU. Note that ARM- and s390-specific functions are called kvm_arm_* and kvm_s390_*, while x86-specific functions are called kvm_arch_*. That follows the convention used by the different architectures. Changing that is the topic of a separate patch. Reviewed-by: Gleb Natapov <gnatapov@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* kvm: make one_reg helpers available for everyoneCornelia Huck2014-05-131-0/+20
| | | | | | | | | | | | s390x introduced helper functions for getting/setting one_regs with commit 860643bc. However, nothing about these is s390-specific. Alexey Kardashevskiy had already posted a general version, so let's merge the two patches and massage the code a bit. CC: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* machine: Replace QEMUMachine by MachineClass in accelerator configurationMarcel Apfelbaum2014-05-051-1/+1
| | | | | | | This minimizes QEMUMachine usage, as part of machine QOM-ification. Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* kvm: add kvm_{vm,vcpu}_enable_capCornelia Huck2014-04-301-0/+30
| | | | | | | | Provide helper functions for enabling capabilities (on a vcpu and on a vm). Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com> Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
* Revert "KVM: Split QEMUMachine typedef into separate header"Andreas Färber2014-03-131-1/+0
| | | | | | | | This reverts commit 9c06a1f79f959fffd09bfb7efc3d76051a6cd2da. The new header sysemu/qemumachine.h is undesired. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* kvm: Add a new machine option kvm-typeAneesh Kumar K.V2014-03-051-1/+1
| | | | | | | | | | | | Targets like ppc64 support different types of KVM, one which use hypervisor mode and the other which doesn't. Add a new machine option kvm-type that helps in selecting the respective ones We also add a new QEMUMachine callback get_vm_type that helps in mapping the string representation of kvm type specified. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> [agraf: spelling fixes, use error_report(), use qemumachine.h] Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: Split QEMUMachine typedef into separate headerAlexander Graf2014-03-051-0/+1
| | | | | | | | | | | | | | | | Older gcc versions (such as the one in SLES11) get confused when you declare a typedef on the same struct twice. To work around that limitation, let's extract the QEMUMachine typedef into a separate header file that is guarded by preprocessor duplicate include checks. This fixes the following type of compile errors for me: In file included from vl.c:125: include/hw/xen/xen.h:39: error: redefinition of typedef "QEMUMachine" include/sysemu/kvm.h:155: error: previous declaration of "QEMUMachine" was here Signed-off-by: Alexander Graf <agraf@suse.de>
* kvm: Common device control API functionsChristoffer Dall2014-02-261-0/+22
| | | | | | | | | | | | | | Introduces two simple functions: int kvm_device_ioctl(int fd, int type, ...); int kvm_create_device(KVMState *s, uint64_t type, bool test); These functions wrap the basic ioctl-based interactions with KVM in a way similar to other KVM ioctl wrappers. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org> Message-id: 1392687720-26806-4-git-send-email-christoffer.dall@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* kvm: Introduce kvm_arch_irqchip_createChristoffer Dall2014-02-261-0/+12
| | | | | | | | | | | | | | Introduce kvm_arch_irqchip_create an arch-specific hook in preparation for architecture-specific use of the device control API to create IRQ chips. Following patches will implement the ARM irqchip create method to prefer the device control API over the older KVM_CREATE_IRQCHIP API. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org> Message-id: 1392687720-26806-3-git-send-email-christoffer.dall@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* Merge remote-tracking branch 'qemu-kvm/uq/master' into stagingAnthony Liguori2013-09-231-10/+19
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # By Alexey Kardashevskiy (3) and others # Via Paolo Bonzini * qemu-kvm/uq/master: target-i386: add feature kvm_pv_unhalt linux-headers: update to 3.12-rc1 target-i386: forward CPUID cache leaves when -cpu host is used linux-headers: update to 3.11 kvm: fix traces to use %x instead of %d kvmvapic: Clear also physical ROM address when entering INACTIVE state kvmvapic: Enter inactive state on hardware reset kvmvapic: Catch invalid ROM size kvm irqfd: support direct msimessage to irq translation fix steal time MSR vmsd callback to proper opaque type kvm: warn if num cpus is greater than num recommended cpu: Move cpu state syncs up into cpu_dump_state() exec: always use MADV_DONTFORK Message-id: 1379694292-1601-1-git-send-email-pbonzini@redhat.com
| * kvm irqfd: support direct msimessage to irq translationAlexey Kardashevskiy2013-09-201-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On PPC64 systems MSI Messages are translated to system IRQ in a PCI host bridge. This is already supported for emulated MSI/MSIX but not for irqfd where the current QEMU allocates IRQ numbers from irqchip and maps MSIMessages to IRQ in the host kernel. This adds a new direct mapping flag which tells the kvm_irqchip_add_msi_route() function that a new VIRQ should not be allocated, instead the value from MSIMessage::data should be used. It is up to the platform code to make sure that this contains a valid IRQ number as sPAPR does in spapr_pci.c. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * cpu: Move cpu state syncs up into cpu_dump_state()James Hogan2013-09-201-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The x86 and ppc targets call cpu_synchronize_state() from their *_cpu_dump_state() callbacks to ensure that up to date state is dumped when KVM is enabled (for example when a KVM internal error occurs). Move this call up into the generic cpu_dump_state() function so that other KVM targets (namely MIPS) can take advantage of it. This requires kvm_cpu_synchronize_state() and cpu_synchronize_state() to be moved out of the #ifdef NEED_CPU_H in <sysemu/kvm.h> so that they're accessible to qom/cpu.c. Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Andreas Färber <afaerber@suse.de> Cc: Alexander Graf <agraf@suse.de> Cc: Gleb Natapov <gleb@redhat.com> Cc: qemu-ppc@nongnu.org Cc: kvm@vger.kernel.org Signed-off-by: Gleb Natapov <gleb@redhat.com>
* | exec: Simplify the guest physical memory allocation hookMarkus Armbruster2013-09-121-5/+0
|/ | | | | | | | | | | | | | | Make it a generic hook rather than a KVM hook. Less code and ifdeffery. Since the only user of the hook is old S390 KVM, there's hope we can get rid of it some day. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Message-id: 1375276272-15988-5-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
* Merge remote-tracking branch 'qemu-kvm/uq/master' into stable-1.5Anthony Liguori2013-08-291-1/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qemu-kvm/uq/master: kvm-stub: fix compilation kvm: shorten the parameter list for get_real_device() kvm: i386: fix LAPIC TSC deadline timer save/restore kvm-all.c: max_cpus should not exceed KVM vcpu limit kvm: Simplify kvm_handle_io kvm: x86: fix setting IA32_FEATURE_CONTROL with nested VMX disabled kvm: add KVM_IRQFD_FLAG_RESAMPLE support kvm: migrate vPMU state target-i386: remove tabs from target-i386/cpu.h Initialize IA32_FEATURE_CONTROL MSR in reset and migration Conflicts: target-i386/cpu.h target-i386/kvm.c aliguori: fixup trivial conflicts due to whitespace and added cpu argument Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
| * kvm: add KVM_IRQFD_FLAG_RESAMPLE supportVincenzo Maffione2013-08-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Added an EventNotifier* parameter to kvm-all.c:kvm_irqchip_add_irqfd_notifier(), in order to give KVM another eventfd to be used as "resamplefd". See the documentation in the linux kernel sources in Documentation/virtual/kvm/api.txt (section 4.75) for more details. When the added parameter is passed NULL, the behaviour of the function is unchanged with respect to the previous versions. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Vincenzo Maffione <v.maffione@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* | kvm: Change prototype of kvm_update_guest_debug()Stefan Weil2013-07-261-1/+1
|/ | | | | | | | | | | Passing a CPUState pointer instead of a CPUArchState pointer eliminates the last target dependent data type in sysemu/kvm.h. It also simplifies the code. Signed-off-by: Stefan Weil <sw@weilnetz.de> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* kvm: Change kvm_{insert,remove}_breakpoint() argument to CPUStateAndreas Färber2013-07-231-2/+2
| | | | | | | | | CPUArchState is no longer directly used since converting CPU loops to CPUState. Prepares for changing GDBState::c_cpu to CPUState. Signed-off-by: Andreas Färber <afaerber@suse.de>
* kvm: Change kvm_remove_all_breakpoints() argument to CPUStateAndreas Färber2013-07-091-1/+1
| | | | | | Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
* kvm: Free current_cpu identifierAndreas Färber2013-07-091-5/+5
| | | | | | | | | | Since CPU loops are done as last step in kvm_{insert,remove}_breakpoint() and kvm_remove_all_breakpoints(), we do not need to distinguish between invoking CPU and iterated CPUs and can thereby free the identifier for use as a global variable. Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* KVM: PIC: Only commit irq routing when necessaryAlexander Graf2013-07-011-0/+1
| | | | | | | | | | | | | The current logic updates KVM's view of our interrupt map every time we change it. While this is nice and bullet proof, it slows things down badly for me. QEMU spends about 3 seconds on every start telling KVM what news it has on its routing maps. Instead, let's just synchronize the whole irq routing map as a whole when we're done constructing it. For things that change during runtime, we can still update the routing table on demand. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: Export kvm_init_irq_routingAlexander Graf2013-07-011-0/+1
| | | | | | | | | | On PPC, we can have different types of interrupt controllers, so we really only know that we are going to use one when we created it. Export kvm_init_irq_routing() to common code, so that we don't have to call kvm_irqchip_create(). Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: Don't assume that mpstate exists with in-kernel PIC alwaysAlexander Graf2013-07-011-0/+10
| | | | | | | | | | | | | | On PPC, we don't support MP state. So far it's not necessary and I'm not convinced yet that we really need to support it ever. However, the current idle logic in QEMU assumes that an in-kernel PIC also means we support MP state. This assumption is not true anymore. Let's split up the two cases into two different variables. That way PPC can expose an in-kernel PIC, while not implementing MP state. Signed-off-by: Alexander Graf <agraf@suse.de> CC: Jan Kiszka <jan.kiszka@siemens.com>
* kvm: Change kvm_cpu_exec() argument to CPUStateAndreas Färber2013-06-281-1/+1
| | | | | | | | | | It no longer uses CPUArchState. Prepares for changing qemu_kvm_cpu_thread_fn() opaque to CPUState. Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
* kvm: Change kvm_set_signal_mask() argument to CPUStateAndreas Färber2013-06-281-1/+1
| | | | | | | | | | CPUArchState is no longer needed. Prepares for changing qemu_kvm_init_cpu_signals() argument to CPUState. Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
* kvm: Change cpu_synchronize_state() argument to CPUStateAndreas Färber2013-06-281-2/+2
| | | | | | | | 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>
OpenPOWER on IntegriCloud