summaryrefslogtreecommitdiffstats
path: root/exec.c
Commit message (Collapse)AuthorAgeFilesLines
* exec: make -mem-path filenames deterministicPeter Feiner2013-03-121-1/+12
| | | | | | | | | Adds ramblocks' names to their backing files when using -mem-path. Eases introspection and debugging. Signed-off-by: Peter Feiner <peter@gridcentric.ca> Message-id: 1362423265-15855-1-git-send-email-peter@gridcentric.ca Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Handle CPU interrupts by inline checking of a flagPeter Maydell2013-03-031-1/+1
| | | | | | | | | | | | | | | | | | | | | Fix some of the nasty TCG race conditions and crashes by implementing cpu_exit() as setting a flag which is checked at the start of each TB. This avoids crashes if a thread or signal handler calls cpu_exit() while the execution thread is itself modifying the TB graph (which may happen in system emulation mode as well as in linux-user mode with a multithreaded guest binary). This fixes the crashes seen in LP:668799; however there are another class of crashes described in LP:1098729 which stem from the fact that in linux-user with a multithreaded guest all threads will use and modify the same global TCG date structures (including the generated code buffer) without any kind of locking. This means that multithreaded guest binaries are still in the "unsupported" category. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* cputlb: Pass CPUState to cpu_unlink_tb()Andreas Färber2013-02-161-1/+1
| | | | | | CPUArchState is no longer needed. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move exit_request field to CPUStateAndreas Färber2013-02-161-1/+3
| | | | | | Since it was located before breakpoints field, it needs to be reset. Signed-off-by: Andreas Färber <afaerber@suse.de>
* Replace non-portable asprintf by g_strdup_printfStefan Weil2013-01-191-5/+3
| | | | | | | | g_strdup_printf already handles OOM errors, so some error handling in QEMU code can be removed. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* exec: Return CPUState from qemu_get_cpu()Andreas Färber2013-01-151-3/+3
| | | | | | | Move the declaration to qemu/cpu.h and add documentation. The implementation still depends on CPUArchState for CPU iteration. Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move cpu_index field to CPUStateAndreas Färber2013-01-151-6/+7
| | | | | | | | | | | | | Note that target-alpha accesses this field from TCG, now using a negative offset. Therefore the field is placed last in CPUState. Pass PowerPCCPU to [kvm]ppc_fixup_cpu() to facilitate this change. Move common parts of mips cpu_state_reset() to mips_cpu_reset(). Acked-by: Richard Henderson <rth@twiddle.net> (for alpha) [AF: Rebased onto ppc CPU subclasses and openpic changes] Signed-off-by: Andreas Färber <afaerber@suse.de>
* cpu: Move numa_node field to CPUStateAndreas Färber2013-01-151-3/+1
| | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* stubs: fully replace qemu-tool.c and qemu-user.cPaolo Bonzini2013-01-121-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Revert "virtio-pci: replace byte swap hack"Blue Swirl2013-01-061-0/+18
| | | | | | This reverts commit 9807caccd605d09a72495637959568d690e10175. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* virtio-pci: replace byte swap hackBlue Swirl2013-01-061-18/+0
| | | | | | | Remove byte swaps by declaring the config space as native endian. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* protect the ramlist with a separate mutexUmesh Deshpande2012-12-201-2/+27
| | | | | | | | | | | | Add the new mutex that protects shared state between ram_save_live and the iothread. If the iothread mutex has to be taken together with the ramlist mutex, the iothread shall always be _outside_. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Umesh Deshpande <udeshpan@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
* add a version number to ram_listUmesh Deshpande2012-12-201-0/+4
| | | | | | | | | | | This will be used to detect if last_block might have become invalid across different calls to ram_save_live. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Umesh Deshpande <udeshpan@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
* exec: sort the memory from biggest to smallestPaolo Bonzini2012-12-201-2/+12
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* exec: change RAM list to a TAILQPaolo Bonzini2012-12-201-17/+17
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* exec: change ramlist from MRU order to a 1-item cachePaolo Bonzini2012-12-201-21/+28
| | | | | | | | | Most of the time, only 2 items will be active (from/to for a string operation, or code/data). But TCG guests likely won't have gigabytes of memory, so this actually goes down to 1 item. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* softmmu: move include files to include/sysemu/Paolo Bonzini2012-12-191-3/+3
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* misc: move include files to include/qemu/Paolo Bonzini2012-12-191-3/+3
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* exec: move include files to include/exec/Paolo Bonzini2012-12-191-4/+4
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* janitor: do not rely on indirect inclusions of or from qemu-char.hPaolo Bonzini2012-12-191-0/+1
| | | | | | | | | Various header files rely on qemu-char.h including qemu-config.h or main-loop.h, but they really do not need qemu-char.h at all (particularly interesting is the case of the block layer!). Clean this up, and also add missing inclusions of qemu-char.h itself. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* exec: move TB handling to translate-all.cBlue Swirl2012-12-161-1711/+2
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* exec: extract TB watchpoint checkBlue Swirl2012-12-161-8/+14
| | | | | | Will be moved by the next patch. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* exec: fix coding styleBlue Swirl2012-12-161-68/+110
| | | | | | Fix coding style in areas to be moved by later patches. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* exec: Advise huge pages for the TCG code gen bufferRichard Henderson2012-12-081-0/+2
| | | | | | | | After allocating 32MB or more contiguous memory, huge pages would seem to be ideal. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* dma: Define dma_context_memory and use in sysbus-ohciPeter Maydell2012-11-121-0/+5
| | | | | | | | | | | | Define a new global dma_context_memory which is a DMAContext corresponding to the global address_space_memory AddressSpace. This can be used by sysbus peripherals like sysbus-ohci which need to do DMA. In particular, use it in the sysbus-ohci device, which fixes a segfault when attempting to use that device. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
* Merge branch 'trivial-patches' of git://github.com/stefanha/qemuBlue Swirl2012-11-031-6/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'trivial-patches' of git://github.com/stefanha/qemu: pc: Drop redundant test for ROM memory region exec: make some functions static target-ppc: make some functions static ppc: add missing static vnc: add missing static vl.c: add missing static target-sparc: make do_unaligned_access static m68k: Return semihosting errno values correctly cadence_uart: More debug information Conflicts: target-m68k/m68k-semi.c
| * exec: make some functions staticBlue Swirl2012-11-011-6/+9
| | | | | | | | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* | tcg: Add extended GETPC mechanism for MMU helpers with ldst optimizationYeongkyoon Lee2012-11-031-0/+11
| | | | | | | | | | | | | | | | | | Add GETPC_EXT which is used by MMU helpers to selectively calculate the code address of accessing guest memory when called from a qemu_ld/st optimized code or a C function. Currently, it supports only i386 and x86-64 hosts. Signed-off-by: Yeongkyoon Lee <yeongkyoon.lee@samsung.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | cpu: Move thread_id to CPUStateAndreas Färber2012-10-311-1/+4
| | | | | | | | Signed-off-by: Andreas Färber <afaerber@suse.de>
* | cpus: Pass CPUState to qemu_cpu_kick()Andreas Färber2012-10-311-1/+1
| | | | | | | | | | | | CPUArchState is no longer needed there. Signed-off-by: Andreas Färber <afaerber@suse.de>
* | cpus: Pass CPUState to qemu_cpu_is_self()Andreas Färber2012-10-311-1/+2
|/ | | | | | | | | Change return type to bool, move to include/qemu/cpu.h and add 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 hwaddrAvi Kivity2012-10-231-81/+81
| | | | | | | | | | | | | | | target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are reserved) and its purpose doesn't match the name (most target_phys_addr_t addresses are not target specific). Replace it with a finger-friendly, standards conformant hwaddr. Outstanding patchsets can be fixed up with the command git rebase -i --exec 'find -name "*.[ch]" | xargs s/target_phys_addr_t/hwaddr/g' origin Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Call MADV_HUGEPAGE for guest RAM allocationsLuiz Capitulino2012-10-221-0/+1
| | | | | | | | | This makes it possible for QEMU to use transparent huge pages (THP) when transparent_hugepage/enabled=madvise. Otherwise THP is only used when it's enabled system wide. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'quintela/migration-next-20121017' into stagingAnthony Liguori2012-10-221-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * quintela/migration-next-20121017: (41 commits) cpus: create qemu_in_vcpu_thread() savevm: make qemu_file_put_notify() return errors savevm: un-export qemu_file_set_error() block-migration: handle errors with the return codes correctly block-migration: Switch meaning of return value block-migration: make flush_blks() return errors buffered_file: buffered_put_buffer() don't need to set last_error savevm: Only qemu_fflush() can generate errors savevm: make qemu_fill_buffer() be consistent savevm: unexport qemu_ftell() savevm: unfold qemu_fclose_internal() savevm: make qemu_fflush() return an error code savevm: Remove qemu_fseek() virtio-net: use qemu_get_buffer() in a temp buffer savevm: unexport qemu_fflush migration: make migrate_fd_wait_for_unfreeze() return errors buffered_file: make buffered_flush return the error code buffered_file: callers of buffered_flush() already check for errors buffered_file: We can access directly to bandwidth_limit buffered_file: unfold migrate_fd_close ...
| * ram: Export last_ram_offset()Juan Quintela2012-10-171-1/+1
| | | | | | | | | | | | | | | | Is the only way of knowing the RAM size. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* | Merge remote-tracking branch 'qemu-kvm/memory/dma' into stagingAnthony Liguori2012-10-221-184/+133
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qemu-kvm/memory/dma: (23 commits) pci: honor PCI_COMMAND_MASTER pci: give each device its own address space memory: add address_space_destroy() dma: make dma access its own address space memory: per-AddressSpace dispatch s390: avoid reaching into memory core internals memory: use AddressSpace for MemoryListener filtering memory: move tcg flush into a tcg memory listener memory: move address_space_memory and address_space_io out of memory core memory: manage coalesced mmio via a MemoryListener xen: drop no-op MemoryListener callbacks kvm: drop no-op MemoryListener callbacks xen_pt: drop no-op MemoryListener callbacks vfio: drop no-op MemoryListener callbacks memory: drop no-op MemoryListener callbacks memory: provide defaults for MemoryListener operations memory: maintain a list of address spaces memory: export AddressSpace memory: prepare AddressSpace for exporting xen_pt: use separate MemoryListeners for memory and I/O ...
| * | memory: add address_space_destroy()Avi Kivity2012-10-221-0/+10
| | | | | | | | | | | | | | | | | | | | | Since address spaces can be created dynamically by device hotplug, they can also be destroyed dynamically. Signed-off-by: Avi Kivity <avi@redhat.com>
| * | memory: per-AddressSpace dispatchAvi Kivity2012-10-221-67/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we use a global radix tree to dispatch memory access. This only works with a single address space; to support multiple address spaces we make the radix tree a member of AddressSpace (via an intermediate structure AddressSpaceDispatch to avoid exposing too many internals). A side effect is that address_space_io also gains a dispatch table. When we remove all the pre-memory-API I/O registrations, we can use that for dispatching I/O and get rid of the original I/O dispatch. Signed-off-by: Avi Kivity <avi@redhat.com>
| * | memory: use AddressSpace for MemoryListener filteringAvi Kivity2012-10-221-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Using the AddressSpace type reduces confusion, as you can't accidentally supply the MemoryRegion you're interested in. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
| * | memory: move tcg flush into a tcg memory listenerAvi Kivity2012-10-221-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We plan to make the core listener listen to all address spaces; this will cause many more flushes than necessary. Prepare for that by moving the flush into a tcg-specific listener. Later we can avoid registering the listener if tcg is disabled. Signed-off-by: Avi Kivity <avi@redhat.com>
| * | memory: move address_space_memory and address_space_io out of memory coreAvi Kivity2012-10-221-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | With this change, memory.c no longer knows anything about special address spaces, 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: manage coalesced mmio via a MemoryListenerAvi Kivity2012-10-221-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of calling a global function on coalesced mmio changes, which routes the call to kvm if enabled, add coalesced mmio hooks to MemoryListener and make kvm use that instead. The motivation is support for multiple address spaces (which means we we need to filter the call on the right address space) but the result is cleaner as well. Signed-off-by: Avi Kivity <avi@redhat.com>
| * | memory: drop no-op MemoryListener callbacksAvi Kivity2012-10-151-96/+0
| | | | | | | | | | | | | | | | | | Removes quite a bit of useless code. Signed-off-by: Avi Kivity <avi@redhat.com>
| * | memory: rename 'exec-obsolete.h'Avi Kivity2012-10-151-2/+1
| |/ | | | | | | | | | | | | | | | | | | | | exec-obsolete.h used to hold pre-memory-API functions that were used from device code prior to the transition to the memory API. Now that the transition is complete, the name no longer describes the file. The functions still need to be merged better into the memory core, but there's no danger of anyone using them. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* | exec: Make MIN_CODE_GEN_BUFFER_SIZE private to exec.cRichard Henderson2012-10-201-0/+4
| | | | | | | | | | | | | | | | It is used nowhere else, and the corresponding MAX_CODE_GEN_BUFFER_SIZE also lives there. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | exec: Allocate code_gen_prologue from code_gen_bufferRichard Henderson2012-10-201-19/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We had a hack for arm and sparc, allocating code_gen_prologue to a special section. Which, honestly does no good under certain cases. We've already got limits on code_gen_buffer_size to ensure that all TBs can use direct branches between themselves; reuse this limit to ensure the prologue is also reachable. As a bonus, we get to avoid marking a page of the main executable's data segment as executable. 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 -fpieRichard Henderson2012-10-201-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hard-coded addresses inside alloc_code_gen_buffer only make sense if we're building an executable that will actually run at the address we've put into the linker scripts. When we're building with -fpie, the executable will run at some random location chosen by the kernel. We get better placement for the code_gen_buffer if we allow the kernel to place the memory, as it will tend to to place it near the executable, based on the PROT_EXEC bit. Since code_gen_prologue is always inside the executable, this effect is easily seen at the end of most TB, with the exit_tb opcode, and with any calls to helper functions. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | exec: Don't make DEFAULT_CODE_GEN_BUFFER_SIZE too largeRichard Henderson2012-10-201-1/+5
| | | | | | | | | | | | | | 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: Split up and tidy code_gen_bufferRichard Henderson2012-10-201-92/+103
|/ | | | | | | | | | | | | | | | 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 for choosing a buffer size, Three variations of a function alloc_code_gen_buffer that contain all of the logic for allocating executable memory via a given allocation mechanism. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* cpu_dump_state: move DUMP_FPU and DUMP_CCOP flags from x86-only to genericPeter Maydell2012-10-051-10/+2
| | | | | | | | | | | Move the DUMP_FPU and DUMP_CCOP flags for cpu_dump_state() from being x86-specific flags to being generic ones. This allows us to drop some TARGET_I386 ifdefs in various places, and means that we can (potentially) be more consistent across architectures about which monitor commands or debug abort printouts include FPU register contents and info about QEMU's condition-code optimisations. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
OpenPOWER on IntegriCloud