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...
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...
exec: Exclude non portable function for MinGW
cpu_physical_memory_set_dirty_lebitmap calls getpageaddr and ffsl which areunavailable for MinGW. As the function is unused for MinGW, it can simplybe excluded from compilation.
Signed-off-by: Stefan Weil <sw@weilnetz.de>...
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.
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>
memory: syncronize kvm bitmap using bitmaps operations
If bitmaps are aligned properly, use bitmap operations. If they arenot, just use old bit at a time code.
memory: cpu_physical_memory_mask_dirty_range() always clears a single flag
Document it
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>
memory: use bit 2 for migration
For historical reasons it was bit 3. Once there, create a constant toknow the number of clients.
memory: make sure that client is always inside range
memory: cpu_physical_memory_clear_dirty_flag() result is never used
memory: split dirty bitmap into three
After all the previous patches, spliting the bitmap gets direct.
Note: For some reason, I have to move DIRTY_MEMORY_* definitions tothe beginning of memory.h to make compilation work.
Signed-off-by: Juan Quintela <quintela@redhat.com>...
memory: unfold cpu_physical_memory_clear_dirty_flag() in its only user
memory: unfold cpu_physical_memory_set_dirty() in its only user
memory: unfold cpu_physical_memory_set_dirty_flag()
memory: make cpu_physical_memory_get_dirty() the main function
And make cpu_physical_memory_get_dirty_flag() to use it. It used tobe the other way around.
memory: cpu_physical_memory_get_dirty() is used as returning a bool
memory: s/mask/clear/ cpu_physical_memory_mask_dirty_range
Now all functions use the same wording that bitops/bitmap operations
memory: use find_next_bit() to find dirty bits
This operation is way faster than doing it bit by bit.
memory: cpu_physical_memory_set_dirty_range() now uses bitmap operations
We were setting a range of bits, so use bitmap_set().
Note: xen has always been wrong, and should have used start insteadof addr from the beginning.
memory: cpu_physical_memory_clear_dirty_range() now uses bitmap operations
We were clearing a range of bits, so use bitmap_clear().
memory: s/dirty/clean/ in cpu_physical_memory_is_dirty()
All uses except one really want the other meaning.
memory: make cpu_physical_memory_reset_dirty() take a length parameter
We have an end parameter in all the callers, and this make it coherentwith the rest of cpu_physical_memory_* functions, that also take alength parameter.
Once here, move the start/end calculation to...
memory: split cpu_physical_memory_* functions to its own include
All the functions that use ram_addr_t should be here.
memory: cpu_physical_memory_set_dirty_flags() result is never used
So return void.
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
memory: create function to set a single dirty bit
exec: create function to get a single dirty bit
memory: make cpu_physical_memory_is_dirty return bool
memory: all users of cpu_physical_memory_get_dirty used only one flag
So cpu_physical_memory_get_dirty_flags is not needed anymore
memory: set single dirty flags when possible
memory: cpu_physical_memory_set_dirty_range() always dirty all flags
So remove the flag argument and do it directly. After this change,there is nothing else using cpu_physical_memory_set_dirty_flags() soremove it.
roms: Flush icache when writing roms to guest memory
We use the rom infrastructure to write firmware and/or initial kernelblobs into guest address space. So we're basically emulating the cacheoff phase on very early system bootup.
That phase is usually responsible for clearing the instruction cache for...
Merge remote-tracking branch 'mst/tags/for_anthony' into staging
pci, pc, acpi fixes, enhancements
This includes some pretty big changes:- pci master abort support by Marcel- pci IRQ API rework by Marcel- acpi generation support by myself
Everything has gone through several revisions, latest versions have been on...
portio: Allow to mark portio lists as coalesced MMIO flushing
This will enable us to remove all remaining explicit calls ofqemu_flush_coalesced_mmio_buffer in IO handlers.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec: Fix prototype of phys_mem_set_alloc and related functions
phys_mem_alloc and its assigned values qemu_anon_ram_alloc andlegacy_s390_alloc must have identical argument lists.
legacy_s390_alloc uses the size parameter to call mmap, so size_t isgood enough for all of them....
memory: Change MemoryRegion priorities from unsigned to signed
When memory regions overlap, priority can be used to specifywhich of them takes priority. By making the priority values signedrather than unsigned, we make it more convenient to implementa situation where one "background" region should appear only...
Merge remote-tracking branch 'rth/tcg-pull' into staging
exec: Add both big- and little-endian memory helpers
Step three in the transition: helpers not tied to the target"default" endianness. To be used when the guest uses a memoryoperation with non-default endianness.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging
QOM CPUState refactorings / X86CPU
tcg: Put target helper data into an array.
One call inside of a loop to tcg_register_helper instead of hundredsof sequential calls.
Presumably more icache and branch prediction friendly; resulting binarysize mostly unchanged on x86_64, as we're trading 32-bit rip-relative...
tcg-aarch64: Update to helper_ret_*_mmu routines
A minimal update to use the new helpers with the return address argument.
Tested-by: Claudio Fontana <claudio.fontana@linaro.org>Reviewed-by: Claudio Fontana <claudio.fontana@linaro.org>Signed-off-by: Richard Henderson <rth@twiddle.net>
exec: Delete is_tcg_gen_code and GETRA_EXT
All implementations now boil down to GETRA.
cpu: Drop cpu_model_str from CPU_COMMON
Since this is only read in cpu_copy() and linux-user has a globalcpu_model, drop the field from generic code.
Signed-off-by: Andreas Färber <afaerber@suse.de>
tcg-arm: Rearrange slow-path qemu_ld/st
Use the new helper_ret_*_mmu routines. Use a conditional callto arrange for a tail-call from the store path, and to load thereturn address for the helper for the load path.
tcg-ppc: use new return-argument ld/st helpers
These use a 32-bit load-of-immediate to save a mflr+addi+mtlr sequence.Tested with a Windows 98 guest (pretty much the most recent thing Icould run on my PPC machine) and kvm-unit-tests's sieve.flat. Thespeed up for sieve.flat is as high as 10% for qemu-system-i386, 25%...
exec: Reduce ifdeffery around -mem-path
Instead of spreading its ifdeffery everywhere, confine it toqemu_ram_alloc_from_ptr(). Everywhere else, simply test block->fd,which is non-negative exactly when block uses -mem-path.
Signed-off-by: Markus Armbruster <armbru@redhat.com>...
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>...
abitypes.h: Remove incorrect ARM ABI_LLONG_ALIGNMENT
The ARM EABI specifies that 64 bit integers should be8 aligned; remove our incorrect setting of 4 alignment.This has no actual effect since it only set the alignmentfor the 'abi_ullong' and 'abi_llong' types, which are used...
memory: Provide separate handling of unassigned io ports accesses
Accesses to unassigned io ports shall return -1 on read and be ignoredon write. Ensure these properties via dedicated ops, decoupling us fromthe memory core's handling of unassigned accesses....
tcg: Introduce zero and sign-extended versions of load helpers
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>Signed-off-by: Richard Henderson <rth@twiddle.net>
tcg: Change tcg_gen_exit_tb argument to uintptr_t
And update all users.
exec: Reorganize the GETRA/GETPC macros
Always define GETRA; use __builtin_extract_return_addr, rather thanhaving a special case for s390. Split GETPC_ADJ out of GETPC; use 2universally, rather than having a special case for arm.
Rename GETPC_LDST to GETRA_LDST to indicate that it does not...
exec: Rename USUFFIX to LSUFFIX
In a following patch, there will be confusion between multiple "unsigned" suffixes; rename this one so as to imply "load".
exec: Split softmmu_defs.h
The _cmmu helpers can be moved to exec-all.h. The helpers that areused from TCG will shortly need access to tcg_target_long so movetheir declarations into tcg.h.
This requires minor include adjustments to all TCG backends....
tcg-i386: Remove abort from GETPC_LDST
Indeed, remove it entirely and remove the is_tcg_gen_code checkfrom GETPC_EXT.
Fixes https://bugs.launchpad.net/qemu/+bug/1218098 wherein a callto a "normal" helper function performed a sequence of tail callsall the way into the memory helper functions, leading to a stack...
tcg: Tidy softmmu_template.h
Avoid a loop in the tlb_fill path; the fill will either succeed orgenerate an exception.
Inline the slow_ld/st function; it was a complete copy of the mainhelper except for the actual cross-page unaligned code, and thecompiler was inlining it anyway....
tcg-i386: Use new return-argument ld/st helpers
Discontinue the jump-around-jump-to-jump scheme, trading it for a singleimmediate move instruction. The two extra jumps always consume 7 bytes,whereas the immediate move is either 5 or 7 bytes depending on where the...
tcg: Add mmu helpers that take a return address argument
Allow the code that tcg generates to be less obtuse, passing inthe return address directly instead of computing it in the helper.
Maintain the old entrance point unchanged as an alternate entry point....
exec: Remove env from list of poisoned names
The global variable env was removed some time ago, so this name may beused without any restriction now.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
gdbstub: Replace GET_REG*() macros with gdb_get_reg*() functions
This avoids polluting the global namespace with a non-prefixed macro andmakes it obvious in the call sites that we return.
Semi-automatic conversion using, e.g., sed i 's/GET_REGL(/return gdb_get_regl(mem_buf, /g' target*/gdbstub.c...
cpu: Introduce CPUClass::gdb_{read,write}_register()
Completes migration of target-specific code to new target-*/gdbstub.c.
Acked-by: Michael Walle <michael@walle.cc> (for lm32)Acked-by: Max Filippov <jcmvbkbc@gmail.com> (for xtensa)Signed-off-by: Andreas Färber <afaerber@suse.de>
Merge remote-tracking branch 'rth/tcg-next' into staging
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging
linux-user: fix segmentation fault passing with h2g(x) != x
When forwarding a segmentation fault into the guest process, we were passingthe host's address directly into the guest process's signal descriptor.
That obviously confused the guest process, since it didn't know what to make...
gdbstub: Change gdb_handlesig() argument to CPUState
Prepares for changing GDBState::c_cpu to CPUState.
cpu: Turn cpu_get_phys_page_debug() into a CPUClass hook
Change breakpoint_invalidate() argument to CPUState alongside.
Since all targets now assign a softmmu-only field, we can drop helperscpu_class_set_{do_unassigned_access,vmsd}() and device_class_set_vmsd()....
exec: Change cpu_memory_rw_debug() argument to CPUState
Propagate X86CPU in kvmvapic for simplicity.
cpu: Move gdb_regs field from CPU_COMMON to CPUState
Prepares for changing gdb_register_coprocessor() argument to CPUState.
gdbstub: Change gdb_register_coprocessor() argument to CPUState
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>
cpu: Change cpu_single_step() argument to CPUState
Use CPUState::env_ptr for now.
Needed for GdbState::c_cpu.
gdbstub: Change syscall callback argument to CPUState
Callback implementations were specific to arm and m68k, so can easilycast to ARMCPU and M68kCPU respectively.
configure: Make NPTL non-optional
Now all linux-user targets support building with NPTL, we can make itmandatory. This is a good idea because: * NPTL is no longer new and experimental; it is completely standard * in practice, linux-user without NPTL is nearly useless for...
Merge git://github.com/hw-claudio/qemu-aarch64-queue into tcg-next
tcg: Remove temp_buf
All targets have been converted to allocating space for temporarieson the stack. No need to allocate space within the CPU_COMMON block.
tcg/aarch64: Implement tlb lookup fast path
Supports CONFIG_QEMU_LDST_OPTIMIZATION
Signed-off-by: Jani Kokkonen <jani.kokkonen@huawei.com>Reviewed-by: Richard Henderson <rth@twiddle.net>Reviewed-by: Claudio Fontana <claudio.fontana@huawei.com>
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>...
cpu: Replace cpu_single_env with CPUState current_cpu
Move it to qom/cpu.h.
exec: Remove unused global variable phys_ram_fd
It seems to be unused since several years (commitbe995c27640a82c7056b6f53d02ec823570114e5 in 2006).
Signed-off-by: Stefan Weil <sw@weilnetz.de>Reviewed-by: Andreas Färber <afaerber@suse.de>Message-id: 1373044036-14443-1-git-send-email-sw@weilnetz.de...
memory: move MemoryListener declaration earlier
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec: move listener from AddressSpaceDispatch to AddressSpace
This will help having two copies of AddressSpaceDispatch during therecreation of the radix tree (one being built, and one that is completeand will be protected by RCU). We do not want to have to unregister and...
exec: separate current radix tree from the one being built
This same treatment previously done to phys_node_map and phys_sectionsis now applied to the dispatch field of AddressSpace. Topology updatesuse as->next_dispatch while accesses use as->dispatch....
piolist: add owner argument to initialization functions and pass devices
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
memory: return MemoryRegion from qemu_ram_addr_from_host
It will be needed in the next patch.
memory: add getter for owner
Whenever memory regions are accessed outside the BQL, they need to bepreserved against hot-unplug. MemoryRegions actually do not have theirown reference count; they piggyback on a QOM object, their "owner".The owner is set at creation time, and there is a function to retrieve...
memory: add ref/unref
memory: introduce memory_region_present
This new API will avoid having too many memory_region_ref/unrefin paths that currently use memory_region_find.
exec: move qemu_ram_addr_from_host_nofail to cputlb.c
After the next patch it would not be used elsewhere anyway. Also,the _nofail and the standard versions of this function return differentthings, which is confusing. Removing the function from the public headers...
ioport: Switch dispatching to memory core layer
The current ioport dispatcher is a complex beast, mostly due to theneed to deal with old portio interface users. But we can overcome itwithout converting all portio users by embedding the required baseaddress of a MemoryRegionPortio access into that data structure. That...
ioport: Remove unused old dispatching services
Remove unused ioport_register and isa_unassign_ioport along witheverything that only those services used.
ioport: Move portio types to ioport.h
This decouples memory.h from ioport.h, concentrating all portio relatedtypes in a single header.
memory: add owner argument to initialization functions
Privatize register_ioport_read/write
No more users outside of ioport.c.
isa: implement isa_is_ioport_assigned via memory_region_find
Open-code isa_is_ioport_assigned via a memory region lookup. As all IOports are now directly or indirectly registered via the memory API, thisbecomes possible and will finally allow us to drop the ioport tables....
gdbstub: Set gdb_set_stop_cpu() argument to CPUState
Prepares for changing cpu_handle_guest_debug() argument to CPUState.
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Andreas Färber <afaerber@suse.de>
hwaddr: Make hwaddr type usable beyond softmmu
While not normally needed for *-user, it can safely be used there sincealways based on uint64_t, to avoid ifdeffery.
To avoid accidental uses, move the guards from exec/hwaddr.h to itsinclusion sites. No need for them in include/hw/....
cpu: Change cpu_exit() argument to CPUState
It no longer depends on CPUArchState, so move it to qom/cpu.c.
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.
rdma: introduce qemu_ram_foreach_block()
This is used during RDMA initialization in order totransmit a description of all the RAM blocks to thepeer for later dynamic chunk registration purposes.
Reviewed-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>...
memory: give name to every AddressSpace
The "info mtree" command in QEMU console prints only "memory" and "I/O" address spaces while there are actually a lot more other AddressSpacestructs created by PCI and VIO devices. Those devices do not normallyhave names and therefore not present in "info mtree" output....
memory: Add iommu map/unmap notifiers
This patch adds a NotifierList to MemoryRegions which represent IOMMUsallowing other parts of the code to register interest in mappings orunmappings from the IOMMU. All IOMMU implementations will need to callmemory_region_notify_iommu() to inform those waiting on the notifier list,...