]> git.proxmox.com Git - qemu.git/blame - memory.h
Direct dispatch through MemoryRegion
[qemu.git] / memory.h
CommitLineData
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 <avi@redhat.com>
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
29typedef struct MemoryRegionOps MemoryRegionOps;
30typedef struct MemoryRegion MemoryRegion;
627a0e90 31typedef struct MemoryRegionPortio MemoryRegionPortio;
74901c3b 32typedef 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
41struct MemoryRegionMmio {
42 CPUReadMemoryFunc *read[3];
43 CPUWriteMemoryFunc *write[3];
44};
45
093bc2cd
AK
46/*
47 * Memory region callbacks
48 */
49struct 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
108typedef struct CoalescedMemoryRange CoalescedMemoryRange;
3e9d69e7 109typedef struct MemoryRegionIoeventfd MemoryRegionIoeventfd;
093bc2cd
AK
110
111struct 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;
545e92e0 119 void (*destructor)(MemoryRegion *mr);
093bc2cd 120 ram_addr_t ram_addr;
658b2224 121 IORange iorange;
14a3c10a 122 bool terminates;
d0a9b5bc 123 bool readable;
8ea9252a 124 bool ram;
fb1cd6f9 125 bool readonly; /* For RAM regions */
6bba19ba 126 bool enabled;
093bc2cd
AK
127 MemoryRegion *alias;
128 target_phys_addr_t alias_offset;
129 unsigned priority;
130 bool may_overlap;
131 QTAILQ_HEAD(subregions, MemoryRegion) subregions;
132 QTAILQ_ENTRY(MemoryRegion) subregions_link;
133 QTAILQ_HEAD(coalesced_ranges, CoalescedMemoryRange) coalesced;
134 const char *name;
5a583347 135 uint8_t dirty_log_mask;
3e9d69e7
AK
136 unsigned ioeventfd_nb;
137 MemoryRegionIoeventfd *ioeventfds;
093bc2cd
AK
138};
139
627a0e90
AK
140struct MemoryRegionPortio {
141 uint32_t offset;
142 uint32_t len;
143 unsigned size;
144 IOPortReadFunc *read;
145 IOPortWriteFunc *write;
146};
147
2dd30228 148#define PORTIO_END_OF_LIST() { }
627a0e90 149
e2177955
AK
150typedef struct MemoryRegionSection MemoryRegionSection;
151
152/**
153 * MemoryRegionSection: describes a fragment of a #MemoryRegion
154 *
155 * @mr: the region, or %NULL if empty
7664e80c 156 * @address_space: the address space the region is mapped in
e2177955
AK
157 * @offset_within_region: the beginning of the section, relative to @mr's start
158 * @size: the size of the section; will not exceed @mr's boundaries
159 * @offset_within_address_space: the address of the first byte of the section
160 * relative to the region's address space
161 */
162struct MemoryRegionSection {
163 MemoryRegion *mr;
7664e80c 164 MemoryRegion *address_space;
e2177955
AK
165 target_phys_addr_t offset_within_region;
166 uint64_t size;
167 target_phys_addr_t offset_within_address_space;
168};
169
7664e80c
AK
170typedef struct MemoryListener MemoryListener;
171
172/**
173 * MemoryListener: callbacks structure for updates to the physical memory map
174 *
175 * Allows a component to adjust to changes in the guest-visible memory map.
176 * Use with memory_listener_register() and memory_listener_unregister().
177 */
178struct MemoryListener {
179 void (*region_add)(MemoryListener *listener, MemoryRegionSection *section);
180 void (*region_del)(MemoryListener *listener, MemoryRegionSection *section);
181 void (*log_start)(MemoryListener *listener, MemoryRegionSection *section);
182 void (*log_stop)(MemoryListener *listener, MemoryRegionSection *section);
183 void (*log_sync)(MemoryListener *listener, MemoryRegionSection *section);
184 void (*log_global_start)(MemoryListener *listener);
185 void (*log_global_stop)(MemoryListener *listener);
186 QLIST_ENTRY(MemoryListener) link;
187};
188
093bc2cd
AK
189/**
190 * memory_region_init: Initialize a memory region
191 *
69ddaf66 192 * The region typically acts as a container for other memory regions. Use
093bc2cd
AK
193 * memory_region_add_subregion() to add subregions.
194 *
195 * @mr: the #MemoryRegion to be initialized
196 * @name: used for debugging; not visible to the user or ABI
197 * @size: size of the region; any subregions beyond this size will be clipped
198 */
199void memory_region_init(MemoryRegion *mr,
200 const char *name,
201 uint64_t size);
202/**
203 * memory_region_init_io: Initialize an I/O memory region.
204 *
69ddaf66 205 * Accesses into the region will cause the callbacks in @ops to be called.
093bc2cd
AK
206 * if @size is nonzero, subregions will be clipped to @size.
207 *
208 * @mr: the #MemoryRegion to be initialized.
209 * @ops: a structure containing read and write callbacks to be used when
210 * I/O is performed on the region.
211 * @opaque: passed to to the read and write callbacks of the @ops structure.
212 * @name: used for debugging; not visible to the user or ABI
213 * @size: size of the region.
214 */
215void memory_region_init_io(MemoryRegion *mr,
216 const MemoryRegionOps *ops,
217 void *opaque,
218 const char *name,
219 uint64_t size);
220
221/**
222 * memory_region_init_ram: Initialize RAM memory region. Accesses into the
69ddaf66 223 * region will modify memory directly.
093bc2cd
AK
224 *
225 * @mr: the #MemoryRegion to be initialized.
c5705a77 226 * @name: the name of the region.
093bc2cd
AK
227 * @size: size of the region.
228 */
229void memory_region_init_ram(MemoryRegion *mr,
093bc2cd
AK
230 const char *name,
231 uint64_t size);
232
233/**
234 * memory_region_init_ram: Initialize RAM memory region from a user-provided.
69ddaf66 235 * pointer. Accesses into the region will modify
093bc2cd
AK
236 * memory directly.
237 *
238 * @mr: the #MemoryRegion to be initialized.
c5705a77 239 * @name: the name of the region.
093bc2cd
AK
240 * @size: size of the region.
241 * @ptr: memory to be mapped; must contain at least @size bytes.
242 */
243void memory_region_init_ram_ptr(MemoryRegion *mr,
093bc2cd
AK
244 const char *name,
245 uint64_t size,
246 void *ptr);
247
248/**
249 * memory_region_init_alias: Initialize a memory region that aliases all or a
250 * part of another memory region.
251 *
252 * @mr: the #MemoryRegion to be initialized.
253 * @name: used for debugging; not visible to the user or ABI
254 * @orig: the region to be referenced; @mr will be equivalent to
255 * @orig between @offset and @offset + @size - 1.
256 * @offset: start of the section in @orig to be referenced.
257 * @size: size of the region.
258 */
259void memory_region_init_alias(MemoryRegion *mr,
260 const char *name,
261 MemoryRegion *orig,
262 target_phys_addr_t offset,
263 uint64_t size);
d0a9b5bc
AK
264
265/**
266 * memory_region_init_rom_device: Initialize a ROM memory region. Writes are
267 * handled via callbacks.
268 *
269 * @mr: the #MemoryRegion to be initialized.
270 * @ops: callbacks for write access handling.
c5705a77 271 * @name: the name of the region.
d0a9b5bc
AK
272 * @size: size of the region.
273 */
274void memory_region_init_rom_device(MemoryRegion *mr,
275 const MemoryRegionOps *ops,
75f5941c 276 void *opaque,
d0a9b5bc
AK
277 const char *name,
278 uint64_t size);
279
093bc2cd 280/**
69ddaf66 281 * memory_region_destroy: Destroy a memory region and reclaim all resources.
093bc2cd
AK
282 *
283 * @mr: the region to be destroyed. May not currently be a subregion
284 * (see memory_region_add_subregion()) or referenced in an alias
285 * (see memory_region_init_alias()).
286 */
287void memory_region_destroy(MemoryRegion *mr);
288
289/**
290 * memory_region_size: get a memory region's size.
291 *
292 * @mr: the memory region being queried.
293 */
294uint64_t memory_region_size(MemoryRegion *mr);
295
8ea9252a
AK
296/**
297 * memory_region_is_ram: check whether a memory region is random access
298 *
299 * Returns %true is a memory region is random access.
300 *
301 * @mr: the memory region being queried
302 */
303bool memory_region_is_ram(MemoryRegion *mr);
304
8991c79b
AK
305/**
306 * memory_region_name: get a memory region's name
307 *
308 * Returns the string that was used to initialize the memory region.
309 *
310 * @mr: the memory region being queried
311 */
312const char *memory_region_name(MemoryRegion *mr);
313
55043ba3
AK
314/**
315 * memory_region_is_logging: return whether a memory region is logging writes
316 *
317 * Returns %true if the memory region is logging writes
318 *
319 * @mr: the memory region being queried
320 */
321bool memory_region_is_logging(MemoryRegion *mr);
322
ce7923da
AK
323/**
324 * memory_region_is_rom: check whether a memory region is ROM
325 *
326 * Returns %true is a memory region is read-only memory.
327 *
328 * @mr: the memory region being queried
329 */
330bool memory_region_is_rom(MemoryRegion *mr);
331
093bc2cd
AK
332/**
333 * memory_region_get_ram_ptr: Get a pointer into a RAM memory region.
334 *
335 * Returns a host pointer to a RAM memory region (created with
336 * memory_region_init_ram() or memory_region_init_ram_ptr()). Use with
337 * care.
338 *
339 * @mr: the memory region being queried.
340 */
341void *memory_region_get_ram_ptr(MemoryRegion *mr);
342
343/**
344 * memory_region_set_offset: Sets an offset to be added to MemoryRegionOps
345 * callbacks.
346 *
347 * This function is deprecated and should not be used in new code.
348 */
349void memory_region_set_offset(MemoryRegion *mr, target_phys_addr_t offset);
350
351/**
352 * memory_region_set_log: Turn dirty logging on or off for a region.
353 *
354 * Turns dirty logging on or off for a specified client (display, migration).
355 * Only meaningful for RAM regions.
356 *
357 * @mr: the memory region being updated.
358 * @log: whether dirty logging is to be enabled or disabled.
359 * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or
360 * %DIRTY_MEMORY_VGA.
361 */
362void memory_region_set_log(MemoryRegion *mr, bool log, unsigned client);
363
364/**
365 * memory_region_get_dirty: Check whether a page is dirty for a specified
366 * client.
367 *
368 * Checks whether a page has been written to since the last
369 * call to memory_region_reset_dirty() with the same @client. Dirty logging
370 * must be enabled.
371 *
372 * @mr: the memory region being queried.
373 * @addr: the address (relative to the start of the region) being queried.
374 * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or
375 * %DIRTY_MEMORY_VGA.
376 */
377bool memory_region_get_dirty(MemoryRegion *mr, target_phys_addr_t addr,
378 unsigned client);
379
380/**
381 * memory_region_set_dirty: Mark a page as dirty in a memory region.
382 *
383 * Marks a page as dirty, after it has been dirtied outside guest code.
384 *
385 * @mr: the memory region being queried.
386 * @addr: the address (relative to the start of the region) being dirtied.
387 */
388void memory_region_set_dirty(MemoryRegion *mr, target_phys_addr_t addr);
389
390/**
391 * memory_region_sync_dirty_bitmap: Synchronize a region's dirty bitmap with
392 * any external TLBs (e.g. kvm)
393 *
394 * Flushes dirty information from accelerators such as kvm and vhost-net
395 * and makes it available to users of the memory API.
396 *
397 * @mr: the region being flushed.
398 */
399void memory_region_sync_dirty_bitmap(MemoryRegion *mr);
400
401/**
402 * memory_region_reset_dirty: Mark a range of pages as clean, for a specified
403 * client.
404 *
405 * Marks a range of pages as no longer dirty.
406 *
407 * @mr: the region being updated.
408 * @addr: the start of the subrange being cleaned.
409 * @size: the size of the subrange being cleaned.
410 * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or
411 * %DIRTY_MEMORY_VGA.
412 */
413void memory_region_reset_dirty(MemoryRegion *mr, target_phys_addr_t addr,
414 target_phys_addr_t size, unsigned client);
415
416/**
417 * memory_region_set_readonly: Turn a memory region read-only (or read-write)
418 *
419 * Allows a memory region to be marked as read-only (turning it into a ROM).
420 * only useful on RAM regions.
421 *
422 * @mr: the region being updated.
423 * @readonly: whether rhe region is to be ROM or RAM.
424 */
425void memory_region_set_readonly(MemoryRegion *mr, bool readonly);
426
d0a9b5bc
AK
427/**
428 * memory_region_rom_device_set_readable: enable/disable ROM readability
429 *
430 * Allows a ROM device (initialized with memory_region_init_rom_device() to
431 * to be marked as readable (default) or not readable. When it is readable,
432 * the device is mapped to guest memory. When not readable, reads are
433 * forwarded to the #MemoryRegion.read function.
434 *
435 * @mr: the memory region to be updated
436 * @readable: whether reads are satisified directly (%true) or via callbacks
437 * (%false)
438 */
439void memory_region_rom_device_set_readable(MemoryRegion *mr, bool readable);
440
093bc2cd
AK
441/**
442 * memory_region_set_coalescing: Enable memory coalescing for the region.
443 *
444 * Enabled writes to a region to be queued for later processing. MMIO ->write
445 * callbacks may be delayed until a non-coalesced MMIO is issued.
446 * Only useful for IO regions. Roughly similar to write-combining hardware.
447 *
448 * @mr: the memory region to be write coalesced
449 */
450void memory_region_set_coalescing(MemoryRegion *mr);
451
452/**
453 * memory_region_add_coalescing: Enable memory coalescing for a sub-range of
454 * a region.
455 *
456 * Like memory_region_set_coalescing(), but works on a sub-range of a region.
457 * Multiple calls can be issued coalesced disjoint ranges.
458 *
459 * @mr: the memory region to be updated.
460 * @offset: the start of the range within the region to be coalesced.
461 * @size: the size of the subrange to be coalesced.
462 */
463void memory_region_add_coalescing(MemoryRegion *mr,
464 target_phys_addr_t offset,
465 uint64_t size);
466
467/**
468 * memory_region_clear_coalescing: Disable MMIO coalescing for the region.
469 *
470 * Disables any coalescing caused by memory_region_set_coalescing() or
471 * memory_region_add_coalescing(). Roughly equivalent to uncacheble memory
472 * hardware.
473 *
474 * @mr: the memory region to be updated.
475 */
476void memory_region_clear_coalescing(MemoryRegion *mr);
477
3e9d69e7
AK
478/**
479 * memory_region_add_eventfd: Request an eventfd to be triggered when a word
480 * is written to a location.
481 *
482 * Marks a word in an IO region (initialized with memory_region_init_io())
483 * as a trigger for an eventfd event. The I/O callback will not be called.
69ddaf66 484 * The caller must be prepared to handle failure (that is, take the required
3e9d69e7
AK
485 * action if the callback _is_ called).
486 *
487 * @mr: the memory region being updated.
488 * @addr: the address within @mr that is to be monitored
489 * @size: the size of the access to trigger the eventfd
490 * @match_data: whether to match against @data, instead of just @addr
491 * @data: the data to match against the guest write
492 * @fd: the eventfd to be triggered when @addr, @size, and @data all match.
493 **/
494void memory_region_add_eventfd(MemoryRegion *mr,
495 target_phys_addr_t addr,
496 unsigned size,
497 bool match_data,
498 uint64_t data,
499 int fd);
500
501/**
69ddaf66 502 * memory_region_del_eventfd: Cancel an eventfd.
3e9d69e7 503 *
69ddaf66
ASRJ
504 * Cancels an eventfd trigger requested by a previous
505 * memory_region_add_eventfd() call.
3e9d69e7
AK
506 *
507 * @mr: the memory region being updated.
508 * @addr: the address within @mr that is to be monitored
509 * @size: the size of the access to trigger the eventfd
510 * @match_data: whether to match against @data, instead of just @addr
511 * @data: the data to match against the guest write
512 * @fd: the eventfd to be triggered when @addr, @size, and @data all match.
513 */
514void memory_region_del_eventfd(MemoryRegion *mr,
515 target_phys_addr_t addr,
516 unsigned size,
517 bool match_data,
518 uint64_t data,
519 int fd);
093bc2cd 520/**
69ddaf66 521 * memory_region_add_subregion: Add a subregion to a container.
093bc2cd 522 *
69ddaf66 523 * Adds a subregion at @offset. The subregion may not overlap with other
093bc2cd
AK
524 * subregions (except for those explicitly marked as overlapping). A region
525 * may only be added once as a subregion (unless removed with
526 * memory_region_del_subregion()); use memory_region_init_alias() if you
527 * want a region to be a subregion in multiple locations.
528 *
529 * @mr: the region to contain the new subregion; must be a container
530 * initialized with memory_region_init().
531 * @offset: the offset relative to @mr where @subregion is added.
532 * @subregion: the subregion to be added.
533 */
534void memory_region_add_subregion(MemoryRegion *mr,
535 target_phys_addr_t offset,
536 MemoryRegion *subregion);
537/**
69ddaf66 538 * memory_region_add_subregion: Add a subregion to a container, with overlap.
093bc2cd 539 *
69ddaf66 540 * Adds a subregion at @offset. The subregion may overlap with other
093bc2cd
AK
541 * subregions. Conflicts are resolved by having a higher @priority hide a
542 * lower @priority. Subregions without priority are taken as @priority 0.
543 * A region may only be added once as a subregion (unless removed with
544 * memory_region_del_subregion()); use memory_region_init_alias() if you
545 * want a region to be a subregion in multiple locations.
546 *
547 * @mr: the region to contain the new subregion; must be a container
548 * initialized with memory_region_init().
549 * @offset: the offset relative to @mr where @subregion is added.
550 * @subregion: the subregion to be added.
551 * @priority: used for resolving overlaps; highest priority wins.
552 */
553void memory_region_add_subregion_overlap(MemoryRegion *mr,
554 target_phys_addr_t offset,
555 MemoryRegion *subregion,
556 unsigned priority);
e34911c4
AK
557
558/**
559 * memory_region_get_ram_addr: Get the ram address associated with a memory
560 * region
561 *
562 * DO NOT USE THIS FUCNTION. This is a temporary workaround while the Xen
563 * code is being reworked.
564 */
565ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr);
566
093bc2cd
AK
567/**
568 * memory_region_del_subregion: Remove a subregion.
569 *
570 * Removes a subregion from its container.
571 *
572 * @mr: the container to be updated.
573 * @subregion: the region being removed; must be a current subregion of @mr.
574 */
575void memory_region_del_subregion(MemoryRegion *mr,
576 MemoryRegion *subregion);
577
6bba19ba
AK
578/*
579 * memory_region_set_enabled: dynamically enable or disable a region
580 *
581 * Enables or disables a memory region. A disabled memory region
582 * ignores all accesses to itself and its subregions. It does not
583 * obscure sibling subregions with lower priority - it simply behaves as
584 * if it was removed from the hierarchy.
585 *
586 * Regions default to being enabled.
587 *
588 * @mr: the region to be updated
589 * @enabled: whether to enable or disable the region
590 */
591void memory_region_set_enabled(MemoryRegion *mr, bool enabled);
592
2282e1af
AK
593/*
594 * memory_region_set_address: dynamically update the address of a region
595 *
596 * Dynamically updates the address of a region, relative to its parent.
597 * May be used on regions are currently part of a memory hierarchy.
598 *
599 * @mr: the region to be updated
600 * @addr: new address, relative to parent region
601 */
602void memory_region_set_address(MemoryRegion *mr, target_phys_addr_t addr);
603
4703359e
AK
604/*
605 * memory_region_set_alias_offset: dynamically update a memory alias's offset
606 *
607 * Dynamically updates the offset into the target region that an alias points
608 * to, as if the fourth argument to memory_region_init_alias() has changed.
609 *
610 * @mr: the #MemoryRegion to be updated; should be an alias.
611 * @offset: the new offset into the target memory region
612 */
613void memory_region_set_alias_offset(MemoryRegion *mr,
614 target_phys_addr_t offset);
615
e2177955
AK
616/**
617 * memory_region_find: locate a MemoryRegion in an address space
618 *
619 * Locates the first #MemoryRegion within an address space given by
620 * @address_space that overlaps the range given by @addr and @size.
621 *
622 * Returns a #MemoryRegionSection that describes a contiguous overlap.
623 * It will have the following characteristics:
624 * .@offset_within_address_space >= @addr
625 * .@offset_within_address_space + .@size <= @addr + @size
626 * .@size = 0 iff no overlap was found
627 * .@mr is non-%NULL iff an overlap was found
628 *
629 * @address_space: a top-level (i.e. parentless) region that contains
630 * the region to be found
631 * @addr: start of the area within @address_space to be searched
632 * @size: size of the area to be searched
633 */
634MemoryRegionSection memory_region_find(MemoryRegion *address_space,
635 target_phys_addr_t addr, uint64_t size);
636
86e775c6
AK
637
638/**
639 * memory_global_sync_dirty_bitmap: synchronize the dirty log for all memory
640 *
641 * Synchronizes the dirty page log for an entire address space.
642 * @address_space: a top-level (i.e. parentless) region that contains the
643 * memory being synchronized
644 */
645void memory_global_sync_dirty_bitmap(MemoryRegion *address_space);
646
69ddaf66
ASRJ
647/**
648 * memory_region_transaction_begin: Start a transaction.
649 *
650 * During a transaction, changes will be accumulated and made visible
651 * only when the transaction ends (is commited).
4ef4db86
AK
652 */
653void memory_region_transaction_begin(void);
69ddaf66
ASRJ
654
655/**
656 * memory_region_transaction_commit: Commit a transaction and make changes
657 * visible to the guest.
4ef4db86
AK
658 */
659void memory_region_transaction_commit(void);
660
7664e80c
AK
661/**
662 * memory_listener_register: register callbacks to be called when memory
663 * sections are mapped or unmapped into an address
664 * space
665 *
666 * @listener: an object containing the callbacks to be called
667 */
668void memory_listener_register(MemoryListener *listener);
669
670/**
671 * memory_listener_unregister: undo the effect of memory_listener_register()
672 *
673 * @listener: an object containing the callbacks to be removed
674 */
675void memory_listener_unregister(MemoryListener *listener);
676
677/**
678 * memory_global_dirty_log_start: begin dirty logging for all regions
679 */
680void memory_global_dirty_log_start(void);
681
682/**
683 * memory_global_dirty_log_stop: begin dirty logging for all regions
684 */
685void memory_global_dirty_log_stop(void);
686
314e2987
BS
687void mtree_info(fprintf_function mon_printf, void *f);
688
093bc2cd
AK
689#endif
690
691#endif