summaryrefslogtreecommitdiffstats
path: root/memory.h
Commit message (Collapse)AuthorAgeFilesLines
* Rename target_phys_addr_t to hwaddrAvi Kivity2012-10-231-35/+35
| | | | | | | | | | | | | | | 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>
* memory: add address_space_destroy()Avi Kivity2012-10-221-0/+12
| | | | | | | 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-0/+62
| | | | | | | | | | | | | 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-3/+3
| | | | | | | | 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: manage coalesced mmio via a MemoryListenerAvi Kivity2012-10-221-0/+4
| | | | | | | | | | | | 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: maintain a list of address spacesAvi Kivity2012-10-151-0/+2
| | | | | | | | | Instead of embedding knowledge of the memory and I/O address spaces in the memory core, maintain a list of all address spaces. This list will later be extended dynamically for other bus masters. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: export AddressSpaceAvi Kivity2012-10-151-0/+21
| | | | | | | | The DMA API will use an AddressSpace to differentiate among different initiators. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* Merge remote-tracking branch 'stefanha/trivial-patches' into stagingAnthony Liguori2012-09-171-5/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stefanha/trivial-patches: configure: fix seccomp check arch_init.c: add missing '%' symbols before PRIu64 in debug printfs kvm: Fix warning from static code analysis qapi: Fix enumeration typo error console: Clean up bytes per pixel calculation Fix copy&paste typos in documentation comments linux-user: Remove #if 0'd cpu_get_real_ticks() definition ui: Fix spelling in comment (ressource -> resource) Spelling fixes in comments and macro names (ressource -> resource) Fix spelling (licenced -> licensed) in GPL Spelling fixes in comments and documentation srp: Don't use QEMU_PACKED for single elements of a structured type
| * Fix copy&paste typos in documentation commentsBALATON Zoltan2012-09-141-5/+6
| | | | | | | | | | Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* | memory: Flush coalesced MMIO on selected region accessJan Kiszka2012-09-111-0/+26
|/ | | | | | | | | | | Instead of flushing pending coalesced MMIO requests on every vmexit, this provides a mechanism to selectively flush when memory regions related to the coalesced one are accessed. This first of all includes the coalesced region itself but can also applied to other regions, e.g. of the same device, by calling memory_region_set_flush_coalesced. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* memory: pass EventNotifier, not eventfdPaolo Bonzini2012-07-121-4/+5
| | | | | | | | | Under Win32, EventNotifiers will not have event_notifier_get_fd, so we cannot call it in common code such as hw/virtio-pci.c. Pass a pointer to the notifier, and only retrieve the file descriptor in kvm-specific code. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: move functions is_romd and section_addr to memory APIBlue Swirl2012-05-011-0/+29
| | | | | Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* memory: fix I/O port aliasesAvi Kivity2012-03-051-1/+8
| | | | | | | | | | | | | | | | | | | Commit e58ac72b6a0 ("ioport: change portio_list not to use memory_region_set_offset()") started using aliases of I/O memory regions. Since the IORange used for the I/O was contained in the target region, the alias information (specifically, the offset into the region) was lost. This broke -vga std. Fix by allocating an independent object to hold the IORange and also the new offset. Note that I/O memory regions were conceptually broken wrt aliases in a different way: an alias can cause the same region to appear twice in an address space, but we had just one IORange to service it. This patch fixes that problem as well, since we can now have multiple IORange/MemoryRegion associations. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: support stateless memory listenersAvi Kivity2012-02-291-0/+3
| | | | | | | | | | | | | Current memory listeners are incremental; that is, they are expected to maintain their own state, and receive callbacks for changes to that state. This patch adds support for stateless listeners; these work by receiving a ->begin() callback (which tells them that new state is coming), a sequence of ->region_add() and ->region_nop() callbacks, and then a ->commit() callback which signifies the end of the new state. They should ignore ->region_del() callbacks. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: allow MemoryListeners to observe a specific address spaceAvi Kivity2012-02-291-1/+3
| | | | | | Ignore any regions not belonging to a specified address space. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: add a readonly attribute to MemoryRegionSectionAvi Kivity2012-02-291-0/+2
| | | | | | | | | | .readonly cannot be obtained from the MemoryRegion, since it is inherited from aliases (so you can have a MemoryRegion mapped RW at one address and RO at another). Record it in a MemoryRegionSection for listeners. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* memory: move ioeventfd ops to MemoryListenerAvi Kivity2012-02-291-0/+4
| | | | | | | This way the accelerator (kvm) can handle them directly. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* memory: switch memory listeners to a QTAILQAvi Kivity2012-02-291-1/+3
| | | | | | | | | | | | | This allows reverse iteration, which in turns allows consistent ordering among multiple listeners: l1->add l2->add l2->del l1->del Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* memory: remove memory_region_set_offset()Avi Kivity2012-02-291-9/+0
| | | | | | | | memory_region_set_offset() complicates the API, and has been deprecated since its introduction. Now that it is no longer used, remove it. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* memory: change dirty getting API to take a sizeBlue Swirl2012-02-041-4/+5
| | | | | | | 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 sizeBlue Swirl2012-01-251-4/+7
| | | | | | | Instead of each target 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: Introduce memory_region_init_reservationJan Kiszka2012-01-191-0/+16
| | | | | | | | | | | | Introduce a memory region type that can reserve I/O space. Such regions are 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 be triggered by guest code (DMA to reserved region). So only warning about such events once, then ignore them. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
* Spelling fixes in comments and documentationStefan Weil2012-01-131-2/+2
| | | | | | | Codespell detected these new spelling issues. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* Drop IO_MEM_ROMDAvi Kivity2012-01-041-0/+1
| | | | | | | | Unlike ->readonly, ->readable is not inherited from aliase, so we can simply query the memory region. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* Remove IO_MEM_SUBPAGEAvi Kivity2012-01-041-0/+1
| | | | | | | Replace with a MemoryRegion flag. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* memory: remove MemoryRegion::backend_registeredAvi Kivity2012-01-041-1/+0
| | | | | | | | | | | | | | | backend_registered was used to lazify the process of registering an mmio region, since the it is different for the I/O address space and the memory address space. However, it also makes registration dependent on the region being visible in the address space. This is not the case for "fake" regions, like watchpoints or IO_MEM_UNASSIGNED. Remove backend_registered and always initialize the region. If it turns out to be part of the I/O address space, we've wasted an I/O slot, but that's not too bad. In any case this will be optimized later on. Signed-off-by: Avi Kivity <avi@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
* vmstate, memory: decouple vmstate from memory APIAvi Kivity2012-01-041-15/+3
| | | | | | | | | | | | | | Currently creating a memory region automatically registers it for live migration. This differs from other state (which is enumerated in a VMStateDescription structure) and ties the live migration code into the memory core. Decouple the two by introducing a separate API, vmstate_register_ram(), for registering a RAM block for migration. Currently the same implementation is reused, but later it can be moved into a separate list, and registrations can be moved to VMStateDescription blocks. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: introduce memory_region_name()Avi Kivity2012-01-041-0/+9
| | | | | | Trivial accessor for the name attribute. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: temporarily add memory_region_get_ram_addr()Avi Kivity2011-12-201-0/+10
| | | | | | | This is a layering violation, but needed while the code contains naked calls to qemu_get_ram_ptr() and the like. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: add API for observing updates to the physical memory mapAvi Kivity2011-12-201-0/+47
| | | | | | | | | | | | | | | Add an API that allows a client to observe changes in the global memory map: - region added (possibly with logging enabled) - region removed (possibly with logging enabled) - logging started on a region - logging stopped on a region - global logging started - global logging removed This API will eventually replace cpu_register_physical_memory_client(). Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: replace cpu_physical_sync_dirty_bitmap() with a memory APIAvi Kivity2011-12-201-0/+10
| | | | | | The function is still used as the implementation. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: introduce memory_region_find()Avi Kivity2011-12-201-0/+39
| | | | | | | | | | | Given an address space (represented by the top-level memory region), returns the memory region that maps a given range. Useful for implementing DMA. The implementation is a simplistic binary search. Once we have a tree representation this can be optimized. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: add memory_region_is_logging()Avi Kivity2011-12-201-0/+9
| | | | Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: add memory_region_is_rom()Avi Kivity2011-12-201-0/+9
| | | | Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: add memory_region_is_ram()Avi Kivity2011-12-201-0/+10
| | | | Signed-off-by: Avi Kivity <avi@redhat.com>
* Merge remote-tracking branch 'qemu-kvm/memory/mutators' into stagingAnthony Liguori2011-12-191-0/+39
|\ | | | | | | | | Conflicts: memory.h
| * memory: introduce memory_region_set_alias_offset()Avi Kivity2011-12-051-0/+12
| | | | | | | | | | | | | | Add an API to update an alias offset of an active alias. This can be used to simplify implementation of dynamic memory banks. Signed-off-by: Avi Kivity <avi@redhat.com>
| * memory: introduce memory_region_set_address()Avi Kivity2011-12-041-0/+11
| | | | | | | | | | | | | | Allow changing the address of a memory region while it is in the memory hierarchy. Signed-off-by: Avi Kivity <avi@redhat.com>
| * memory: introduce memory_region_set_enabled()Avi Kivity2011-12-041-0/+17
| | | | | | | | | | | | | | | | This allows users to disable a memory region without removing it from the hierarchy, simplifying the implementation of memory routers. Signed-off-by: Avi Kivity <avi@redhat.com>
* | memory: minor documentation fixes/enhancementsAdemar de Souza Reis Jr2011-12-061-16/+22
|/ | | | | | | | | | | | Fix typos and minor documentation errors in both memory.h and docs/memory.txt. Also add missing documentation formatting tags to transaction functions. Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Ademar de Souza Reis Jr <areis@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* memory: add MemoryRegionOps::valid.acceptsAvi Kivity2011-11-241-0/+7
| | | | | | | | MemoryRegionOps::valid tries to declaratively specify which transactions are accepted by the device/bus, however it is not completely generic. Add a callback for special cases. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: use 128-bit integers for sizes and intermediatesAvi Kivity2011-10-161-1/+2
| | | | | | | Since the memory API supports 64-bit buses, it needs a larger type to represent intermediate results. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: simple memory tree printerBlue Swirl2011-10-021-0/+2
| | | | | | | | Add a monitor command 'info mtree' to show the memory hierarchy much like /proc/iomem in Linux. Signed-off-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: implement memory_region_set_readonly()Avi Kivity2011-09-251-0/+1
| | | | | | | The property is inheritable, but only if set to true. This is so that memory routers can mark sections of RAM as read-only via aliases. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: add opaque parameter to memory_region_init_rom_device()Avi Kivity2011-08-261-0/+1
| | | | | | The MemoryRegionOps callbacks expect it. Signed-off-by: Avi Kivity <avi@redhat.com>
* memory: add API for creating ROM/device regionsAvi Kivity2011-08-121-0/+34
| | | | | | | | ROM/device regions act as mapped RAM for reads, can I/O memory for writes. 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 goodAvi Kivity2011-08-121-0/+1
| | | | | Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* memory: rename PORTIO_END to PORTIO_END_OF_LISTAvi Kivity2011-08-081-1/+1
| | | | | | | For consistency with other _END_OF_LIST macros. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* memory: transaction APIAvi Kivity2011-07-291-0/+8
| | | | | | | | | | | | Allow changes to the memory hierarchy to be accumulated and made 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 to an address space. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* memory: add ioeventfd supportAvi Kivity2011-07-291-0/+45
| | | | | | | | | | As with the rest of the memory API, the caller associates an eventfd with an address, and the memory API takes care of registering or unregistering when the address is made visible or invisible to the guest. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud