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

qemu-common: Move tcg_enabled() etc. to sysemu/tcg.h

Other accelerators have their own headers: sysemu/hax.h, sysemu/hvf.h,
sysemu/kvm.h, sysemu/whpx.h. Only tcg_enabled() & friends sit in
qemu-common.h. This necessitates inclusion of qemu-common.h into
headers, which is against the rules spelled out in qemu-common.h's
file comment.

Move tcg_enabled() & friends into their own header sysemu/tcg.h, and
adjust #include directives.

Cc: Richard Henderson <rth@twiddle.net>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190523143508.25387-2-armbru@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
[Rebased with conflicts resolved automatically, except for
accel/tcg/tcg-all.c]

+56 -18
+1
MAINTAINERS
··· 125 125 F: include/exec/helper*.h 126 126 F: include/exec/tb-hash.h 127 127 F: include/sysemu/cpus.h 128 + F: include/sysemu/tcg.h 128 129 129 130 FPU emulation 130 131 M: Aurelien Jarno <aurelien@aurel32.net>
+1
accel/tcg/cpu-exec-common.c
··· 20 20 #include "qemu/osdep.h" 21 21 #include "cpu.h" 22 22 #include "sysemu/cpus.h" 23 + #include "sysemu/tcg.h" 23 24 #include "exec/exec-all.h" 24 25 25 26 bool tcg_allowed;
+1 -1
accel/tcg/tcg-all.c
··· 26 26 #include "qemu/osdep.h" 27 27 #include "sysemu/accel.h" 28 28 #include "sysemu/sysemu.h" 29 + #include "sysemu/tcg.h" 29 30 #include "qom/object.h" 30 - #include "qemu-common.h" 31 31 #include "cpu.h" 32 32 #include "sysemu/cpus.h" 33 33 #include "qemu/main-loop.h"
+2 -1
accel/tcg/translate-all.c
··· 16 16 * You should have received a copy of the GNU Lesser General Public 17 17 * License along with this library; if not, see <http://www.gnu.org/licenses/>. 18 18 */ 19 + 19 20 #include "qemu/osdep.h" 20 21 21 - #include "qemu-common.h" 22 22 #define NO_CPU_IO_DEFS 23 23 #include "cpu.h" 24 24 #include "trace.h" ··· 55 55 #include "qemu/main-loop.h" 56 56 #include "exec/log.h" 57 57 #include "sysemu/cpus.h" 58 + #include "sysemu/tcg.h" 58 59 59 60 /* #define DEBUG_TB_INVALIDATE */ 60 61 /* #define DEBUG_TB_FLUSH */
+2
bsd-user/main.c
··· 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, see <http://www.gnu.org/licenses/>. 18 18 */ 19 + 19 20 #include "qemu/osdep.h" 20 21 #include "qemu/units.h" 22 + #include "sysemu/tcg.h" 21 23 #include "qemu-version.h" 22 24 #include <machine/trap.h> 23 25
+1
cpus.c
··· 33 33 #include "qemu/error-report.h" 34 34 #include "qemu/qemu-print.h" 35 35 #include "sysemu/sysemu.h" 36 + #include "sysemu/tcg.h" 36 37 #include "sysemu/block-backend.h" 37 38 #include "exec/gdbstub.h" 38 39 #include "sysemu/dma.h"
+2
exec.c
··· 16 16 * You should have received a copy of the GNU Lesser General Public 17 17 * License along with this library; if not, see <http://www.gnu.org/licenses/>. 18 18 */ 19 + 19 20 #include "qemu/osdep.h" 20 21 #include "qapi/error.h" 21 22 ··· 32 33 #endif 33 34 #include "sysemu/kvm.h" 34 35 #include "sysemu/sysemu.h" 36 + #include "sysemu/tcg.h" 35 37 #include "qemu/timer.h" 36 38 #include "qemu/config-file.h" 37 39 #include "qemu/error-report.h"
+1
hw/i386/pc.c
··· 50 50 #include "hw/pci/msi.h" 51 51 #include "hw/sysbus.h" 52 52 #include "sysemu/sysemu.h" 53 + #include "sysemu/tcg.h" 53 54 #include "sysemu/numa.h" 54 55 #include "sysemu/kvm.h" 55 56 #include "sysemu/qtest.h"
+2
hw/ppc/spapr_caps.c
··· 21 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 22 * THE SOFTWARE. 23 23 */ 24 + 24 25 #include "qemu/osdep.h" 25 26 #include "qemu/error-report.h" 26 27 #include "qapi/error.h" ··· 32 33 #include "cpu-models.h" 33 34 #include "kvm_ppc.h" 34 35 #include "sysemu/qtest.h" 36 + #include "sysemu/tcg.h" 35 37 36 38 #include "hw/ppc/spapr.h" 37 39
+1
hw/s390x/ipl.c
··· 14 14 #include "qemu/osdep.h" 15 15 #include "qapi/error.h" 16 16 #include "sysemu/sysemu.h" 17 + #include "sysemu/tcg.h" 17 18 #include "cpu.h" 18 19 #include "elf.h" 19 20 #include "hw/loader.h"
+1
include/exec/ram_addr.h
··· 21 21 22 22 #ifndef CONFIG_USER_ONLY 23 23 #include "hw/xen/xen.h" 24 + #include "sysemu/tcg.h" 24 25 #include "exec/ramlist.h" 25 26 26 27 struct RAMBlock {
-8
include/qemu-common.h
··· 77 77 sendto(sockfd, buf, len, flags, destaddr, addrlen) 78 78 #endif 79 79 80 - extern bool tcg_allowed; 81 - void tcg_exec_init(unsigned long tb_size); 82 - #ifdef CONFIG_TCG 83 - #define tcg_enabled() (tcg_allowed) 84 - #else 85 - #define tcg_enabled() 0 86 - #endif 87 - 88 80 void cpu_exec_init_all(void); 89 81 void cpu_exec_step_atomic(CPUState *cpu); 90 82
+19
include/sysemu/tcg.h
··· 1 + /* 2 + * QEMU TCG support 3 + * 4 + * This work is licensed under the terms of the GNU GPL, version 2 or later. 5 + * See the COPYING file in the top-level directory. 6 + */ 7 + 8 + #ifndef SYSEMU_TCG_H 9 + #define SYSEMU_TCG_H 10 + 11 + extern bool tcg_allowed; 12 + void tcg_exec_init(unsigned long tb_size); 13 + #ifdef CONFIG_TCG 14 + #define tcg_enabled() (tcg_allowed) 15 + #else 16 + #define tcg_enabled() 0 17 + #endif 18 + 19 + #endif
+2
linux-user/main.c
··· 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, see <http://www.gnu.org/licenses/>. 18 18 */ 19 + 19 20 #include "qemu/osdep.h" 20 21 #include "qemu/units.h" 22 + #include "sysemu/tcg.h" 21 23 #include "qemu-version.h" 22 24 #include <sys/syscall.h> 23 25 #include <sys/resource.h>
+1 -1
memory.c
··· 15 15 16 16 #include "qemu/osdep.h" 17 17 #include "qapi/error.h" 18 - #include "qemu-common.h" 19 18 #include "cpu.h" 20 19 #include "exec/memory.h" 21 20 #include "exec/address-spaces.h" ··· 30 29 #include "exec/ram_addr.h" 31 30 #include "sysemu/kvm.h" 32 31 #include "sysemu/sysemu.h" 32 + #include "sysemu/tcg.h" 33 33 #include "hw/qdev-properties.h" 34 34 #include "migration/vmstate.h" 35 35
+1
monitor.c
··· 53 53 #include "sysemu/hw_accel.h" 54 54 #include "authz/list.h" 55 55 #include "qapi/util.h" 56 + #include "sysemu/tcg.h" 56 57 #include "sysemu/tpm.h" 57 58 #include "qapi/qmp/qdict.h" 58 59 #include "qapi/qmp/qerror.h"
+1
qemu-nbd.c
··· 21 21 #include <libgen.h> 22 22 #include <pthread.h> 23 23 24 + #include "qemu-common.h" 24 25 #include "qapi/error.h" 25 26 #include "qemu/cutils.h" 26 27 #include "sysemu/block-backend.h"
+1 -1
qom/cpu.c
··· 20 20 21 21 #include "qemu/osdep.h" 22 22 #include "qapi/error.h" 23 - #include "qemu-common.h" 24 23 #include "qom/cpu.h" 25 24 #include "sysemu/hw_accel.h" 26 25 #include "qemu/notify.h" ··· 30 29 #include "qemu/error-report.h" 31 30 #include "qemu/qemu-print.h" 32 31 #include "sysemu/sysemu.h" 32 + #include "sysemu/tcg.h" 33 33 #include "hw/boards.h" 34 34 #include "hw/qdev-properties.h" 35 35 #include "trace-root.h"
+1 -1
target/arm/cpu.c
··· 24 24 #include "qapi/visitor.h" 25 25 #include "cpu.h" 26 26 #include "internals.h" 27 - #include "qemu-common.h" 28 27 #include "exec/exec-all.h" 29 28 #include "hw/qdev-properties.h" 30 29 #if !defined(CONFIG_USER_ONLY) 31 30 #include "hw/loader.h" 32 31 #endif 33 32 #include "sysemu/sysemu.h" 33 + #include "sysemu/tcg.h" 34 34 #include "sysemu/hw_accel.h" 35 35 #include "kvm_arm.h" 36 36 #include "disas/capstone.h"
+1
target/i386/cpu.c
··· 47 47 #include "standard-headers/asm-x86/kvm_para.h" 48 48 49 49 #include "sysemu/sysemu.h" 50 + #include "sysemu/tcg.h" 50 51 #include "hw/qdev-properties.h" 51 52 #include "hw/i386/topology.h" 52 53 #ifndef CONFIG_USER_ONLY
+1 -1
target/i386/cpu.h
··· 20 20 #ifndef I386_CPU_H 21 21 #define I386_CPU_H 22 22 23 - #include "qemu-common.h" 23 + #include "sysemu/tcg.h" 24 24 #include "cpu-qom.h" 25 25 #include "hyperv-proto.h" 26 26 #include "exec/cpu-defs.h"
+1
target/i386/helper.c
··· 25 25 #include "kvm_i386.h" 26 26 #ifndef CONFIG_USER_ONLY 27 27 #include "sysemu/sysemu.h" 28 + #include "sysemu/tcg.h" 28 29 #include "sysemu/hw_accel.h" 29 30 #include "monitor/monitor.h" 30 31 #include "hw/i386/apic_internal.h"
+1 -1
target/i386/machine.c
··· 1 1 #include "qemu/osdep.h" 2 - #include "qemu-common.h" 3 2 #include "cpu.h" 4 3 #include "exec/exec-all.h" 5 4 #include "hw/hw.h" ··· 10 9 #include "hyperv.h" 11 10 12 11 #include "sysemu/kvm.h" 12 + #include "sysemu/tcg.h" 13 13 14 14 #include "qemu/error-report.h" 15 15
+1
target/ppc/translate_init.inc.c
··· 24 24 #include "sysemu/arch_init.h" 25 25 #include "sysemu/cpus.h" 26 26 #include "sysemu/hw_accel.h" 27 + #include "sysemu/tcg.h" 27 28 #include "cpu-models.h" 28 29 #include "mmu-hash32.h" 29 30 #include "mmu-hash64.h"
+1 -1
target/s390x/cpu.c
··· 26 26 #include "internal.h" 27 27 #include "kvm_s390x.h" 28 28 #include "sysemu/kvm.h" 29 - #include "qemu-common.h" 30 29 #include "qemu/timer.h" 31 30 #include "qemu/error-report.h" 32 31 #include "trace.h" ··· 39 38 #include "hw/hw.h" 40 39 #include "sysemu/arch_init.h" 41 40 #include "sysemu/sysemu.h" 41 + #include "sysemu/tcg.h" 42 42 #endif 43 43 #include "fpu/softfloat.h" 44 44
+1
target/s390x/cpu_models.c
··· 15 15 #include "internal.h" 16 16 #include "kvm_s390x.h" 17 17 #include "sysemu/kvm.h" 18 + #include "sysemu/tcg.h" 18 19 #include "qapi/error.h" 19 20 #include "qapi/visitor.h" 20 21 #include "qemu/error-report.h"
+2 -1
target/s390x/gdbstub.c
··· 17 17 * You should have received a copy of the GNU Lesser General Public 18 18 * License along with this library; if not, see <http://www.gnu.org/licenses/>. 19 19 */ 20 + 20 21 #include "qemu/osdep.h" 21 - #include "qemu-common.h" 22 22 #include "cpu.h" 23 23 #include "internal.h" 24 24 #include "exec/exec-all.h" 25 25 #include "exec/gdbstub.h" 26 26 #include "qemu/bitops.h" 27 27 #include "sysemu/hw_accel.h" 28 + #include "sysemu/tcg.h" 28 29 29 30 int s390_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) 30 31 {
+1
target/s390x/helper.c
··· 28 28 #include "sysemu/hw_accel.h" 29 29 #ifndef CONFIG_USER_ONLY 30 30 #include "sysemu/sysemu.h" 31 + #include "sysemu/tcg.h" 31 32 #endif 32 33 33 34 #ifndef CONFIG_USER_ONLY
+1
target/s390x/interrupt.c
··· 14 14 #include "internal.h" 15 15 #include "exec/exec-all.h" 16 16 #include "sysemu/kvm.h" 17 + #include "sysemu/tcg.h" 17 18 #include "hw/s390x/ioinst.h" 18 19 #include "tcg_s390x.h" 19 20 #if !defined(CONFIG_USER_ONLY)
+1
target/s390x/machine.c
··· 21 21 #include "kvm_s390x.h" 22 22 #include "tcg_s390x.h" 23 23 #include "sysemu/kvm.h" 24 + #include "sysemu/tcg.h" 24 25 25 26 static int cpu_post_load(void *opaque, int version_id) 26 27 {
+1
target/s390x/mmu_helper.c
··· 22 22 #include "internal.h" 23 23 #include "kvm_s390x.h" 24 24 #include "sysemu/kvm.h" 25 + #include "sysemu/tcg.h" 25 26 #include "exec/exec-all.h" 26 27 #include "trace.h" 27 28 #include "hw/s390x/storage-keys.h"
+1 -1
target/s390x/sigp.c
··· 9 9 */ 10 10 11 11 #include "qemu/osdep.h" 12 - #include "qemu-common.h" 13 12 #include "cpu.h" 14 13 #include "internal.h" 15 14 #include "sysemu/hw_accel.h" 16 15 #include "exec/address-spaces.h" 17 16 #include "exec/exec-all.h" 18 17 #include "sysemu/sysemu.h" 18 + #include "sysemu/tcg.h" 19 19 #include "trace.h" 20 20 #include "qapi/qapi-types-misc.h" 21 21
+1
vl.c
··· 30 30 #include "qemu/help_option.h" 31 31 #include "qemu/uuid.h" 32 32 #include "sysemu/seccomp.h" 33 + #include "sysemu/tcg.h" 33 34 34 35 #ifdef CONFIG_SDL 35 36 #if defined(__APPLE__) || defined(main)