History | View | Annotate | Download (129.1 kB)
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>
Convert IO_MEM_{RAM,ROM,UNASSIGNED,NOTDIRTY} to MemoryRegions
Convert the fixed-address IO_MEM_RAM, IO_MEM_ROM, IO_MEM_UNASSIGNED,and IO_MEM_NOTDIRTY io handlers to MemoryRegions. These aren't realregions, since they are never added to the memory hierarchy, but they...
Switch cpu_register_physical_memory_log() to use MemoryRegions
Still internally using ram_addr.
Signed-off-by: Avi Kivity <avi@redhat.com>Reviewed-by: Richard Henderson <rth@twiddle.net>
Convert the subpage wrapper to be a MemoryRegion
Convert IO_MEM_SUBPAGE_RAM to be a MemoryRegion
Convert io_mem_watch to be a MemoryRegion
Direct dispatch through MemoryRegion
Now that all mmio goes through MemoryRegions, we can convertio_mem_opaque to be a MemoryRegion pointer, and remove the thunksthat convert from old-style CPU{Read,Write}MemoryFunc to MemoryRegionOps.
Signed-off-by: Avi Kivity <avi@redhat.com>...
Remove IO_MEM_SUBPAGE
Replace with a MemoryRegion flag.
Drop IO_MEM_ROMD
Unlike ->readonly, ->readable is not inherited from aliase, so we can simplyquery the memory region.
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.
memory: obsolete cpu_physical_memory_[gs]et_dirty_tracking()
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>
memory: move endianness compensation to memory core
Instead of doing device endianness compensation in cpu_register_io_memory(),do it in the memory core.
exec: make phys_page_find() return a temporary
Instead of returning a PhysPageDesc pointer, return a temporary.This lets us move away from actually storing PhysPageDesc's, andinstead sythesising them when needed.
memory: move mmio access to functions
Currently mmio access goes directly to the io_mem_{read,write} arrays.In preparation for eliminating them, add indirection via a function.
Fix wrong region_offset when overlaying a page with another
cpu_register_physical_memory_log() does not update region_offsetif a page was previously registered for the same address. Thiscould cause mmio accesses going to the wrong place, by using theold region_offset....
Avoid range comparisons on io index types
The code sometimes uses range comparisons on io indexes (e.g.index =< IO_MEM_ROM). Avoid these as they make moving to objects harder.
Uninline get_page_addr_code()
Its use of IO_MEM_ROM and friends will later cause #include loops; and itis too large to merit inlining.
vmstate, memory: decouple vmstate from memory API
Currently creating a memory region automatically registers it forlive migration. This differs from other state (which is enumeratedin a VMStateDescription structure) and ties the live migration codeinto the memory core....
Store MemoryRegion in RAMBlock
As a step in moving live migration from RAMBlocks to MemoryRegions,store the MemoryRegion in a RAMBlock.
Remove cpu_get_physical_page_desc()
No longer used.
Signed-off-by: Avi Kivity <avi@redhat.com>
memory: remove CPUPhysMemoryClient
memory: add API for observing updates to the physical memory map
Add an API that allows a client to observe changes in the globalmemory map: - region added (possibly with logging enabled) - region removed (possibly with logging enabled) - logging started on a region...
memory: move obsolete exec.c functions to a private header
This will help avoid accidental usage.
memory, xen: pass MemoryRegion to xen_ram_alloc()
Currently xen_ram_alloc() relies on ram_addr, which is going away.Give it something else to use as a cookie.
phys_page_find_alloc: Use correct initial region_offset.
This fixes a common bug with initial region_offset value.Usually, the pages are re-assigned afterwards, so the bughas a very small effect on regular QEMU use flows.
Signed-off-by: Alex Rozenman <Alex_Rozenman@mentor.com>...
exec.c: Fix subpage memory access to RAM MemoryRegion
Commit 95c318f5e1f88d7e5bcc6deac17330fd4806a2d3 (Fix segfault in mmiosubpage handling code.) prevented a segfault by making all subpageregistrations over an existing memory page perform an unassigned access....
tcg/arm: remove fixed map code buffer restriction
On ARM, don't map the code buffer at a fixed location, and fix up thecall/goto tcg routines to let it do long jumps.
Mapping the code buffer at a fixed address could sometimes result in it beingmapped over the top of the heap with pretty random results....
w32: Disable buffering for log file
W32 does not support line buffering, but it supports unbuffered output.
Unbuffered output is better for writing to qemu.log than fully bufferedoutput because it also shows the latest log messages when an applicationcrash occurs....
Error check find_ram_offset
Spotted via code review, we initialize offset to 0 to avoid acompiler warning, but in the unlikely case that offset isnever set to something else, we should abort instead of returna value that will almost certainly cause problems....
Make cpu_single_env thread-local
Make cpu_single_env thread-local. This fixes a regressionin 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]...
exec.c: Remove useless comment
As phys_ram_size had been removed since QEMU 0.12. Remove the uselesscomment.
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.c
None of this is needed by tools, and most of it can even be made staticinside cpus.c.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Move GETPC from dyngen-exec.h to exec-all.h
GETPC can be used even from outside of helper code. Move the macro toa 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_bits
It was introduced with commit 54936004fddc52c321cb3f9a9a51140e782bed5das 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 functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
fix QLIST usage for RAM list
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 qemu
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 memory
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>
memory: use signed arithmetic
When trying to map an alias of a ram region, where the alias starts ataddress A and we map it into address B, and A > B, we had an arithmeticunderflow. Because we use unsigned arithmetic, the underflow convertedinto a large number which failed addrrange_intersects() tests....
Avoid allocating TCG resources in non-TCG mode
Do not allocate TCG-only resources like the translation buffer whenrunning over KVM or XEN. Saves a "few" bytes in the qemu address spaceand is also conceptually cleaner.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
Merge remote-tracking branch 'agraf/xen-next' into staging
exec.c: initialize memory map
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>
cpu-common: Have a ram_addr_t of uint64 with Xen.
In Xen case, memory can be bigger than the host memory. that mean a32bits 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(...).
As the variable pd and addr1 inside the function cpu_physical_memory_rware mean to handle a RAM address, they should be of the ram_addr_t typeinstead of unsigned long.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>...
Fix unassigned memory access handling
cea5f9a28faa528b6b1b117c9ab2d8828f473fef exposed bugs in unassigned memoryaccess 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 arguments
qemu_ram_ptr_length should take ram_addr_t as argument rather thantarget_phys_addr_t because is doing comparisons with RAMBlock addresses.
cpu_physical_memory_map should create a ram_addr_t address to pass to...
xen: Clean up map cache API naming
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>
xen: Fold CONFIG_XEN_MAPCACHE into CONFIG_XEN
Xen won't be enabled if there is no backend support available for thehost. And that also means the map cache will work. So drop the separateconfig switch and move the required stubs over to xen-stub.c.
exec.c: Fix calculation of code_gen_buffer_max_size
When calculating the point at which we should not try to put anotherTB into the code gen buffer, we have to allow not just for OPC_MAX_SIZEbut OPC_BUF_SIZE. This is because the target translate.c will only...
exec: add endian specific phys ld/st functions
Device code some times needs to access physical memory and does thatthrough the ld./st._phys functions. However, these are the exact samefunctions that the CPU uses to access memory, which means they willbe endianness swapped depending on the target CPU....
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
Remove exec-all.h include directives
Most exec-all.h include directives are now useless, remove them.
exec: last_first_tb was only used in !ONLY_USER case
Once there, use a better variable name.
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Merge remote-tracking branch 'mst/for_anthony' into staging
Conflicts: hw/usb-uhci.c
xen: remove xen_map_block and xen_unmap_block
Replace xen_map_block with qemu_map_cache with the appropriate lockingand size parameters.Replace xen_unmap_block with qemu_invalidate_entry.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>...
exec.c: refactor cpu_physical_memory_map
Introduce qemu_ram_ptr_length that takes an address and a size asparameters rather than just an address.
Refactor cpu_physical_memory_map so that we call qemu_ram_ptr_length onlyonce rather than calling qemu_get_ram_ptr one time per page....
xen: mapcache performance improvements
Use qemu_invalidate_entry in cpu_physical_memory_unmap.
Do not lock mapcache entries in qemu_get_ram_ptr if the address falls inthe ramblock with offset == 0. We don't need to do that because thecallers of qemu_get_ram_ptr either try to map an entire block, other...
xen: remove qemu_map_cache_unlock
There is no need for qemu_map_cache_unlock, just useqemu_invalidate_entry instead.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>Signed-off-by: Alexander Graf <agraf@suse.de>
Merge remote-tracking branch 'origin/master' into pci
Conflicts: hw/virtio-pci.c
CPUPhysMemoryClient: batch addresses in catchup
When a phys memory client registers and we play catchup by walkingthe page tables, we can make a huge improvement in the number oftimes the set_memory callback is called by batching contiguouspages together. With a 4G guest, this reduces the number of callbacks...
Merge remote branch 'rth/axp-next' into alpha-merge
Fix compilation warning due to missing header for sigaction (followup)
This patch removes all references to signal.h when qemu-common.h is includedas they become redundant.
Signed-off-by: Alexandre Raymond <cerbere@gmail.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
exec: Implement qemu_ram_free_from_ptr()
Required for regions mapped via qemu_ram_alloc_from_ptr(). VFIOand ivshmem will make use of this to remove mappings when devicesare hot unplugged.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-alpha: Trap for unassigned and unaligned addresses.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Merge branch 'trivial-patches' of git://repo.or.cz/qemu/stefanha
Fix typos in comments (chek -> check)
s390x: change mapping base to allow guests > 2GB
the current s390x qemu memory layout is
0x1000000: guest start0x80000000: qemu binary
which limits the amount of available memory to <2GB.This patch moves the guest pages to 32GB to not collide with the binary...
s390x: complain when allocating ram fails
While trying out the > 64GB guest RAM patch, I hit some virtual addresslimitations of my host system, which resulted in mmap failing. Unfortunately,qemu didn't tell me about this failure, but just used the NULL pointer...
xen: Introduce the Xen mapcache
On IA32 host or IA32 PAE host, at present, generally, we can't createan HVM guest with more than 2G memory, because generally it's almostimpossible for Qemu to find a large enough and consecutive virtualaddress space to map an HVM guest's whole physical address space....
Introduce qemu_put_ram_ptr
This function allows to unlock a ram_ptr give by qemu_get_ram_ptr. Aftera call to qemu_put_ram_ptr, the pointer may be unmap from QEMU whenused with Xen.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>Acked-by: Alexander Graf <agraf@suse.de>...
Merge remote branch 'origin/master' into pci
Conflicts: exec.c
CPUPhysMemoryClient: Pass guest physical address not region offset
When we're trying to get a newly registered phys memory client updatedwith the current page mappings, we end up passing the region offset(a ram_addr_t) as the start address rather than the actual guest...
CPUPhysMemoryClient: Fix typo in phys memory client registration
When we register a physical memory client, we try to walk the pagetables, calling the set_memory hook for every entry. Effectivelyplaying catchup for the client for everything already registered....
Break up user and system cpu_interrupt implementations
Both have only two lines in common, and we will convert the systemservice into a callback which is of no use for user mode operation.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>CC: Riku Voipio <riku.voipio@iki.fi>...
Redirect cpu_interrupt to callback handler
This allows to override the interrupt handling of QEMU in system mode.KVM will make use of it to set a specialized handler.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Remove unused function parameter from cpu_restore_state
The previous patch removed the need for parameter puc.Is is now unused, so remove it.
Cc: Aurelien Jarno <aurelien@aurel32.net>Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Stefan Weil <weil@mail.berlios.de>
exec: Remove a type cast which is no longer needed
All other type casts in calls of cpu_physical_memory_write areused by hardware emulations and will be fixed by separate patches.
Cc: Blue Swirl <blauwirbel@gmail.com>Signed-off-by: Stefan Weil <weil@mail.berlios.de>...
Replace cpu_physical_memory_rw were possible
Using cpu_physical_memory_read, cpu_physical_memory_write and ldub_physimproves readability and allows removing some type casts.
lduw_phys and ldl_phys were not used because both require alignedaddresses. Therefore it is not possible to simply replace existing...
exec: Handle registrations of the entire address space
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
cpu: add set_memory flag to request dirty logging
Pass the flag to all cpu notifiers, doingnothing at this point. Will be used byfollow-up patches.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Expose thread_id in info cpus
Based on patch by Glauber Costa:
To allow management applications like libvirt to apply CPU affinities tothe VCPU threads, expose their ID via info cpus. This patch provides thepre-existing and used interface from qemu-kvm....
s390: Detect invalid invocations of qemu_ram_free/remap
This both detects invalid invocations of qemu_ram_free andqemu_ram_remap when mem_path is non-NULL and fixes a build error ons390 ("'area' may be used uninitialized in this function").
Add qemu_ram_remap
qemu_ram_remap() unmaps the specified RAM pages, then re-maps thesepages again. This is used by KVM HWPoison support to clear HWPoisonedpage tables across guest rebooting, so that a new page may beallocated later to recover the memory error....
Refactor thread retrieval and check
We have qemu_cpu_self and qemu_thread_self. The latter is retrieving thecurrent thread, the former is checking for equality (using CPUState). Wealso have qemu_thread_equal which is only used like qemu_cpu_self.
This refactors the interfaces, creating qemu_cpu_is_self and...
Fix performance regression in qemu_get_ram_ptr
When the commit f471a17e9d869df3c6573f7ec02c4725676d6f3a converted theram_blocks structure to QLIST, it also removed the conditional check beforeswitching the current block at the beginning of the list.
In the common use case where ram_blocks has a few blocks with only one...
Introduce log_start/log_stop in CPUPhysMemoryClient
In order to use log_start/log_stop with Xen as well in the vga code,this two operations have been put in CPUPhysMemoryClient.
The two new functions cpu_physical_log_start,cpu_physical_log_stop areused in hw/vga.c and replace the kvm_log_start/stop. With this, vga does...
Make tb_alloc static
This function is only used within exec.c, so no need to make it public.
Signed-off-by: Tristan Gingold <gingold@adacore.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg/sparc64: fix segfault
With current OpenBSD, code_gen_buffer was mapped 8GB away fromtext segment. Then any helpers were beyond the 2GB range of callinstruction genereated by TCG and so the calls would go nowhere,leading to a segfault.
Fix by specifying an address for the code_gen_buffer,...
Use mmap() within code_gen_alloc() for OpenBSD.
Signed-off-by: Brad Smith <brad@comstyle.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
exec: introduce endianness swapped mmio
The way we're currently modeling mmio is too simplified. We assume thatevery device has the same endianness as the target CPU. In reality,most devices are little endian (all PCI and ISA ones I'm aware of). Someare big endian (special system devices) and a very little fraction is...
Add endianness as io mem parameter
As stated before, devices can be little, big or native endian. Thetarget endianness is not of their concern, so we need to push thingsdown a level.
This patch adds a parameter to cpu_register_io_memory that allows adevice to choose its endianness. For now, all devices simply choose...
exec: Remove debugging fprintf() that slipped into qemu_ram_alloc_from_ptr()
Remove the debugging fprintf() slipped in via the following commit:
commit b2e0a138e77245290428a7d599a929e2e1bfe510 Author: Michael S. Tsirkin <mst@redhat.com> Date: Mon Nov 22 19:52:34 2010 +0200...
migration: stable ram block ordering
This makes ram block ordering under migration stable, ordered by offset.This is especially useful for migration to exec, for debugging.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Tested-by: Jason Wang <jasowang@redhat.com>
exec: Use fprintf_function for dump_exec_info (format checking)
fprintf_function uses format checking with GCC_FMT_ATTR.
It is declared in qemu-common.h and used in cpu-all.h(which is included from cpu.h), so qemu-common.h mustbe included earlier. Some redundant include statements...
Export qemu_ram_addr_from_host
To be used by next patches.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>Signed-off-by: Avi Kivity <avi@redhat.com>
exec: Fix compilation error for debug code
is_softmmu was removed with commitd4c430a80f000d722bb70287af4d4c184a8d7006,so remove it now from debug code, too.
Fix also the format specifier for paddrin the same line of code.
Cc: Blue Swirl <blauwirbel@gmail.com>...
Introduce qemu_madvise()
vl.c has a Sun-specific hack to supply a prototype for madvise(),but the call site has apparently moved to arch_init.c.
Haiku doesn't implement madvise() in favor of posix_madvise().OpenBSD and Solaris 10 don't implement posix_madvise() but madvise()....
Fix segfault in mmio subpage handling code.
It is possible that subpage mmio is registered over existing memorypage. When this happens "memory" will have real memory address and notindex into io_mem array so next access to the page will generatesegfault. It is uncommon to have some part of a page to be accessed as...