History | View | Annotate | Download (72.1 kB)
memory: add return value to address_space_rw/read/write
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
memory: propagate errors on I/O dispatch
exec: just use io_mem_read/io_mem_write for 8-byte I/O accesses
The memory API is able to split it in two 4-byte accesses.
memory: correctly handle endian-swapped 64-bit accesses
memory: add address_space_access_valid
The old-style IOMMU lets you check whether an access is valid in agiven DMAContext. There is no equivalent for AddressSpace in thememory API, implement it with a lookup of the dispatch tree.
Reviewed-by: Richard Henderson <rth@twiddle.net>...
exec: implement .valid.accepts for subpages
exec: introduce memory_access_size
This will be used by address_space_access_valid too.
exec: introduce memory_access_is_direct
After the previous patches, this is a common test for all read/writefunctions.
exec: expect mr->ops to be initialized for ROM
There is no need to use the special phys_section_rom section.
memory: move unassigned_mem_ops to memory.c
reservation_ops is already doing the same thing.
memory: add address_space_translate
Using phys_page_find to translate an AddressSpace to a MemoryRegionSectionis unwieldy. It requires to pass the page index rather than the address,and later memory_region_section_addr has to be called. Replacememory_region_section_addr with a function that does all of it: call...
memory: dispatch unassigned accesses based on .valid.accepts
This provides the basics for detecting accesses to unassigned memoryas soon as they happen, and also for a simple implementation ofaddress_space_access_valid.
exec: do not use error_mem_read
We will soon reach this case when doing (unaligned) accesses thatspan partly past the end of memory. We do not want to crash inthat case.
unassigned_mem_ops and rom_mem_ops are now the same.
exec: make io_mem_unassigned private
There is no reason to avoid a recompile before accessing unassignedmemory. In the end it will be treated as MMIO anyway.
exec: drop useless #if
This code is only compiled for softmmu targets.
exec: eliminate io_mem_ram
It is never used, the IOTLB always goes through io_mem_notdirty.
In fact in softmmu_template.h, if it were, QEMU would crash justbelow the tests, as soon as io_mem_read/write dispatches toerror_mem_read/write.
memory: clean up phys_page_find
Remove the goto.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
memory: limit sections in the radix tree to the actual address space size
The radix tree is statically sized to fit TARGET_PHYS_ADDR_SPACE_BITS.If a larger memory region is registered, it will overflow.
Fix by limiting any section in the radix tree to the supported size....
memory: assert that PhysPageEntry's ptr does not overflow
While sized to 15 bits in PhysPageEntry, the ptr field is ORed into theiotlb entries together with a page-aligned pointer. The ptr field mustnot overflow into this page-aligned value, assert that it is smaller than...
exec: eliminate stq_phys_notdirty
It is not used anywhere.
exec: eliminate qemu_put_ram_ptr
exec: remove obsolete comment
See how we call memory_region_section_addr two lines below toconvert a physical address to a base address in the region.
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>...
osdep: introduce qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memory
We switched from qemu_memalign to mmap() but then we don't modifyqemu_vfree() to do a munmap() over free(). Which we cannot dobecause qemu_vfree() frees memory allocated by qemu_{mem,block}align....
cpu: Add qemu_for_each_cpu()
Wrapper to avoid open-coded loops and to make CPUState iterationindependent of CPUArchState.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Igor Mammedov <imammedo@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
hw: move headers to include/
Many of these should be cleaned up with proper qdev-/QOM-ification.Right now there are many catch-all headers in include/hw/ARCH dependingon cpu.h, and this makes it necessary to compile these files per-target.However, fixing this does not belong in these patches....
exec: assert that RAMBlock size is non-zero
find_ram_offset() does not handle size=0 gracefully. It hands out thesame RAMBlock offset multiple times, leading to obscure failures lateron.
Add an assert to warn early if something is incorrectly allocating a...
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
exec: make -mem-path filenames deterministic
Adds ramblocks' names to their backing files when using -mem-path. Easesintrospection and debugging.
Signed-off-by: Peter Feiner <peter@gridcentric.ca>Message-id: 1362423265-15855-1-git-send-email-peter@gridcentric.ca...
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>
exec: Pass CPUState to cpu_reset_interrupt()
Move it to qom/cpu.c to avoid build failures depending on include orderof cpu-qom.h and exec/cpu-all.h.
Change opaques of various ..._irq_handler() functions to theappropriate CPU type to facilitate using cpu_reset_interrupt()....
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: Register VMStateDescription through CPUState
In comparison to DeviceClass::vmsd, CPU VMState is split in two,"cpu_common" and "cpu", and uses cpu_index as instance_id instead of -1.Therefore add a CPU-specific CPUClass::vmsd field.
Unlike the legacy CPUArchState registration, rather register CPUState....
cpu: Fix qemu_get_cpu() to return NULL if CPU not found
Commit 55e5c2850 breaks CPU not found return value, and returnsCPU corresponding to the last non NULL env.Fix it by returning CPU only if env is not NULL, otherwise CPU isnot found and function should return NULL....
Handle CPU interrupts by inline checking of a flag
Fix some of the nasty TCG race conditions and crashes by implementingcpu_exit() as setting a flag which is checked at the start of each TB.This avoids crashes if a thread or signal handler calls cpu_exit()...
cpu: Move exit_request field to CPUState
Since it was located before breakpoints field, it needs to be reset.
cputlb: Pass CPUState to cpu_unlink_tb()
CPUArchState is no longer needed.
Replace non-portable asprintf by g_strdup_printf
g_strdup_printf already handles OOM errors, so some error handling inQEMU code can be removed.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
exec: Return CPUState from qemu_get_cpu()
Move the declaration to qemu/cpu.h and add documentation.The implementation still depends on CPUArchState for CPU iteration.
cpu: Move numa_node field to CPUState
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()....
stubs: fully replace qemu-tool.c and qemu-user.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Revert "virtio-pci: replace byte swap hack"
This reverts commit 9807caccd605d09a72495637959568d690e10175.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
virtio-pci: replace byte swap hack
Remove byte swaps by declaring the config spaceas native endian.
exec: change RAM list to a TAILQ
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
exec: sort the memory from biggest to smallest
add a version number to ram_list
This will be used to detect if last_block might have become invalidacross different calls to ram_save_live.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Umesh Deshpande <udeshpan@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>...
protect the ramlist with a separate mutex
Add the new mutex that protects shared state between ram_save_liveand the iothread. If the iothread mutex has to be taken togetherwith the ramlist mutex, the iothread shall always be outside.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
exec: change ramlist from MRU order to a 1-item cache
Most of the time, only 2 items will be active (from/to for a string operation,or code/data). But TCG guests likely won't have gigabytes of memory, sothis actually goes down to 1 item.
softmmu: move include files to include/sysemu/
misc: move include files to include/qemu/
exec: move include files to include/exec/
janitor: do not rely on indirect inclusions of or from qemu-char.h
Various header files rely on qemu-char.h including qemu-config.h ormain-loop.h, but they really do not need qemu-char.h at all (particularlyinteresting is the case of the block layer!). Clean this up, and also...
exec: move TB handling to translate-all.c
exec: extract TB watchpoint check
Will be moved by the next patch.
exec: fix coding style
Fix coding style in areas to be moved by later patches.
exec: Advise huge pages for the TCG code gen buffer
After allocating 32MB or more contiguous memory, huge pageswould seem to be ideal.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
dma: Define dma_context_memory and use in sysbus-ohci
Define a new global dma_context_memory which is a DMAContext correspondingto the global address_space_memory AddressSpace. This can be used bysysbus peripherals like sysbus-ohci which need to do DMA....
Merge branch 'trivial-patches' of git://github.com/stefanha/qemu
tcg: Add extended GETPC mechanism for MMU helpers with ldst optimization
Add GETPC_EXT which is used by MMU helpers to selectively calculate the codeaddress of accessing guest memory when called from a qemu_ld/st optimized codeor a C function. Currently, it supports only i386 and x86-64 hosts....
exec: make some functions static
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
cpu: Move thread_id to CPUState
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,...
Call MADV_HUGEPAGE for guest RAM allocations
This makes it possible for QEMU to use transparent huge pages (THP)when transparent_hugepage/enabled=madvise. Otherwise THP is onlyused when it's enabled system wide.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>...
Merge remote-tracking branch 'quintela/migration-next-20121017' into staging
Merge remote-tracking branch 'qemu-kvm/memory/dma' into staging
memory: per-AddressSpace dispatch
Currently we use a global radix tree to dispatch memory access. This onlyworks with a single address space; to support multiple address spaces wemake the radix tree a member of AddressSpace (via an intermediate structure...
memory: add address_space_destroy()
Since address spaces can be created dynamically by device hotplug, theycan also be destroyed dynamically.
Signed-off-by: Avi Kivity <avi@redhat.com>
memory: move address_space_memory and address_space_io out of memory core
With this change, memory.c no longer knows anything about special addressspaces, so it is prepared for AddressSpace based DMA.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Avi Kivity <avi@redhat.com>
memory: move tcg flush into a tcg memory listener
We plan to make the core listener listen to all address spaces; thiswill cause many more flushes than necessary. Prepare for that bymoving the flush into a tcg-specific listener.
Later we can avoid registering the listener if tcg is disabled....
memory: use AddressSpace for MemoryListener filtering
Using the AddressSpace type reduces confusion, as you can't accidentallysupply the MemoryRegion you're interested in.
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...
exec: Split up and tidy code_gen_buffer
It now consists of:
A macro definition of MAX_CODE_GEN_BUFFER_SIZE with host-specific values,
A function size_code_gen_buffer that applies most of the reasoning forchoosing a buffer size,
Three variations of a function alloc_code_gen_buffer that contain all...
exec: Don't make DEFAULT_CODE_GEN_BUFFER_SIZE too large
For ARM we cap the buffer size to 16MB. Do not allocate 32MB in that case.
exec: Do not use absolute address hints for code_gen_buffer with -fpie
The hard-coded addresses inside alloc_code_gen_buffer only make senseif we're building an executable that will actually run at the addresswe've put into the linker scripts.
When we're building with -fpie, the executable will run at some...
exec: Allocate code_gen_prologue from code_gen_buffer
We had a hack for arm and sparc, allocating code_gen_prologue to aspecial section. Which, honestly does no good under certain cases.We've already got limits on code_gen_buffer_size to ensure that all...
exec: Make MIN_CODE_GEN_BUFFER_SIZE private to exec.c
It is used nowhere else, and the corresponding MAX_CODE_GEN_BUFFER_SIZEalso lives there.
ram: Export last_ram_offset()
Is the only way of knowing the RAM size.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
memory: drop no-op MemoryListener callbacks
Removes quite a bit of useless code.
memory: rename 'exec-obsolete.h'
exec-obsolete.h used to hold pre-memory-API functions that were used fromdevice code prior to the transition to the memory API. Now that thetransition is complete, the name no longer describes the file. Thefunctions still need to be merged better into the memory core, but there's...
cpu_dump_state: move DUMP_FPU and DUMP_CCOP flags from x86-only to generic
Move the DUMP_FPU and DUMP_CCOP flags for cpu_dump_state() from beingx86-specific flags to being generic ones. This allows us to drop someTARGET_I386 ifdefs in various places, and means that we can (potentially)...
exec, memory: Call to xen_modified_memory.
This patch add some calls to xen_modified_memory to notify Xen about dirtybitsduring migration.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>Reviewed-by: Avi Kivity <avi@redhat.com>
exec: Introduce helper to set dirty flags.
This new helper/hook is used in the next patch to add an extra call in a singleplace.
tcg-sparc: Don't MAP_FIXED on top of the program
The address we pick in sparc64.ld is also 0x60000000, so doing a fixed mapon top of that is guaranteed to blow up. Choosing 0x40000000 is exactlyright for the max of code_gen_buffer_size set below.
No need to ever use MAP_FIXED. While getting our desired address helps...
tcg-sparc: Assume v9 cpu always, i.e. force v8plus in 32-bit mode.
Current code doesn't actually work in 32-bit mode at all. Sinceno one really noticed, drop the complication of v7 and v8 cpus.Eliminate the --sparc_cpu configure option and standardize macro...
cpu_physical_memory_write_rom() needs to do TB invalidates
cpu_physical_memory_write_rom(), despite the name, can also be used towrite images into RAM - and will often be used that way if the machineuses load_image_targphys() into RAM addresses.
However, cpu_physical_memory_write_rom(), unlike cpu_physical_memory_rw()...
add -machine mem-merge=on|off option
It allows to disable memory merge support (KSM on Linux), which isenabled by default otherwise.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
memory: add -machine dump-guest-core=on|off
Add a new '[,dump-guest-core=on|off]' option to the '-machine' option. When'dump-guest-core=off' is specified, guest memory is omitted from the core dump.The default behavior continues to be to include guest memory when a core dump is...
exec.c: fix dirty bitmap reallocation
For each newly created RAM block, dirty bitmap is reallocated with g_realloc, which doesn'tmake any promises on initial content of new extra data in returned buffer. In theory,we initialize this new data with cpu_physical_memory_set_dirty_range() call. The...
exec.c: Fix off-by-one error in register_subpage
subpage_register() expects "end" to be the last byte in the mapping.Registering a non-page-aligned memory region that extends up to orbeyond a page boundary causes subpage_register() to silently failthrough the (end >= PAGE_SIZE) check....
exec.c: Use subpages for large unaligned mappings
Registering a multi-page memory region that is non-page-aligned resultsin a subpage from the start to the page boundary, some number of fullpages, and possibly another subpage from the last page boundary to the...
exec.c: Remove out of date comment
Remove an out of date comment: this comment used to be attached tocpu_register_physical_memory_log(), before commit 0f0cb164 accidentallyinserted a couple of other functions between the comment and its function.It is in any case obsolete since (a) the function arguments it refers...
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
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.)...
dirty bitmap: abstract its use
Always use accessors to read/set the dirty bitmap.
Only TCG needs TLB handling
Refactor the code that is only needed for tcg to an static function.Call that only when tcg is enabled. We can't refactor to a dummyfunction in the kvm case, as qemu can be compiled at the same timewith tcg and kvm.
qemu-log: move logging to qemu-log.c
Move logging functions from exec.c to qemu-log.c,compile it only once.