summaryrefslogtreecommitdiffstats
path: root/exec.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | memory: store MemoryRegionSection pointers in phys_mapAvi Kivity2012-02-291-80/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 synthesized from the information in a MemoryRegionSection. Adjust phys_page_find() to synthesize a PhysPageDesc. The upshot is that phys_map now contains uniform values, so it's easier to generate and compress. The end result is somewhat clumsy but this will be improved as we we propagate MemoryRegionSections throughout the code instead of transforming them to PhysPageDesc. The MemoryRegionSection pointers are stored as uint16_t offsets in an array. This saves space (when we also compress node pointers) and is more cache friendly. Signed-off-by: Avi Kivity <avi@redhat.com>
* | memory: unify phys_map last level with intermediate levelsAvi Kivity2012-02-291-43/+35
| | | | | | | | | | | | | | This lays the groundwork for storing leaf data in intermediate levels, saving space. Signed-off-by: Avi Kivity <avi@redhat.com>
* | memory: remove first level of l1_phys_mapAvi Kivity2012-02-291-21/+8
| | | | | | | | | | | | | | | | | | L1 and the lower levels in l1_phys_map are equivalent, except that L1 has a different size, and is always allocated. Simplify the code by removing L1. This leaves us with a tree composed solely of L2 tables, but that problem can be renamed away later. Signed-off-by: Avi Kivity <avi@redhat.com>
* | memory: change memory registration to rebuild the memory map on each changeAvi Kivity2012-02-291-1/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of incrementally building the memory map, rebuild it every time. This allows later simplification, since the code need not consider overlaying a previous mapping. It is also RCU friendly. With large memory guests this can get expensive, since the operation is O(mem size), but this will be optimized later. As a side effect subpage and L2 leaks are fixed here. Signed-off-by: Avi Kivity <avi@redhat.com>
* | memory: support stateless memory listenersAvi Kivity2012-02-291-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | Current memory listeners are incremental; that is, they are expected to maintain their own state, and receive callbacks for changes to that state. This patch adds support for stateless listeners; these work by receiving a ->begin() callback (which tells them that new state is coming), a sequence of ->region_add() and ->region_nop() callbacks, and then a ->commit() callback which signifies the end of the new state. They should ignore ->region_del() callbacks. Signed-off-by: Avi Kivity <avi@redhat.com>
* | memory: split memory listener for the two address spacesAvi Kivity2012-02-291-14/+66
| | | | | | | | | | | | | | The memory and I/O address spaces do different things, so split them into two memory listeners. Signed-off-by: Avi Kivity <avi@redhat.com>
* | memory: allow MemoryListeners to observe a specific address spaceAvi Kivity2012-02-291-1/+1
| | | | | | | | | | | | Ignore any regions not belonging to a specified address space. Signed-off-by: Avi Kivity <avi@redhat.com>
* | memory: use a MemoryListener for core memory map updates tooAvi Kivity2012-02-291-0/+75
| | | | | | | | | | | | | | | | This transforms memory.c into a library which can then be unit tested easily, by feeding it inputs and listening to its outputs. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* | memory: don't pass ->readable attribute to cpu_register_physical_memory_logAvi Kivity2012-02-291-1/+1
|/ | | | | | | | It can be derived from the MemoryRegion itself (which is why it is not used there). Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* exec.c: Clarify comment about tlb_flush() flush_global parameterPeter Maydell2012-02-011-2/+12
| | | | | | | | | | Clarify the comment about tlb_flush()'s flush_global parameter, so it is clearer what it does and why it is OK that the implementation currently ignores it. Reviewed-by: Andreas F=C3=A4rber <afaerber@suse.de> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtio-pci: Fix endianness of virtio configBenjamin Herrenschmidt2012-01-211-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | The virtio config area in PIO space is a bit special. The initial header is little endian but the rest (device specific) is guest native endian. The PIO accessors for PCI on machines that don't have native IO ports assume that all PIO is little endian, which works fine for everything except the above. A complicated way to fix it would be to split the BAR into two memory regions with different endianess settings, but this isn't practical to do, besides, the PIO code doesn't honor region endianness anyway (I have a patch for that too but it isn't necessary at this stage). So I decided to go for the quick fix instead which consists of reverting the swap in virtio-pci in selected places, hoping that when we eventually do a "v2" of the virtio protocols, we sort that out once and for all using a fixed endian setting for everything. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Alexander Graf <agraf@suse.de> [agraf: keep virtio in libhw and determine endianness through a helper function in exec.c] Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
* tcg-arm: fix a typo in commentsAurelien Jarno2012-01-131-1/+1
| | | | | | | | | ARM still doesn't support 16GB buffers in 32-bit modes, replace the 16GB 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_SHIFTAvi Kivity2012-01-041-18/+14
| | | | | | | | | We no longer use any of the lower bits of a ram_addr, so we might as well use them for the io table index. This increases the number of potential I/O handlers by a factor of 8. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* Drop IO_MEM_ROMDAvi Kivity2012-01-041-8/+12
| | | | | | | | Unlike ->readonly, ->readable is not inherited from aliase, so we can simply query the memory region. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* Remove IO_MEM_SUBPAGEAvi Kivity2012-01-041-5/+5
| | | | | | | Replace with a MemoryRegion flag. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* Direct dispatch through MemoryRegionAvi Kivity2012-01-041-30/+10
| | | | | | | | | Now that all mmio goes through MemoryRegions, we can convert io_mem_opaque to be a MemoryRegion pointer, and remove the thunks that convert from old-style CPU{Read,Write}MemoryFunc to MemoryRegionOps. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* Convert io_mem_watch to be a MemoryRegionAvi Kivity2012-01-041-47/+26
| | | | | Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* Convert IO_MEM_SUBPAGE_RAM to be a MemoryRegionAvi Kivity2012-01-041-48/+24
| | | | | Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* Convert the subpage wrapper to be a MemoryRegionAvi Kivity2012-01-041-52/+18
| | | | | Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* Switch cpu_register_physical_memory_log() to use MemoryRegionsAvi Kivity2012-01-041-5/+19
| | | | | | | Still internally using ram_addr. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* Convert IO_MEM_{RAM,ROM,UNASSIGNED,NOTDIRTY} to MemoryRegionsAvi Kivity2012-01-041-134/+84
| | | | | | | | | | Convert the fixed-address IO_MEM_RAM, IO_MEM_ROM, IO_MEM_UNASSIGNED, and IO_MEM_NOTDIRTY io handlers to MemoryRegions. These aren't real regions, since they are never added to the memory hierarchy, but they allow reuse of the dispatch functionality. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* Uninline get_page_addr_code()Avi Kivity2012-01-041-0/+26
| | | | | | | | Its use of IO_MEM_ROM and friends will later cause #include loops; and it is too large to merit inlining. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* Avoid range comparisons on io index typesAvi Kivity2012-01-041-17/+20
| | | | | | | | The code sometimes uses range comparisons on io indexes (e.g. index =< IO_MEM_ROM). Avoid these as they make moving to objects harder. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* Fix wrong region_offset when overlaying a page with anotherAvi Kivity2012-01-041-0/+1
| | | | | | | | | | | cpu_register_physical_memory_log() does not update region_offset if a page was previously registered for the same address. This could cause mmio accesses going to the wrong place, by using the old region_offset. Signed-off-by: Avi Kivity <avi@redhat.com> Acked-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Richard Henderson <rth@twiddle.net>
* memory: move mmio access to functionsAvi Kivity2012-01-041-27/+27
| | | | | | | | Currently mmio access goes directly to the io_mem_{read,write} arrays. In preparation for eliminating them, add indirection via a function. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* exec: make phys_page_find() return a temporaryAvi Kivity2012-01-041-100/+48
| | | | | | | | | Instead of returning a PhysPageDesc pointer, return a temporary. This lets us move away from actually storing PhysPageDesc's, and instead sythesising them when needed. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* memory: move endianness compensation to memory coreAvi Kivity2012-01-041-133/+9
| | | | | | | | Instead of doing device endianness compensation in cpu_register_io_memory(), do it in the memory core. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* memory: obsolete cpu_physical_memory_[gs]et_dirty_tracking()Avi Kivity2012-01-041-10/+0
| | | | | | | The getter is no longer used, so it is completely removed. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Store MemoryRegion in RAMBlockAvi Kivity2012-01-041-0/+1
| | | | | | | | As a step in moving live migration from RAMBlocks to MemoryRegions, store the MemoryRegion in a RAMBlock. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* vmstate, memory: decouple vmstate from memory APIAvi Kivity2012-01-041-9/+22
| | | | | | | | | | | | | | Currently creating a memory region automatically registers it for live migration. This differs from other state (which is enumerated in a VMStateDescription structure) and ties the live migration code into the memory core. Decouple the two by introducing a separate API, vmstate_register_ram(), for registering a RAM block for migration. Currently the same implementation is reused, but later it can be moved into a separate list, and registrations can be moved to VMStateDescription blocks. Signed-off-by: Avi Kivity <avi@redhat.com>
* Remove cpu_get_physical_page_desc()Avi Kivity2012-01-031-11/+0
| | | | | | No longer used. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: remove CPUPhysMemoryClientAvi Kivity2012-01-031-164/+5
| | | | | | No longer used. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: add API for observing updates to the physical memory mapAvi Kivity2011-12-201-0/+5
| | | | | | | | | | | | | | | Add an API that allows a client to observe changes in the global memory map: - region added (possibly with logging enabled) - region removed (possibly with logging enabled) - logging started on a region - logging stopped on a region - global logging started - global logging removed This API will eventually replace cpu_register_physical_memory_client(). Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: move obsolete exec.c functions to a private headerAvi Kivity2011-12-191-0/+3
| | | | | | This will help avoid accidental usage. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory, xen: pass MemoryRegion to xen_ram_alloc()Avi Kivity2011-12-191-4/+6
| | | | | | | Currently xen_ram_alloc() relies on ram_addr, which is going away. Give it something else to use as a cookie. Signed-off-by: Avi Kivity <avi@redhat.com>
* phys_page_find_alloc: Use correct initial region_offset.Alex Rozenman2011-12-151-1/+2
| | | | | | | | | This fixes a common bug with initial region_offset value. Usually, the pages are re-assigned afterwards, so the bug has a very small effect on regular QEMU use flows. Signed-off-by: Alex Rozenman <Alex_Rozenman@mentor.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* exec.c: Fix subpage memory access to RAM MemoryRegionAndreas Färber2011-12-151-2/+63
| | | | | | | | | | | | | | | | | | | Commit 95c318f5e1f88d7e5bcc6deac17330fd4806a2d3 (Fix segfault in mmio subpage handling code.) prevented a segfault by making all subpage registrations over an existing memory page perform an unassigned access. Symptoms were writes not taking effect and reads returning zero. Very small page sizes are not currently supported either, so subpage memory areas cannot fully be avoided. Therefore change the previous fix to use a new IO_MEM_SUBPAGE_RAM instead of IO_MEM_UNASSIGNED. Suggested by Avi. Reviewed-by: Avi Kivity <avi@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Avi Kivity <avi@redhat.com> Cc: Gleb Natapov <gleb@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* tcg/arm: remove fixed map code buffer restrictionDr. David Alan Gilbert2011-12-141-3/+1
| | | | | | | | | | | On ARM, don't map the code buffer at a fixed location, and fix up the call/goto tcg routines to let it do long jumps. Mapping the code buffer at a fixed address could sometimes result in it being mapped over the top of the heap with pretty random results. Signed-off-by: Dr. David Alan Gilbert <david.gilbert@linaro.org> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
* w32: Disable buffering for log fileStefan Weil2011-12-101-2/+4
| | | | | | | | | | | W32 does not support line buffering, but it supports unbuffered output. Unbuffered output is better for writing to qemu.log than fully buffered output because it also shows the latest log messages when an application crash occurs. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Make cpu_single_env thread-localPaolo Bonzini2011-11-011-1/+1
| | | | | | | | | | | | Make cpu_single_env thread-local. This fixes a regression in handling of multi-threaded programs in linux-user mode (bug 823902). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> [Peter Maydell: rename tls_cpu_single_env to cpu_single_env] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Error check find_ram_offsetAlex Williamson2011-11-011-2/+9
| | | | | | | | | | Spotted via code review, we initialize offset to 0 to avoid a compiler warning, but in the unlikely case that offset is never set to something else, we should abort instead of return a value that will almost certainly cause problems. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* exec.c: Remove useless comment陳韋任2011-10-261-1/+0
| | | | | | | | As phys_ram_size had been removed since QEMU 0.12. Remove the useless comment. Signed-off-by: Chen Wen-Ren <chenwj@iis.sinica.edu.tw> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* qemu-timer: move icount to cpus.cPaolo Bonzini2011-10-211-3/+0
| | | | | | | None of this is needed by tools, and most of it can even be made static inside cpus.c. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Move GETPC from dyngen-exec.h to exec-all.hBlue Swirl2011-10-011-0/+1
| | | | | | | GETPC() can be used even from outside of helper code. Move the macro to a more accessible location. Avoid a compile warning from redefining it in exec.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Remove qemu_host_page_bitsStefan Weil2011-09-211-4/+0
| | | | | | | | It was introduced with commit 54936004fddc52c321cb3f9a9a51140e782bed5d as host_page_bits but never used. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-24/+24
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* fix QLIST usage for RAM listPaolo Bonzini2011-08-121-1/+1
| | | | | | | Spotted while reviewing the migration thread patches. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* Integrate I/O memory regions into qemuAvi Kivity2011-08-081-0/+10
| | | | | | | | get_system_io() returns the root I/O memory region. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Use mmap to allocate execute memoryTobias Nygren2011-08-071-1/+2
| | | | | | | Use mmap to allocate executable memory on NetBSD as well. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Avoid allocating TCG resources in non-TCG modeJan Kiszka2011-08-051-5/+14
| | | | | | | | | Do not allocate TCG-only resources like the translation buffer when running over KVM or XEN. Saves a "few" bytes in the qemu address space and is also conceptually cleaner. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud