[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 6/6] target/i386: Prohibit target specific KVM prototypes on u
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v5 6/6] target/i386: Prohibit target specific KVM prototypes on user emulation |
Date: |
Wed, 13 Sep 2023 11:30:08 +0200 |
None of these target-specific prototypes should be used
by user emulation. Remove their declaration there, so we
get a compile failure if ever used (instead of having to
deal with linker and its possible optimizations, such
dead code removal).
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/i386/kvm/kvm_i386.h | 4 ++++
target/i386/cpu.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h
index 55d4e68c34..5ef73f0a1c 100644
--- a/target/i386/kvm/kvm_i386.h
+++ b/target/i386/kvm/kvm_i386.h
@@ -13,6 +13,10 @@
#include "sysemu/kvm.h"
+#ifdef CONFIG_USER_ONLY
+#error Cannot include kvm_i386.h from user emulation
+#endif
+
#ifdef CONFIG_KVM
#define kvm_pit_in_kernel() \
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index c201ff26bd..db8ed6284d 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -26,7 +26,7 @@
#include "tcg/helper-tcg.h"
#include "sysemu/reset.h"
#include "sysemu/hvf.h"
-#include "kvm/kvm_i386.h"
+#include "sysemu/kvm.h"
#include "sev.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
@@ -40,6 +40,7 @@
#include "exec/address-spaces.h"
#include "hw/boards.h"
#include "hw/i386/sgx-epc.h"
+#include "kvm/kvm_i386.h"
#endif
#include "disas/capstone.h"
--
2.41.0
- [PATCH v5 0/6] target/i386: Restrict system-specific features from user emulation, Philippe Mathieu-Daudé, 2023/09/13
- [PATCH v5 1/6] target/i386: Check kvm_hyperv_expand_features() return value, Philippe Mathieu-Daudé, 2023/09/13
- [PATCH v5 2/6] target/i386: Drop accel_uses_host_cpuid before x86_cpu_get_supported_cpuid, Philippe Mathieu-Daudé, 2023/09/13
- [PATCH v5 3/6] target/i386: Call accel-agnostic x86_cpu_get_supported_cpuid(), Philippe Mathieu-Daudé, 2023/09/13
- [PATCH v5 4/6] target/i386: Move x86_cpu_get_migratable_flags() around, Philippe Mathieu-Daudé, 2023/09/13
- [RFC PATCH v5 5/6] target/i386: Restrict system-specific code from user emulation, Philippe Mathieu-Daudé, 2023/09/13
- [PATCH v5 6/6] target/i386: Prohibit target specific KVM prototypes on user emulation,
Philippe Mathieu-Daudé <=
- Re: [PATCH v5 0/6] target/i386: Restrict system-specific features from user emulation, Paolo Bonzini, 2023/09/13