History | View | Annotate | Download (51 kB)
memory: Fix copy&paste mistake in memory_region_iorange_write
The last argument of find_portio is "write", so this must be true here.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
memory: pass EventNotifier, not eventfd
Under Win32, EventNotifiers will not have event_notifier_get_fd, so wecannot call it in common code such as hw/virtio-pci.c. Pass a pointer tothe notifier, and only retrieve the file descriptor in kvm-specific code....
memory: check address space when a listener is registered
This patch resolves a bug in memory listener registration."range_add" callback was called on each section of the bothaddress space (IO and memory space) even if it doesn't matchthe address space filter....
memory: print aliased IO ranges in info mtree
Print also I/O ports behind bridges and other aliases.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>Signed-off-by: Avi Kivity <avi@redhat.com>
memory: get rid of cpu_register_io_memory()
The return value of cpu_register_io_memory() is no longer used anywhere, sowe can remove it and all associated data and code.
Signed-off-by: Avi Kivity <avi@redhat.com>
memory: dispatch directly via MemoryRegion
Instead of indirecting via io_mem_region, dispatch directlythrough the MemoryRegion obtained from the iotlb or phys_page_find().
memory: fix I/O port aliases
Commit e58ac72b6a0 ("ioport: change portio_list not to usememory_region_set_offset()") started using aliases of I/O memoryregions. Since the IORange used for the I/O was contained in thetarget region, the alias information (specifically, the offset...
memory: don't pass ->readable attribute to cpu_register_physical_memory_log
It can be derived from the MemoryRegion itself (which is why it is notused there).
Signed-off-by: Avi Kivity <avi@redhat.com>Reviewed-by: Richard Henderson <rth@twiddle.net>
memory: use a MemoryListener for core memory map updates too
This transforms memory.c into a library which can then be unit testedeasily, by feeding it inputs and listening to its outputs.
memory: drop AddressSpaceOps
All functionality has been moved to various MemoryListeners.
memory: allow MemoryListeners to observe a specific address space
Ignore any regions not belonging to a specified address space.
memory: support stateless memory listeners
Current memory listeners are incremental; that is, they are expected tomaintain their own state, and receive callbacks for changes to that state.
This patch adds support for stateless listeners; these work by receiving...
memory: remove memory_region_set_offset()
memory_region_set_offset() complicates the API, and has been deprecatedsince its introduction. Now that it is no longer used, remove it.
memory: add shorthand for invoking a callback on all listeners
memory: switch memory listeners to a QTAILQ
This allows reverse iteration, which in turns allows consistent orderingamong multiple listeners:
l1->add l2->add l2->del l1->del
memory: code motion: move MEMORY_LISTENER_CALL()
So it can be used in earlier code.
memory: move ioeventfd ops to MemoryListener
This way the accelerator (kvm) can handle them directly.
memory: add a readonly attribute to MemoryRegionSection
.readonly cannot be obtained from the MemoryRegion, since it isinherited from aliases (so you can have a MemoryRegion mapped RWat one address and RO at another). Record it in a MemoryRegionSection...
memory-region: Report if region is read-only or write-only on info mtree
Helpful to understand guest configurations of things like the i440FX'sPAM or the state of ROM devices.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
memory: change dirty getting API to take a size
Instead of each device knowing or guessing the guest page size,just pass the desired size of dirtied memory area.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
memory: change dirty setting APIs to take a size
Instead of each target knowing or guessing the guest page size,just pass the desired size of dirtied memory area.
memory: Introduce memory_region_init_reservation
Introduce a memory region type that can reserve I/O space. Such regionsare useful for modeling I/O that is only handled outside of QEMU, i.e.in the context of an accelerator like KVM.
Any access to such a region from QEMU is a bug, but could theoretically...
prepare for future GPLv2+ relicensing
All files under GPLv2 will get GPLv2+ changes starting tomorrow.event_notifier.c and exec-obsolete.h were only ever touched by Red Hatemployees and can be relicensed now.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
memory: Fix adjust_endianness()
Commit a621f38de85598a13d8d8524d1a94fc6a1818215 (Direct dispatchthrough MemoryRegion) moved byte swaps to a central function.
Add a missing break, so that long-sized byte swaps don't abort.
Signed-off-by: Andreas Färber <afaerber@suse.de>...
memory: Fix memory_region_wrong_endianness()
Since commit be675c972088eba210e18dc125613e9f205a6bfb (memory: moveendianness compensation to memory core) it was checking forTARGET_BIG_ENDIAN instead of TARGET_WORDS_BIGENDIAN, thereby notswapping correctly for Big Endian targets....
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.
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.
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.
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.
memory: remove MemoryRegion::backend_registered
backend_registered was used to lazify the process of registering anmmio region, since the it is different for the I/O address space andthe memory address space. However, it also makes registration dependent...
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.
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....
memory: introduce memory_region_name()
Trivial accessor for the name attribute.
memory: remove CPUPhysMemoryClient
No longer used.
memory: temporarily add memory_region_get_ram_addr()
This is a layering violation, but needed while the code containsnaked calls to qemu_get_ram_ptr() and the like.
memory: introduce memory_region_find()
Given an address space (represented by the top-level memory region),returns the memory region that maps a given range. Useful for implementingDMA.
The implementation is a simplistic binary search. Once we have a tree...
memory: replace cpu_physical_sync_dirty_bitmap() with a memory API
The function is still used as the implementation.
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...
kvm: switch kvm slots to use host virtual address instead of ram_addr_t
This simplifies a later switch to the memory API in slot management.
memory: add memory_region_is_ram()
memory: add memory_region_is_rom()
memory: add memory_region_is_logging()
Merge remote-tracking branch 'qemu-kvm/memory/exec-obsolete' into staging
Merge remote-tracking branch 'qemu-kvm/memory/xen' into staging
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.
memory: optimize empty transactions due to mutators
The mutating memory APIs can easily cause empty transactions,where the mutators don't actually change anything, or perhapsonly modify disabled regions. Detect these conditions andavoid regenerating the memory topology....
memory: introduce memory_region_set_alias_offset()
Add an API to update an alias offset of an active alias. This can beused to simplify implementation of dynamic memory banks.
memory: introduce memory_region_set_address()
Allow changing the address of a memory region while it isin the memory hierarchy.
memory: introduce memory_region_set_enabled()
This allows users to disable a memory region without removingit from the hierarchy, simplifying the implementation ofmemory routers.
memory: add MemoryRegionOps::valid.accepts
MemoryRegionOps::valid tries to declaratively specify which transactionsare accepted by the device/bus, however it is not completely generic. Adda callback for special cases.
memory: fix 'info mtree' segfaults
'info mtree' accesses invalid memory in two cases, both due to incorrect(and unsafe) usage of QTAILQ_FOREACH_SAFE().
Reported-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Avi Kivity <avi@redhat.com>
memory: use 128-bit integers for sizes and intermediates
Since the memory API supports 64-bit buses, it needs a larger type to representintermediate results.
memory: Fix old portio word accesses
As we register old portio regions via ioport_register, we are alsoresponsible for providing the word access wrapper.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Avi Kivity <avi@redhat.com>
Introduce PortioList
Add a type and methods for manipulating a list of disjoint I/O ports,used in some older hardware devices.
Based on original patch by Richard Henderson.
Signed-off-by: Richard Henderson <rth@twiddle.net>Signed-off-by: Avi Kivity <avi@redhat.com>
memory: Print region priority
Useful to discover eclipses.
memory: Do not print empty PIO root
memory: Print regions in ascending order
Makes reading the output more user friendly.
memory: simple memory tree printer
Add a monitor command 'info mtree' to show the memory hierarchymuch like /proc/iomem in Linux.
memory: implement memory_region_set_readonly()
The property is inheritable, but only if set to true. This is sothat memory routers can mark sections of RAM as read-only via aliases.
memory: fix subregion collision warning
Instead of the offset property use the proper addr property to calculatethe offsets.
Additionally, be a little more verbose on the warning and print thesubregion name.
Signed-off-by: Michael Walle <michael@walle.cc>...
Fix subtle integer overflow bug in memory API
It is quite common to have a MemoryRegion with size of INT64_MAX.When processing alias regions in render_memory_region() it's quiteeasy to find a case where it will construct a temporary AddrRange witha non-zero start, and size still of INT64_MAX. When means attempting...
memory: Fix memory_region_get_ram_ptr for ROM devices
Mask out the sub-page bits that are used by ROM device for storing theio-index and the IO_MEM_ROMD flag.
memory: fix rom_device I/O mode
When adding a rom_device in I/O mode, we incorrectly masked off the lowbits, resulting in a pure RAM map. Fix my masking off the high bits andIO_MEM_ROMD, yielding a pure I/O map.
memory: add opaque parameter to memory_region_init_rom_device()
The MemoryRegionOps callbacks expect it.
memory: fix memory_region_init_rom_device() not initializing ->ops
memory: Fix old_portio vs non-zero offset
The legacy functions that we're wrapping expect that offsetto be included in the register. Indeed, they generallyexpect the absolute address and then mask off the "high" bits.
The FDC is the first converted device with a non-zero offset....
memory: temporarily suppress the subregion collision warning
After 312b4234, the APIC and PCI devices are colliding with each other. Thisis harmless in practice because the APIC accesses are special cased and nevermake there way onto the bus.
Avi is working on a proper fix, but until that's ready, avoid printing the...
memory: abstract cracking of write access ops into a function
The memory API automatically cracks large reads and writes into smallerones when needed. Factor out this mechanism, which is now duplicated betweenmemory reads and memory writes, into a function....
memory: crack wide ioport accesses into smaller ones when needed
The memory API supports cracking wide accesses into narrower oneswhen needed; but this was no implemented for the pio address space,causing lsi53c895a's IO BAR to malfunction.
Fix by correctly cracking wide accesses when needed....
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>
memory: add API for creating ROM/device regions
ROM/device regions act as mapped RAM for reads, can I/O memory forwrites. This allow emulation of flash devices.
Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
memory: reclaim resources when a memory region is destroyed for good
memory: synchronize dirty bitmap before unmapping a range
When a range is being unmapped, ask accelerators (e.g. kvm) to synchronize thedirty bitmap to avoid losing information forever.
Fixes grub2 screen update.
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....
memory: rename MemoryRegion::has_ram_addr to ::terminates
I/O regions will not have ram_addrs, so this is a better name.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
memory: late initialization of ram_addr
For non-RAM memory regions, we cannot tell whether this is an I/O regionor an MMIO region. Since the qemu backing registration is different forthe two, we have to defer initialization until we know which address...
memory: I/O address space support
Allow registering I/O ports via the same mechanism as mmio ranges.
memory: add backward compatibility for old portio registration
memory: add backward compatibility for old mmio registration
This eases the transition to the new API.
memory: add ioeventfd support
As with the rest of the memory API, the caller associates an eventfdwith an address, and the memory API takes care of registering orunregistering when the address is made visible or invisible to theguest.
memory: separate building the final memory map into two steps
Instead of adding and deleting regions in one pass, do a deletepass followed by an add pass. This fixes the following case:
from: 0x0000-0x0fff ram (a1) 0x1000-0x1fff mmio (a2) 0x2000-0x2fff ram (a3)...
memory: transaction API
Allow changes to the memory hierarchy to be accumulated andmade visible all at once. This reduces computational effort,especially when an accelerator (e.g. kvm) is involved.
Useful when a single register update causes multiple changes...
Hierarchical memory region API
The memory API separates the attributes of a memory region (its size, howreads or writes are handled, dirty logging, and coalescing) from where itis mapped and whether it is enabled. This allows a device to configurea memory region once, then hand it off to its parent bus to map it according...
memory: implement dirty tracking
Currently dirty tracking is implemented by passing throughall calls to the underlying cpu_physical_memory_*() calls.
memory: merge adjacent segments of a single memory region
Simple implementations of memory routers, for example the Cirrus VGA memory banksor the 440FX PAM registers can generate adjacent memory regions which are contiguous.Detect these and merge them; this saves kvm memory slots and shortens lookup times....
Internal interfaces for memory API
get_system_memory() provides the root of the memory hierarchy.
This interface is intended to be private between memory.c and exec.c.If this file is included elsewhere, it should be regarded as a bug (orTODO item). However, it will be temporarily needed for the conversion...
memory: abstract address space operations
Prepare for multiple address space support by abstracting away the detailsof registering a memory range with qemu's flat representation into anAddressSpace object.
Note operations which are memory specific are not abstracted, since they will...