History | View | Annotate | Download (53.2 kB)
Merge remote-tracking branch 'remotes/kvm/uq/master' into staging
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
kvm: Introduce kvm_arch_irqchip_create
Introduce kvm_arch_irqchip_create an arch-specific hook in preparationfor architecture-specific use of the device control API to create IRQchips.
Following patches will implement the ARM irqchip create method to prefer...
kvm: Common device control API functions
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...
KVM: Use return value for error print
Commit 94ccff13 introduced a more verbose failure message and retryoperations on KVM VM creation. However, it ended up using a variablefor its failure message that hasn't been initialized yet.
Fix it to use the value it meant to set....
kvm: print suberror on all internal errors
KVM introduced internal error exit reason and suberror at the same time,and later extended it with internal error data.QEMU does not report suberror on hosts between these two events becausewe check for the extension. (half a year in 2009, but it is misleading)...
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-pci-for-qemu-20140128.0' into staging
vfio-pci updates include: - Destroy MemoryRegions on device teardown - Print warnings around PCI option ROM failures - Skip bogus mappings from 64bit BAR sizing...
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
kvm: initialize qemu_host_page_size
There is a HOST_PAGE_ALIGN macro which makes sense for KVM acceleratorbut it uses qemu_host_page_size/qemu_host_page_mask which initializedfor TCG only.
This moves qemu_host_page_size/qemu_host_page_mask initialization from...
KVM: fix addr type for KVM_IOEVENTFD
The @addr here is a guest physical address and can easily be biggerthan 4G.
This changes uint32_t to hwaddr.
Cc: qemu-stable@nongnu.orgCc: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>...
KVM: Retry KVM_CREATE_VM on EINTR
Upstreaming this change from Android (https://android-review.googlesource.com/54211).
On heavily loaded machines with many VM instances we see KVM_CREATE_VMfailing with EINTR on this path:
kvm_dev_ioctl_create_vm -> kvm_create_vm -> kvm_init_mmu_notifier -> mmu_notifier_register -> do_mmu_notifier_register -> mm_take_all_locks...
kvm: use directly cpu_physical_memory_* api for tracking dirty pages
Performance is important in this function, and we want to optimize even further.
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>
kvm: refactor start address calculation
memory: move bitmap synchronization to its own function
We want to have all the functions that handle directly the dirtybitmap near. We will change it later.
kvm: Query KVM for available memory slots
KVM reports the number of available memory slots (KVM_CAP_NR_MEMSLOTS)using the extension interface. Both x86 and s390 implement this, ARMand powerpc do not yet enable it. Convert the static slots array tobe dynamically allocated, supporting more slots when available....
kvm: warn if num cpus is greater than num recommended
The comment in kvm_max_vcpus() states that it's using the recommendedprocedure from the kernel API documentation to get the max numberof vcpus that kvm supports. It is, but by always returning themaximum number supported. The maximum number should only be used...
kvm irqfd: support direct msimessage to irq translation
On PPC64 systems MSI Messages are translated to system IRQ in a PCIhost bridge. This is already supported for emulated MSI/MSIX butnot for irqfd where the current QEMU allocates IRQ numbers fromirqchip and maps MSIMessages to IRQ in the host kernel....
exec: Simplify the guest physical memory allocation hook
Make it a generic hook rather than a KVM hook. Less code andifdeffery.
Since the only user of the hook is old S390 KVM, there's hope we canget rid of it some day.
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>...
cpu: Use QTAILQ for CPU list
Introduce CPU_FOREACH(), CPU_FOREACH_SAFE() and CPU_NEXT() shorthandmacros.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Merge remote-tracking branch 'qemu-kvm/uq/master' into stable-1.5
kvm-all.c: max_cpus should not exceed KVM vcpu limit
maxcpus, which specifies the maximum number of hotpluggable CPUs,should not exceed KVM's vcpu limit.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>[Reword message. - Paolo]Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
kvm: Simplify kvm_handle_io
Now that cpu_in/out is just a wrapper around address_space_rw, we canalso call the latter directly. As host endianness == guest endianness,there is no need for the memory access helpers st*_p/ld*_p as well.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
kvm: add KVM_IRQFD_FLAG_RESAMPLE support
Added an EventNotifier* parameter tokvm-all.c:kvm_irqchip_add_irqfd_notifier(), in order to give KVManother eventfd to be used as "resamplefd". See the documentationin the linux kernel sources in Documentation/virtual/kvm/api.txt...
kvm: Change prototype of kvm_update_guest_debug()
Passing a CPUState pointer instead of a CPUArchState pointer eliminatesthe 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>...
cpu: Move singlestep_enabled field from CPU_COMMON to CPUState
Prepares for changing cpu_single_step() argument to CPUState.
Acked-by: Michael Walle <michael@walle.cc> (for lm32)Signed-off-by: Andreas Färber <afaerber@suse.de>
kvm: Change kvm_{insert,remove}_breakpoint() argument to CPUState
CPUArchState is no longer directly used since converting CPU loops toCPUState.
Prepares for changing GDBState::c_cpu to CPUState.
Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging
QOM CPUState refactorings
cpu: Make first_cpu and next_cpu CPUState
Move next_cpu from CPU_COMMON to CPUState.Move first_cpu variable to qom/cpu.h.
gdbstub needs to use CPUState::env_ptr for now.cpu_copy() no longer needs to save and restore cpu_next.
Acked-by: Paolo Bonzini <pbonzini@redhat.com>...
kvm: Free current_cpu identifier
Since CPU loops are done as last step in kvm_{insert,remove}_breakpoint()and kvm_remove_all_breakpoints(), we do not need to distinguish betweeninvoking CPU and iterated CPUs and can thereby free the identifier foruse as a global variable....
kvm: Change kvm_remove_all_breakpoints() 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>
Fix -machine options accel, kernel_irqchip, kvm_shadow_mem
Multiple -machine options with the same ID are merged. All but theone without an ID are to be silently ignored.
In most places, we query these options with a null ID. This iscorrect.
In some places, we instead query whatever options come first in the...
Merge remote-tracking branch 'bonzini/iommu-for-anthony' into staging
memory: add ref/unref calls
Add ref/unref calls at the following places:
- places where memory regions are stashed by a listener and used outside the BQL (including in Xen or KVM).
- memory_region_find callsites
- creation of aliases and containers (only the aliased/contained...
kvm: skip system call when msi route is unchanged
Some guests do a large number of mask/unmaskcalls which currently trigger expensive route updatesystem calls.Detect that route in unchanged and skip the system call.
Reported-by: "Zhanghaoyu (A)" <haoyu.zhang@huawei.com>...
kvm: add detail error message when fail to add ioeventfd
I try to hotplug 28 * 8 multiple-function devices to guest withold host kernel, ioeventfds in host kernel will be exhausted, thenqemu fails to allocate ioeventfds for blk/nic devices.
It's better to add detail error here....
kvm: zero-initialize KVM_SET_GSI_ROUTING input
kvm_add_routing_entry makes an attempt tozero-initialize any new routing entry.However, it fails to initialize paddingwithin the u field of the structurekvm_irq_routing_entry.
Other functions like kvm_irqchip_update_msi_route...
KVM: Export kvm_init_irq_routing
On PPC, we can have different types of interrupt controllers, so we reallyonly 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 callkvm_irqchip_create()....
KVM: MSI: Swap payload to native endianness
The usual MSI injection mechanism writes msi.data into memory using anle32 wrapper. So on big endian guests, this swaps msg.data into theexpected byte order.
For irqfd however, we don't swap the payload right now, rendering...
KVM: PIC: Only commit irq routing when necessary
The current logic updates KVM's view of our interrupt map every time wechange it. While this is nice and bullet proof, it slows things downbadly for me. QEMU spends about 3 seconds on every start telling KVM what...
KVM: Don't assume that mpstate exists with in-kernel PIC always
On PPC, we don't support MP state. So far it's not necessary and I'mnot convinced yet that we really need to support it ever.
However, the current idle logic in QEMU assumes that an in-kernel PIC...
kvm: Change kvm_cpu_synchronize_state() argument to CPUState
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>...
kvm: Change kvm_set_signal_mask() argument to CPUState
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>...
cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks
Make cpustats monitor command available unconditionally.
Prepares for changing kvm_handle_internal_error() and kvm_cpu_exec()arguments to CPUState.
kvm: Change kvm_handle_internal_error() argument to CPUState
It no longer uses CPUArchState.
Prepares for changing kvm_cpu_exec() argument to CPUState.
kvm: Change kvm_cpu_exec() argument to CPUState
Prepares for changing qemu_kvm_cpu_thread_fn() opaque to CPUState.
memory: make section size a 128-bit integer
So far, the size of all regions passed to listeners could fit in 64 bits,because artificial regions (containers and aliases) are eliminated bythe memory core, leaving only device regions which have reasonable sizes...
fix double free the memslot in kvm_set_phys_mem
Luiz Capitulino reported that guest refused to boot and qemucomplained with:kvm_set_phys_mem: error unregistering overlapping slot: Invalid argument
It is caused by commit 235e8982ad that did double free for the memslot...
kvm: support using KVM_MEM_READONLY flag for regions
For readonly memory regions and rom devices in romd_mode,we make use of the KVM_MEM_READONLY. A slot that usesKVM_MEM_READONLY can be read from and code can execute from theregion, but writes will exit to qemu....
kvm: add kvm_readonly_mem_enabled
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.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
osdep, kvm: rename low-level RAM allocation functions
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>...
kvm-all: add kvm_run_exit tracepoint
This patch enable us to know exit reason of KVM_RUN. It will help usknow 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 tracepoints
This patch adds tracepoints at ioctl to kvm. Tracing these ioctl isuseful for clarification whether the cause of troubles is qemu or kvm.
Signed-off-by: Kazuya Saito <saito.kazuya@jp.fujitsu.com>...
cpu: Call cpu_synchronize_post_init() from DeviceClass::realize()
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 staging
pci: add pci test device
This adds a new device that we can use for testing PCI PIO and MMIO, with andwithout ioeventfd in different configurations. FAST_MMIO will be added if/whenkvm supports it. Also included are minor cleanups in kvm APIs that it needs....
cpu: Pass CPUState to cpu_synchronize_post()
... so it could be called without requiring CPUArchState.
kvm: remove unused APIs
There are only used internally now, move themout of header and out of stub.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
kvm: support any size for pio eventfd
kvm: support non datamatch ioeventfd
Adding restrictions just adds code.
cpu: Move halted and interrupt_request fields to CPUState
Both fields are used in VMState, thus need to be moved together.Explicitly zero them on reset since they were located beforebreakpoints.
Pass PowerPCCPU to kvmppc_handle_halt().
cpu: Pass CPUState to cpu_interrupt()
Move it to qom/cpu.h to avoid issues with include order.
Change pc_acpi_smi_interrupt() opaque to X86CPU.
cpu: Move exit_request field to CPUState
Since it was located before breakpoints field, it needs to be reset.
kvm: Pass CPUState to kvm_on_sigbus_vcpu()
Since commit 20d695a9254c1b086a456d3b79a3c311236643ba (kvm: PassCPUState 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>...
kvm: Create kvm_arch_vcpu_id() function
This will allow each architecture to define how the VCPU ID is set onthe 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_route
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>
cpu: Move cpu_index field to CPUState
Note that target-alpha accesses this field from TCG, now using anegative 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()....
kvm: Pass CPUState to kvm_init_vcpu()
CPUArchState is no longer needed, and it thereby no longer depends onNEED_CPU_H.
Merge branch 'master' of git://git.qemu.org/qemu into qom-cpu
Adapt header include paths.
cpu: Move kvm_state field into CPUState
Adapt some functions to take CPUState / {PowerPC,S390}CPU argument.
cpu: Move kvm_run into CPUState
Pass CPUState / {X86,S390}CPU to helper functions.
cpu: Move kvm_fd into CPUState
kvm: Pass CPUState to kvm_arch_*
Move kvm_vcpu_dirty field into CPUState to simplify things and changeits type to bool while at it.
kvm: Pass CPUState to kvm_vcpu_ioctl()
Adapt helper functions to pass X86CPU / PowerPCCPU / S390CPU.
softmmu: move include files to include/sysemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
misc: move include files to include/qemu/
exec: move include files to include/exec/
kvm: do not flush after deleting gsi
Deleting a GSI isn't necessary: it is enoughto stop using it. Delay flush until an entry is used.
pci: update all users to look in pci/
update all users so we can remove the makefile hack.
kvm: fix incorrect length in a loop over kvm dirty pages map
QEMU allocates a map enough for 4k pages. However the system page sizecan be 64K (for example on POWER) and the host kernel uses only a smallpart of it as one big stores a dirty flag for 16 pages 4K each,...
kvm: Actually remove software breakpoints from list on cleanup
So far we only removed them from the guest, leaving its states in thelist. This made it impossible for gdb to re-enable breakpoints on thesame address after re-attaching.
cpus: Pass CPUState to run_on_cpu()
Move the declaration to include/qemu/cpu.h and add documentation.
cpus: Pass CPUState to qemu_cpu_kick()
CPUArchState is no longer needed there.
cpus: Pass CPUState to qemu_cpu_is_self()
Change return type to bool, move to include/qemu/cpu.h andadd 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 hwaddr
target_phys_addr_t is unwieldly, violates the C standard (_t suffixes arereserved) and its purpose doesn't match the name (most target_phys_addr_taddresses are not target specific). Replace it with a finger-friendly,...
memory: use AddressSpace for MemoryListener filtering
Using the AddressSpace type reduces confusion, as you can't accidentallysupply 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 MemoryListener
Instead of calling a global function on coalesced mmio changes, whichroutes the call to kvm if enabled, add coalesced mmio hooks toMemoryListener and make kvm use that instead.
The motivation is support for multiple address spaces (which means we...
kvm: drop no-op MemoryListener callbacks
Removes quite a bit of useless code.
Signed-off-by: Avi Kivity <avi@redhat.com>
kvm: use separate MemoryListeners for memory and I/O
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 listenerfor memory and I/O, and utilize MemoryListener's address space filtering to...
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
kvm: Fix warning from static code analysis
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 needto check it here.
Signed-off-by: Stefan Weil <sw@weilnetz.de>...
kvm: Rename irqchip_inject_ioctl to irq_set_ioctl
This variable is no longer bound to irqchip, and the IOCTL sets the IRQlevel, 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>...
kvm: Stop flushing coalesced MMIO on vmexit
The memory subsystem will now take care of flushing whenever affectedregions 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()
Move the init of the irqchip_inject_ioctl field of KVMState out ofkvm_irqchip_create() and into kvm_init(), so that kvm_set_irq()can be used even when no irqchip is created (for architectures...
kvm: Introduce kvm_has_intx_set_mask
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_route
This service allows to update an MSI route without releasing/reacquiringthe associated VIRQ. Will be used by PCI device assignment, later onlikely also by virtio/vhost and VFIO.
kvm: Clean up irqfd API
No need to expose the fd-based interface, everyone will already be finewith the more handy EventNotifier variant. Rename the latter to clarifythat we are still talking about irqfds here.
qemu: Use valgrind annotations to mark kvm guest memory as defined
valgrind with kvm produces a big amount of false positives regarding"Conditional jump or move depends on uninitialised value(s)". Thishappens because the guest memory is allocated with qemu_vmalloc which...
kvm: Decouple 'GSI routing' from 'kernel irqchip'
Don't assume having an in-kernel irqchip means that GSIrouting is enabled.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Avi Kivity <avi@redhat.com>
kvm: Decouple 'irqfds usable' from 'kernel irqchip'
Instead of assuming that we can use irqfds if and only ifkvm_irqchip_in_kernel(), add a bool to the KVMState whichindicates this, and is set only on x86 and only if theirqchip is in the kernel.
The kernel documentation implies that the only thing...
kvm: Decouple 'MSI routing via irqfds' from 'kernel irqchip'
Decouple another x86-specific assumption about what irqchips imply.