History | View | Annotate | Download (51.1 kB)
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().
Signed-off-by: Andreas Färber <afaerber@suse.de>
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.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
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.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
cpus: Pass CPUState to run_on_cpu()
CPUArchState is no longer needed.
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.
kvm: Move kvm_allows_irq0_override() to target-i386, fix return type
kvm_allows_irq0_override() is a totally x86 specific concept:move it to the target-specific source file where it belongs.This means we need a new header file for the prototype:kvm_i386.h, in line with the existing kvm_ppc.h....
kvm: Rename kvm_irqchip_set_irq() to kvm_set_irq()
Rename the function kvm_irqchip_set_irq() to kvm_set_irq(),since it can be used for sending (asynchronous) interrupts whetherthere is a full irqchip model in the kernel or not. (We don'tinclude 'async' in the function name since asynchronous is the...
kvm: Decouple 'async interrupt delivery' from 'kernel irqchip'
On x86 userspace delivers interrupts to the kernel asynchronously(and therefore VCPU idle management is done in the kernel) if andonly if there is an in-kernel irqchip. On other architectures this...
kvm: Check if smp_cpus exceeds max cpus supported by kvm
Add a helper function for fetching max cpus supported by kvm.
Make QEMU exit with an error message if smp_cpus exceeds limitof VCPU count retrieved by invoking this helper function.
Signed-off-by: Dunrong Huang <riegamaths@gmail.com>...
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
virtio: move common irqfd handling out of virtio-pci
All transports can use the same event handler for the irqfd, though theexact mechanics of the assignment will be specific. Note that thereare three states: handled by the kernel, handled in userspace, disabled....
memory: pass EventNotifier, not eventfd
Under Win32, EventNotifiers will not have event_notifier_get_fd, so wecannot call it in common code such as hw/virtio-pci.c. Pass a pointer tothe notifier, and only retrieve the file descriptor in kvm-specific code....
s390: autodetect map private
By default qemu will use MAP_PRIVATE for guest pages. This will writeprotect pages and thus break on s390 systems that dont support this feature.Therefore qemu has a hack to always use MAP_SHARED for s390. But MAP_SHAREDhas other problems (no dirty pages tracking, a lot more swap overhead etc.)...
kvm: Don't abort on kvm_irqchip_add_msi_route()
Anyone using these functions has to be prepared that irqchipsupport may not be present. It shouldn't be up to the corecode to determine whether this is a fatal error. Currentlycode written as:
virq = kvm_irqchip_add_msi_route(...)...
kvm: add missing include files
These are included via monitor.h right now, add them explicitly.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
kvm: Fix build for non-CAP_IRQ_ROUTING targets
A type definition and a KVMState field initialization escaped therequired wrapping with KVM_CAP_IRQ_ROUTING. Also, we need to provide adummy kvm_irqchip_release_virq as virtio-pci references (but does notuse) it....
kvm: Introduce kvm_irqchip_add/remove_irqfd
Add services to associate an eventfd file descriptor as input with anIRQ line as output. Such a line can be an input pin of an in-kernelirqchip or a virtual line returned by kvm_irqchip_add_route.
kvm: Rename kvm_irqchip_add_route to kvm_irqchip_add_irq_route
We will add kvm_irqchip_add_msi_route, so let's make the differenceclearer.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Avi Kivity <avi@redhat.com>
kvm: Introduce kvm_irqchip_add_msi_route
Add a service that establishes a static route from a virtual IRQ line toan MSI message. Will be used for IRQFD and device assignment. As we willuse this service outside of CONFIG_KVM protected code, stub it properly....
kvm: Publicize kvm_irqchip_release_virq
This allows to drop routes created by kvm_irqchip_add_irq/msi_routeagain.
kvm: Make kvm_irqchip_commit_routes an internal service
Automatically commit route changes after kvm_add_routing_entry andkvm_irqchip_release_virq. There is no performance relevant use case forwhich collecting multiple route changes is beneficial. This makes...
kvm: Add support for direct MSI injections
If the kernel supports KVM_SIGNAL_MSI, we can avoid the route-basedMSI injection mechanism.
kvm: Enable in-kernel irqchip support by default
As MSI is now fully supported by KVM (/wrt available features inupstream), we can finally enable the in-kernel irqchip by default.
kvm: Refactor KVMState::max_gsi to gsi_count
Instead of the bitmap size, store the maximum of GSIs the kernelsupport. Move the GSI limit assertion to the API functionkvm_irqchip_add_route and make it stricter.
kvm: Introduce basic MSI support for in-kernel irqchips
This patch basically adds kvm_irqchip_send_msi, a service for sendingarbitrary MSI messages to KVM's in-kernel irqchip models.
As the original KVM API requires us to establish a static route from a...
kvm: Fix dirty tracking with large kernel page size
If the kernel page size is larger than TARGET_PAGE_SIZE, whichhappens for example on ppc64 with kernels compiled for 64K pages,the dirty tracking doesn't work.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>...
kvm: set gsi_bits and max_gsi correctly
The current kvm_init_irq_routing() doesn't set up the used_gsi_bitmapcorrectly, and as a consequence pins max_gsi to 32 when it reallyshould be 1024. I ran into this limitation while testing pcipassthrough, where I consistently got an -ENOSPC return from...
kvm: allow arbitrarily sized mmio ioeventfd
We use a 2 byte ioeventfd for virtio memory,add support for this.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Reviewed-by: Amos Kong <akong@redhat.com>Signed-off-by: Avi Kivity <avi@redhat.com>
kvm: Drop unused kvm_pit_in_kernel
This is now implied by kvm_irqchip_in_kernel.
kvm: Comparison with ioctl number macros needs to be unsigned
In kvm-all.c we store an ioctl cmd number in the irqchip_inject_ioctl fieldof KVMState, which has type 'int'. This seems to make sense since theioctl() man page says that the cmd parameter has type int....
Rename CPUState -> CPUArchState
Scripted conversion: for file in .[hc] hw/.[hc] hw/kvm/*.[hc] linux-user/*.[hc] linux-user/m68k/*.[hc] bsd-user/*.[hc] darwin-user/*.[hc] tcg/*/*.[hc] target-*/cpu.h; do sed -i "s/CPUState/CPUArchState/g" $file done...
Spelling fixes in comments (it's -> its)
Reviewed-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Stefan Weil <sw@weilnetz.de>...
kvm: fill in padding to help valgrind
valgrind warns about padding fields which are passedto vcpu ioctls uninitialized.This is not an error in practice because kvm ignored padding.Since the ioctls in question are off data path andthe cost is zero anyway, initialize padding to 0...
kvm: Add kvm_has_pit_state2 helper
To be used for in-kernel PIT emulation.
Merge remote-tracking branch 'qemu-kvm/memory/urgent' into staging
Merge remote-tracking branch 'qemu-kvm/memory/core' into staging
kvm: fix unaligned slots
kvm_set_phys_mem() may be passed sections that are not aligned to a pageboundary. The current code simply brute-forces the alignment which leadsto an inconsistency and an abort().
Fix by aligning the start and the end of the section correctly, discarding...
memory: allow MemoryListeners to observe a specific address space
Ignore any regions not belonging to a specified address space.
memory: support stateless memory listeners
Current memory listeners are incremental; that is, they are expected tomaintain their own state, and receive callbacks for changes to that state.
This patch adds support for stateless listeners; these work by receiving...
memory: switch memory listeners to a QTAILQ
This allows reverse iteration, which in turns allows consistent orderingamong multiple listeners:
l1->add l2->add l2->del l1->del
Signed-off-by: Avi Kivity <avi@redhat.com>Reviewed-by: Richard Henderson <rth@twiddle.net>
memory: move ioeventfd ops to MemoryListener
This way the accelerator (kvm) can handle them directly.
kvm: Set cpu_single_env only once
As we have thread-local cpu_single_env now and KVM uses exactly onethread per VCPU, we can drop the cpu_single_env updates from the loopand initialize this variable only once during setup.
kvm: Implement kvm_irqchip_in_kernel like kvm_enabled
To both avoid that kvm_irqchip_in_kernel always has to be paired withkvm_enabled and that the former ends up in a function call, implement itlike the latter. This means keeping the state in a global variable and...
KVM: Fix compilation on non-x86
Commit 84b058d broke compilation for KVM on non-x86 targets, whichdon't have KVM_CAP_IRQ_ROUTING defined.
Fix by not using the unavailable constant when it's not around.
Signed-off-by: Alexander Graf <agraf@suse.de>
memory: change dirty setting APIs to take a size
Instead of each target knowing or guessing the guest page size,just pass the desired size of dirtied memory area.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Fix dirty logging with 32-bit qemu & 64-bit guests
The kvm_get_dirty_pages_log_range() function uses two addressvariables to step through the monitored memory region to update thedirty log. However, these variables have type unsigned long, whichcan overflow if running a 64-bit guest with a 32-bit qemu binary....
kvm: Introduce core services for in-kernel irqchip support
Add the basic infrastructure to active in-kernel irqchip support, injectinterrupts into these models, and maintain IRQ routes.
Routing is optional and depends on the host arch supportingKVM_CAP_IRQ_ROUTING. When it's not available on x86, we looe the HPET as...
kvm: x86: Establish IRQ0 override control
KVM is forced to disable the IRQ0 override when we run with in-kernelirqchip but without IRQ routing support of the kernel. Set the fwcfgvalue correspondingly. This aligns us with qemu-kvm.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
kvm: flush the dirty log when unregistering a slot
Otherwise, the dirty log information is lost in the kernel forever.
Fixes opensuse-12.1 boot screen, which changes the vga windows rapidly.
kvm: avoid cpu_get_physical_page_desc()
This reaches into the innards of the memory core, which are beingchanged. Switch to a memory API version.
kvm: switch kvm slots to use host virtual address instead of ram_addr_t
This simplifies a later switch to the memory API in slot management.
kvm: convert to MemoryListener API
Drop the use of cpu_register_phys_memory_client() in favour of the newMemoryListener API. The new API simplifies the caller, since there is noneed to deal with splitting and merging slots; however this is not exploited...
kvm: Print something before calling abort() if KVM_RUN fails
It's a little unfriendly to call abort() without printing any sort oferror message. So turn the DPRINTK into an fprintf(stderr, ...).
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>...
kvm_init didn't set return value after create vm failed
And kvm_ioctl(s, KVM_CREATE_VM, 0)'s return value can be < -1,so change the check of vmfd at label 'err'.
Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
kvm: avoid reentring kvm_flush_coalesced_mmio_buffer()
mmio callbacks invoked by kvm_flush_coalesced_mmio_buffer() maythemselves indirectly call kvm_flush_coalesced_mmio_buffer().Prevent reentering the function by checking a flag that indicateswe're processing coalesced mmio requests....
RunState: Rename enum values as generated by the QAPI
Next commit will convert the query-status command to use theRunState type as generated by the QAPI.
In order to "transparently" replace the current enum by the QAPIone, we have to make some changes to some enum values....
Replace the VMSTOP macros with a proper state type
Today, when notifying a VM state change with vm_state_notify(),we pass a VMSTOP macro as the 'reason' argument. This is not idealbecause the VMSTOP macros tell why qemu stopped and not exactlywhat the current VM state is....
main: force enabling of I/O thread
Enabling the I/O thread by default seems like an important part of declaring1.0. Besides allowing true SMP support with KVM, the I/O thread means that theTCG VCPU doesn't have to multiplex itself with the I/O dispatch routines which...
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
kvm: Drop obsolete KVM_IOEVENTFD #ifdefs
kvm: Drop KVM_CAP build dependencies
No longer needed with accompanied kernel headers. We are only left withbuild dependencies that are controlled by kvm arch headers.
CC: Alexander Graf <agraf@suse.de>Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
kvm: Drop useless zero-initializations
Backing KVMState is alreay zero-initialized.