Lines Matching +full:memory +full:- +full:region
2 * Physical memory management API
10 * the COPYING file in the top-level directory.
17 #include "exec/cpu-common.h"
34 #define MAX_PHYS_ADDR (((hwaddr)1 << MAX_PHYS_ADDR_SPACE_BITS) - 1)
36 #define TYPE_MEMORY_REGION "memory-region"
40 #define TYPE_IOMMU_MEMORY_REGION "iommu-memory-region"
45 #define TYPE_RAM_DISCARD_MANAGER "ram-discard-manager"
89 * @mr: the region, or %NULL if empty
90 * @fv: the flat view of the address space the region is mapped in
94 * relative to the region's address space
96 * @nonvolatile: this section is non-volatile
158 * should be able to take care of over-sized invalidations.
196 /* RAM is pre-allocated and passed into qemu_ram_alloc_from_ptr */
199 /* RAM is mmap-ed with MAP_SHARED */
216 /* RAM is a persistent kind memory */
222 * support 'write-tracking' migration type.
223 * Implies ram_state->ram_wt_enabled.
228 * RAM is mmap-ed with MAP_NORESERVE. When set, reserving swap space (or huge
230 * set, the OS will do the reservation, if supported for the memory type.
237 /* RAM is an mmap-ed named file */
240 /* RAM is mmap-ed read-only */
243 /* RAM FD is opened read-only */
264 n->notify = fn; in iommu_notifier_init()
265 n->notifier_flags = flags; in iommu_notifier_init()
266 n->start = start; in iommu_notifier_init()
267 n->end = end; in iommu_notifier_init()
268 n->iommu_idx = iommu_idx; in iommu_notifier_init()
272 * Memory region callbacks
275 /* Read from the memory region. @addr is relative to @mr; @size is
280 /* Write to the memory region. @addr is relative to @mr; @size is
299 /* Guest-visible constraints: */
351 * to handle requests to the memory region. Other methods are optional.
359 * to an output TLB entry. If the IOMMU is aware of memory transaction
373 * for secure transactions and one for non-secure transactions.
404 * @hwaddr: address to be translated within the memory region
428 * Optional method -- need not be provided if the IOMMU does not
438 * returns -EINVAL if the new flag bitmap is not supported by the
439 * IOMMU memory region. In case of failure, the error object
459 * Optional method -- an IOMMU only needs to provide this method
462 * Note: this is not related to record-and-replay functionality.
470 * can be used to allow users of the IOMMU to get implementation-specific
475 * memory_region_iommu_get_attr() will always return -EINVAL.
481 * @data: memory to fill in with the attribute data
484 * returns -EINVAL for unrecognized or unimplemented attribute types.
501 * @attrs: memory transaction attributes
529 * Notification that previously discarded memory is about to get populated.
535 * is aligned within the memory region to the minimum granularity
546 * Notification that previously populated memory was discarded successfully
547 * and listeners should drop all references to such memory and prevent
552 * is aligned within the memory region to the minimum granularity
574 rdl->notify_populate = populate_fn; in ram_discard_listener_init()
575 rdl->notify_discard = discard_fn; in ram_discard_listener_init()
576 rdl->double_discard_supported = double_discard_supported; in ram_discard_listener_init()
599 * after parts were discarded (freeing up memory) and before parts will be
600 * populated (consuming memory), to be used/accessed by the VM.
609 * memory inside a #MemoryRegion), and require proper coordination to only
611 * remain discarded from silently getting populated and consuming memory.
615 * An example #RamDiscardManager is virtio-mem, which logically (un)plugs
616 * memory within an assigned RAM #MemoryRegion, coordinated with the VM.
617 * Logically unplugging memory consists of discarding RAM. The VM agreed to not
618 * access unplugged (discarded) memory - especially via DMA. virtio-mem will
619 * properly coordinate with listeners before memory is plugged (populated),
620 * and after memory is unplugged (discarded).
624 * granularity within the #MemoryRegion. Listeners have to prepare for memory
802 * A struct representing a memory region.
822 /* owner as TYPE_DEVICE. Used for re-entrancy checks in MR access hotpath */
848 /* For devices designed to perform re-entrant IO into their own IO MRs */
860 QLIST_FOREACH((n), &(mr)->iommu_notify, node)
867 * struct MemoryListener: callbacks structure for updates to the physical memory map
869 * Allows a component to adjust to changes in the guest-visible memory map.
939 * #MemoryListener.region_nop(), if dirty memory logging clients have
944 * @old: A bitmap of dirty memory logging clients that were active in
946 * @new: A bitmap of dirty memory logging clients that are active in
958 * #MemoryListener.log_start(), if dirty memory logging clients have
963 * @old: A bitmap of dirty memory logging clients that were active in
965 * @new: A bitmap of dirty memory logging clients that are active in
976 * copy of the dirty memory bitmap for a #MemoryRegionSection.
1001 * Called before reading the dirty memory bitmap for a
1013 * enables the %DIRTY_LOG_MIGRATION client on all memory regions in
1029 * disables the %DIRTY_LOG_MIGRATION client on all memory regions in
1039 * Called after reading the dirty memory bitmap
1110 * Govern the order in which memory listeners are invoked. Lower priorities
1120 * identify one memory listener with the rest.
1156 * Maximum DMA bounce buffer size used for indirect memory map requests.
1158 * DMA requests to indirect memory regions within this AddressSpace. DMA
1174 /* Flattened global view of current active memory hierarchy. Kept in sorted
1189 return qatomic_rcu_read(&as->current_map); in address_space_to_flatview()
1215 * A FlatView is made up of a list of non-overlapping ranges, each of
1225 return a->mr == b->mr && in MemoryRegionSection_eq()
1226 a->fv == b->fv && in MemoryRegionSection_eq()
1227 a->offset_within_region == b->offset_within_region && in MemoryRegionSection_eq()
1228 a->offset_within_address_space == b->offset_within_address_space && in MemoryRegionSection_eq()
1229 int128_eq(a->size, b->size) && in MemoryRegionSection_eq()
1230 a->readonly == b->readonly && in MemoryRegionSection_eq()
1231 a->nonvolatile == b->nonvolatile; in MemoryRegionSection_eq()
1235 * memory_region_section_new_copy: Copy a memory region section
1237 * Allocate memory for a new copy, copy the memory region section, and
1245 * memory_region_section_free_copy: Free a copied memory region section
1247 * Free a copy of a memory section created via memory_region_section_new_copy().
1255 * memory_region_section_intersect_range: Adjust the memory section to cover
1259 * @offset: the offset of the given range in the memory region
1268 uint64_t start = MAX(s->offset_within_region, offset); in memory_region_section_intersect_range()
1269 Int128 end = int128_min(int128_add(int128_make64(s->offset_within_region), in memory_region_section_intersect_range()
1270 s->size), in memory_region_section_intersect_range()
1278 s->offset_within_address_space += start - s->offset_within_region; in memory_region_section_intersect_range()
1279 s->offset_within_region = start; in memory_region_section_intersect_range()
1280 s->size = int128_sub(end, int128_make64(start)); in memory_region_section_intersect_range()
1285 * memory_region_init: Initialize a memory region
1287 * The region typically acts as a container for other memory regions. Use
1291 * @owner: the object that tracks the region's reference count
1293 * @size: size of the region; any subregions beyond this size will be clipped
1301 * memory_region_ref: Add 1 to a memory region's reference count
1303 * Whenever memory regions are accessed outside the BQL, they need to be
1304 * preserved against hot-unplug. MemoryRegions actually do not have their
1310 * the region could be returned at any time by memory_region_find, and this
1318 * memory_region_unref: Remove 1 to a memory region's reference count
1320 * Whenever memory regions are accessed outside the BQL, they need to be
1321 * preserved against hot-unplug. MemoryRegions actually do not have their
1330 * memory_region_init_io: Initialize an I/O memory region.
1332 * Accesses into the region will cause the callbacks in @ops to be called.
1336 * @owner: the object that tracks the region's reference count
1338 * I/O is performed on the region.
1341 * @size: size of the region.
1351 * memory_region_init_ram_nomigrate: Initialize RAM memory region. Accesses
1352 * into the region will modify memory
1356 * @owner: the object that tracks the region's reference count
1357 * @name: Region name, becomes part of RAMBlock name used in migration stream
1359 * @size: size of the region.
1363 * RAM memory region to be migrated; that is the responsibility of the caller.
1374 * memory_region_init_ram_flags_nomigrate: Initialize RAM memory region.
1375 * Accesses into the region will
1376 * modify memory directly.
1379 * @owner: the object that tracks the region's reference count
1380 * @name: Region name, becomes part of RAMBlock name used in migration stream
1382 * @size: size of the region.
1388 * RAM memory region to be migrated; that is the responsibility of the caller.
1400 * memory_region_init_resizeable_ram: Initialize memory region with resizable
1401 * RAM. Accesses into the region will
1402 * modify memory directly. Only an initial
1409 * @owner: the object that tracks the region's reference count
1410 * @name: Region name, becomes part of RAMBlock name used in migration stream
1412 * @size: used size of the region.
1413 * @max_size: max size of the region.
1418 * RAM memory region to be migrated; that is the responsibility of the caller.
1434 * memory_region_init_ram_from_file: Initialize RAM memory region with a
1435 * mmap-ed backend.
1438 * @owner: the object that tracks the region's reference count
1439 * @name: Region name, becomes part of RAMBlock name used in migration stream
1441 * @size: size of the region.
1442 * @align: alignment of the region base address; if 0, the default alignment
1452 * RAM memory region to be migrated; that is the responsibility of the caller.
1467 * memory_region_init_ram_from_fd: Initialize RAM memory region with a
1468 * mmap-ed backend.
1471 * @owner: the object that tracks the region's reference count
1472 * @name: the name of the region.
1473 * @size: size of the region.
1482 * RAM memory region to be migrated; that is the responsibility of the caller.
1497 * memory_region_init_ram_ptr: Initialize RAM memory region from a
1498 * user-provided pointer. Accesses into the
1499 * region will modify memory directly.
1502 * @owner: the object that tracks the region's reference count
1503 * @name: Region name, becomes part of RAMBlock name used in migration stream
1505 * @size: size of the region.
1506 * @ptr: memory to be mapped; must contain at least @size bytes.
1509 * RAM memory region to be migrated; that is the responsibility of the caller.
1518 * memory_region_init_ram_device_ptr: Initialize RAM device memory region from
1519 * a user-provided pointer.
1522 * MMIO BAR of an vfio-pci assigned device. The memory region may be mapped
1523 * into the VM address space and access to the region will modify memory
1524 * directly. However, the memory region should not be included in a memory
1530 * @owner: the object that tracks the region's reference count
1531 * @name: the name of the region.
1532 * @size: size of the region.
1533 * @ptr: memory to be mapped; must contain at least @size bytes.
1536 * RAM memory region to be migrated; that is the responsibility of the caller.
1537 * (For RAM device memory regions, migrating the contents rarely makes sense.)
1546 * memory_region_init_alias: Initialize a memory region that aliases all or a
1547 * part of another memory region.
1550 * @owner: the object that tracks the region's reference count
1552 * @orig: the region to be referenced; @mr will be equivalent to
1553 * @orig between @offset and @offset + @size - 1.
1555 * @size: size of the region.
1565 * memory_region_init_rom_nomigrate: Initialize a ROM memory region.
1568 * and then marking the resulting region read-only with
1572 * RAM side of the memory region to be migrated; that is the responsibility
1576 * @owner: the object that tracks the region's reference count
1577 * @name: Region name, becomes part of RAMBlock name used in migration stream
1579 * @size: size of the region.
1591 * memory_region_init_rom_device_nomigrate: Initialize a ROM memory region.
1595 * RAM side of the memory region to be migrated; that is the responsibility
1599 * @owner: the object that tracks the region's reference count
1602 * @name: Region name, becomes part of RAMBlock name used in migration stream
1604 * @size: size of the region.
1618 * memory_region_init_iommu: Initialize a memory region of a custom type
1621 * An IOMMU region translates addresses and forwards accesses to a target
1622 * memory region.
1625 * @_iommu_mr should be a pointer to enough memory for an instance of
1629 * accesses to the memory region. See the documentation of
1635 * @owner: the object that tracks the region's reference count
1637 * @size: size of the region.
1647 * memory_region_init_ram - Initialize RAM memory region. Accesses into the
1648 * region will modify memory directly.
1651 * @owner: the object that tracks the region's reference count (must be
1653 * @name: name of the memory region
1654 * @size: size of the region in bytes
1666 * If you pass a non-NULL non-device @owner then we will assert.
1683 * memory_region_init_rom: Initialize a ROM memory region.
1686 * and then marking the resulting region read-only with
1694 * If you pass a non-NULL non-device @owner then we will assert.
1697 * @owner: the object that tracks the region's reference count
1698 * @name: Region name, becomes part of RAMBlock name used in migration stream
1700 * @size: size of the region.
1712 * memory_region_init_rom_device: Initialize a ROM memory region.
1715 * This function initializes a memory region backed by RAM for reads
1725 * If you pass a non-NULL non-device @owner then we will assert.
1728 * @owner: the object that tracks the region's reference count
1731 * @name: Region name, becomes part of RAMBlock name used in migration stream
1733 * @size: size of the region.
1748 * memory_region_owner: get a memory region's owner.
1750 * @mr: the memory region being queried.
1755 * memory_region_size: get a memory region's size.
1757 * @mr: the memory region being queried.
1762 * memory_region_is_ram: check whether a memory region is random access
1764 * Returns %true if a memory region is random access.
1766 * @mr: the memory region being queried
1770 return mr->ram; in memory_region_is_ram()
1774 * memory_region_is_ram_device: check whether a memory region is a ram device
1776 * Returns %true if a memory region is a device backed ram region
1778 * @mr: the memory region being queried
1783 * memory_region_is_romd: check whether a memory region is in ROMD mode
1785 * Returns %true if a memory region is a ROM device and currently set to allow
1788 * @mr: the memory region being queried
1792 return mr->rom_device && mr->romd_mode; in memory_region_is_romd()
1796 * memory_region_is_protected: check whether a memory region is protected
1798 * Returns %true if a memory region is protected RAM and cannot be accessed
1801 * @mr: the memory region being queried
1806 * memory_region_has_guest_memfd: check whether a memory region has guest_memfd
1809 * Returns %true if a memory region's ram_block has valid guest_memfd assigned.
1811 * @mr: the memory region being queried
1816 * memory_region_get_iommu: check whether a memory region is an iommu
1818 * Returns pointer to IOMMUMemoryRegion if a memory region is an iommu,
1821 * @mr: the memory region being queried
1825 if (mr->alias) { in memory_region_get_iommu()
1826 return memory_region_get_iommu(mr->alias); in memory_region_get_iommu()
1828 if (mr->is_iommu) { in memory_region_get_iommu()
1835 * memory_region_get_iommu_class_nocheck: returns iommu memory region class
1838 * Returns pointer to IOMMUMemoryRegionClass if a memory region is an iommu,
1841 * @iommu_mr: the memory region being queried
1846 return (IOMMUMemoryRegionClass *) (((Object *)iommu_mr)->class); in memory_region_get_iommu_class_nocheck()
1857 * @iommu_mr: the memory region being queried
1864 * Note: for any IOMMU implementation, an in-place mapping change
1867 * @iommu_mr: the memory region that was changed
1907 * -EINVAL indicates that at least one of the attributes of the notifier
1908 * is not supported (flag/range) by the IOMMU memory region. In case of error
1911 * @mr: the memory region to observe
1923 * mr->iommu_ops->get_page_size().
1925 * Note: this is not related to record-and-replay functionality.
1927 * @iommu_mr: the memory region to observe
1936 * @mr: the memory region which was observed and for which notify_stopped()
1948 * -EINVAL indicates that the IOMMU does not support the requested
1951 * @iommu_mr: the memory region
1961 * use for translations with the given memory transaction attributes.
1963 * @iommu_mr: the memory region
1964 * @attrs: the memory transaction attributes
1973 * @iommu_mr: the memory region
1978 * memory_region_name: get a memory region's name
1980 * Returns the string that was used to initialize the memory region.
1982 * @mr: the memory region being queried
1987 * memory_region_is_logging: return whether a memory region is logging writes
1989 * Returns %true if the memory region is logging writes for the given client
1991 * @mr: the memory region being queried
1998 * memory region is logging writes.
2003 * @mr: the memory region being queried
2008 * memory_region_is_rom: check whether a memory region is ROM
2010 * Returns %true if a memory region is read-only memory.
2012 * @mr: the memory region being queried
2016 return mr->ram && mr->readonly; in memory_region_is_rom()
2020 * memory_region_is_nonvolatile: check whether a memory region is non-volatile
2022 * Returns %true is a memory region is non-volatile memory.
2024 * @mr: the memory region being queried
2028 return mr->nonvolatile; in memory_region_is_nonvolatile()
2032 * memory_region_get_fd: Get a file descriptor backing a RAM memory region.
2034 * Returns a file descriptor backing a file-based RAM memory region,
2035 * or -1 if the region is not a file-based RAM memory region.
2037 * @mr: the RAM or alias memory region being queried.
2042 * memory_region_from_host: Convert a pointer into a RAM memory region
2045 * Given a host pointer inside a RAM memory region (created with
2052 * protecting the pointer, such as a reference to the region that includes
2056 * @offset: the offset within memory region
2061 * memory_region_get_ram_ptr: Get a pointer into a RAM memory region.
2063 * Returns a host pointer to a RAM memory region (created with
2069 * protecting the pointer, such as a reference to the region that includes
2072 * @mr: the memory region being queried.
2076 /* memory_region_ram_resize: Resize a RAM region.
2079 * Care has to be taken if the guest might have already detected the memory.
2081 * @mr: a memory region created with @memory_region_init_resizeable_ram.
2082 * @newsize: the new size the region
2090 * a memory mapped region
2092 * @mr: the memory region to be msync
2102 * @mr: the memory region to be updated
2109 * memory_region_set_log: Turn dirty logging on or off for a region.
2114 * @mr: the memory region being updated.
2121 * memory_region_set_dirty: Mark a range of bytes as dirty in a memory region.
2126 * @mr: the memory region being dirtied.
2127 * @addr: the address (relative to the start of the region) being dirtied.
2134 * memory_region_clear_dirty_bitmap - clear dirty bitmap for memory range
2137 * dirty bitmap of a memory range within the memory region. This can
2142 * @mr: the memory region to clear the dirty log upon
2143 * @start: start address offset within the memory region
2144 * @len: length of the memory region to clear dirty bitmap
2159 * The dirty bitmap region which gets copied into the snapshot (and
2171 * @mr: the memory region being queried.
2172 * @addr: the address (relative to the start of the region) being queried.
2185 * @mr: the memory region being queried.
2187 * @addr: the address (relative to the start of the region) being queried.
2200 * @mr: the region being updated.
2211 * TBs (for self-modifying code).
2213 * The MemoryRegionOps->write() callback of a ROM device must use this function
2215 * accessing the memory returned by memory_region_get_ram_ptr().
2218 * detect self-modifying code.
2220 * @mr: the region being flushed.
2221 * @addr: the start, relative to the start of the region, of the range being
2228 * memory_region_set_readonly: Turn a memory region read-only (or read-write)
2230 * Allows a memory region to be marked as read-only (turning it into a ROM).
2233 * @mr: the region being updated.
2234 * @readonly: whether the region is to be ROM or RAM.
2239 * memory_region_set_nonvolatile: Turn a memory region non-volatile
2241 * Allows a memory region to be marked as non-volatile.
2244 * @mr: the region being updated.
2245 * @nonvolatile: whether the region is to be non-volatile.
2254 * device is mapped to guest memory and satisfies read access directly.
2258 * @mr: the memory region to be updated
2259 * @romd_mode: %true to put the region into ROMD mode
2264 * memory_region_set_coalescing: Enable memory coalescing for the region.
2266 * Enabled writes to a region to be queued for later processing. MMIO ->write
2267 * callbacks may be delayed until a non-coalesced MMIO is issued.
2268 * Only useful for IO regions. Roughly similar to write-combining hardware.
2270 * @mr: the memory region to be write coalesced
2275 * memory_region_add_coalescing: Enable memory coalescing for a sub-range of
2276 * a region.
2278 * Like memory_region_set_coalescing(), but works on a sub-range of a region.
2281 * @mr: the memory region to be updated.
2282 * @offset: the start of the range within the region to be coalesced.
2290 * memory_region_clear_coalescing: Disable MMIO coalescing for the region.
2293 * memory_region_add_coalescing(). Roughly equivalent to uncacheble memory
2296 * @mr: the memory region to be updated.
2301 * memory_region_set_flush_coalesced: Enforce memory coalescing flush before
2304 * Ensure that pending coalesced MMIO request are flushed before the memory
2305 * region is accessed. This property is automatically enabled for all regions
2308 * @mr: the memory region to be updated.
2313 * memory_region_clear_flush_coalesced: Disable memory coalescing flush before
2318 * memory regions that have MMIO coalescing enabled for themselves. For them,
2321 * @mr: the memory region to be updated.
2329 * Marks a word in an IO region (initialized with memory_region_init_io())
2334 * @mr: the memory region being updated.
2354 * @mr: the memory region being updated.
2372 * subregions (except for those explicitly marked as overlapping). A region
2375 * want a region to be a subregion in multiple locations.
2377 * @mr: the region to contain the new subregion; must be a container
2392 * A region may only be added once as a subregion (unless removed with
2394 * want a region to be a subregion in multiple locations.
2396 * @mr: the region to contain the new subregion; must be a container
2408 * memory_region_get_ram_addr: Get the ram address associated with a memory
2409 * region
2411 * @mr: the region to be queried
2422 * @subregion: the region being removed; must be a current subregion of @mr.
2428 * memory_region_set_enabled: dynamically enable or disable a region
2430 * Enables or disables a memory region. A disabled memory region
2432 * obscure sibling subregions with lower priority - it simply behaves as
2437 * @mr: the region to be updated
2438 * @enabled: whether to enable or disable the region
2443 * memory_region_set_address: dynamically update the address of a region
2445 * Dynamically updates the address of a region, relative to its container.
2446 * May be used on regions are currently part of a memory hierarchy.
2448 * @mr: the region to be updated
2449 * @addr: new address, relative to container region
2454 * memory_region_set_size: dynamically update the size of a region.
2456 * Dynamically updates the size of a region.
2458 * @mr: the region to be updated
2459 * @size: used size of the region.
2464 * memory_region_set_alias_offset: dynamically update a memory alias's offset
2466 * Dynamically updates the offset into the target region that an alias points
2470 * @offset: the new offset into the target memory region
2476 * memory_region_set_unmergeable: Set a memory region unmergeable
2478 * Mark a memory region unmergeable, resulting in the memory region (or
2479 * everything contained in a memory region container) not getting merged when
2480 * simplifying the address space and notifying memory listeners. Consequently,
2481 * memory listeners will never get notified about ranges that are larger than
2482 * the original memory regions.
2484 * This is primarily useful when multiple aliases to a RAM memory region are
2485 * mapped into a memory region container, and updates (e.g., enable/disable or
2486 * map/unmap) of individual memory region aliases are not supposed to affect
2487 * other memory regions in the same container.
2508 * into another memory region, which does not necessarily imply that it is
2519 * The #RamDiscardManager cannot change while a memory region is mapped.
2559 * - @size = 0 iff no overlap was found
2560 * - @mr is non-%NULL iff an overlap was found
2563 * relative to the returned region (in the .@mr field), not to the
2571 * - @offset_within_address_space >= @addr
2572 * - @offset_within_address_space + .@size <= @addr + @size
2582 * memory_global_dirty_log_sync: synchronize the dirty log for all memory
2591 * memory_global_after_dirty_log_sync: synchronize the dirty log for all memory
2595 * before dirty guest memory pages are read. If you are using
2616 * memory_listener_register: register callbacks to be called when memory
2621 * @filter: if non-%NULL, only regions in this address space will be observed
2660 * @addr: address within that region
2662 * @op: size, sign, and endianness of the memory operation
2663 * @attrs: memory transaction attributes to use for the access
2675 * @addr: address within that region
2677 * @op: size, sign, and endianness of the memory operation
2678 * @attrs: memory transaction attributes to use for the access
2700 * is destroyed, its root memory region (given by address_space_init()) may be destroyed
2721 * or failed (eg unassigned memory, device rejected the transaction,
2726 * @attrs: memory transaction attributes
2739 * or failed (eg unassigned memory, device rejected the transaction,
2744 * @attrs: memory transaction attributes
2756 * write data to both ROM and RAM. This is used for non-guest
2761 * a device will be silently ignored -- only real RAM and ROM will
2765 * or failed (eg unassigned memory, device rejected the transaction,
2770 * @attrs: memory transaction attributes
2788 * target-* code; devices should be CPU-agnostic and use either the LE
2794 * @attrs: memory transaction attributes
2837 * target-* code; devices should be CPU-agnostic and use either the LE
2843 * @attrs: memory transaction attributes
2857 assert(addr < cache->len); in address_space_ldub_cached()
2858 if (likely(cache->ptr)) { in address_space_ldub_cached()
2859 return ldub_p(cache->ptr + addr); in address_space_ldub_cached()
2868 assert(addr < cache->len); in address_space_stb_cached()
2869 if (likely(cache->ptr)) { in address_space_stb_cached()
2870 stb_p(cache->ptr + addr, val); in address_space_stb_cached()
2891 * memory region
2904 * read-modify-write operations. In this case, is_write should be %true.
2920 * Initializes #MemoryRegionCache structure without memory region attached.
2925 cache->mrs.mr = NULL; in address_space_cache_init_empty()
2927 cache->fv = NULL; in address_space_cache_init_empty()
2945 * @cache: The #MemoryRegionCache whose memory should be released.
2958 * to the returned region disappears after address_space_translate returns.
2962 * @xlat: pointer to address within the returned memory region section's
2966 * @attrs: memory attributes
2985 * Check whether memory is assigned to the given address space range, and
2996 * @attrs: memory attributes
3001 /* address_space_map: map a physical memory region into a host virtual address
3006 * Use only for reads OR writes - not for read-modify-write operations.
3014 * @attrs: memory attributes
3019 /* address_space_unmap: Unmaps a memory region previously mapped by address_space_map()
3021 * Will also mark the memory as dirty if @is_write == %true. @access_len gives
3022 * the amount of memory that was actually read or written by the caller.
3038 * such as when bounce buffer memory would exceed the limit. The callback can
3101 return !mr->readonly && !mr->rom_device; in memory_access_is_direct()
3110 * or failed (eg unassigned memory, device rejected the transaction,
3115 * @attrs: memory transaction attributes
3137 ptr = qemu_map_ram_ptr(mr->ram_block, addr1); in address_space_read()
3151 * address_space_read_cached: read from a cached RAM region
3153 * @cache: Cached region to be addressed
3154 * @addr: address relative to the base of the RAM region
3162 assert(addr < cache->len && len <= cache->len - addr); in address_space_read_cached()
3163 fuzz_dma_read_cb(cache->xlat + addr, len, cache->mrs.mr); in address_space_read_cached()
3164 if (likely(cache->ptr)) { in address_space_read_cached()
3165 memcpy(buf, cache->ptr + addr, len); in address_space_read_cached()
3173 * address_space_write_cached: write to a cached RAM region
3175 * @cache: Cached region to be addressed
3176 * @addr: address relative to the base of the RAM region
3184 assert(addr < cache->len && len <= cache->len - addr); in address_space_write_cached()
3185 if (likely(cache->ptr)) { in address_space_write_cached()
3186 memcpy(cache->ptr + addr, buf, len); in address_space_write_cached()
3197 * or failed (eg unassigned memory, device rejected the transaction,
3202 * @c: constant byte to fill the memory
3204 * @attrs: memory transaction attributes
3211 * to manage the actual amount of memory consumed by the VM (then, the memory
3212 * provided by RAM blocks might be bigger than the desired memory consumption).
3214 * - Discarding parts of a RAM blocks does not result in the change being
3216 * - All memory in RAM blocks is pinned or duplicated, invaldiating any previous
3218 * - Discarding parts of a RAM blocks will result in integrity issues (e.g.,
3227 * Returns 0 if successful. Returns -EBUSY if a technology that relies on
3241 * Returns 0 if successful. Returns -EBUSY if discards are already set to
3248 * uncoordinated discarding of pages in RAM blocks, allowing co-existence with
3255 * Test if any discarding of memory in ram blocks is disabled.
3260 * Test if any discarding of memory in ram blocks is required to work reliably.