]>
Commit | Line | Data |
---|---|---|
093bc2cd AK |
1 | /* |
2 | * Physical memory management API | |
3 | * | |
4 | * Copyright 2011 Red Hat, Inc. and/or its affiliates | |
5 | * | |
6 | * Authors: | |
7 | * Avi Kivity <[email protected]> | |
8 | * | |
9 | * This work is licensed under the terms of the GNU GPL, version 2. See | |
10 | * the COPYING file in the top-level directory. | |
11 | * | |
12 | */ | |
13 | ||
14 | #ifndef MEMORY_H | |
15 | #define MEMORY_H | |
16 | ||
17 | #ifndef CONFIG_USER_ONLY | |
18 | ||
19 | #include <stdint.h> | |
20 | #include <stdbool.h> | |
21 | #include "qemu-common.h" | |
22 | #include "cpu-common.h" | |
23 | #include "targphys.h" | |
24 | #include "qemu-queue.h" | |
658b2224 | 25 | #include "iorange.h" |
627a0e90 | 26 | #include "ioport.h" |
08dafab4 | 27 | #include "int128.h" |
093bc2cd AK |
28 | |
29 | typedef struct MemoryRegionOps MemoryRegionOps; | |
30 | typedef struct MemoryRegion MemoryRegion; | |
627a0e90 | 31 | typedef struct MemoryRegionPortio MemoryRegionPortio; |
74901c3b | 32 | typedef struct MemoryRegionMmio MemoryRegionMmio; |
093bc2cd AK |
33 | |
34 | /* Must match *_DIRTY_FLAGS in cpu-all.h. To be replaced with dynamic | |
35 | * registration. | |
36 | */ | |
37 | #define DIRTY_MEMORY_VGA 0 | |
38 | #define DIRTY_MEMORY_CODE 1 | |
39 | #define DIRTY_MEMORY_MIGRATION 3 | |
40 | ||
74901c3b AK |
41 | struct MemoryRegionMmio { |
42 | CPUReadMemoryFunc *read[3]; | |
43 | CPUWriteMemoryFunc *write[3]; | |
44 | }; | |
45 | ||
093bc2cd AK |
46 | /* |
47 | * Memory region callbacks | |
48 | */ | |
49 | struct MemoryRegionOps { | |
50 | /* Read from the memory region. @addr is relative to @mr; @size is | |
51 | * in bytes. */ | |
52 | uint64_t (*read)(void *opaque, | |
53 | target_phys_addr_t addr, | |
54 | unsigned size); | |
55 | /* Write to the memory region. @addr is relative to @mr; @size is | |
56 | * in bytes. */ | |
57 | void (*write)(void *opaque, | |
58 | target_phys_addr_t addr, | |
59 | uint64_t data, | |
60 | unsigned size); | |
61 | ||
62 | enum device_endian endianness; | |
63 | /* Guest-visible constraints: */ | |
64 | struct { | |
65 | /* If nonzero, specify bounds on access sizes beyond which a machine | |
66 | * check is thrown. | |
67 | */ | |
68 | unsigned min_access_size; | |
69 | unsigned max_access_size; | |
70 | /* If true, unaligned accesses are supported. Otherwise unaligned | |
71 | * accesses throw machine checks. | |
72 | */ | |
73 | bool unaligned; | |
897fa7cf AK |
74 | /* |
75 | * If present, and returns #false, the transaction is not accepted | |
76 | * by the device (and results in machine dependent behaviour such | |
77 | * as a machine check exception). | |
78 | */ | |
79 | bool (*accepts)(void *opaque, target_phys_addr_t addr, | |
80 | unsigned size, bool is_write); | |
093bc2cd AK |
81 | } valid; |
82 | /* Internal implementation constraints: */ | |
83 | struct { | |
84 | /* If nonzero, specifies the minimum size implemented. Smaller sizes | |
85 | * will be rounded upwards and a partial result will be returned. | |
86 | */ | |
87 | unsigned min_access_size; | |
88 | /* If nonzero, specifies the maximum size implemented. Larger sizes | |
89 | * will be done as a series of accesses with smaller sizes. | |
90 | */ | |
91 | unsigned max_access_size; | |
92 | /* If true, unaligned accesses are supported. Otherwise all accesses | |
93 | * are converted to (possibly multiple) naturally aligned accesses. | |
94 | */ | |
95 | bool unaligned; | |
96 | } impl; | |
627a0e90 AK |
97 | |
98 | /* If .read and .write are not present, old_portio may be used for | |
99 | * backwards compatibility with old portio registration | |
100 | */ | |
101 | const MemoryRegionPortio *old_portio; | |
74901c3b AK |
102 | /* If .read and .write are not present, old_mmio may be used for |
103 | * backwards compatibility with old mmio registration | |
104 | */ | |
105 | const MemoryRegionMmio old_mmio; | |
093bc2cd AK |
106 | }; |
107 | ||
108 | typedef struct CoalescedMemoryRange CoalescedMemoryRange; | |
3e9d69e7 | 109 | typedef struct MemoryRegionIoeventfd MemoryRegionIoeventfd; |
093bc2cd AK |
110 | |
111 | struct MemoryRegion { | |
112 | /* All fields are private - violators will be prosecuted */ | |
113 | const MemoryRegionOps *ops; | |
114 | void *opaque; | |
115 | MemoryRegion *parent; | |
08dafab4 | 116 | Int128 size; |
093bc2cd AK |
117 | target_phys_addr_t addr; |
118 | target_phys_addr_t offset; | |
16ef61c9 | 119 | bool backend_registered; |
545e92e0 | 120 | void (*destructor)(MemoryRegion *mr); |
093bc2cd | 121 | ram_addr_t ram_addr; |
658b2224 | 122 | IORange iorange; |
14a3c10a | 123 | bool terminates; |
d0a9b5bc | 124 | bool readable; |
8ea9252a | 125 | bool ram; |
fb1cd6f9 | 126 | bool readonly; /* For RAM regions */ |
6bba19ba | 127 | bool enabled; |
093bc2cd AK |
128 | MemoryRegion *alias; |
129 | target_phys_addr_t alias_offset; | |
130 | unsigned priority; | |
131 | bool may_overlap; | |
132 | QTAILQ_HEAD(subregions, MemoryRegion) subregions; | |
133 | QTAILQ_ENTRY(MemoryRegion) subregions_link; | |
134 | QTAILQ_HEAD(coalesced_ranges, CoalescedMemoryRange) coalesced; | |
135 | const char *name; | |
5a583347 | 136 | uint8_t dirty_log_mask; |
3e9d69e7 AK |
137 | unsigned ioeventfd_nb; |
138 | MemoryRegionIoeventfd *ioeventfds; | |
093bc2cd AK |
139 | }; |
140 | ||
627a0e90 AK |
141 | struct MemoryRegionPortio { |
142 | uint32_t offset; | |
143 | uint32_t len; | |
144 | unsigned size; | |
145 | IOPortReadFunc *read; | |
146 | IOPortWriteFunc *write; | |
147 | }; | |
148 | ||
2dd30228 | 149 | #define PORTIO_END_OF_LIST() { } |
627a0e90 | 150 | |
093bc2cd AK |
151 | /** |
152 | * memory_region_init: Initialize a memory region | |
153 | * | |
69ddaf66 | 154 | * The region typically acts as a container for other memory regions. Use |
093bc2cd AK |
155 | * memory_region_add_subregion() to add subregions. |
156 | * | |
157 | * @mr: the #MemoryRegion to be initialized | |
158 | * @name: used for debugging; not visible to the user or ABI | |
159 | * @size: size of the region; any subregions beyond this size will be clipped | |
160 | */ | |
161 | void memory_region_init(MemoryRegion *mr, | |
162 | const char *name, | |
163 | uint64_t size); | |
164 | /** | |
165 | * memory_region_init_io: Initialize an I/O memory region. | |
166 | * | |
69ddaf66 | 167 | * Accesses into the region will cause the callbacks in @ops to be called. |
093bc2cd AK |
168 | * if @size is nonzero, subregions will be clipped to @size. |
169 | * | |
170 | * @mr: the #MemoryRegion to be initialized. | |
171 | * @ops: a structure containing read and write callbacks to be used when | |
172 | * I/O is performed on the region. | |
173 | * @opaque: passed to to the read and write callbacks of the @ops structure. | |
174 | * @name: used for debugging; not visible to the user or ABI | |
175 | * @size: size of the region. | |
176 | */ | |
177 | void memory_region_init_io(MemoryRegion *mr, | |
178 | const MemoryRegionOps *ops, | |
179 | void *opaque, | |
180 | const char *name, | |
181 | uint64_t size); | |
182 | ||
183 | /** | |
184 | * memory_region_init_ram: Initialize RAM memory region. Accesses into the | |
69ddaf66 | 185 | * region will modify memory directly. |
093bc2cd AK |
186 | * |
187 | * @mr: the #MemoryRegion to be initialized. | |
188 | * @dev: a device associated with the region; may be %NULL. | |
189 | * @name: the name of the region; the pair (@dev, @name) must be globally | |
190 | * unique. The name is part of the save/restore ABI and so cannot be | |
191 | * changed. | |
192 | * @size: size of the region. | |
193 | */ | |
194 | void memory_region_init_ram(MemoryRegion *mr, | |
195 | DeviceState *dev, /* FIXME: layering violation */ | |
196 | const char *name, | |
197 | uint64_t size); | |
198 | ||
199 | /** | |
200 | * memory_region_init_ram: Initialize RAM memory region from a user-provided. | |
69ddaf66 | 201 | * pointer. Accesses into the region will modify |
093bc2cd AK |
202 | * memory directly. |
203 | * | |
204 | * @mr: the #MemoryRegion to be initialized. | |
205 | * @dev: a device associated with the region; may be %NULL. | |
206 | * @name: the name of the region; the pair (@dev, @name) must be globally | |
207 | * unique. The name is part of the save/restore ABI and so cannot be | |
208 | * changed. | |
209 | * @size: size of the region. | |
210 | * @ptr: memory to be mapped; must contain at least @size bytes. | |
211 | */ | |
212 | void memory_region_init_ram_ptr(MemoryRegion *mr, | |
213 | DeviceState *dev, /* FIXME: layering violation */ | |
214 | const char *name, | |
215 | uint64_t size, | |
216 | void *ptr); | |
217 | ||
218 | /** | |
219 | * memory_region_init_alias: Initialize a memory region that aliases all or a | |
220 | * part of another memory region. | |
221 | * | |
222 | * @mr: the #MemoryRegion to be initialized. | |
223 | * @name: used for debugging; not visible to the user or ABI | |
224 | * @orig: the region to be referenced; @mr will be equivalent to | |
225 | * @orig between @offset and @offset + @size - 1. | |
226 | * @offset: start of the section in @orig to be referenced. | |
227 | * @size: size of the region. | |
228 | */ | |
229 | void memory_region_init_alias(MemoryRegion *mr, | |
230 | const char *name, | |
231 | MemoryRegion *orig, | |
232 | target_phys_addr_t offset, | |
233 | uint64_t size); | |
d0a9b5bc AK |
234 | |
235 | /** | |
236 | * memory_region_init_rom_device: Initialize a ROM memory region. Writes are | |
237 | * handled via callbacks. | |
238 | * | |
239 | * @mr: the #MemoryRegion to be initialized. | |
240 | * @ops: callbacks for write access handling. | |
241 | * @dev: a device associated with the region; may be %NULL. | |
242 | * @name: the name of the region; the pair (@dev, @name) must be globally | |
243 | * unique. The name is part of the save/restore ABI and so cannot be | |
244 | * changed. | |
245 | * @size: size of the region. | |
246 | */ | |
247 | void memory_region_init_rom_device(MemoryRegion *mr, | |
248 | const MemoryRegionOps *ops, | |
75f5941c | 249 | void *opaque, |
d0a9b5bc AK |
250 | DeviceState *dev, /* FIXME: layering violation */ |
251 | const char *name, | |
252 | uint64_t size); | |
253 | ||
093bc2cd | 254 | /** |
69ddaf66 | 255 | * memory_region_destroy: Destroy a memory region and reclaim all resources. |
093bc2cd AK |
256 | * |
257 | * @mr: the region to be destroyed. May not currently be a subregion | |
258 | * (see memory_region_add_subregion()) or referenced in an alias | |
259 | * (see memory_region_init_alias()). | |
260 | */ | |
261 | void memory_region_destroy(MemoryRegion *mr); | |
262 | ||
263 | /** | |
264 | * memory_region_size: get a memory region's size. | |
265 | * | |
266 | * @mr: the memory region being queried. | |
267 | */ | |
268 | uint64_t memory_region_size(MemoryRegion *mr); | |
269 | ||
8ea9252a AK |
270 | /** |
271 | * memory_region_is_ram: check whether a memory region is random access | |
272 | * | |
273 | * Returns %true is a memory region is random access. | |
274 | * | |
275 | * @mr: the memory region being queried | |
276 | */ | |
277 | bool memory_region_is_ram(MemoryRegion *mr); | |
278 | ||
55043ba3 AK |
279 | /** |
280 | * memory_region_is_logging: return whether a memory region is logging writes | |
281 | * | |
282 | * Returns %true if the memory region is logging writes | |
283 | * | |
284 | * @mr: the memory region being queried | |
285 | */ | |
286 | bool memory_region_is_logging(MemoryRegion *mr); | |
287 | ||
ce7923da AK |
288 | /** |
289 | * memory_region_is_rom: check whether a memory region is ROM | |
290 | * | |
291 | * Returns %true is a memory region is read-only memory. | |
292 | * | |
293 | * @mr: the memory region being queried | |
294 | */ | |
295 | bool memory_region_is_rom(MemoryRegion *mr); | |
296 | ||
093bc2cd AK |
297 | /** |
298 | * memory_region_get_ram_ptr: Get a pointer into a RAM memory region. | |
299 | * | |
300 | * Returns a host pointer to a RAM memory region (created with | |
301 | * memory_region_init_ram() or memory_region_init_ram_ptr()). Use with | |
302 | * care. | |
303 | * | |
304 | * @mr: the memory region being queried. | |
305 | */ | |
306 | void *memory_region_get_ram_ptr(MemoryRegion *mr); | |
307 | ||
308 | /** | |
309 | * memory_region_set_offset: Sets an offset to be added to MemoryRegionOps | |
310 | * callbacks. | |
311 | * | |
312 | * This function is deprecated and should not be used in new code. | |
313 | */ | |
314 | void memory_region_set_offset(MemoryRegion *mr, target_phys_addr_t offset); | |
315 | ||
316 | /** | |
317 | * memory_region_set_log: Turn dirty logging on or off for a region. | |
318 | * | |
319 | * Turns dirty logging on or off for a specified client (display, migration). | |
320 | * Only meaningful for RAM regions. | |
321 | * | |
322 | * @mr: the memory region being updated. | |
323 | * @log: whether dirty logging is to be enabled or disabled. | |
324 | * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or | |
325 | * %DIRTY_MEMORY_VGA. | |
326 | */ | |
327 | void memory_region_set_log(MemoryRegion *mr, bool log, unsigned client); | |
328 | ||
329 | /** | |
330 | * memory_region_get_dirty: Check whether a page is dirty for a specified | |
331 | * client. | |
332 | * | |
333 | * Checks whether a page has been written to since the last | |
334 | * call to memory_region_reset_dirty() with the same @client. Dirty logging | |
335 | * must be enabled. | |
336 | * | |
337 | * @mr: the memory region being queried. | |
338 | * @addr: the address (relative to the start of the region) being queried. | |
339 | * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or | |
340 | * %DIRTY_MEMORY_VGA. | |
341 | */ | |
342 | bool memory_region_get_dirty(MemoryRegion *mr, target_phys_addr_t addr, | |
343 | unsigned client); | |
344 | ||
345 | /** | |
346 | * memory_region_set_dirty: Mark a page as dirty in a memory region. | |
347 | * | |
348 | * Marks a page as dirty, after it has been dirtied outside guest code. | |
349 | * | |
350 | * @mr: the memory region being queried. | |
351 | * @addr: the address (relative to the start of the region) being dirtied. | |
352 | */ | |
353 | void memory_region_set_dirty(MemoryRegion *mr, target_phys_addr_t addr); | |
354 | ||
355 | /** | |
356 | * memory_region_sync_dirty_bitmap: Synchronize a region's dirty bitmap with | |
357 | * any external TLBs (e.g. kvm) | |
358 | * | |
359 | * Flushes dirty information from accelerators such as kvm and vhost-net | |
360 | * and makes it available to users of the memory API. | |
361 | * | |
362 | * @mr: the region being flushed. | |
363 | */ | |
364 | void memory_region_sync_dirty_bitmap(MemoryRegion *mr); | |
365 | ||
366 | /** | |
367 | * memory_region_reset_dirty: Mark a range of pages as clean, for a specified | |
368 | * client. | |
369 | * | |
370 | * Marks a range of pages as no longer dirty. | |
371 | * | |
372 | * @mr: the region being updated. | |
373 | * @addr: the start of the subrange being cleaned. | |
374 | * @size: the size of the subrange being cleaned. | |
375 | * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or | |
376 | * %DIRTY_MEMORY_VGA. | |
377 | */ | |
378 | void memory_region_reset_dirty(MemoryRegion *mr, target_phys_addr_t addr, | |
379 | target_phys_addr_t size, unsigned client); | |
380 | ||
381 | /** | |
382 | * memory_region_set_readonly: Turn a memory region read-only (or read-write) | |
383 | * | |
384 | * Allows a memory region to be marked as read-only (turning it into a ROM). | |
385 | * only useful on RAM regions. | |
386 | * | |
387 | * @mr: the region being updated. | |
388 | * @readonly: whether rhe region is to be ROM or RAM. | |
389 | */ | |
390 | void memory_region_set_readonly(MemoryRegion *mr, bool readonly); | |
391 | ||
d0a9b5bc AK |
392 | /** |
393 | * memory_region_rom_device_set_readable: enable/disable ROM readability | |
394 | * | |
395 | * Allows a ROM device (initialized with memory_region_init_rom_device() to | |
396 | * to be marked as readable (default) or not readable. When it is readable, | |
397 | * the device is mapped to guest memory. When not readable, reads are | |
398 | * forwarded to the #MemoryRegion.read function. | |
399 | * | |
400 | * @mr: the memory region to be updated | |
401 | * @readable: whether reads are satisified directly (%true) or via callbacks | |
402 | * (%false) | |
403 | */ | |
404 | void memory_region_rom_device_set_readable(MemoryRegion *mr, bool readable); | |
405 | ||
093bc2cd AK |
406 | /** |
407 | * memory_region_set_coalescing: Enable memory coalescing for the region. | |
408 | * | |
409 | * Enabled writes to a region to be queued for later processing. MMIO ->write | |
410 | * callbacks may be delayed until a non-coalesced MMIO is issued. | |
411 | * Only useful for IO regions. Roughly similar to write-combining hardware. | |
412 | * | |
413 | * @mr: the memory region to be write coalesced | |
414 | */ | |
415 | void memory_region_set_coalescing(MemoryRegion *mr); | |
416 | ||
417 | /** | |
418 | * memory_region_add_coalescing: Enable memory coalescing for a sub-range of | |
419 | * a region. | |
420 | * | |
421 | * Like memory_region_set_coalescing(), but works on a sub-range of a region. | |
422 | * Multiple calls can be issued coalesced disjoint ranges. | |
423 | * | |
424 | * @mr: the memory region to be updated. | |
425 | * @offset: the start of the range within the region to be coalesced. | |
426 | * @size: the size of the subrange to be coalesced. | |
427 | */ | |
428 | void memory_region_add_coalescing(MemoryRegion *mr, | |
429 | target_phys_addr_t offset, | |
430 | uint64_t size); | |
431 | ||
432 | /** | |
433 | * memory_region_clear_coalescing: Disable MMIO coalescing for the region. | |
434 | * | |
435 | * Disables any coalescing caused by memory_region_set_coalescing() or | |
436 | * memory_region_add_coalescing(). Roughly equivalent to uncacheble memory | |
437 | * hardware. | |
438 | * | |
439 | * @mr: the memory region to be updated. | |
440 | */ | |
441 | void memory_region_clear_coalescing(MemoryRegion *mr); | |
442 | ||
3e9d69e7 AK |
443 | /** |
444 | * memory_region_add_eventfd: Request an eventfd to be triggered when a word | |
445 | * is written to a location. | |
446 | * | |
447 | * Marks a word in an IO region (initialized with memory_region_init_io()) | |
448 | * as a trigger for an eventfd event. The I/O callback will not be called. | |
69ddaf66 | 449 | * The caller must be prepared to handle failure (that is, take the required |
3e9d69e7 AK |
450 | * action if the callback _is_ called). |
451 | * | |
452 | * @mr: the memory region being updated. | |
453 | * @addr: the address within @mr that is to be monitored | |
454 | * @size: the size of the access to trigger the eventfd | |
455 | * @match_data: whether to match against @data, instead of just @addr | |
456 | * @data: the data to match against the guest write | |
457 | * @fd: the eventfd to be triggered when @addr, @size, and @data all match. | |
458 | **/ | |
459 | void memory_region_add_eventfd(MemoryRegion *mr, | |
460 | target_phys_addr_t addr, | |
461 | unsigned size, | |
462 | bool match_data, | |
463 | uint64_t data, | |
464 | int fd); | |
465 | ||
466 | /** | |
69ddaf66 | 467 | * memory_region_del_eventfd: Cancel an eventfd. |
3e9d69e7 | 468 | * |
69ddaf66 ASRJ |
469 | * Cancels an eventfd trigger requested by a previous |
470 | * memory_region_add_eventfd() call. | |
3e9d69e7 AK |
471 | * |
472 | * @mr: the memory region being updated. | |
473 | * @addr: the address within @mr that is to be monitored | |
474 | * @size: the size of the access to trigger the eventfd | |
475 | * @match_data: whether to match against @data, instead of just @addr | |
476 | * @data: the data to match against the guest write | |
477 | * @fd: the eventfd to be triggered when @addr, @size, and @data all match. | |
478 | */ | |
479 | void memory_region_del_eventfd(MemoryRegion *mr, | |
480 | target_phys_addr_t addr, | |
481 | unsigned size, | |
482 | bool match_data, | |
483 | uint64_t data, | |
484 | int fd); | |
093bc2cd | 485 | /** |
69ddaf66 | 486 | * memory_region_add_subregion: Add a subregion to a container. |
093bc2cd | 487 | * |
69ddaf66 | 488 | * Adds a subregion at @offset. The subregion may not overlap with other |
093bc2cd AK |
489 | * subregions (except for those explicitly marked as overlapping). A region |
490 | * may only be added once as a subregion (unless removed with | |
491 | * memory_region_del_subregion()); use memory_region_init_alias() if you | |
492 | * want a region to be a subregion in multiple locations. | |
493 | * | |
494 | * @mr: the region to contain the new subregion; must be a container | |
495 | * initialized with memory_region_init(). | |
496 | * @offset: the offset relative to @mr where @subregion is added. | |
497 | * @subregion: the subregion to be added. | |
498 | */ | |
499 | void memory_region_add_subregion(MemoryRegion *mr, | |
500 | target_phys_addr_t offset, | |
501 | MemoryRegion *subregion); | |
502 | /** | |
69ddaf66 | 503 | * memory_region_add_subregion: Add a subregion to a container, with overlap. |
093bc2cd | 504 | * |
69ddaf66 | 505 | * Adds a subregion at @offset. The subregion may overlap with other |
093bc2cd AK |
506 | * subregions. Conflicts are resolved by having a higher @priority hide a |
507 | * lower @priority. Subregions without priority are taken as @priority 0. | |
508 | * A region may only be added once as a subregion (unless removed with | |
509 | * memory_region_del_subregion()); use memory_region_init_alias() if you | |
510 | * want a region to be a subregion in multiple locations. | |
511 | * | |
512 | * @mr: the region to contain the new subregion; must be a container | |
513 | * initialized with memory_region_init(). | |
514 | * @offset: the offset relative to @mr where @subregion is added. | |
515 | * @subregion: the subregion to be added. | |
516 | * @priority: used for resolving overlaps; highest priority wins. | |
517 | */ | |
518 | void memory_region_add_subregion_overlap(MemoryRegion *mr, | |
519 | target_phys_addr_t offset, | |
520 | MemoryRegion *subregion, | |
521 | unsigned priority); | |
522 | /** | |
523 | * memory_region_del_subregion: Remove a subregion. | |
524 | * | |
525 | * Removes a subregion from its container. | |
526 | * | |
527 | * @mr: the container to be updated. | |
528 | * @subregion: the region being removed; must be a current subregion of @mr. | |
529 | */ | |
530 | void memory_region_del_subregion(MemoryRegion *mr, | |
531 | MemoryRegion *subregion); | |
532 | ||
6bba19ba AK |
533 | /* |
534 | * memory_region_set_enabled: dynamically enable or disable a region | |
535 | * | |
536 | * Enables or disables a memory region. A disabled memory region | |
537 | * ignores all accesses to itself and its subregions. It does not | |
538 | * obscure sibling subregions with lower priority - it simply behaves as | |
539 | * if it was removed from the hierarchy. | |
540 | * | |
541 | * Regions default to being enabled. | |
542 | * | |
543 | * @mr: the region to be updated | |
544 | * @enabled: whether to enable or disable the region | |
545 | */ | |
546 | void memory_region_set_enabled(MemoryRegion *mr, bool enabled); | |
547 | ||
2282e1af AK |
548 | /* |
549 | * memory_region_set_address: dynamically update the address of a region | |
550 | * | |
551 | * Dynamically updates the address of a region, relative to its parent. | |
552 | * May be used on regions are currently part of a memory hierarchy. | |
553 | * | |
554 | * @mr: the region to be updated | |
555 | * @addr: new address, relative to parent region | |
556 | */ | |
557 | void memory_region_set_address(MemoryRegion *mr, target_phys_addr_t addr); | |
558 | ||
4703359e AK |
559 | /* |
560 | * memory_region_set_alias_offset: dynamically update a memory alias's offset | |
561 | * | |
562 | * Dynamically updates the offset into the target region that an alias points | |
563 | * to, as if the fourth argument to memory_region_init_alias() has changed. | |
564 | * | |
565 | * @mr: the #MemoryRegion to be updated; should be an alias. | |
566 | * @offset: the new offset into the target memory region | |
567 | */ | |
568 | void memory_region_set_alias_offset(MemoryRegion *mr, | |
569 | target_phys_addr_t offset); | |
570 | ||
69ddaf66 ASRJ |
571 | /** |
572 | * memory_region_transaction_begin: Start a transaction. | |
573 | * | |
574 | * During a transaction, changes will be accumulated and made visible | |
575 | * only when the transaction ends (is commited). | |
4ef4db86 AK |
576 | */ |
577 | void memory_region_transaction_begin(void); | |
69ddaf66 ASRJ |
578 | |
579 | /** | |
580 | * memory_region_transaction_commit: Commit a transaction and make changes | |
581 | * visible to the guest. | |
4ef4db86 AK |
582 | */ |
583 | void memory_region_transaction_commit(void); | |
584 | ||
314e2987 BS |
585 | void mtree_info(fprintf_function mon_printf, void *f); |
586 | ||
093bc2cd AK |
587 | #endif |
588 | ||
589 | #endif |