提交 7a0eb196 编写于 作者: A Avi Kivity

KVM: Avoid using CONFIG_ in userspace visible headers

Kconfig symbols are not available in userspace, and are not stripped by
headers-install.  Avoid their use by adding #defines in <asm/kvm.h> to
suit each architecture.
Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 d39123a4
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#include <linux/ioctl.h> #include <linux/ioctl.h>
/* Select x86 specific features in <linux/kvm.h> */
#define __KVM_HAVE_IOAPIC
#define __KVM_HAVE_DEVICE_ASSIGNMENT
/* Architectural interrupt line count. */ /* Architectural interrupt line count. */
#define KVM_NR_INTERRUPTS 256 #define KVM_NR_INTERRUPTS 256
......
...@@ -9,6 +9,13 @@ ...@@ -9,6 +9,13 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/ioctl.h> #include <linux/ioctl.h>
/* Select x86 specific features in <linux/kvm.h> */
#define __KVM_HAVE_PIT
#define __KVM_HAVE_IOAPIC
#define __KVM_HAVE_DEVICE_ASSIGNMENT
#define __KVM_HAVE_MSI
#define __KVM_HAVE_USER_NMI
/* Architectural interrupt line count. */ /* Architectural interrupt line count. */
#define KVM_NR_INTERRUPTS 256 #define KVM_NR_INTERRUPTS 256
......
...@@ -58,10 +58,10 @@ struct kvm_irqchip { ...@@ -58,10 +58,10 @@ struct kvm_irqchip {
__u32 pad; __u32 pad;
union { union {
char dummy[512]; /* reserving space */ char dummy[512]; /* reserving space */
#ifdef CONFIG_X86 #ifdef __KVM_HAVE_PIT
struct kvm_pic_state pic; struct kvm_pic_state pic;
#endif #endif
#if defined(CONFIG_X86) || defined(CONFIG_IA64) #ifdef __KVM_HAVE_IOAPIC
struct kvm_ioapic_state ioapic; struct kvm_ioapic_state ioapic;
#endif #endif
} chip; } chip;
...@@ -384,16 +384,16 @@ struct kvm_trace_rec { ...@@ -384,16 +384,16 @@ struct kvm_trace_rec {
#define KVM_CAP_MP_STATE 14 #define KVM_CAP_MP_STATE 14
#define KVM_CAP_COALESCED_MMIO 15 #define KVM_CAP_COALESCED_MMIO 15
#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */
#if defined(CONFIG_X86)||defined(CONFIG_IA64) #ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
#define KVM_CAP_DEVICE_ASSIGNMENT 17 #define KVM_CAP_DEVICE_ASSIGNMENT 17
#endif #endif
#define KVM_CAP_IOMMU 18 #define KVM_CAP_IOMMU 18
#if defined(CONFIG_X86) #ifdef __KVM_HAVE_MSI
#define KVM_CAP_DEVICE_MSI 20 #define KVM_CAP_DEVICE_MSI 20
#endif #endif
/* Bug in KVM_SET_USER_MEMORY_REGION fixed: */ /* Bug in KVM_SET_USER_MEMORY_REGION fixed: */
#define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21 #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21
#if defined(CONFIG_X86) #ifdef __KVM_HAVE_USER_NMI
#define KVM_CAP_USER_NMI 22 #define KVM_CAP_USER_NMI 22
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册