summaryrefslogtreecommitdiffstats
path: root/exec.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* memory: use signed arithmeticAvi Kivity2011-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | When trying to map an alias of a ram region, where the alias starts at address A and we map it into address B, and A > B, we had an arithmetic underflow. Because we use unsigned arithmetic, the underflow converted into a large number which failed addrrange_intersects() tests. The concrete example which triggered this was cirrus vga mapping the framebuffer at offsets 0xc0000-0xc7fff (relative to the start of the framebuffer) into offsets 0xa0000 (relative to system addres space start). With our favorite analogy of a windowing system, this is equivalent to dragging a subwindow off the left edge of the screen, and failing to clip it into its parent window which is on screen. Fix by switching to signed arithmetic. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'agraf/xen-next' into stagingAnthony Liguori2011-07-291-6/+7
|\
| * cpu-common: Have a ram_addr_t of uint64 with Xen.Anthony PERARD2011-07-261-4/+5
| | | | | | | | | | | | | | | | In Xen case, memory can be bigger than the host memory. that mean a 32bits host (and QEMU) should be able to handle a RAM address of 64bits. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Alexander Graf <agraf@suse.de>
| * exec.c: Use ram_addr_t in cpu_physical_memory_rw(...).Anthony PERARD2011-07-261-2/+2
| | | | | | | | | | | | | | | | | | | | As the variable pd and addr1 inside the function cpu_physical_memory_rw are mean to handle a RAM address, they should be of the ram_addr_t type instead of unsigned long. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* | exec.c: initialize memory mapAvi Kivity2011-07-291-0/+19
|/ | | | | | | Allocate the root memory region and initialize it. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix unassigned memory access handlingBlue Swirl2011-07-201-6/+6
| | | | | | | | cea5f9a28faa528b6b1b117c9ab2d8828f473fef exposed bugs in unassigned memory access handling. Fix them by always passing CPUState to the handlers. Reported-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* qemu_ram_ptr_length: take ram_addr_t as argumentsStefano Stabellini2011-07-171-7/+14
| | | | | | | | | | | | | | | | | | | | | | qemu_ram_ptr_length should take ram_addr_t as argument rather than target_phys_addr_t because is doing comparisons with RAMBlock addresses. cpu_physical_memory_map should create a ram_addr_t address to pass to qemu_ram_ptr_length from PhysPageDesc phys_offset. Remove code after abort() in qemu_ram_ptr_length. Changes in v2: - handle 0 size in qemu_ram_ptr_length; - rename addr1 to raddr; - initialize raddr to ULONG_MAX. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
* xen: Fold CONFIG_XEN_MAPCACHE into CONFIG_XENJan Kiszka2011-07-171-8/+8
| | | | | | | | | Xen won't be enabled if there is no backend support available for the host. And that also means the map cache will work. So drop the separate config switch and move the required stubs over to xen-stub.c. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Alexander Graf <agraf@suse.de>
* xen: Clean up map cache API namingJan Kiszka2011-07-171-8/+10
| | | | | | | The map cache is a Xen thing, so its API should make this clear. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Alexander Graf <agraf@suse.de>
OpenPOWER on IntegriCloud