aboutsummaryrefslogtreecommitdiff
path: root/include/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2023-06-20 18:57:12 +0100
committerRichard Henderson <richard.henderson@linaro.org>2023-06-21 07:19:46 +0200
commitc5ffd16ba4c8fd3601742cc9d2b3cff03995dd5d (patch)
tree37fda109b162c34f6147a299dcfae638a9db3414 /include/hw
parent2346098b9586f93fa596435b07fce1541151e2bd (diff)
downloadqemu-c5ffd16ba4c8fd3601742cc9d2b3cff03995dd5d.zip
qemu-c5ffd16ba4c8fd3601742cc9d2b3cff03995dd5d.tar.gz
qemu-c5ffd16ba4c8fd3601742cc9d2b3cff03995dd5d.tar.bz2
Revert "cputlb: Restrict SavedIOTLB to system emulation"
This reverts commit d7ee93e24359703debf4137f4cc632563aa4e8d1. That commit tries to make a field in the CPUState struct not be present when CONFIG_USER_ONLY is set. Unfortunately, you can't conditionally omit fields in structs like this based on ifdefs that are set per-target. If you try it, then code in files compiled per-target (where CONFIG_USER_ONLY is or can be set) will disagree about the struct layout with files that are compiled once-only (where this kind of ifdef is never set). This manifests specifically in 'make check-tcg' failing, because code in cpus-common.c that sets up the CPUState::cpu_index field puts it at a different offset from the code in plugins/core.c in qemu_plugin_vcpu_init_hook() which reads the cpu_index field. The latter then hits an assert because from its point of view every thread has a 0 cpu_index. There might be other weird behaviour too. Mostly we catch this kind of bug because the CONFIG_whatever is listed in include/exec/poison.h and so the reference to it in build-once source files will then cause a compiler error. Unfortunately CONFIG_USER_ONLY is an exception to that: we have some places where we use it in "safe" ways in headers that will be seen by once-only source files (e.g. ifdeffing out function prototypes) and it would be a lot of refactoring to be able to get to a position where we could poison it. This leaves us in a "you have to be careful to walk around the bear trap" situation... Fixes: d7ee93e243597 ("cputlb: Restrict SavedIOTLB to system emulation") Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20230620175712.1331625-1-peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/hw')
-rw-r--r--include/hw/core/cpu.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index ee8d6b4..4871ad8 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -226,7 +226,7 @@ struct CPUWatchpoint {
QTAILQ_ENTRY(CPUWatchpoint) entry;
};
-#if defined(CONFIG_PLUGIN) && !defined(CONFIG_USER_ONLY)
+#ifdef CONFIG_PLUGIN
/*
* For plugins we sometime need to save the resolved iotlb data before
* the memory regions get moved around by io_writex.
@@ -410,11 +410,9 @@ struct CPUState {
#ifdef CONFIG_PLUGIN
GArray *plugin_mem_cbs;
-#if !defined(CONFIG_USER_ONLY)
/* saved iotlb data from io_writex */
SavedIOTLB saved_iotlb;
-#endif /* !CONFIG_USER_ONLY */
-#endif /* CONFIG_PLUGIN */
+#endif
/* TODO Move common fields from CPUArchState here. */
int cpu_index;