memory: differentiate memory_region_is_logging and memory_region_get_dirty_log_mask

For now memory regions only track DIRTY_MEMORY_VGA individually, but
this will change soon. To support this, split memory_region_is_logging
in two functions: one that returns a given bit from dirty_log_mask,
and one that returns the entire mask. memory_region_is_logging gets an
extra parameter so that the compiler flags misuse.

While VGA-specific users (including the Xen listener!) will want to keep
checking that bit, KVM and vhost check for "any bit except migration"
(because migration is handled via the global start/stop listener
callbacks).

Backports commit 2d1a35bef0ed96b3f23535e459c552414ccdbafd from qemu
This commit is contained in:
Paolo Bonzini 2018-02-13 08:41:40 -05:00 committed by Lioncash
parent 9847ba46d6
commit 1551573acc
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
16 changed files with 33 additions and 2 deletions

View file

@ -2055,6 +2055,7 @@
#define memory_region_get_addr memory_region_get_addr_aarch64
#define memory_region_get_alignment memory_region_get_alignment_aarch64
#define memory_region_get_container memory_region_get_container_aarch64
#define memory_region_get_dirty_log_mask memory_region_get_dirty_log_mask_aarch64
#define memory_region_get_fd memory_region_get_fd_aarch64
#define memory_region_get_may_overlap memory_region_get_may_overlap_aarch64
#define memory_region_get_priority memory_region_get_priority_aarch64

View file

@ -2055,6 +2055,7 @@
#define memory_region_get_addr memory_region_get_addr_aarch64eb
#define memory_region_get_alignment memory_region_get_alignment_aarch64eb
#define memory_region_get_container memory_region_get_container_aarch64eb
#define memory_region_get_dirty_log_mask memory_region_get_dirty_log_mask_aarch64eb
#define memory_region_get_fd memory_region_get_fd_aarch64eb
#define memory_region_get_may_overlap memory_region_get_may_overlap_aarch64eb
#define memory_region_get_priority memory_region_get_priority_aarch64eb

View file

@ -2055,6 +2055,7 @@
#define memory_region_get_addr memory_region_get_addr_arm
#define memory_region_get_alignment memory_region_get_alignment_arm
#define memory_region_get_container memory_region_get_container_arm
#define memory_region_get_dirty_log_mask memory_region_get_dirty_log_mask_arm
#define memory_region_get_fd memory_region_get_fd_arm
#define memory_region_get_may_overlap memory_region_get_may_overlap_arm
#define memory_region_get_priority memory_region_get_priority_arm

View file

@ -2055,6 +2055,7 @@
#define memory_region_get_addr memory_region_get_addr_armeb
#define memory_region_get_alignment memory_region_get_alignment_armeb
#define memory_region_get_container memory_region_get_container_armeb
#define memory_region_get_dirty_log_mask memory_region_get_dirty_log_mask_armeb
#define memory_region_get_fd memory_region_get_fd_armeb
#define memory_region_get_may_overlap memory_region_get_may_overlap_armeb
#define memory_region_get_priority memory_region_get_priority_armeb

View file

@ -2061,6 +2061,7 @@ symbols = (
'memory_region_get_addr',
'memory_region_get_alignment',
'memory_region_get_container',
'memory_region_get_dirty_log_mask',
'memory_region_get_fd',
'memory_region_get_may_overlap',
'memory_region_get_priority',

View file

@ -512,8 +512,20 @@ const char *memory_region_name(const MemoryRegion *mr);
* Returns %true if the memory region is logging writes
*
* @mr: the memory region being queried
* @client: the client being queried
*/
bool memory_region_is_logging(MemoryRegion *mr);
bool memory_region_is_logging(MemoryRegion *mr, uint8_t client);
/**
* memory_region_get_dirty_log_mask: return the clients for which a
* memory region is logging writes.
*
* Returns a bitmap of clients, which right now will be either 0 or
* (1 << DIRTY_MEMORY_VGA).
*
* @mr: the memory region being queried
*/
uint8_t memory_region_get_dirty_log_mask(MemoryRegion *mr);
/**
* memory_region_is_rom: check whether a memory region is ROM

View file

@ -2055,6 +2055,7 @@
#define memory_region_get_addr memory_region_get_addr_m68k
#define memory_region_get_alignment memory_region_get_alignment_m68k
#define memory_region_get_container memory_region_get_container_m68k
#define memory_region_get_dirty_log_mask memory_region_get_dirty_log_mask_m68k
#define memory_region_get_fd memory_region_get_fd_m68k
#define memory_region_get_may_overlap memory_region_get_may_overlap_m68k
#define memory_region_get_priority memory_region_get_priority_m68k

View file

@ -1269,11 +1269,16 @@ bool memory_region_is_skip_dump(MemoryRegion *mr)
return mr->skip_dump;
}
bool memory_region_is_logging(MemoryRegion *mr)
uint8_t memory_region_get_dirty_log_mask(MemoryRegion *mr)
{
return mr->dirty_log_mask;
}
bool memory_region_is_logging(MemoryRegion *mr, uint8_t client)
{
return memory_region_get_dirty_log_mask(mr) & (1 << client);
}
bool memory_region_is_rom(MemoryRegion *mr)
{
return mr->ram && mr->readonly;

View file

@ -2055,6 +2055,7 @@
#define memory_region_get_addr memory_region_get_addr_mips
#define memory_region_get_alignment memory_region_get_alignment_mips
#define memory_region_get_container memory_region_get_container_mips
#define memory_region_get_dirty_log_mask memory_region_get_dirty_log_mask_mips
#define memory_region_get_fd memory_region_get_fd_mips
#define memory_region_get_may_overlap memory_region_get_may_overlap_mips
#define memory_region_get_priority memory_region_get_priority_mips

View file

@ -2055,6 +2055,7 @@
#define memory_region_get_addr memory_region_get_addr_mips64
#define memory_region_get_alignment memory_region_get_alignment_mips64
#define memory_region_get_container memory_region_get_container_mips64
#define memory_region_get_dirty_log_mask memory_region_get_dirty_log_mask_mips64
#define memory_region_get_fd memory_region_get_fd_mips64
#define memory_region_get_may_overlap memory_region_get_may_overlap_mips64
#define memory_region_get_priority memory_region_get_priority_mips64

View file

@ -2055,6 +2055,7 @@
#define memory_region_get_addr memory_region_get_addr_mips64el
#define memory_region_get_alignment memory_region_get_alignment_mips64el
#define memory_region_get_container memory_region_get_container_mips64el
#define memory_region_get_dirty_log_mask memory_region_get_dirty_log_mask_mips64el
#define memory_region_get_fd memory_region_get_fd_mips64el
#define memory_region_get_may_overlap memory_region_get_may_overlap_mips64el
#define memory_region_get_priority memory_region_get_priority_mips64el

View file

@ -2055,6 +2055,7 @@
#define memory_region_get_addr memory_region_get_addr_mipsel
#define memory_region_get_alignment memory_region_get_alignment_mipsel
#define memory_region_get_container memory_region_get_container_mipsel
#define memory_region_get_dirty_log_mask memory_region_get_dirty_log_mask_mipsel
#define memory_region_get_fd memory_region_get_fd_mipsel
#define memory_region_get_may_overlap memory_region_get_may_overlap_mipsel
#define memory_region_get_priority memory_region_get_priority_mipsel

View file

@ -2055,6 +2055,7 @@
#define memory_region_get_addr memory_region_get_addr_powerpc
#define memory_region_get_alignment memory_region_get_alignment_powerpc
#define memory_region_get_container memory_region_get_container_powerpc
#define memory_region_get_dirty_log_mask memory_region_get_dirty_log_mask_powerpc
#define memory_region_get_fd memory_region_get_fd_powerpc
#define memory_region_get_may_overlap memory_region_get_may_overlap_powerpc
#define memory_region_get_priority memory_region_get_priority_powerpc

View file

@ -2055,6 +2055,7 @@
#define memory_region_get_addr memory_region_get_addr_sparc
#define memory_region_get_alignment memory_region_get_alignment_sparc
#define memory_region_get_container memory_region_get_container_sparc
#define memory_region_get_dirty_log_mask memory_region_get_dirty_log_mask_sparc
#define memory_region_get_fd memory_region_get_fd_sparc
#define memory_region_get_may_overlap memory_region_get_may_overlap_sparc
#define memory_region_get_priority memory_region_get_priority_sparc

View file

@ -2055,6 +2055,7 @@
#define memory_region_get_addr memory_region_get_addr_sparc64
#define memory_region_get_alignment memory_region_get_alignment_sparc64
#define memory_region_get_container memory_region_get_container_sparc64
#define memory_region_get_dirty_log_mask memory_region_get_dirty_log_mask_sparc64
#define memory_region_get_fd memory_region_get_fd_sparc64
#define memory_region_get_may_overlap memory_region_get_may_overlap_sparc64
#define memory_region_get_priority memory_region_get_priority_sparc64

View file

@ -2055,6 +2055,7 @@
#define memory_region_get_addr memory_region_get_addr_x86_64
#define memory_region_get_alignment memory_region_get_alignment_x86_64
#define memory_region_get_container memory_region_get_container_x86_64
#define memory_region_get_dirty_log_mask memory_region_get_dirty_log_mask_x86_64
#define memory_region_get_fd memory_region_get_fd_x86_64
#define memory_region_get_may_overlap memory_region_get_may_overlap_x86_64
#define memory_region_get_priority memory_region_get_priority_x86_64