Re: [PATCH] qemu-kvm: kvm headers update

2009-10-08 Thread Avi Kivity

On 10/06/2009 07:09 PM, Arnd Bergmann wrote:

On Tuesday 06 October 2009, Avi Kivity wrote:
   

On 10/05/2009 09:27 PM, Michael S. Tsirkin wrote:
 


   

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.


   

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.

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).


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] qemu-kvm: kvm headers update

2009-10-06 Thread Michael S. Tsirkin
On Tue, Oct 06, 2009 at 11:52:24AM +0200, Avi Kivity wrote:
> On 10/05/2009 09:27 PM, Michael S. Tsirkin wrote:
>>
>>
>>> 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.
>>
>>
>
> 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.

> -- 
> error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] qemu-kvm: kvm headers update

2009-10-06 Thread Avi Kivity

On 10/05/2009 09:27 PM, Michael S. Tsirkin wrote:




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.

   


I think 'make headers_install' results in non-portable headers since it 
unifdefs stuff out.


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] qemu-kvm: kvm headers update

2009-10-06 Thread Avi Kivity

On 10/05/2009 09:27 PM, Michael S. Tsirkin wrote:


   

Why are you dropping these?  Any dependencies on CONFIG_ will be broken.
 

Instead I included kvm_types which has these.
   


Oh, a side effect.  Mind moving the CONFIG_* stuff to a separate header 
(which we can include using -include)?  Separate patch please.


--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] qemu-kvm: kvm headers update

2009-10-05 Thread Michael S. Tsirkin
On Mon, Oct 05, 2009 at 05:38:35PM +0200, Avi Kivity wrote:
> On 10/05/2009 11:46 AM, Michael S. Tsirkin wrote:
>> 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.
>>
>> Signed-off-by: Michael S. Tsirkin
>> ---
>>   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(-)
>>
>> diff --git a/kvm/include/linux/kvm.h b/kvm/include/linux/kvm.h
>> index 801865d..2c9a209 100644
>> --- a/kvm/include/linux/kvm.h
>> +++ b/kvm/include/linux/kvm.h
>> @@ -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
>>
>
> Why are you dropping these?  Any dependencies on CONFIG_ will be broken.

Instead I included kvm_types which has these.

>
> 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.

> -- 
> error compiling committee.c: too many arguments to function
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] qemu-kvm: kvm headers update

2009-10-05 Thread Avi Kivity

On 10/05/2009 11:46 AM, Michael S. Tsirkin wrote:

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.

Signed-off-by: Michael S. Tsirkin
---
  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(-)

diff --git a/kvm/include/linux/kvm.h b/kvm/include/linux/kvm.h
index 801865d..2c9a209 100644
--- a/kvm/include/linux/kvm.h
+++ b/kvm/include/linux/kvm.h
@@ -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
   


Why are you dropping these?  Any dependencies on CONFIG_ will be broken.

Or is this the output of 'make headers_install'?

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] qemu-kvm: kvm headers update

2009-10-05 Thread 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.h instead of copying it.

Signed-off-by: Michael S. Tsirkin 
---
 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(-)

diff --git a/kvm/include/linux/kvm.h b/kvm/include/linux/kvm.h
index 801865d..2c9a209 100644
--- a/kvm/include/linux/kvm.h
+++ b/kvm/include/linux/kvm.h
@@ -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 
 #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 
+#include 
 
 #include 
 #include 
 
 #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) \
-   (0x0fff & (val))
-#define TRACE_REC_NUM_DATA_ARGS(val) \
-   (0x7000 & ((val) << 28))
-#define TRACE_REC_TCS(val) \
-   (0x8000 & ((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_M