Commit 1eaae985d4 for qemu.org
commit 1eaae985d4dec2aa0b187e362db50be46968d117
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date: Tue Jun 16 13:58:21 2026 +0200
accel/tcg: Restrict headers being TCG specific
Forbid including TCG-specific headers in non-TCG builds.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260617171438.75914-12-philmd@oss.qualcomm.com>
diff --git a/include/accel/tcg/cpu-mmu-index.h b/include/accel/tcg/cpu-mmu-index.h
index e681a90844..e0fb6ef91c 100644
--- a/include/accel/tcg/cpu-mmu-index.h
+++ b/include/accel/tcg/cpu-mmu-index.h
@@ -9,6 +9,10 @@
#ifndef ACCEL_TCG_CPU_MMU_INDEX_H
#define ACCEL_TCG_CPU_MMU_INDEX_H
+#ifndef CONFIG_TCG
+#error Can only include this header with TCG
+#endif
+
#include "hw/core/cpu.h"
#include "accel/tcg/cpu-ops.h"
#include "tcg/debug-assert.h"
diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h
index 5950cdcaab..710da12b82 100644
--- a/include/accel/tcg/cpu-ops.h
+++ b/include/accel/tcg/cpu-ops.h
@@ -10,6 +10,10 @@
#ifndef TCG_CPU_OPS_H
#define TCG_CPU_OPS_H
+#ifndef CONFIG_TCG
+#error Can only include this header with TCG
+#endif
+
#include "exec/breakpoint.h"
#include "exec/hwaddr.h"
#include "exec/memattrs.h"
diff --git a/include/accel/tcg/getpc.h b/include/accel/tcg/getpc.h
index 0fc08addcf..8a97ce34e7 100644
--- a/include/accel/tcg/getpc.h
+++ b/include/accel/tcg/getpc.h
@@ -8,6 +8,10 @@
#ifndef ACCEL_TCG_GETPC_H
#define ACCEL_TCG_GETPC_H
+#ifndef CONFIG_TCG
+#error Can only include this header with TCG
+#endif
+
/* GETPC is the true target of the return instruction that we'll execute. */
#ifdef CONFIG_TCG_INTERPRETER
extern __thread uintptr_t tci_tb_ptr;
diff --git a/include/accel/tcg/helper-retaddr.h b/include/accel/tcg/helper-retaddr.h
index 037fda2b83..ebdc8b378d 100644
--- a/include/accel/tcg/helper-retaddr.h
+++ b/include/accel/tcg/helper-retaddr.h
@@ -6,6 +6,10 @@
#ifndef ACCEL_TCG_HELPER_RETADDR_H
#define ACCEL_TCG_HELPER_RETADDR_H
+#ifndef CONFIG_TCG
+#error Can only include this header with TCG
+#endif
+
/*
* For user-only, helpers that use guest to host address translation
* must protect the actual host memory access by recording 'retaddr'
diff --git a/include/accel/tcg/probe.h b/include/accel/tcg/probe.h
index dd9ecbbdf1..0b788901ba 100644
--- a/include/accel/tcg/probe.h
+++ b/include/accel/tcg/probe.h
@@ -7,6 +7,10 @@
#ifndef ACCEL_TCG_PROBE_H
#define ACCEL_TCG_PROBE_H
+#ifndef CONFIG_TCG
+#error Can only include this header with TCG
+#endif
+
#include "exec/mmu-access-type.h"
#include "exec/vaddr.h"
diff --git a/include/accel/tcg/tb-cpu-state.h b/include/accel/tcg/tb-cpu-state.h
index 8f912900ca..1903af4c2a 100644
--- a/include/accel/tcg/tb-cpu-state.h
+++ b/include/accel/tcg/tb-cpu-state.h
@@ -6,6 +6,10 @@
#ifndef EXEC_TB_CPU_STATE_H
#define EXEC_TB_CPU_STATE_H
+#ifndef CONFIG_TCG
+#error Can only include this header with TCG
+#endif
+
#include "exec/vaddr.h"
typedef struct TCGTBCPUState {