From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH 4/4] include/exec/poison: Mark CONFIG_KVM as poisoned, too
Date: Wed, 14 Jun 2017 21:21:53 +0200 [thread overview]
Message-ID: <1497468113-2874-5-git-send-email-thuth@redhat.com> (raw)
In-Reply-To: <1497468113-2874-1-git-send-email-thuth@redhat.com>
We unfortunately need some additional "#ifndef NEED_CPU_H" fuzz in
include/sysemu/kvm.h for this, so that the header can still be included
from common code (which is done all over the place), but now we can
finally be sure that nobody uses this define in a wrong place anymore.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
hw/acpi/ich9.c | 1 -
include/exec/poison.h | 1 +
include/sysemu/kvm.h | 37 +++++++++++++++++++++++++++++++++++--
3 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 5c279bb..c5d8646 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -33,7 +33,6 @@
#include "sysemu/sysemu.h"
#include "hw/acpi/acpi.h"
#include "hw/acpi/tco.h"
-#include "sysemu/kvm.h"
#include "exec/address-spaces.h"
#include "hw/i386/ich9.h"
diff --git a/include/exec/poison.h b/include/exec/poison.h
index 5ffed4d..540fc70 100644
--- a/include/exec/poison.h
+++ b/include/exec/poison.h
@@ -80,6 +80,7 @@
#pragma GCC poison CONFIG_LINUX_USER
#pragma GCC poison CONFIG_VHOST_NET
+#pragma GCC poison CONFIG_KVM
#endif
#endif
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 1e91613..8cc57e4 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -19,6 +19,8 @@
#include "exec/memattrs.h"
#include "hw/irq.h"
+#ifdef NEED_CPU_H
+
#ifdef CONFIG_KVM
#include <linux/kvm.h>
#include <linux/kvm_para.h>
@@ -39,6 +41,8 @@
#define KVM_FEATURE_CLOCKSOURCE_STABLE_BIT 0
#endif
+#endif /* NEED_CPU_H */
+
extern bool kvm_allowed;
extern bool kvm_kernel_irqchip;
extern bool kvm_split_irqchip;
@@ -55,7 +59,8 @@ extern bool kvm_direct_msi_allowed;
extern bool kvm_ioeventfd_any_length_allowed;
extern bool kvm_msi_use_devid;
-#if defined CONFIG_KVM || !defined NEED_CPU_H
+#if !defined(NEED_CPU_H)
+
#define kvm_enabled() (kvm_allowed)
/**
* kvm_irqchip_in_kernel:
@@ -178,6 +183,31 @@ extern bool kvm_msi_use_devid;
#define kvm_msi_devid_required() (kvm_msi_use_devid)
#else
+
+#ifdef CONFIG_KVM
+
+/*
+ * Same definitions again, but we need to keep them separate
+ * since CONFIG_KVM is poisoned without NEED_CPU_H
+ */
+#define kvm_enabled() (kvm_allowed)
+#define kvm_irqchip_in_kernel() (kvm_kernel_irqchip)
+#define kvm_irqchip_is_split() (kvm_split_irqchip)
+#define kvm_async_interrupts_enabled() (kvm_async_interrupts_allowed)
+#define kvm_halt_in_kernel() (kvm_halt_in_kernel_allowed)
+#define kvm_eventfds_enabled() (kvm_eventfds_allowed)
+#define kvm_irqfds_enabled() (kvm_irqfds_allowed)
+#define kvm_resamplefds_enabled() (kvm_resamplefds_allowed)
+#define kvm_msi_via_irqfd_enabled() (kvm_msi_via_irqfd_allowed)
+#define kvm_gsi_routing_enabled() (kvm_gsi_routing_allowed)
+#define kvm_gsi_direct_mapping() (kvm_gsi_direct_mapping)
+#define kvm_readonly_mem_enabled() (kvm_readonly_mem_allowed)
+#define kvm_direct_msi_enabled() (kvm_direct_msi_allowed)
+#define kvm_ioeventfd_any_length_enabled() (kvm_ioeventfd_any_length_allowed)
+#define kvm_msi_devid_required() (kvm_msi_use_devid)
+
+#else
+
#define kvm_enabled() (0)
#define kvm_irqchip_in_kernel() (false)
#define kvm_irqchip_is_split() (false)
@@ -193,7 +223,10 @@ extern bool kvm_msi_use_devid;
#define kvm_direct_msi_enabled() (false)
#define kvm_ioeventfd_any_length_enabled() (false)
#define kvm_msi_devid_required() (false)
-#endif
+
+#endif /* CONFIG_KVM */
+
+#endif /* NEED_CPU_H */
struct kvm_run;
struct kvm_lapic_state;
--
1.8.3.1
next prev parent reply other threads:[~2017-06-14 19:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-14 19:21 [Qemu-devel] [PATCH 0/4] Poison some more target-specific defines Thomas Huth
2017-06-14 19:21 ` [Qemu-devel] [PATCH 1/4] include/exec/poison: Add missing TARGET defines Thomas Huth
2017-06-19 21:49 ` Richard Henderson
2017-06-20 5:18 ` Thomas Huth
2017-06-14 19:21 ` [Qemu-devel] [PATCH 2/4] include/exec/poison: Mark some CONFIG defines as poisoned, too Thomas Huth
2017-06-19 21:50 ` Richard Henderson
2017-06-14 19:21 ` [Qemu-devel] [PATCH 3/4] include/hw/i386/pc.h: Move CONFIG_KVM related definitions to kvm_i386.h Thomas Huth
2017-06-15 8:04 ` Paolo Bonzini
2017-06-14 19:21 ` Thomas Huth [this message]
2017-06-14 20:59 ` [Qemu-devel] [PATCH 4/4] include/exec/poison: Mark CONFIG_KVM as poisoned, too Paolo Bonzini
2017-06-15 8:32 ` Thomas Huth
2017-06-14 20:01 ` [Qemu-devel] [PATCH 0/4] Poison some more target-specific defines no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1497468113-2874-5-git-send-email-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).