[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 07/42] Move CONFIG_KVM related definitions to kvm_i38
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 07/42] Move CONFIG_KVM related definitions to kvm_i386.h |
Date: |
Wed, 5 Jul 2017 09:14:10 +0200 |
From: Thomas Huth <address@hidden>
pc.h and sysemu/kvm.h are also included from common code (where
CONFIG_KVM is not available), so the #defines that depend on CONFIG_KVM
should not be declared here to avoid that anybody is using them in a
wrong way. Since we're also going to poison CONFIG_KVM for common code,
let's move them to kvm_i386.h instead. Most of the dummy definitions
from sysemu/kvm.h are also unused since the code that uses them is
only compiled for CONFIG_KVM (e.g. target/i386/kvm.c), so the unused
defines are also simply dropped here instead of being moved.
Signed-off-by: Thomas Huth <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/i386/pc_q35.c | 1 +
include/hw/i386/pc.h | 13 -------------
include/sysemu/kvm.h | 15 ---------------
target/i386/kvm_i386.h | 23 +++++++++++++++++++++++
4 files changed, 24 insertions(+), 28 deletions(-)
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 1523ef3..8f696b7 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -36,6 +36,7 @@
#include "hw/timer/mc146818rtc.h"
#include "hw/xen/xen.h"
#include "sysemu/kvm.h"
+#include "kvm_i386.h"
#include "hw/kvm/clock.h"
#include "hw/pci-host/q35.h"
#include "exec/address-spaces.h"
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 233216a..f48d167 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -20,19 +20,6 @@
#define HPET_INTCAP "hpet-intcap"
-#ifdef CONFIG_KVM
-#define kvm_pit_in_kernel() \
- (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
-#define kvm_pic_in_kernel() \
- (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
-#define kvm_ioapic_in_kernel() \
- (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
-#else
-#define kvm_pit_in_kernel() 0
-#define kvm_pic_in_kernel() 0
-#define kvm_ioapic_in_kernel() 0
-#endif
-
/**
* PCMachineState:
* @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 1e91613..ca40b6e 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -22,21 +22,6 @@
#ifdef CONFIG_KVM
#include <linux/kvm.h>
#include <linux/kvm_para.h>
-#else
-/* These constants must never be used at runtime if kvm_enabled() is false.
- * They exist so we don't need #ifdefs around KVM-specific code that already
- * checks kvm_enabled() properly.
- */
-#define KVM_CPUID_SIGNATURE 0
-#define KVM_CPUID_FEATURES 0
-#define KVM_FEATURE_CLOCKSOURCE 0
-#define KVM_FEATURE_NOP_IO_DELAY 0
-#define KVM_FEATURE_MMU_OP 0
-#define KVM_FEATURE_CLOCKSOURCE2 0
-#define KVM_FEATURE_ASYNC_PF 0
-#define KVM_FEATURE_STEAL_TIME 0
-#define KVM_FEATURE_PV_EOI 0
-#define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 0
#endif
extern bool kvm_allowed;
diff --git a/target/i386/kvm_i386.h b/target/i386/kvm_i386.h
index bfce427..1de9876 100644
--- a/target/i386/kvm_i386.h
+++ b/target/i386/kvm_i386.h
@@ -15,6 +15,29 @@
#define kvm_apic_in_kernel() (kvm_irqchip_in_kernel())
+#ifdef CONFIG_KVM
+
+#define kvm_pit_in_kernel() \
+ (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
+#define kvm_pic_in_kernel() \
+ (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
+#define kvm_ioapic_in_kernel() \
+ (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
+
+#else
+
+#define kvm_pit_in_kernel() 0
+#define kvm_pic_in_kernel() 0
+#define kvm_ioapic_in_kernel() 0
+
+/* These constants must never be used at runtime if kvm_enabled() is false.
+ * They exist so we don't need #ifdefs around KVM-specific code that already
+ * checks kvm_enabled() properly.
+ */
+#define KVM_CPUID_FEATURES 0
+
+#endif /* CONFIG_KVM */
+
bool kvm_allows_irq0_override(void);
bool kvm_has_smm(void);
bool kvm_has_adjust_clock_stable(void);
--
1.8.3.1
- [Qemu-devel] [PULL 00/42] Misc changes for 2017-07-05, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 02/42] qemu-doc: Add missing "@c man end" statements, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 04/42] target/i386: fix interrupt CPL error when using ist in x86-64, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 03/42] nbd: fix NBD over TLS, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 06/42] include/exec/poison: Add some more missing TARGET and CONFIG defines, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 05/42] target/i386: simplify handling of conforming code segments on interrupt, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 01/42] vcpu_dirty: share the same field in CPUState for all accelerators, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 08/42] include/exec/poison: Mark CONFIG_KVM as poisoned, too, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 07/42] Move CONFIG_KVM related definitions to kvm_i386.h,
Paolo Bonzini <=
- [Qemu-devel] [PULL 09/42] cpu: Introduce a wrapper for tlb_flush() that can be used in common code, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 15/42] util/oslib-win32: Remove if conditional, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 13/42] sockets: avoid formatting buffer that may not be NUL terminated, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 11/42] Makefile: Move bootdevice.o to common-obj-y, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 12/42] hw/misc/edu: Compile the edu device as common object, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 17/42] main_loop: Make main_loop_wait() return void, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 10/42] include/exec/poison: Mark CONFIG_SOFTMMU as poisoned, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 18/42] checkpatch: should not use signal except for SIG_DFL or SIG_IGN, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 14/42] xsave_helper: pull xsave and xrstor out of kvm.c into helper function, Paolo Bonzini, 2017/07/05
- [Qemu-devel] [PULL 16/42] tests/test-char.c: Don't use main_loop_wait()'s return value, Paolo Bonzini, 2017/07/05