History | View | Annotate | Download (129.6 kB)
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>
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").
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
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...
exec: replace tabs by spaces.
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
exec: remove code duplication in qemu_ram_alloc() and qemu_ram_alloc_from_ptr()
Since most of the code in qemu_ram_alloc() andqemu_ram_alloc_from_ptr() are duplicated, letqemu_ram_alloc_from_ptr() to switch by checking void *host, and changeqemu_ram_alloc() to a wrapper....
Add qemu_ram_alloc_from_ptr function
Provide a function to add an allocated region of memory to the qemu RAM.
This patch is copied from Marcelo's qemu_ram_map() in qemu-kvm and given theclearer name qemu_ram_alloc_from_ptr().
Signed-off-by: Cam Macdonell <cam@cs.ualberta.ca>...
Declare code_gen_ptr, code_gen_max_blocks 'static'
Both values are only used in exec.c, so there is no needto make them globally available.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Fix warning about uninitialized variable
With gcc 4.2.1-sjlj (mingw32-2) I get this warning:/src/qemu/exec.c: In function 'qemu_ram_alloc':/src/qemu/exec.c:2777: warning: 'offset' may be used uninitialized in this function
Fix by initializing the variable....
ramblocks: No more being lazy about duplicate names
Now that we have a working qemu_ram_free() and the primary runtimeuser of it has been updated, don't be lenient about duplicate id strings.We also shouldn't need to create them ondemand at the target....
savevm: Add DeviceState param
When available, we'd like to be able to access the DeviceStatewhen registering a savevm. For buses with a get_dev_path()function, this will allow us to create more unique savevmid strings.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>...
qemu_ram_alloc: Add DeviceState and name parameters
These will be used to generate unique id strings for ramblocks. The namefield is required, the device pointer is optional as most callers don'thave a device. When there's no device or the device isn't a child of...
ramblocks: Make use of DeviceState pointer and BusInfo.get_dev_path
With these two pieces in place, we can start naming ramblocks. Whenthe device is present and it lives on a bus that provides a devicepath, we concatenate the path and the provided name. Otherwise we...
qemu_ram_free: Implement it
Now that we can support a ram_addr_t space with holes, we can implementqemu_ram_free().
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Remove uses of ram.last_offset (aka last_ram_offset)
We currently need this either to allocate the next ram_addr_t for anew block, or for total memory to be migrated. Both of which we cancalculate without need of this to keep us in a contiguous address space....
A bit optimization for tlb_set_page()
This patch avoids handling write watchpoints on read-only memory access.It also breaks the searching loop for watchpoint once the setup forhandling watchpoint later is done.
Signed-off-by: Jun Koi <junkoi2004@gmail.com>...
ram_blocks: Convert to a QLIST
This makes the RAM block list easier to manipulate. Also incorporaterelevant variables into the RAMList struct.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Acked-by: Chris Wright <chrisw@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
tcg-s390: Allocate the code_gen_buffer near the main program.
This allows the use of direct calls to the helpers,and a direct branch back to the epilogue.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg: get rid of copy_size in TCGOpDef
copy_size is a left-over from the dyngen era, remove it.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
tcg: Initialize the prologue after GUEST_BASE is fixed.
This will allow backends to make intelligent choices about howto implement GUEST_BASE.
Fix -mem-path with hugetlbfs
Fallback to qemu_vmalloc in case file_ram_alloc fails.
Fill in unassigned mem read/write callbacks.
Implement the "functions may be omitted with NULL pointer" interface mentioned in the function block comment by transformingNULL entries in the read/write arrays into calls to theunassigned_mem family of functions....
qemu: address todo comment in exec.c
exec.c has a comment 'XXX: optimize' for lduw_phys/stw_phys,so let's do it, along the lines of stl_phys.
The reason to address 16 bit accesses specifically is that virtio relieson these accesses to be done atomically, using memset as we do now...
Fix zero-length write(2).
Remove PAGE_RESERVED
The usermode PAGE_RESERVED code is not required by the current mmapimplementation, and is already broken when guest_base != 0.Unfortunately the bsd emulation still uses the old mmap implementation,so we can't rip it out altogether....
Remove IO_MEM_SUBWIDTH.
Greatly simplify the subpage implementation by not supportingmultiple devices at the same address at different widths. Wedon't need full copies of mem_read/mem_write/opaque for eachaddress, only a single index back into the main io_mem_* arrays....
Cleanup dead code
This patch removes some dead code in exec.c
Signed-off-by: Jun Koi <junkoi2004@gmail.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Revert "Avoid page_set_flags() assert in qemu-user host page protection code"
This reverts commit 01c0bef1625d8e5d6d5c6abaf413214d667615ad.
(breaks build on 32-bit hosts)
Avoid page_set_flags() assert in qemu-user host page protection code
V2 that uses endaddr = end-of-guest-address-space if !h2g_valid(endaddr)after I found out that indeed works; and also disables the FreeBSD 6.x/compat/linux/proc/self/maps fallback because it can return partial lines...
Replace direct phys_ram_dirty access with wrapper functions.
Replaces direct phys_ram_dirty access with wrapper functions to preventdirect access to the phys_ram_dirty bitmap.
Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>Signed-off-by: OHMURA Kei <ohmura.kei@lab.ntt.co.jp>...
Split TLB addend and target_phys_addr_t
Historically the qemu tlb "addend" field was used for both RAM and IO accesses,so needed to be able to hold both host addresses (unsigned long) and guestphysical addresses (target_phys_addr_t). However since the introduction of...
linux-user: fix page_unprotect when host page size > target page size
When the host page size is bigger that the target one, unprotecting apage should:- mark all the target pages corresponding to the host page as writable- invalidate all tb corresponding to the host page (and not the target...
tcg: align static_code_gen_buffer to CODE_GEN_ALIGN
On ia64, the default memory alignement is not enough for a codealignement. To fix that, force static_code_gen_buffer alignmentto CODE_GEN_ALIGN.
Get bsd-user host page protection code working on FreeBSD hosts
Use kinfo_getvmmap(3) on FeeBSD >= 7.x and /compat/linux/proc on olderFreeBSD. (kinfo_getvmmap is preferred since /compat/linux/proc isusually only mounted on hosts also using the Linuxolator.)...
Compile qemu-timer only once
Arrange various declarations so that also non-CPU code can accessthem, adjust users.
Move CPU specific code to cpus.c.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
exec: remove dead code
be more specific in -mem-path error messages
Signed-Off-By: Michael Tokarev <mjt@tls.msk.ru>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Large page TLB flush
QEMU uses a fixed page size for the CPU TLB. If the guest uses largepages then we effectively split these into multiple smaller pages, andpopulate the corresponding TLB entries on demand.
When the guest invalidates the TLB by virtual address we must invalidate...
Fix pagetable code
The multi-level pagetable code fails to iterate ove all entries becauseof the L2_BITS v.s. L2_SIZE thinko.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Fix more wrong usermode virtual address types
Fixes warning: CC sparc-bsd-user/exec.o/src/qemu/exec.c: In function `page_check_range':/src/qemu/exec.c:2375: warning: comparison is always true due to limited range of data type
Fix usermode virtual address type
Usermode virtual addresses are abi_ulong, not target_ulong.
Disable phsyical memory handling in userspace emulation.
Code to handle physical memory access is not meaningful in usrmode emulation,so disable it.
Add tb_page_addr_t
The page tracking code in exec.c is used by both userspace and systememulation. Userspace emulation uses it to track virtual pages, andsystem emulation to track ram pages. Introduce a new type to hold thiskind of address.
Fix last page errors in page_check_range and page_set_flags.
The addr < end comparison prevents iterating over the lastpage in the guest address space; an iteration based onlength avoids this problem.
At the same time, assert that the given address is in the...
Implement multi-level page tables.
Define L1_MAP_ADDR_SPACE_BITS to be either the virtual address size(in user mode) or physical address size (in system mode), and usethat to size l1_map. This rewrites page_find_alloc, page_flush_tb,and walk_memory_regions....
Move TARGET_PHYS_ADDR_SPACE_BITS to target-*/cpu.h.
Removes a set of ifdefs from exec.c.
Introduce TARGET_VIRT_ADDR_SPACE_BITS for all targets otherthan Alpha. This will be used for page_find_alloc, which issupposed to be using virtual addresses in the first place....
KVM: Rework VCPU state writeback API
This grand cleanup drops all reset and vmsave/load relatedsynchronization points in favor of four(!) generic hooks:
- cpu_synchronize_all_states in qemu_savevm_state_complete (initial sync from kernel before vmsave)...
Add option to use file backed guest memory
Port qemu-kvm's -mem-path and -mem-prealloc options. These are usefulfor backing guest memory with huge pages via hugetlbfs.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>CC: john cooper <john.cooper@redhat.com>
Avoid tlb_set_page in userspace emulation
tlb_set_page isn't meaningful for userspace emulation, so remove it.
Move subpage definitions
Move definitions for subpage handling into !CONFIG_USER_ONLY code.
Remove bogus cpu_physical_memory_rw
Userspace doesn't have physical memory, so cpu_physical_memory_rwmakes no sense. This is only used to implement cpu_memory_rw_debug, sojust implement that directly instead.
Remove l1_phys_map from userspace emulation
Userspace emulation doesn't have a physical address space, sol1_phys_map makes no sense. This code is never actually used, so don'ttry and build it.
Fix userspace breakpoint invalidation
Remove bogus virtual->physical address translation inbreakpoint_invalidate for userspace emulation.
qemu: memory notifiers
This adds notifiers for phys memory changes: a set of callbacks thatvhost can register and update kernel accordingly. Down the road, kvmcode can be switched to use these as well, instead of calling kvm codedirectly from exec.c as is done now....
kvm: move kvm to use memory notifiers
remove direct kvm calls from exec.c, makekvm use memory notifiers framework instead.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Acked-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Merge remote branch 'qemu-kvm/uq/master' into staging-tmp
fix locking error with current_tb
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
linux-user: remove signal handler before calling abort()
Qemu may hang in host_signal_handler after qemu has done aseppuku with cpu_abort(). But at this stage we are not reallyinterested in target process coredump anymore, so unregisterhost_signal_handler to die grafefully....
exec.c: dead assignments
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
kvm: Flush coalesced MMIO buffer periodly
The default action of coalesced MMIO is, cache the writing in buffer, until:1. The buffer is full.2. Or the exit to QEmu due to other reasons.
But this would result in a very late writing in some condition.1. The each time write to MMIO content is small....
win32: pair qemu_memalign() with qemu_vfree()
Win32 suffers from a very big memory leak when dealing with SCSI devices.Each read/write request allocates memory with qemu_memalign (ieVirtualAlloc) but frees it with qemu_free (ie free).Pair all qemu_memalign() calls with qemu_vfree() to prevent such leaks....
linux-user: enable tb unlinking when compiled with NPTL
Fixes receiving signals when guest code is being executed in a tightloop. For an example, try interrupting the following code with ctrl-c.
http://nchipin.kos.to/test-loop.c
The tight loop is ofcourse brainless, but it is also exactly how the waitpid* testcases...
Fix win32 log file location
/tmp doesn't exist under win32. Ease the pain of win32 development slightly.
From: Juha Riihimäki <juha.riihimaki@nokia.com>Signed-off-by: Riku Voipio <riku.voipio@nokia.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Give a error when running out of iomem areas.
The limit of iomem areas is quite low. Without thedebug print, it is quite hard to figure out why moredevices are not getting registered.
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Allocate physical memory in low virtual address space
KVM on S390x requires the virtual address space of the guest's RAM to bewithin the first 256GB.
The general direction I'd like to see KVM on S390 move is that this requirementis losened, but for now that's what we're stuck with....
Add support for GNU/kFreeBSD
ksm support
Call MADV_MERGEABLE on guest memory allocations. MADV_MERGABLE will beavailable starting in Linux 2.6.32. This system call registers a region ofvirtual address space with Linux as a candidate for transparent memorysharing.
Patchworks-ID: 35447...
fix comment on cpu_register_physical_memory_offset
We don't require full pages in cpu_register_physical_memory,except for RAM.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vmstate: remove const from pre_save() functions
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vmstate: add version_id argument to post_load
Revert "Get rid of _t suffix"
In the very least, a change like this requires discussion on the list.
The naming convention is goofy and it causes a massive merge problem. Somethinglike this must be presented on the list first so people can provide input...
Get rid of _t suffix
Some not so obvious bits, slirp and Xen were left alone for the timebeing.
Signed-off-by: malc <av1474@comtv.ru>
Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there aresome additions and it's not entirely compatible. Because of that, there havebeen conflicts with system headers on BSD systems. Some hacks have beenintroduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...
vmstate: port cpu_comon
microblaze: Trap on bus accesses to unmapped areas.
kvm: Simplify cpu_synchronize_state()
cpu_synchronize_state() is a little unreadable since the 'modified'argument isn't self-explanatory. Simplify it by making it alwayssynchronize the kernel state into qemu, and automatically flush theregisters back to the kernel if they've been synchronized on this...
Make CPURead/WriteFunc structure 'const'
Unbreak large mem support by removing kqemu
kqemu introduces a number of restrictions on the i386 target. The worst is thatit prevents large memory from working in the default build.
Furthermore, kqemu is fundamentally flawed in a number of ways. It relies on...
Fix Sparse warnings: "Using plain integer as NULL pointer"
rename USE_NPTL to CONFIG_USE_NPTL