qemu-kvm: kvm headers update
PATCH 1/1 qemu-kvm: kvm headers update
Update headers from linux 2.6.32-rc1, this mainly adds irqfd which will make it easier to add vhost, down the line. Also reduce code duplication by including kvm_types.h instead of copying it.
--- kvm/include/linux/kvm.h | 131 +++++++++++++++---------------------- kvm/include/linux/kvm_para.h | 56 +--------------- kvm/include/x86/asm/kvm.h | 46 +------------ kvm/include/x86/asm/kvm_para.h | 141 +--------------------------------------- 4 files changed, 61 insertions(+), 313 deletions(-)
kvm/include/linux/kvm.h +52 -79
@@ -1,43 +1,4 @@ -#ifndef KVM_UNIFDEF_H -#define KVM_UNIFDEF_H - -#ifdef __i386__ -#ifndef CONFIG_X86_32 -#define CONFIG_X86_32 1 -#endif -#endif - -#ifdef __x86_64__ -#ifndef CONFIG_X86_64 -#define CONFIG_X86_64 1 -#endif -#endif - -#if defined(__i386__) || defined (__x86_64__) -#ifndef CONFIG_X86 -#define CONFIG_X86 1 -#endif -#endif - -#ifdef __ia64__ -#ifndef CONFIG_IA64 -#define CONFIG_IA64 1 -#endif -#endif - -#ifdef __PPC__ -#ifndef CONFIG_PPC -#define CONFIG_PPC 1 -#endif -#endif - -#ifdef __s390__ -#ifndef CONFIG_S390 -#define CONFIG_S390 1 -#endif -#endif - -#endif +#include <linux/kvm_types.h> #ifndef __LINUX_KVM_H#define __LINUX_KVM_H
@@ -47,14 +8,14 @@* Note: you must update KVM_API_VERSION if you change this interface. */ -#include <asm/types.h> +#include <linux/types.h> #include <linux/ioctl.h> #include <asm/kvm.h> #define KVM_API_VERSION 12 -/* for KVM_TRACE_ENABLE */ +/* for KVM_TRACE_ENABLE, deprecated */ struct kvm_user_trace_setup {__u32 buf_size;/* sub_buffer size of each per-cpu */ __u32 buf_nr;/* the number of sub_buffers of each per-cpu */
@@ -281,7 +242,7 @@ struct kvm_dirty_log {__u32 slot;__u32 padding1;union { -void *dirty_bitmap;/* one bit per page */ +void *dirty_bitmap;/* one bit per page */ __u64 padding2; }; };
@@ -347,6 +308,28 @@ struct kvm_guest_debug {struct kvm_guest_debug_arch arch; }; +enum { + kvm_ioeventfd_flag_nr_datamatch, + kvm_ioeventfd_flag_nr_pio, + kvm_ioeventfd_flag_nr_deassign, + kvm_ioeventfd_flag_nr_max, +}; + +#define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch) +#define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio) +#define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign) + +#define KVM_IOEVENTFD_VALID_FLAG_MASK ((1 << kvm_ioeventfd_flag_nr_max) - 1) + +struct kvm_ioeventfd { +__u64 datamatch; +__u64 addr;/* legal pio/mmio address */ +__u32 len;/* 1, 2, 4, or 8 bytes */ +__s32 fd; +__u32 flags; +__u8 pad[36 ]; +}; +#define KVM_TRC_SHIFT 16/* * kvm trace categories
@@ -365,35 +348,6 @@ struct kvm_guest_debug {#define KVM_TRC_CYCLE_SIZE 8#define KVM_TRC_EXTRA_MAX 7 -/* This structure represents a single trace buffer record. */ -struct kvm_trace_rec { -/* variable rec_val -* is split into: -* bits 0 - 27 -> event id -* bits 28 -30 -> number of extra data args of size u32 -* bits 31 -> binary indicator for if tsc is in record -*/ -__u32 rec_val; -__u32 pid; -__u32 vcpu_id; -union { -struct { -__u64 timestamp; -__u32 extra_u32[KVM_TRC_EXTRA_MAX ]; - } __attribute__((packed)) timestamp; -struct { -__u32 extra_u32[KVM_TRC_EXTRA_MAX ]; - } notimestamp; - } u; -}; - -#define TRACE_REC_EVENT_ID (val) \ - (0x0fffffff & (val)) -#define TRACE_REC_NUM_DATA_ARGS (val) \ - (0x70000000 & ((val) << 28)) -#define TRACE_REC_TCS (val) \ - (0x80000000 & ((val) << 31)) -#define KVMIO 0xAE/*
@@ -473,8 +427,15 @@ struct kvm_trace_rec {#ifdef __KVM_HAVE_MCE#define KVM_CAP_MCE 31#endif +#define KVM_CAP_IRQFD 32 +#ifdef __KVM_HAVE_PIT#define KVM_CAP_PIT2 33 +#endif +#define KVM_CAP_SET_BOOT_CPU_ID 34 +#ifdef __KVM_HAVE_PIT_STATE2#define KVM_CAP_PIT_STATE2 35 +#endif +#define KVM_CAP_IOEVENTFD 36#define KVM_CAP_SET_IDENTITY_MAP_ADDR 37#ifdef KVM_CAP_IRQ_ROUTING
@@ -528,16 +489,19 @@ struct kvm_x86_mce { };#endif +#define KVM_IRQFD_FLAG_DEASSIGN (1 << 0) + +struct kvm_irqfd { +__u32 fd; +__u32 gsi; +__u32 flags; +__u8 pad[20 ]; +}; +/* * ioctls for VM fds */ #define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) -#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) -#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) -#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\ - struct kvm_userspace_memory_region) -#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) -#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)/* * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns * a vcpu fd.
@@ -545,6 +509,12 @@ struct kvm_x86_mce {#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) +#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44) +#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) +#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\ + struct kvm_userspace_memory_region) +#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47) +#define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)/* Device model IOC */ #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
@@ -573,7 +543,10 @@ struct kvm_x86_mce {#define KVM_ASSIGN_SET_MSIX_ENTRY \ _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry)#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) +#define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd)#define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config) +#define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78) +#define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd)/* * ioctls for vcpu fds
@@ -716,7 +689,7 @@ struct kvm_assigned_msix_nr {__u16 padding; }; -#define KVM_MAX_MSIX_PER_DEV 512 +#define KVM_MAX_MSIX_PER_DEV 256struct kvm_assigned_msix_entry {__u32 assigned_dev_id;__u32 gsi;
kvm/include/linux/kvm_para.h +2 -54
70 lines not on this page · raw message
kvm/include/x86/asm/kvm.h +4 -42
67 lines not on this page · raw message
kvm/include/x86/asm/kvm_para.h +3 -138
152 lines not on this page · raw message
Signature · 1 line
1.6.5.rc2
Quoted 49 lines · Michael S. Tsirkin
Update headers from linux 2.6.32-rc1, this mainly adds irqfd which will make it easier to add vhost, down the line. Also reduce code duplication by including
kvm_types.hinstead of copying it.Signed-off-by Michael S. Tsirkin<[email protected]>--- kvm/include/linux/kvm.h | 131 +++++++++++++++---------------------- kvm/include/linux/kvm_para.h | 56 +--------------- kvm/include/x86/asm/kvm.h | 46 +------------ kvm/include/x86/asm/kvm_para.h | 141 +--------------------------------------- 4 files changed, 61 insertions(+), 313 deletions(-)kvm/include/linux/kvm.h +0
-31@@ -1,43 +1,4 @@ -#ifndef KVM_UNIFDEF_H -#define KVM_UNIFDEF_H - -#ifdef __i386__ -#ifndef CONFIG_X86_32 -#define CONFIG_X86_32 1 -#endif -#endif - -#ifdef __x86_64__ -#ifndef CONFIG_X86_64 -#define CONFIG_X86_64 1 -#endif -#endif - -#if defined(__i386__) || defined (__x86_64__) -#ifndef CONFIG_X86 -#define CONFIG_X86 1 -#endif -#endif - -#ifdef __ia64__ -#ifndef CONFIG_IA64 -#define CONFIG_IA64 1 -#endif -#endif - -#ifdef __PPC__ -#ifndef CONFIG_PPC -#define CONFIG_PPC 1 -#endif
kvm/include/linux/kvm.h line 1
Quoted 10 lines
kvm/include/linux/kvm.h +0
-9-#endif - -#ifdef __s390__ -#ifndef CONFIG_S390 -#define CONFIG_S390 1 -#endif -#endif - -#endif
Why are you dropping these? Any dependencies on CONFIG_ will be broken.
Or is this the output of 'make headers_install'?
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 54 lines · Avi Kivity
Quoted 53 lines · Michael S. Tsirkin
Update headers from linux 2.6.32-rc1, this mainly adds irqfd which will make it easier to add vhost, down the line. Also reduce code duplication by including
kvm_types.hinstead of copying it.Signed-off-by Michael S. Tsirkin<[email protected]>--- kvm/include/linux/kvm.h | 131 +++++++++++++++---------------------- kvm/include/linux/kvm_para.h | 56 +--------------- kvm/include/x86/asm/kvm.h | 46 +------------ kvm/include/x86/asm/kvm_para.h | 141 +--------------------------------------- 4 files changed, 61 insertions(+), 313 deletions(-)kvm/include/linux/kvm.h +0
-35@@ -1,43 +1,4 @@ -#ifndef KVM_UNIFDEF_H -#define KVM_UNIFDEF_H - -#ifdef __i386__ -#ifndef CONFIG_X86_32 -#define CONFIG_X86_32 1 -#endif -#endif - -#ifdef __x86_64__ -#ifndef CONFIG_X86_64 -#define CONFIG_X86_64 1 -#endif -#endif - -#if defined(__i386__) || defined (__x86_64__) -#ifndef CONFIG_X86 -#define CONFIG_X86 1 -#endif -#endif - -#ifdef __ia64__ -#ifndef CONFIG_IA64 -#define CONFIG_IA64 1 -#endif -#endif - -#ifdef __PPC__ -#ifndef CONFIG_PPC -#define CONFIG_PPC 1 -#endif -#endif - -#ifdef __s390__ -#ifndef CONFIG_S390
Quoted 8 lines
kvm/include/linux/kvm.h line 4
Quoted 6 lines
kvm/include/linux/kvm.h +0
-5-#define CONFIG_S390 1 -#endif -#endif - -#endif Why are you dropping these? Any dependencies on
CONFIG_will be broken.
Instead I included kvm_types which has these.
Quoted 2 lines
Or is this the output of 'make
headers_install'?
yes. I just added include to kvm_types to add the CONFIG_ stuff. Or maybe instead we should fix users to depend on the correct ifdefs.
Quoted 2 lines
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 6 lines · Michael S. Tsirkin
Quoted 4 lines
Why are you dropping these? Any dependencies on
CONFIG_will be broken.Instead I included
kvm_typeswhich has these.
Oh, a side effect. Mind moving the CONFIG_* stuff to a separate header (which we can include using -include)? Separate patch please.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 8 lines · Michael S. Tsirkin
Quoted 4 lines
Or is this the output of 'make
headers_install'?yes. I just added include to
kvm_typesto add theCONFIG_stuff. Or maybe instead we should fix users to depend on the correct ifdefs.
I think 'make headers_install' results in non-portable headers since it unifdefs stuff out.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 5 lines · Avi Kivity
Quoted 4 lines · Michael S. Tsirkin
Quoted 4 lines
Or is this the output of 'make
headers_install'?
Quoted 7 lines
Quoted 4 lines
yes. I just added include to
kvm_typesto add theCONFIG_stuff. Or maybe instead we should fix users to depend on the correct ifdefs.I think 'make
headers_install' results in non-portable headers since it unifdefs stuff out.
Heh, take a look at the diff, if you see issues, let me know.
Quoted 2 lines
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 21 lines · Arnd Bergmann
Quoted 7 lines · Avi Kivity
Quoted 5 lines · Michael S. Tsirkin
Quoted 5 lines
Or is this the output of 'make
headers_install'?Quoted 8 lines
Quoted 5 lines
yes. I just added include to
kvm_typesto add theCONFIG_stuff. Or maybe instead we should fix users to depend on the correct ifdefs.I think 'make
headers_install' results in non-portable headers since it unifdefs stuff out.The point of 'make
headers_install' is to turn kernel headers into user space headers, e.g. removing address space annotations that are undefined in user space but required in the kernel.
Quoted 7 lines
Unifdef only removes parts under #ifdef
__KERNEL__, and by extension, anything under CONFIG_*, which is not allowed outside of__KERNEL__, because it may have an entirely different meaning in user space.So, for building qemu, we should really use a copy of the 'installed' version, but of course not for building the external module.
Yeah - kvm headers used to depend on CONFIG_*, but looks like this was fixed (by me - oh my memory).
Signature · 1 line
error compiling committee.c: too many arguments to function