History | View | Annotate | Download (122 kB)
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
Signed-off-by: Andreas Färber <afaerber@suse.de>
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.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
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.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
qdev: Use wrapper for qdev_get_path
This makes it easier to remove it from BusInfo.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>[AF: Drop now unnecessary NULL initialization in scsibus_get_dev_path()]...
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
exec: fix TB invalidation after breakpoint insertion/deletion
tb_invalidate_phys_addr has to be called with the exact physical address ofthe breakpoint we add/remove, not just the page's base address.Otherwise we easily fail to flush the right TB.
This breakage was introduced by the commit f3705d5329 "memory: make...
Clarify comments of tb_invalidate_phys_[page_]range
They could suggest that all TBs of the page containing the range wouldbe invalidated.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Add API to check whether a physical address is I/O address
This API will be used in the following patch.
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
linux-user: Fix stale tbs after mmap
If we execute linux-user code that does the following:
we end up executing a stale cached tb that contains translated code...
memory: move functions is_romd and section_addr to memory API
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
cputlb: prepare private memory API for public consumption
Fold is_ram_rom and is_ram_rom_romd() into callers.
Change is_romd() and section_addr() to take MemoryRegioninstead of MemoryRegionSection for consistency anduse memory_region_ prefix.
Reviewed-by: Richard Henderson <rth@twiddle.net>...
cputlb: move TLB handling to a separate file
Move TLB handling and softmmu code load helpers to cputlb.c,compile only for softmmu targets.
exec: prepare for splitting
Make s_cputlb_empty_entry 'const'.
Rename tlb_flush_jmp_cache() to tb_flush_jmp_cache().
Refactor code to add cpu_tlb_reset_dirty_all(),memory_region_section_get_iotlb() andmemory_region_is_unassigned().
Remove unused cpu_tlb_update_dirty()....
w64: Use uintptr_t in exec.c
Replace all type casts to 'long' or 'unsigned long' by 'intptr_t' or 'uintptr_t'.
For type casts which are only used to extract the lower bits of an addressor to modify those bits, signedness does not matter. There I always use 'uintptr_t'....
w64: Fix data types in cpu-all.h, exec.c
w64 needs uintptr_t instead of unsigned long.For other hosts, nothing changes.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
w64: Use larger alignment for section with generated code
The MinGW-w64 compiler allows attribute((aligned (32)).
exec: provide tb_invalidate_phys_addr function
Allow TB invalidation by its physical address, extract implementationfrom the breakpoint_invalidate function.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Use uintptr_t for various op related functions
Use uintptr_t instead of void * or unsigned long inseveral op related functions, env->mem_io_pc andGETPC macro.
Reviewed-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
w64: Fix data type of tb_next and other variables used for host addresses
QEMU host addresses must use uintptr_t to be portable for hosts withan unusual size of long (w64).
tb_jmp_offset is an uint16_t value, therefore the local variable offsetin function tb_set_jmp_target was changed from unsigned long to uint16_t....
tcg: Use the GDB JIT debugging interface.
This allows us to generate unwind info for the dynamicly generatedcode in the code_gen_buffer. Only i386 is converted at this point.
exec: fix guest memory access for Xen
In cpu_physical_memory_rw, a change has been introduced and qemu_get_ram_ptr isno longuer called with the ram addr we want to access, but only with thesection address. This patch fixes this. (All other call to qemu_get_ram_ptr are...
memory: check for watchpoints when getting code ram_addr
The code to get the ram_addr from a (tlb entry, vaddr) pairchecks that the resulting memory is not MMIO, but neglects tocheck whether the region is hidden by a watchpoint page.
Add the missing check....
exec: fix write tlb entry misused as iotlb
A couple of code paths check the lower bits of CPUTLBEntry::addr_writeagainst io_mem_ram as a way of looking for a dirty RAM page. This worksby accident since the value is zero, which matches all clear bits for...
softmmu templates: optionally pass CPUState to memory access functions
Optionally, make memory access helpers take a parameter for CPUStateinstead of relying on global env.
On most targets, perform simple moves to reorder registers. On i386,switch from regparm(3) calling convention to standard stack-based...
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...
memory: get rid of cpu_register_io_memory()
The return value of cpu_register_io_memory() is no longer used anywhere, sowe can remove it and all associated data and code.
memory: dispatch directly via MemoryRegion
Instead of indirecting via io_mem_region, dispatch directlythrough the MemoryRegion obtained from the iotlb or phys_page_find().
exec: fix code tlb entry misused as iotlb in get_page_addr_code()
get_page_addr_code() reads a code tlb entry, but interprets it as aniotlb entry. This works by accident since the low bits of a RAM codetlb entry are clear, and match a RAM iotlb entry. This accident is...
memory: store section indices in iotlb instead of io indices
A step towards eliminating io indices.
memory: make phys_page_find() return an unadjusted section
We'd like to store the section index in the iotlb, so we can'tadjust it before returning. Return an unadjusted section andinstead introduce section_addr(), which does the adjustment later.
memory: fix I/O port aliases
Commit e58ac72b6a0 ("ioport: change portio_list not to usememory_region_set_offset()") started using aliases of I/O memoryregions. Since the IORange used for the I/O was contained in thetarget region, the alias information (specifically, the offset...
Merge branch 'xtensa' of git://jcmvbkbc.spb.ru/dumb/qemu-xtensa
memory: replace phys_page_find_alloc() with phys_page_set()
By giving the function the value we want to set, we make itmore flexible for the next patch.
memory: switch phys_page_set() to a recursive implementation
Setting multiple pages at once requires backtracking to previousnodes; easiest to achieve via recursion.
memory: change phys_page_set() to set multiple pages
memory: unify PhysPageEntry::node and ::leaf
They have the same type, unify them.
memory: allow phys_map tree paths to terminate early
When storing large contiguous ranges in phys_map, all values tend tobe the same pointers to a single MemoryRegionSection. Collapse themby marking nodes with level > 0 as leaves. This reduces tree memory...
memory: unify the two branches of cpu_register_physical_memory_log()
Identical except that the second branch knows its not modifying an existingsubpage.
memory: move tlb flush to MemoryListener commit callback
This way, if we have several changes in a single transaction, we flush justonce.
memory: make phys_page_find() return a MemoryRegionSection
We no longer describe memory in terms of individual pages; use sectionsthroughout instead.
PhysPageDesc no longer used - remove.
memory: give phys_page_find() its own tree search loop
We'll change phys_page_find_alloc() soon, but phys_page_find()doesn't need to bear the consequences.
memory: simplify multipage/subpage registration
Instead of considering subpage on a per-page basis, split each sectioninto a subpage head, multipage body, and subpage tail, and registereach separately. This simplifies the registration functions.
memory: change memory registration to rebuild the memory map on each change
Instead of incrementally building the memory map, rebuild it every time.This allows later simplification, since the code need not consider overlayinga previous mapping. It is also RCU friendly....
memory: remove first level of l1_phys_map
L1 and the lower levels in l1_phys_map are equivalent, except that L1 hasa different size, and is always allocated. Simplify the code by removingL1. This leaves us with a tree composed solely of L2 tables, but that...
memory: unify phys_map last level with intermediate levels
This lays the groundwork for storing leaf data in intermediate levels,saving space.
memory: store MemoryRegionSection pointers in phys_map
Instead of storing PhysPageDesc, store pointers to MemoryRegionSections.The various offsets (phys_offset & ~TARGET_PAGE_MASK,PHYS_OFFSET & TARGET_PAGE_MASK, region_offset) can all be synthesizedfrom the information in a MemoryRegionSection. Adjust phys_page_find()...
memory: compress phys_map node pointers to 16 bits
Use an expanding vector to store nodes. Allocation is baroque to g_renew()potentially invalidating pointers; this will be addressed later.
memory: fix RAM subpages in newly initialized pages
If the first subpage installed in a page is RAM, then we install it asa full page, instead of a subpage. Fix by not special casing RAM.
The issue dates to commit db7b5426a4b4242, which introduced subpages....
memory: don't pass ->readable attribute to cpu_register_physical_memory_log
It can be derived from the MemoryRegion itself (which is why it is notused there).
Signed-off-by: Avi Kivity <avi@redhat.com>Reviewed-by: Richard Henderson <rth@twiddle.net>
memory: use a MemoryListener for core memory map updates too
This transforms memory.c into a library which can then be unit testedeasily, by feeding it inputs and listening to its outputs.
memory: allow MemoryListeners to observe a specific address space
Ignore any regions not belonging to a specified address space.
memory: split memory listener for the two address spaces
The memory and I/O address spaces do different things, so split them intotwo memory listeners.
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...
exec: fix check_watchpoint exiting cpu_loop
In case of BP_STOP_BEFORE_ACCESS watchpoint check_watchpoint intends tosignal EXCP_DEBUG exception on exit from cpu loop, but later overwritesexception code by the cpu_resume_from_signal call.
Use cpu_loop_exit with BP_STOP_BEFORE_ACCESS watchpoints....
exec: let cpu_watchpoint_insert accept larger watchpoints
Make cpu_watchpoint_insert accept watchpoints of any power-of-two sizeup to the target page size.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
exec: add missing breaks to the watch_mem_write
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>Reviewed-by: Andreas Färber <afaerber@suse.de>Reviewed-by: Meador Inge <meadori@codesourcery.com>
exec.c: Clarify comment about tlb_flush() flush_global parameter
Clarify the comment about tlb_flush()'s flush_global parameter,so it is clearer what it does and why it is OK that the implementationcurrently ignores it.
Reviewed-by: Andreas F=C3=A4rber <afaerber@suse.de>...
virtio-pci: Fix endianness of virtio config
The virtio config area in PIO space is a bit special. The initialheader is little endian but the rest (device specific) is guestnative endian.
The PIO accessors for PCI on machines that don't have native IO ports...
tcg-arm: fix a typo in comments
ARM still doesn't support 16GB buffers in 32-bit modes, replace the16GB by 16MB in the comment.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Remove IO_MEM_SHIFT
We no longer use any of the lower bits of a ram_addr, so we might as welluse them for the io table index. This increases the number of potentialI/O handlers by a factor of 8.