qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

ram_addr: Split RAMBlock definition

We need some of the fields without having to poison everything else.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

+66 -39
+1
MAINTAINERS
··· 1975 1975 F: include/exec/memop.h 1976 1976 F: include/exec/memory.h 1977 1977 F: include/exec/ram_addr.h 1978 + F: include/exec/ramblock.h 1978 1979 F: memory.c 1979 1980 F: include/exec/memory-internal.h 1980 1981 F: exec.c
+1 -39
include/exec/ram_addr.h
··· 24 24 #include "hw/xen/xen.h" 25 25 #include "sysemu/tcg.h" 26 26 #include "exec/ramlist.h" 27 - 28 - struct RAMBlock { 29 - struct rcu_head rcu; 30 - struct MemoryRegion *mr; 31 - uint8_t *host; 32 - uint8_t *colo_cache; /* For colo, VM's ram cache */ 33 - ram_addr_t offset; 34 - ram_addr_t used_length; 35 - ram_addr_t max_length; 36 - void (*resized)(const char*, uint64_t length, void *host); 37 - uint32_t flags; 38 - /* Protected by iothread lock. */ 39 - char idstr[256]; 40 - /* RCU-enabled, writes protected by the ramlist lock */ 41 - QLIST_ENTRY(RAMBlock) next; 42 - QLIST_HEAD(, RAMBlockNotifier) ramblock_notifiers; 43 - int fd; 44 - size_t page_size; 45 - /* dirty bitmap used during migration */ 46 - unsigned long *bmap; 47 - /* bitmap of already received pages in postcopy */ 48 - unsigned long *receivedmap; 49 - 50 - /* 51 - * bitmap to track already cleared dirty bitmap. When the bit is 52 - * set, it means the corresponding memory chunk needs a log-clear. 53 - * Set this up to non-NULL to enable the capability to postpone 54 - * and split clearing of dirty bitmap on the remote node (e.g., 55 - * KVM). The bitmap will be set only when doing global sync. 56 - * 57 - * NOTE: this bitmap is different comparing to the other bitmaps 58 - * in that one bit can represent multiple guest pages (which is 59 - * decided by the `clear_bmap_shift' variable below). On 60 - * destination side, this should always be NULL, and the variable 61 - * `clear_bmap_shift' is meaningless. 62 - */ 63 - unsigned long *clear_bmap; 64 - uint8_t clear_bmap_shift; 65 - }; 27 + #include "exec/ramblock.h" 66 28 67 29 /** 68 30 * clear_bmap_size: calculate clear bitmap size
+64
include/exec/ramblock.h
··· 1 + /* 2 + * Declarations for cpu physical memory functions 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 or 10 + * later. See the COPYING file in the top-level directory. 11 + * 12 + */ 13 + 14 + /* 15 + * This header is for use by exec.c and memory.c ONLY. Do not include it. 16 + * The functions declared here will be removed soon. 17 + */ 18 + 19 + #ifndef QEMU_EXEC_RAMBLOCK_H 20 + #define QEMU_EXEC_RAMBLOCK_H 21 + 22 + #ifndef CONFIG_USER_ONLY 23 + #include "cpu-common.h" 24 + 25 + struct RAMBlock { 26 + struct rcu_head rcu; 27 + struct MemoryRegion *mr; 28 + uint8_t *host; 29 + uint8_t *colo_cache; /* For colo, VM's ram cache */ 30 + ram_addr_t offset; 31 + ram_addr_t used_length; 32 + ram_addr_t max_length; 33 + void (*resized)(const char*, uint64_t length, void *host); 34 + uint32_t flags; 35 + /* Protected by iothread lock. */ 36 + char idstr[256]; 37 + /* RCU-enabled, writes protected by the ramlist lock */ 38 + QLIST_ENTRY(RAMBlock) next; 39 + QLIST_HEAD(, RAMBlockNotifier) ramblock_notifiers; 40 + int fd; 41 + size_t page_size; 42 + /* dirty bitmap used during migration */ 43 + unsigned long *bmap; 44 + /* bitmap of already received pages in postcopy */ 45 + unsigned long *receivedmap; 46 + 47 + /* 48 + * bitmap to track already cleared dirty bitmap. When the bit is 49 + * set, it means the corresponding memory chunk needs a log-clear. 50 + * Set this up to non-NULL to enable the capability to postpone 51 + * and split clearing of dirty bitmap on the remote node (e.g., 52 + * KVM). The bitmap will be set only when doing global sync. 53 + * 54 + * NOTE: this bitmap is different comparing to the other bitmaps 55 + * in that one bit can represent multiple guest pages (which is 56 + * decided by the `clear_bmap_shift' variable below). On 57 + * destination side, this should always be NULL, and the variable 58 + * `clear_bmap_shift' is meaningless. 59 + */ 60 + unsigned long *clear_bmap; 61 + uint8_t clear_bmap_shift; 62 + }; 63 + #endif 64 + #endif