History | View | Annotate | Download (72.1 kB)
Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging
QOM CPUState refactorings
log: Change log_cpu_state[_mask]() argument to CPUState
Since commit 878096eeb278a8ac1ccd6667af73e026f29b4cf5 (cpu: Turncpu_dump_{state,statistics}() into CPUState hooks) CPUArchState is nolonger needed.
Add documentation and make the functions available through qemu/log.h...
cpu: Make first_cpu and next_cpu CPUState
Move next_cpu from CPU_COMMON to CPUState.Move first_cpu variable to qom/cpu.h.
gdbstub needs to use CPUState::env_ptr for now.cpu_copy() no longer needs to save and restore cpu_next.
Acked-by: Paolo Bonzini <pbonzini@redhat.com>...
cpu: Replace cpu_single_env with CPUState current_cpu
Move it to qom/cpu.h.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Simplify -machine option queries with qemu_get_machine_opts()
The previous two commits fixed bugs in -machine option queries. Ican't find fault with the remaining queries, but let's useqemu_get_machine_opts() everywhere, for consistency, simplicity and...
exec: Remove unused global variable phys_ram_fd
It seems to be unused since several years (commitbe995c27640a82c7056b6f53d02ec823570114e5 in 2006).
Signed-off-by: Stefan Weil <sw@weilnetz.de>Reviewed-by: Andreas Färber <afaerber@suse.de>Message-id: 1373044036-14443-1-git-send-email-sw@weilnetz.de...
exec: remove cur_map
cur_map is not used anymore; instead, each AddressSpaceDispatchhas its own nodes/sections pair. The priorities of theMemoryListeners, and in the future RCU, guarantee that thenodes/sections are not freed while they are still in use....
exec: change some APIs to take AddressSpaceDispatch
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec: change well-known physical sections to macros
Sections like phys_section_unassigned always have fixed addressin phys_sections. Declared as macro, so we can use themwhen having more than one phys_sections array.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>...
exec: separate current memory map from the one being built
Currently, phys_node_map and phys_sections are shared by allof the AddressSpaceDispatch. When updating mem topology, allAddressSpaceDispatch will rebuild dispatch tables sequentiallyon them. In order to prepare for RCU access, leave the old...
exec: move listener from AddressSpaceDispatch to AddressSpace
This will help having two copies of AddressSpaceDispatch during therecreation of the radix tree (one being built, and one that is completeand will be protected by RCU). We do not want to have to unregister and...
exec: separate current radix tree from the one being built
This same treatment previously done to phys_node_map and phys_sectionsis now applied to the dispatch field of AddressSpace. Topology updatesuse as->next_dispatch while accesses use as->dispatch....
exec: put memory map in AddressSpaceDispatch
After this patch, AddressSpaceDispatch holds a constistent tuple of(phys_map, nodes, sections). This will be important when updatesof the topology will run concurrently with reads.
cur_map is not used anymore except for freeing it at the end of the...
memory: return MemoryRegion from qemu_ram_addr_from_host
It will be needed in the next patch.
exec: reorganize address_space_map
First of all, rename "todo" to "done".
Second, clearly separate the case of done == 0 with the case of done != 0.This will help handling reference counting in the next patch.
Third, this test:
if (memory_region_get_ram_addr(mr) + xlat != raddr + todo) {...
memory: ref/unref memory across address_space_map/unmap
The iothread mutex might be released between map and unmap, so themapped region might disappear.
exec: simplify destruction of the phys map
Do not bother visiting the radix tree when an address space is destroyed.After the previous patch, this has become a pointless exercise. Whencalled from address_space_destroy_dispatch, all you're doing is zeroing...
memory: add ref/unref calls
Add ref/unref calls at the following places:
- places where memory regions are stashed by a listener and used outside the BQL (including in Xen or KVM).
- memory_region_find callsites
- creation of aliases and containers (only the aliased/contained...
exec: check MRU in qemu_ram_addr_from_host
This function is not used outside the iothread mutex, so itcan use ram_list.mru_block.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec: move qemu_ram_addr_from_host_nofail to cputlb.c
After the next patch it would not be used elsewhere anyway. Also,the _nofail and the standard versions of this function return differentthings, which is confusing. Removing the function from the public headers...
ioport: Switch dispatching to memory core layer
The current ioport dispatcher is a complex beast, mostly due to theneed to deal with old portio interface users. But we can overcome itwithout converting all portio users by embedding the required baseaddress of a MemoryRegionPortio access into that data structure. That...
memory: add owner argument to initialization functions
memory: destroy phys_sections one by one
phys_sections_clear is invoked after the dispatch tree has beendestroyed. This leaves a window where phys_sections_nb > 0 but thesubpages are not valid anymore, which is a recipe for use-after-freebugs.
Move the destruction of subpages in phys_sections_clear. We will...
cpu: Change cpu_exit() argument to CPUState
It no longer depends on CPUArchState, so move it to qom/cpu.c.
Prepares for changing GDBState::c_cpu to CPUState.
cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks
Make cpustats monitor command available unconditionally.
Prepares for changing kvm_handle_internal_error() and kvm_cpu_exec()arguments to CPUState.
cpu: Introduce VMSTATE_CPU() macro for CPUState
To be used to embed common CPU state into CPU subclasses.
Reviewed-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
linux-user: Fix compilation failure
Fix compilation failures for linux-user targets following recentmigration related commits bd2fa51fcd and 43487c67.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Message-id: 1372362818-4740-1-git-send-email-peter.maydell@linaro.org...
rdma: introduce qemu_ram_foreach_block()
This is used during RDMA initialization in order totransmit a description of all the RAM blocks to thepeer for later dynamic chunk registration purposes.
Reviewed-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>...
dma: eliminate DMAContext
The DMAContext is a simple pointer to an AddressSpace that is now alwaysalready available. Make everyone hold the address space directly,and clean up the DMA API to use the AddressSpace directly.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>...
memory: give name to every AddressSpace
The "info mtree" command in QEMU console prints only "memory" and "I/O" address spaces while there are actually a lot more other AddressSpacestructs created by PCI and VIO devices. Those devices do not normallyhave names and therefore not present in "info mtree" output....
exec: reorganize mem_add to match Int128 version
When adding support for 2^64-byte sections, we will have to changethe structure of mem_add to avoid failures in int128_get64.Reorganize the code now before introducing Int128.
memory: make section size a 128-bit integer
So far, the size of all regions passed to listeners could fit in 64 bits,because artificial regions (containers and aliases) are eliminated bythe memory core, leaving only device regions which have reasonable sizes...
memory: iommu support
Add a new memory region type that translates addresses it is given,then forwards them to a target address space. This is similar toan alias, except that the mapping is more flexible than a lineartranslation and trucation, and also less efficient since the...
dma: eliminate old-style IOMMU support
The translate function in the DMAContext is now always NULL.Remove every reference to it.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec.c: address_space_translate: handle access to addr 0 of 2^64 sized region
The memory API allows a MemoryRegion's size to be 2^64, as a specialcase (otherwise the size always fits in a 64 bit integer). This meantthat attempts to access address zero in a 2^64 sized region would...
memory: Introduce address_space_lookup_region
This introduces a wrapper for phys_page_find (before we complicateaddress_space_translate with IOMMU translation). This function willalso encapsulate locking and reference counting when we introduceBQL-free dispatching....
memory: move private types to exec.c
exec: Allow unaligned address_space_rw
This will be needed for some corner cases with para-virtual I/O ports.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec: Resolve subpages in one step except for IOTLB fills
Except for the case of setting the IOTLB entry in TCG mode, we can avoidthe subpage dispatching handlers and do the resolution directly onaddress_space_lookup_region. An IOTLB entry describes a full page, not...
exec: Implement subpage_read/write via address_space_rw
This will allow to add support for unaligned memory regions: the subpagecontainer region can activate unaligned support unconditionally becausethe read/write handler will now ensure that accesses are split as...
exec: return MemoryRegion from address_space_translate
Only address_space_translate_for_iotlb needs to return the section.Every caller of address_space_translate now uses only section->mr,return it directly.
Revert "memory: limit sections in the radix tree to the actual address space size"
This reverts commit 86a8623692b1b559a419a92eb8b6897c221bca74.
memory: add return value to address_space_rw/read/write
Reviewed-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
memory: propagate errors on I/O dispatch
exec: just use io_mem_read/io_mem_write for 8-byte I/O accesses
The memory API is able to split it in two 4-byte accesses.
memory: correctly handle endian-swapped 64-bit accesses
memory: add address_space_access_valid
The old-style IOMMU lets you check whether an access is valid in agiven DMAContext. There is no equivalent for AddressSpace in thememory API, implement it with a lookup of the dispatch tree.
Reviewed-by: Richard Henderson <rth@twiddle.net>...
exec: implement .valid.accepts for subpages
exec: introduce memory_access_size
This will be used by address_space_access_valid too.
exec: introduce memory_access_is_direct
After the previous patches, this is a common test for all read/writefunctions.
exec: expect mr->ops to be initialized for ROM
There is no need to use the special phys_section_rom section.
memory: move unassigned_mem_ops to memory.c
reservation_ops is already doing the same thing.
memory: add address_space_translate
Using phys_page_find to translate an AddressSpace to a MemoryRegionSectionis unwieldy. It requires to pass the page index rather than the address,and later memory_region_section_addr has to be called. Replacememory_region_section_addr with a function that does all of it: call...
memory: dispatch unassigned accesses based on .valid.accepts
This provides the basics for detecting accesses to unassigned memoryas soon as they happen, and also for a simple implementation ofaddress_space_access_valid.
exec: do not use error_mem_read
We will soon reach this case when doing (unaligned) accesses thatspan partly past the end of memory. We do not want to crash inthat case.
unassigned_mem_ops and rom_mem_ops are now the same.
exec: make io_mem_unassigned private
There is no reason to avoid a recompile before accessing unassignedmemory. In the end it will be treated as MMIO anyway.
exec: drop useless #if
This code is only compiled for softmmu targets.
exec: eliminate io_mem_ram
It is never used, the IOTLB always goes through io_mem_notdirty.
In fact in softmmu_template.h, if it were, QEMU would crash justbelow the tests, as soon as io_mem_read/write dispatches toerror_mem_read/write.
memory: clean up phys_page_find
Remove the goto.
memory: limit sections in the radix tree to the actual address space size
The radix tree is statically sized to fit TARGET_PHYS_ADDR_SPACE_BITS.If a larger memory region is registered, it will overflow.
Fix by limiting any section in the radix tree to the supported size....
memory: assert that PhysPageEntry's ptr does not overflow
While sized to 15 bits in PhysPageEntry, the ptr field is ORed into theiotlb entries together with a page-aligned pointer. The ptr field mustnot overflow into this page-aligned value, assert that it is smaller than...
exec: eliminate stq_phys_notdirty
It is not used anywhere.
exec: eliminate qemu_put_ram_ptr
exec: remove obsolete comment
See how we call memory_region_section_addr two lines below toconvert a physical address to a base address in the region.
osdep, kvm: rename low-level RAM allocation functions
This is preparatory to the introduction of a separate freeing API.
Reported-by: Amos Kong <akong@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Amos Kong <akong@redhat.com>...
osdep: introduce qemu_anon_ram_free to free qemu_anon_ram_alloc-ed memory
We switched from qemu_memalign to mmap() but then we don't modifyqemu_vfree() to do a munmap() over free(). Which we cannot dobecause qemu_vfree() frees memory allocated by qemu_{mem,block}align....
cpu: Add qemu_for_each_cpu()
Wrapper to avoid open-coded loops and to make CPUState iterationindependent of CPUArchState.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Igor Mammedov <imammedo@redhat.com>Signed-off-by: Andreas Färber <afaerber@suse.de>
hw: move headers to include/
Many of these should be cleaned up with proper qdev-/QOM-ification.Right now there are many catch-all headers in include/hw/ARCH dependingon cpu.h, and this makes it necessary to compile these files per-target.However, fixing this does not belong in these patches....
exec: assert that RAMBlock size is non-zero
find_ram_offset() does not handle size=0 gracefully. It hands out thesame RAMBlock offset multiple times, leading to obscure failures lateron.
Add an assert to warn early if something is incorrectly allocating a...
Merge remote-tracking branch 'afaerber/qom-cpu' into staging
exec: make -mem-path filenames deterministic
Adds ramblocks' names to their backing files when using -mem-path. Easesintrospection and debugging.
Signed-off-by: Peter Feiner <peter@gridcentric.ca>Message-id: 1362423265-15855-1-git-send-email-peter@gridcentric.ca...
cpu: Move halted and interrupt_request fields to CPUState
Both fields are used in VMState, thus need to be moved together.Explicitly zero them on reset since they were located beforebreakpoints.
Pass PowerPCCPU to kvmppc_handle_halt().
exec: Pass CPUState to cpu_reset_interrupt()
Move it to qom/cpu.c to avoid build failures depending on include orderof cpu-qom.h and exec/cpu-all.h.
Change opaques of various ..._irq_handler() functions to theappropriate CPU type to facilitate using cpu_reset_interrupt()....
cpu: Pass CPUState to cpu_interrupt()
Move it to qom/cpu.h to avoid issues with include order.
Change pc_acpi_smi_interrupt() opaque to X86CPU.
cpu: Register VMStateDescription through CPUState
In comparison to DeviceClass::vmsd, CPU VMState is split in two,"cpu_common" and "cpu", and uses cpu_index as instance_id instead of -1.Therefore add a CPU-specific CPUClass::vmsd field.
Unlike the legacy CPUArchState registration, rather register CPUState....
cpu: Fix qemu_get_cpu() to return NULL if CPU not found
Commit 55e5c2850 breaks CPU not found return value, and returnsCPU corresponding to the last non NULL env.Fix it by returning CPU only if env is not NULL, otherwise CPU isnot found and function should return NULL....
Handle CPU interrupts by inline checking of a flag
Fix some of the nasty TCG race conditions and crashes by implementingcpu_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()...
cpu: Move exit_request field to CPUState
Since it was located before breakpoints field, it needs to be reset.
cputlb: Pass CPUState to cpu_unlink_tb()
CPUArchState is no longer needed.
Replace non-portable asprintf by g_strdup_printf
g_strdup_printf already handles OOM errors, so some error handling inQEMU 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()
Move the declaration to qemu/cpu.h and add documentation.The implementation still depends on CPUArchState for CPU iteration.
cpu: Move numa_node field to CPUState
cpu: Move cpu_index field to CPUState
Note that target-alpha accesses this field from TCG, now using anegative 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()....
stubs: fully replace qemu-tool.c and qemu-user.c
Revert "virtio-pci: replace byte swap hack"
This reverts commit 9807caccd605d09a72495637959568d690e10175.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
virtio-pci: replace byte swap hack
Remove byte swaps by declaring the config spaceas native endian.
exec: change RAM list to a TAILQ
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Juan Quintela <quintela@redhat.com>
exec: sort the memory from biggest to smallest
add a version number to ram_list
This will be used to detect if last_block might have become invalidacross 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>...
protect the ramlist with a separate mutex
Add the new mutex that protects shared state between ram_save_liveand the iothread. If the iothread mutex has to be taken togetherwith the ramlist mutex, the iothread shall always be outside.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
exec: change ramlist from MRU order to a 1-item cache
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, sothis actually goes down to 1 item.
softmmu: move include files to include/sysemu/
misc: move include files to include/qemu/
exec: move include files to include/exec/
janitor: do not rely on indirect inclusions of or from qemu-char.h
Various header files rely on qemu-char.h including qemu-config.h ormain-loop.h, but they really do not need qemu-char.h at all (particularlyinteresting is the case of the block layer!). Clean this up, and also...
exec: move TB handling to translate-all.c
exec: extract TB watchpoint check
Will be moved by the next patch.
exec: fix coding style
Fix coding style in areas to be moved by later patches.
exec: Advise huge pages for the TCG code gen buffer
After allocating 32MB or more contiguous memory, huge pageswould 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-ohci
Define a new global dma_context_memory which is a DMAContext correspondingto the global address_space_memory AddressSpace. This can be used bysysbus peripherals like sysbus-ohci which need to do DMA....