[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/11] log: do not unnecessarily include qom/cpu.h
From: |
Denis V. Lunev |
Subject: |
[Qemu-devel] [PATCH 07/11] log: do not unnecessarily include qom/cpu.h |
Date: |
Thu, 7 Jan 2016 16:55:28 +0300 |
From: Paolo Bonzini <address@hidden>
Split the bits that require it to exec/log.h.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Denis V. Lunev <address@hidden>
Acked-by: Christian Borntraeger <address@hidden>
---
bsd-user/main.c | 1 +
cpu-exec.c | 1 +
exec.c | 1 +
hw/acpi/cpu_hotplug.c | 1 +
hw/timer/a9gtimer.c | 1 +
include/exec/log.h | 60 +++++++++++++++++++++++++++++++++++++++++++
include/qemu/log.h | 59 ------------------------------------------
linux-user/main.c | 1 +
qom/cpu.c | 1 +
target-alpha/translate.c | 1 +
target-arm/translate-a64.c | 1 +
target-arm/translate.c | 1 +
target-cris/translate.c | 1 +
target-i386/seg_helper.c | 1 +
target-i386/smm_helper.c | 1 +
target-i386/translate.c | 1 +
target-lm32/helper.c | 1 +
target-lm32/translate.c | 1 +
target-m68k/translate.c | 1 +
target-microblaze/helper.c | 1 +
target-microblaze/translate.c | 1 +
target-mips/helper.c | 1 +
target-mips/translate.c | 1 +
target-moxie/translate.c | 1 +
target-openrisc/translate.c | 1 +
target-ppc/mmu-hash32.c | 1 +
target-ppc/mmu-hash64.c | 1 +
target-ppc/mmu_helper.c | 1 +
target-ppc/translate.c | 1 +
target-s390x/translate.c | 1 +
target-sh4/helper.c | 1 +
target-sh4/translate.c | 1 +
target-sparc/int32_helper.c | 1 +
target-sparc/int64_helper.c | 1 +
target-sparc/translate.c | 1 +
target-tilegx/translate.c | 1 +
target-tricore/translate.c | 1 +
target-unicore32/translate.c | 1 +
target-xtensa/translate.c | 1 +
tcg/tcg.c | 1 +
translate-all.c | 1 +
41 files changed, 99 insertions(+), 59 deletions(-)
create mode 100644 include/exec/log.h
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 1ecaeb5..fefcfc1 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -33,6 +33,7 @@
#include "tcg.h"
#include "qemu/timer.h"
#include "qemu/envlist.h"
+#include "exec/log.h"
int singlestep;
unsigned long mmap_min_addr;
diff --git a/cpu-exec.c b/cpu-exec.c
index c88d0ff..8e2e52b 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -27,6 +27,7 @@
#include "exec/address-spaces.h"
#include "qemu/rcu.h"
#include "exec/tb-hash.h"
+#include "exec/log.h"
#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY)
#include "hw/i386/apic.h"
#endif
diff --git a/exec.c b/exec.c
index 8718a75..b6a0b01 100644
--- a/exec.c
+++ b/exec.c
@@ -54,6 +54,7 @@
#include "exec/memory-internal.h"
#include "exec/ram_addr.h"
+#include "exec/log.h"
#include "qemu/range.h"
#ifndef _WIN32
diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
index f5b9972..16bacfc 100644
--- a/hw/acpi/cpu_hotplug.c
+++ b/hw/acpi/cpu_hotplug.c
@@ -11,6 +11,7 @@
*/
#include "hw/hw.h"
#include "hw/acpi/cpu_hotplug.h"
+#include "qom/cpu.h"
static uint64_t cpu_status_read(void *opaque, hwaddr addr, unsigned int size)
{
diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c
index dd4aae8..b38c76a 100644
--- a/hw/timer/a9gtimer.c
+++ b/hw/timer/a9gtimer.c
@@ -24,6 +24,7 @@
#include "qemu/timer.h"
#include "qemu/bitops.h"
#include "qemu/log.h"
+#include "qom/cpu.h"
#ifndef A9_GTIMER_ERR_DEBUG
#define A9_GTIMER_ERR_DEBUG 0
diff --git a/include/exec/log.h b/include/exec/log.h
new file mode 100644
index 0000000..ba1c9b5
--- /dev/null
+++ b/include/exec/log.h
@@ -0,0 +1,60 @@
+#ifndef QEMU_EXEC_LOG_H
+#define QEMU_EXEC_LOG_H
+
+#include "qemu/log.h"
+#include "qom/cpu.h"
+#include "disas/disas.h"
+
+/* cpu_dump_state() logging functions: */
+/**
+ * log_cpu_state:
+ * @cpu: The CPU whose state is to be logged.
+ * @flags: Flags what to log.
+ *
+ * Logs the output of cpu_dump_state().
+ */
+static inline void log_cpu_state(CPUState *cpu, int flags)
+{
+ if (qemu_log_enabled()) {
+ cpu_dump_state(cpu, qemu_logfile, fprintf, flags);
+ }
+}
+
+/**
+ * log_cpu_state_mask:
+ * @mask: Mask when to log.
+ * @cpu: The CPU whose state is to be logged.
+ * @flags: Flags what to log.
+ *
+ * Logs the output of cpu_dump_state() if loglevel includes @mask.
+ */
+static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags)
+{
+ if (qemu_loglevel & mask) {
+ log_cpu_state(cpu, flags);
+ }
+}
+
+#ifdef NEED_CPU_H
+/* disas() and target_disas() to qemu_logfile: */
+static inline void log_target_disas(CPUState *cpu, target_ulong start,
+ target_ulong len, int flags)
+{
+ target_disas(qemu_logfile, cpu, start, len, flags);
+}
+
+static inline void log_disas(void *code, unsigned long size)
+{
+ disas(qemu_logfile, code, size);
+}
+
+#if defined(CONFIG_USER_ONLY)
+/* page_dump() output to the log file: */
+static inline void log_page_dump(void)
+{
+ page_dump(qemu_logfile);
+}
+#endif
+#endif
+
+#endif
diff --git a/include/qemu/log.h b/include/qemu/log.h
index d837d90..09722e3 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -5,10 +5,6 @@
#include <stdbool.h>
#include <stdio.h>
#include "qemu/compiler.h"
-#include "qom/cpu.h"
-#ifdef NEED_CPU_H
-#include "disas/disas.h"
-#endif
/* Private global variables, don't use */
extern FILE *qemu_logfile;
@@ -78,61 +74,6 @@ qemu_log_vprintf(const char *fmt, va_list va)
void GCC_FMT_ATTR(2, 3) qemu_log_mask(int mask, const char *fmt, ...);
-/* Special cases: */
-
-/* cpu_dump_state() logging functions: */
-/**
- * log_cpu_state:
- * @cpu: The CPU whose state is to be logged.
- * @flags: Flags what to log.
- *
- * Logs the output of cpu_dump_state().
- */
-static inline void log_cpu_state(CPUState *cpu, int flags)
-{
- if (qemu_log_enabled()) {
- cpu_dump_state(cpu, qemu_logfile, fprintf, flags);
- }
-}
-
-/**
- * log_cpu_state_mask:
- * @mask: Mask when to log.
- * @cpu: The CPU whose state is to be logged.
- * @flags: Flags what to log.
- *
- * Logs the output of cpu_dump_state() if loglevel includes @mask.
- */
-static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags)
-{
- if (qemu_loglevel & mask) {
- log_cpu_state(cpu, flags);
- }
-}
-
-#ifdef NEED_CPU_H
-/* disas() and target_disas() to qemu_logfile: */
-static inline void log_target_disas(CPUState *cpu, target_ulong start,
- target_ulong len, int flags)
-{
- target_disas(qemu_logfile, cpu, start, len, flags);
-}
-
-static inline void log_disas(void *code, unsigned long size)
-{
- disas(qemu_logfile, code, size);
-}
-
-#if defined(CONFIG_USER_ONLY)
-/* page_dump() output to the log file: */
-static inline void log_page_dump(void)
-{
- page_dump(qemu_logfile);
-}
-#endif
-#endif
-
-
/* Maintenance: */
/* fflush() the log file */
diff --git a/linux-user/main.c b/linux-user/main.c
index ee12035..61547ab 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -33,6 +33,7 @@
#include "qemu/timer.h"
#include "qemu/envlist.h"
#include "elf.h"
+#include "exec/log.h"
char *exec_path;
diff --git a/qom/cpu.c b/qom/cpu.c
index fb80d13..ce7dfa2 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -23,6 +23,7 @@
#include "sysemu/kvm.h"
#include "qemu/notify.h"
#include "qemu/log.h"
+#include "exec/log.h"
#include "qemu/error-report.h"
#include "sysemu/sysemu.h"
diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 9909c70..635f129 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -27,6 +27,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
#undef ALPHA_DEBUG_DISAS
diff --git a/target-arm/translate-a64.c b/target-arm/translate-a64.c
index 14e8131..6be4b39 100644
--- a/target-arm/translate-a64.c
+++ b/target-arm/translate-a64.c
@@ -35,6 +35,7 @@
#include "exec/helper-proto.h"
#include "exec/helper-gen.h"
+#include "exec/log.h"
#include "trace-tcg.h"
diff --git a/target-arm/translate.c b/target-arm/translate.c
index d485e7d..de3f93e 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -36,6 +36,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
#define ENABLE_ARCH_4T arm_dc_feature(s, ARM_FEATURE_V4T)
diff --git a/target-cris/translate.c b/target-cris/translate.c
index 2429931..a17a009 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -34,6 +34,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
#define DISAS_CRIS 0
diff --git a/target-i386/seg_helper.c b/target-i386/seg_helper.c
index 20ee892..e55694f 100644
--- a/target-i386/seg_helper.c
+++ b/target-i386/seg_helper.c
@@ -22,6 +22,7 @@
#include "qemu/log.h"
#include "exec/helper-proto.h"
#include "exec/cpu_ldst.h"
+#include "exec/log.h"
//#define DEBUG_PCALL
diff --git a/target-i386/smm_helper.c b/target-i386/smm_helper.c
index c272a98..1ab6637 100644
--- a/target-i386/smm_helper.c
+++ b/target-i386/smm_helper.c
@@ -19,6 +19,7 @@
#include "cpu.h"
#include "exec/helper-proto.h"
+#include "exec/log.h"
/* SMM support */
diff --git a/target-i386/translate.c b/target-i386/translate.c
index a3dd167..3079e96 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -32,6 +32,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
#define PREFIX_REPZ 0x01
diff --git a/target-lm32/helper.c b/target-lm32/helper.c
index e26c133..978b99f 100644
--- a/target-lm32/helper.c
+++ b/target-lm32/helper.c
@@ -21,6 +21,7 @@
#include "qemu/host-utils.h"
#include "sysemu/sysemu.h"
#include "exec/semihost.h"
+#include "exec/log.h"
int lm32_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int rw,
int mmu_idx)
diff --git a/target-lm32/translate.c b/target-lm32/translate.c
index fa5b0b9..ad6bd20 100644
--- a/target-lm32/translate.c
+++ b/target-lm32/translate.c
@@ -28,6 +28,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
#define DISAS_LM32 1
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 41ae2c6..03772cf 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -28,6 +28,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
//#define DEBUG_DISPATCH 1
diff --git a/target-microblaze/helper.c b/target-microblaze/helper.c
index a482e47..5539f74 100644
--- a/target-microblaze/helper.c
+++ b/target-microblaze/helper.c
@@ -20,6 +20,7 @@
#include "cpu.h"
#include "qemu/host-utils.h"
+#include "exec/log.h"
#define D(x)
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index 9e52011..27b8277 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -27,6 +27,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
#define SIM_COMPAT 0
diff --git a/target-mips/helper.c b/target-mips/helper.c
index 118072a..4675b07 100644
--- a/target-mips/helper.c
+++ b/target-mips/helper.c
@@ -25,6 +25,7 @@
#include "cpu.h"
#include "sysemu/kvm.h"
#include "exec/cpu_ldst.h"
+#include "exec/log.h"
enum {
TLBRET_XI = -6,
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 5626647..cfc993c 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -32,6 +32,7 @@
#include "exec/semihost.h"
#include "trace-tcg.h"
+#include "exec/log.h"
#define MIPS_DEBUG_DISAS 0
diff --git a/target-moxie/translate.c b/target-moxie/translate.c
index 6dedcb7..9e2ac47 100644
--- a/target-moxie/translate.c
+++ b/target-moxie/translate.c
@@ -35,6 +35,7 @@
#include "exec/helper-proto.h"
#include "exec/helper-gen.h"
+#include "exec/log.h"
/* This is the state at translation time. */
typedef struct DisasContext {
diff --git a/target-openrisc/translate.c b/target-openrisc/translate.c
index 606490a..b572eee 100644
--- a/target-openrisc/translate.c
+++ b/target-openrisc/translate.c
@@ -32,6 +32,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
#define OPENRISC_DISAS
diff --git a/target-ppc/mmu-hash32.c b/target-ppc/mmu-hash32.c
index a00ae3c..74b77a5 100644
--- a/target-ppc/mmu-hash32.c
+++ b/target-ppc/mmu-hash32.c
@@ -23,6 +23,7 @@
#include "sysemu/kvm.h"
#include "kvm_ppc.h"
#include "mmu-hash32.h"
+#include "exec/log.h"
//#define DEBUG_BAT
diff --git a/target-ppc/mmu-hash64.c b/target-ppc/mmu-hash64.c
index 34e20fa..7631476 100644
--- a/target-ppc/mmu-hash64.c
+++ b/target-ppc/mmu-hash64.c
@@ -22,6 +22,7 @@
#include "sysemu/kvm.h"
#include "kvm_ppc.h"
#include "mmu-hash64.h"
+#include "exec/log.h"
//#define DEBUG_SLB
diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c
index 5217691..34c2338 100644
--- a/target-ppc/mmu_helper.c
+++ b/target-ppc/mmu_helper.c
@@ -23,6 +23,7 @@
#include "mmu-hash64.h"
#include "mmu-hash32.h"
#include "exec/cpu_ldst.h"
+#include "exec/log.h"
//#define DEBUG_MMU
//#define DEBUG_BATS
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 4be7eaa..b0dc66a 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -28,6 +28,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
#define CPU_SINGLE_STEP 0x1
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index c79a2cb..4c69ee3 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -43,6 +43,7 @@ static TCGv_ptr cpu_env;
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
/* Information that (most) every instruction needs to manipulate. */
diff --git a/target-sh4/helper.c b/target-sh4/helper.c
index eaececd..90b4405 100644
--- a/target-sh4/helper.c
+++ b/target-sh4/helper.c
@@ -23,6 +23,7 @@
#include <inttypes.h>
#include "cpu.h"
+#include "exec/log.h"
#if !defined(CONFIG_USER_ONLY)
#include "hw/sh4/sh_intc.h"
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index 7bc6216..b07904d 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -28,6 +28,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
typedef struct DisasContext {
diff --git a/target-sparc/int32_helper.c b/target-sparc/int32_helper.c
index 7c380ba..ac5e599 100644
--- a/target-sparc/int32_helper.c
+++ b/target-sparc/int32_helper.c
@@ -20,6 +20,7 @@
#include "cpu.h"
#include "trace.h"
#include "sysemu/sysemu.h"
+#include "exec/log.h"
#define DEBUG_PCALL
diff --git a/target-sparc/int64_helper.c b/target-sparc/int64_helper.c
index b02d22b..a753151 100644
--- a/target-sparc/int64_helper.c
+++ b/target-sparc/int64_helper.c
@@ -19,6 +19,7 @@
#include "cpu.h"
#include "exec/helper-proto.h"
+#include "exec/log.h"
#include "trace.h"
#define DEBUG_PCALL
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 63440dd..0c771e1 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -33,6 +33,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
#define DEBUG_DISAS
diff --git a/target-tilegx/translate.c b/target-tilegx/translate.c
index 354f25a..78befe8 100644
--- a/target-tilegx/translate.c
+++ b/target-tilegx/translate.c
@@ -20,6 +20,7 @@
#include "cpu.h"
#include "qemu/log.h"
+#include "exec/log.h"
#include "disas/disas.h"
#include "tcg-op.h"
#include "exec/cpu_ldst.h"
diff --git a/target-tricore/translate.c b/target-tricore/translate.c
index 135c583..1d29ea1 100644
--- a/target-tricore/translate.c
+++ b/target-tricore/translate.c
@@ -27,6 +27,7 @@
#include "exec/helper-gen.h"
#include "tricore-opcodes.h"
+#include "exec/log.h"
/*
* TCG registers
diff --git a/target-unicore32/translate.c b/target-unicore32/translate.c
index d2f92f0..8e9e434 100644
--- a/target-unicore32/translate.c
+++ b/target-unicore32/translate.c
@@ -24,6 +24,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
/* internal defines */
diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c
index fbcec94..72dff3a 100644
--- a/target-xtensa/translate.c
+++ b/target-xtensa/translate.c
@@ -43,6 +43,7 @@
#include "exec/helper-gen.h"
#include "trace-tcg.h"
+#include "exec/log.h"
typedef struct DisasContext {
diff --git a/tcg/tcg.c b/tcg/tcg.c
index a163541..77c1365 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -60,6 +60,7 @@
#endif
#include "elf.h"
+#include "exec/log.h"
/* Forward declarations for functions declared in tcg-target.c and used here.
*/
static void tcg_target_init(TCGContext *s);
diff --git a/translate-all.c b/translate-all.c
index 042a857..4d5526d 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -62,6 +62,7 @@
#include "translate-all.h"
#include "qemu/bitmap.h"
#include "qemu/timer.h"
+#include "exec/log.h"
//#define DEBUG_TB_INVALIDATE
//#define DEBUG_FLUSH
--
2.5.0
- [Qemu-devel] [PATCH 01/11] trace: fix documentation, (continued)
- [Qemu-devel] [PATCH 01/11] trace: fix documentation, Denis V. Lunev, 2016/01/07
- [Qemu-devel] [PATCH 04/11] trace: no need to call trace_backend_init in different branches now, Denis V. Lunev, 2016/01/07
- [Qemu-devel] [PATCH 05/11] trace: add "-trace enable=...", Denis V. Lunev, 2016/01/07
- [Qemu-devel] [PATCH 06/11] trace: add "-trace help", Denis V. Lunev, 2016/01/07
- [Qemu-devel] [PATCH 08/11] log: move qemu-log.c into util/ directory, Denis V. Lunev, 2016/01/07
- [Qemu-devel] [PATCH 03/11] trace: split trace_init_file out of trace_init_backends, Denis V. Lunev, 2016/01/07
- [Qemu-devel] [PATCH 02/11] trace: split trace_init_events out of trace_init_backends, Denis V. Lunev, 2016/01/07
- [Qemu-devel] [PATCH 10/11] trace: switch default backend to "log", Denis V. Lunev, 2016/01/07
- [Qemu-devel] [PATCH 11/11] log: add "-d trace:PATTERN", Denis V. Lunev, 2016/01/07
- [Qemu-devel] [PATCH 09/11] trace: convert stderr backend to log, Denis V. Lunev, 2016/01/07
- [Qemu-devel] [PATCH 07/11] log: do not unnecessarily include qom/cpu.h,
Denis V. Lunev <=
- Re: [Qemu-devel] [PATCH v4 00/11] simplify usage of tracepoints, and connect them to logging, Eric Blake, 2016/01/07
- Re: [Qemu-devel] [PATCH v4 00/11] simplify usage of tracepoints, and connect them to logging, Denis V. Lunev, 2016/01/14
- Re: [Qemu-devel] [PATCH v4 00/11] simplify usage of tracepoints, and connect them to logging, Stefan Hajnoczi, 2016/01/15