History | View | Annotate | Download (76.4 kB)
exec: Remove unneeded include files
This file does not depend on windows.h.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
exec: Make cpu_memory_rw_debug use the CPUs AS
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
exec: Make cpu_physical_memory_write_rom input an AS
exec: Make stb_phys input an AddressSpace
exec: Make stw_*_phys input an AddressSpace
exec: Make stl_phys_notdirty input an AddressSpace
exec: Make stl_*_phys input an AddressSpace
exec: Make stq_*_phys input an AddressSpace
exec: Make lduw_*_phys input an AddressSpace
exec: Make ldq/ldub_*_phys input an AddressSpace
exec: Make ldl_*_phys input an AddressSpace
exec: On AS changes, only flush affected CPU TLBs
cpu: Add per-cpu address space
exec: Make memory_region_section_get_iotlb use section AS
exec: Always initialize MemorySection address spaces
exec: Make iotlb_to_region input an AS
exec: Make tb_invalidate_phys_addr input an AS
No functional change.
memory: fix limiting of translation at a page boundary
Commit 360e607 (address_space_translate: do not cross page boundaries,2014-01-30) broke MMIO accesses in cases where the section is shorterthan the full register width. This can happen for example with the...
address_space_translate: do not cross page boundaries
The following commit:
commit 149f54b53b7666a3facd45e86eece60ce7d3b114Author: Paolo Bonzini <pbonzini@redhat.com>Date: Fri May 24 12:59:37 2013 +0200
memory: add address_space_translate
breaks Xen support in QEMU, in particular the Xen mapcache. The effect...
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
memory: cpu_physical_memory_mask_dirty_range() always clears a single flag
Document it
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>
memory: only resize dirty bitmap when memory size increases
memory: split dirty bitmap into three
After all the previous patches, spliting the bitmap gets direct.
Note: For some reason, I have to move DIRTY_MEMORY_* definitions tothe beginning of memory.h to make compilation work.
Signed-off-by: Juan Quintela <quintela@redhat.com>...
memory: s/mask/clear/ cpu_physical_memory_mask_dirty_range
Now all functions use the same wording that bitops/bitmap operations
memory: s/dirty/clean/ in cpu_physical_memory_is_dirty()
All uses except one really want the other meaning.
memory: make cpu_physical_memory_reset_dirty() take a length parameter
We have an end parameter in all the callers, and this make it coherentwith the rest of cpu_physical_memory_* functions, that also take alength parameter.
Once here, move the start/end calculation to...
memory: cpu_physical_memory_set_dirty_tracking() should return void
Result was always 0, and not used anywhere. Once there, use bool typefor the parameter.
memory: split cpu_physical_memory_* functions to its own include
All the functions that use ram_addr_t should be here.
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>
exec: use accessor function to know if memory is dirty
Signed-off-by: Juan Quintela <quintela@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
exec: create function to get a single dirty bit
memory: make cpu_physical_memory_is_dirty return bool
memory: set single dirty flags when possible
memory: cpu_physical_memory_set_dirty_range() always dirty all flags
So remove the flag argument and do it directly. After this change,there is nothing else using cpu_physical_memory_set_dirty_flags() soremove it.
mempath prefault: fix off-by-one error
Fix off-by-one error (noticed by Andrea Arcangeli).
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
roms: Flush icache when writing roms to guest memory
We use the rom infrastructure to write firmware and/or initial kernelblobs into guest address space. So we're basically emulating the cacheoff phase on very early system bootup.
That phase is usually responsible for clearing the instruction cache for...
exec: separate sections and nodes per address space
Every address space has its own nodes and sections, butit uses the same global arrays of nodes/section.
This limits the number of devices that can be attachedto the guest to 20-30 devices. It happens because:...
split definitions for exec.c and translate-all.c radix trees
The exec.c and translate-all.c radix trees are quite different, andthe exec.c one in particular is not limited to the CPU---it can beused also by devices that do DMA, and in that case the address space...
exec: replace leaf with skip
In preparation for dynamic radix tree depth support, rename is_leaffield to skip, telling us how many bits to skip to next level.Set to 0 for leaf.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
exec: extend skip field to 6 bit, page entry to 32 bit
Extend skip to 6 bit. As page entry doesn't fit in 16 bitany longer anyway, extend it to 32 bit.This doubles node map memory requirements, but follow-uppatches will save this memory.
exec: pass hw address to phys_page_find
callers always shift by target page bits so let's just do thisinternally.
exec: memory radix tree page level compression
At the moment, memory radix tree is already variable width, but it canonly skip the low bits of address.
This is efficient if we have huge memory regions but inefficient if weare only using a tiny portion of the address space....
exec: make address spaces 64-bit wide
As an alternative to commit 818f86b (exec: limit system memorysize, 2013-11-04) let's just make all address spaces 64-bit wide.This eliminates problems with phys_page_find ignoring bits aboveTARGET_PHYS_ADDR_SPACE_BITS and address_space_translate_internal...
exec: reduce L2_PAGE_SIZE
With the single exception of ppc with 16M pages,we get the same number of levelswith L2_PAGE_SIZE = 10 as with L2_PAGE_SIZE = 9.
by doing this we reduce memory footprint of a single levelin the node memory map by 2x without runtime overhead....
qemu: mempath: prefault pages manually (v4)
v4: s/fail/failed/ (Peter Maydell)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Merge remote-tracking branch 'mst/tags/for_anthony' into staging
pci, pc, virtio bug fixes
This reverts PCI master abort support - we'll want iteventually but it exposes too many core bugs to be safe for 1.7.This also reverts a recent exec.c change that was an...
Revert "exec: limit system memory size"
This reverts commit 818f86b88394b7b2b59d313e51043fe15a8004db.
This was a work-around for bugs elsewhere in the system,exposed by commit a53ae8e934cd54686875b5bcfc2f434244ee55d6: "hw/pci: partially handle pci master abort"...
exec: fix breakpoint_invalidate when pc may not be translated
This fixes qemu abort with the following message:
include/qemu/int128.h:22: int128_get64: Assertion `!a.hi' failed.
which happens due to attempt to invalidate breakpoint by virtual address...
exec: limit system memory size
The page table logic in exec.c assumesthat memory addresses are at most TARGET_PHYS_ADDR_SPACE_BITS.
But pci addresses are full 64 bit so if we try to render them ignoringthe extra bits, we get strange effects with sections overlapping each...
exec: Fix bounce buffer allocation in address_space_map()
This fixes a regression introduced by commit e3127ae0c, which kept theallocation size of the bounce buffer limited to one page in order toavoid unbounded allocations (as explained in the commit message of...
exec: remove qemu_safe_ram_ptr
This is not needed since the RAM list is not modified anymore byqemu_get_ram_ptr. Replace it with qemu_get_ram_block.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
exec: Fix prototype of phys_mem_set_alloc and related functions
phys_mem_alloc and its assigned values qemu_anon_ram_alloc andlegacy_s390_alloc must have identical argument lists.
legacy_s390_alloc uses the size parameter to call mmap, so size_t isgood enough for all of them....
Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging
QOM CPUState refactorings / X86CPU
cpu: Move cpu_copy() into linux-user
It is only used there and is deemed very fragile if not incorrect in itscurrent memcpy() form. Moving it into linux-user will allow to moveparts into target_cpu.h headers and only copy what the ABI mandates.
Signed-off-by: Andreas Färber <afaerber@suse.de>
exec: cleanup DEBUG_SUBPAGE
Touched some error after enabling DEBUG_SUBPAGE.
Signed-off-by: Amos Kong <akong@redhat.com>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Merge remote-tracking branch 'mjt/trivial-patches' into staging
exec: Fix broken build for MinGW (regression)
Commit 3435f39513a104294b5e3bbf3612047028d25cfc reduced the ifdeffery withthis result for MinGW:
exec.c: In function ‘qemu_ram_free’:exec.c:1239:17: warning: implicit declaration of function ‘munmap’ [-Wimplicit-function-declaration]...
exec: always use MADV_DONTFORK
MADV_DONTFORK prevents fork to fail with -ENOMEM if the defaultovercommit heuristics decides there's too much anonymous virtualmemory allocated. If the KVM secondary MMU is synchronized with MMUnotifiers or not, doesn't make a difference in that regard....
exec: Clean up unnecessary S390 ifdeffery
Another issue missed in commit fdec991 is -mem-path: it needs to berejected only for old S390 KVM, not for any S390. Not that Ipersonally care, but the ifdeffery in qemu_ram_alloc_from_ptr() annoysme.
Note that this doesn't actually make -mem-path work, as the kernel...
exec: Don't abort when we can't allocate guest memory
We abort() on memory allocation failure. abort() is appropriate forprogramming errors. Maybe most memory allocation failures areprogramming errors, maybe not. But guest memory allocation failureisn't, and aborting when the user asks for more memory than we can...
exec: Fix Xen RAM allocation with unusual options
Issues:
exec: Clean up fall back when -mem-path allocation fails
With -mem-path, qemu_ram_alloc_from_ptr() first tries to allocateaccordingly, but when it fails, it falls back to normal allocation.
The fall back allocation code used to be effectively identical to the...
exec: Reduce ifdeffery around -mem-path
Instead of spreading its ifdeffery everywhere, confine it toqemu_ram_alloc_from_ptr(). Everywhere else, simply test block->fd,which is non-negative exactly when block uses -mem-path.
Signed-off-by: Markus Armbruster <armbru@redhat.com>...
exec: Simplify the guest physical memory allocation hook
Make it a generic hook rather than a KVM hook. Less code andifdeffery.
Since the only user of the hook is old S390 KVM, there's hope we canget rid of it some day.
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>...
exec: Drop incorrect & dead S390 code in qemu_ram_remap()
Old S390 KVM wants guest RAM mapped in a peculiar way. Commit 6b02494implemented that.
When qemu_ram_remap() got added in commit cd19cfa, its code carefullymimicked the allocation code: peculiar way if defined(TARGET_S390X) &&...
exec: do tcg_commit only when tcg_enabled
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
memory: Provide separate handling of unassigned io ports accesses
Accesses to unassigned io ports shall return -1 on read and be ignoredon write. Ensure these properties via dedicated ops, decoupling us fromthe memory core's handling of unassigned accesses....
exec: check offset_within_address_space for register subpage
If offset_within_address_space falls in a page, then we register asubpage. So check offset_within_address_space rather thanoffset_within_region.
Cc: qemu-stable@nongnu.orgCc: Paolo Bonzini <pbonzini@redhat.com>...
exec: fix writing to MMIO area with non-power-of-two length
The problem is introduced by commit 2332616 (exec: Support 64-bitoperations in address_space_rw, 2013-07-08). Before that commit,memory_access_size would only return 1/2/4.
Since alignment is already handled above, reduce l to the largest...
cpu: Use QTAILQ for CPU list
Introduce CPU_FOREACH(), CPU_FOREACH_SAFE() and CPU_NEXT() shorthandmacros.
cpu: Replace qemu_for_each_cpu()
It was introduced to loop over CPUs from target-independent code, butsince commit 182735efaf956ccab50b6d74a4fed163e0f35660 target-independentCPUState is used.
A loop can be considered more efficient than function calls in a loop,...
cpu: Fix VMSTATE_CPU() semantics
Commit 1a1562f5ea3da17d45d3829e35b5f49da9ec2db5 prepared a VMSTATE_CPU()macro for device-style VMStateDescription registration, but missed toadapt cpu_exec_init(), so that the "cpu_common" VMStateDescription wasstill registered for AlphaCPU (fe31e7374299c0c6172ce618b29bf2fecbd881c7)...
kvm: Change prototype of kvm_update_guest_debug()
Passing a CPUState pointer instead of a CPUArchState pointer eliminatesthe last target dependent data type in sysemu/kvm.h.
It also simplifies the code.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Acked-by: Paolo Bonzini <pbonzini@redhat.com>...
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging
linux-user: Reset copied CPUs in cpu_copy() always
When a new thread gets created, we need to reset non arch specific state toget the new CPU into clean state.
However this reset should happen before the arch specific CPU contents getcopied over. Otherwise we end up having clean reset state in our newly created...
cpu: Turn cpu_get_phys_page_debug() into a CPUClass hook
Change breakpoint_invalidate() argument to CPUState alongside.
Since all targets now assign a softmmu-only field, we can drop helperscpu_class_set_{do_unassigned_access,vmsd}() and device_class_set_vmsd()....
exec: Change cpu_memory_rw_debug() argument to CPUState
Propagate X86CPU in kvmvapic for simplicity.
cpu: Move singlestep_enabled field from CPU_COMMON to CPUState
Prepares for changing cpu_single_step() argument to CPUState.
Acked-by: Michael Walle <michael@walle.cc> (for lm32)Signed-off-by: Andreas Färber <afaerber@suse.de>
cpu: Change cpu_single_step() argument to CPUState
Use CPUState::env_ptr for now.
Needed for GdbState::c_cpu.
exec.c: Pass correct pointer type to qemu_ram_ptr_length
Commit e3127ae0 introduced a problem where we're passing ahwaddr* to qemu_ram_ptr_length() but it wants a ram_addr_t*;this will cause problems on 32 bit hosts and in any caseprovokes a clang warning on MacOSX:...
exec: fix incorrect assumptions in memory_access_size
access_size_min can be 1 because erroneous accesses must not crashQEMU, they should trigger exceptions in the guest or just returngarbage (depending on the CPU). I am not sure I understand thecomment: placing a 4-byte field at the last byte of a region...
exec: Support 64-bit operations in address_space_rw
Honor the implementation maximum access size, and at least checkthe minimum access size.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Richard Henderson <rth@twiddle.net>
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.
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: 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...