public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm-kmod: Various compat fixes for older kernels
@ 2009-05-25  7:06 Jan Kiszka
  2009-05-26  7:49 ` Avi Kivity
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2009-05-25  7:06 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel

[-- Attachment #1: Type: text/plain, Size: 4103 bytes --]

Various fixes that were required to build against a 2.6.18 kernel, but
some affect newer kernels, too:

 - replacements for uaccess.h and relay.h
 - flush_work compat wrapper
 - fix msi_enabled hack
 - hack eventfd.c for INIT_WORK
 - move phys_addr_t and true/false definitions as headers require it
   earlier
 - add MSR_K7_HWCR definition

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 external-module-compat-comm.h |   17 +++++++++++++++++
 sync                          |    6 +++---
 x86/external-module-compat.h  |   27 ++++++++++++++++-----------
 3 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/external-module-compat-comm.h b/external-module-compat-comm.h
index 581d867..dc02349 100644
--- a/external-module-compat-comm.h
+++ b/external-module-compat-comm.h
@@ -299,7 +299,11 @@ static inline void pagefault_enable(void)
 
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+#include <asm/uaccess.h>
+#else
 #include <linux/uaccess.h>
+#endif
 
 /* vm ops ->fault() was introduced in 2.6.23. */
 #include <linux/mm.h>
@@ -555,6 +559,15 @@ static inline int cancel_work_sync(struct work_struct *work)
 
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
+
+static inline void flush_work(struct work_struct *work)
+{
+	cancel_work_sync(work);
+}
+
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
 
 struct pci_dev;
@@ -565,7 +578,11 @@ struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
+#include <linux/relayfs_fs.h>
+#else
 #include <linux/relay.h>
+#endif
 
 /* relay_open() interface has changed on 2.6.21 */
 
diff --git a/sync b/sync
index f3f4d6a..18f0200 100755
--- a/sync
+++ b/sync
@@ -67,8 +67,8 @@ def __hack(data):
         if match(r'^}'): kvm_arch_init = False
         if match(r'MODULE_AUTHOR'):
             w('MODULE_INFO(version, "%s");' % (version,))
-        line = sub(r'match->dev->msi_enabled',
-                      'kvm_pcidev_msi_enabled(match->dev)', line)
+        line = sub(r'(\w+)->dev->msi_enabled',
+                   r'kvm_pcidev_msi_enabled(\1->dev)', line)
         if match(r'atomic_inc\(&kvm->mm->mm_count\);'):
             line = 'mmget(&kvm->mm->mm_count);'
         if match(r'^\t\.fault = '):
@@ -124,7 +124,7 @@ def hack(T, arch, file):
 
 hack_files = {
     'x86': str.split('kvm_main.c mmu.c vmx.c svm.c x86.c irq.h lapic.c'
-                     ' i8254.c kvm_trace.c timer.c'),
+                     ' i8254.c kvm_trace.c timer.c eventfd.c'),
     'ia64': str.split('kvm_main.c kvm_fw.c kvm_lib.c kvm-ia64.c'),
 }
 
diff --git a/x86/external-module-compat.h b/x86/external-module-compat.h
index d74aaaa..6c23a03 100644
--- a/x86/external-module-compat.h
+++ b/x86/external-module-compat.h
@@ -5,6 +5,18 @@
 
 #include <linux/compiler.h>
 #include <linux/version.h>
+#include <linux/types.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
+
+typedef u64 phys_addr_t;
+
+#endif
+
+#undef true
+#define true 1
+#undef false
+#define false 0
 
 #include "../external-module-compat-comm.h"
 
@@ -352,11 +364,6 @@ static inline void preempt_notifier_sys_exit(void) {}
 #define X86_FEATURE_NX (1*32+20)
 #endif
 
-#undef true
-#define true 1
-#undef false
-#define false 0
-
 /* EFER_LMA and EFER_LME are missing in pre 2.6.24 i386 kernels */
 #ifndef EFER_LME
 #define _EFER_LME           8  /* Long mode enable */
@@ -486,6 +493,10 @@ struct kvm_desc_ptr {
 #define FEATURE_CONTROL_VMXON_ENABLED	(1<<2)
 #endif
 
+#ifndef MSR_K7_HWCR
+#define MSR_K7_HWCR                     0xc0010015
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) && defined(__x86_64__)
 
 #undef set_debugreg
@@ -522,12 +533,6 @@ struct mtrr_state_type {
 
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
-
-typedef u64 phys_addr_t;
-
-#endif
-
 #ifndef CONFIG_HAVE_KVM_IRQCHIP
 #define CONFIG_HAVE_KVM_IRQCHIP 1
 #endif


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] kvm-kmod: Various compat fixes for older kernels
  2009-05-25  7:06 [PATCH] kvm-kmod: Various compat fixes for older kernels Jan Kiszka
@ 2009-05-26  7:49 ` Avi Kivity
  2009-05-26  8:26   ` Amit Shah
  2009-05-26  9:01   ` Jan Kiszka
  0 siblings, 2 replies; 7+ messages in thread
From: Avi Kivity @ 2009-05-26  7:49 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: kvm-devel

Jan Kiszka wrote:
> Various fixes that were required to build against a 2.6.18 kernel, but
> some affect newer kernels, too:
>
>   
>  - replacements for uaccess.h and relay.h
>  - flush_work compat wrapper
>  - fix msi_enabled hack
>  - hack eventfd.c for INIT_WORK
>   


Please split into separate patches.


>  - move phys_addr_t and true/false definitions as headers require it
>    earlier
>  - add MSR_K7_HWCR definition
>
>   

I had these two already, but not pushed.  Maybe I need to have a script 
push my master branch somewhere, so you don't duplicate my work needlessly.


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kvm-kmod: Various compat fixes for older kernels
  2009-05-26  7:49 ` Avi Kivity
@ 2009-05-26  8:26   ` Amit Shah
  2009-05-26  9:01   ` Jan Kiszka
  1 sibling, 0 replies; 7+ messages in thread
From: Amit Shah @ 2009-05-26  8:26 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Jan Kiszka, kvm-devel

On (Tue) May 26 2009 [10:49:35], Avi Kivity wrote:
> I had these two already, but not pushed.  Maybe I need to have a script  
> push my master branch somewhere, so you don't duplicate my work 
> needlessly.

A 'next' branch that's the real bleeding-edge, while the patches get
tested and master gets pushed out?

		Amit

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kvm-kmod: Various compat fixes for older kernels
  2009-05-26  7:49 ` Avi Kivity
  2009-05-26  8:26   ` Amit Shah
@ 2009-05-26  9:01   ` Jan Kiszka
  2009-05-26  9:11     ` Avi Kivity
  1 sibling, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2009-05-26  9:01 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel

[-- Attachment #1: Type: text/plain, Size: 784 bytes --]

Avi Kivity wrote:
> Jan Kiszka wrote:
>> Various fixes that were required to build against a 2.6.18 kernel, but
>> some affect newer kernels, too:
>>
>>    - replacements for uaccess.h and relay.h
>>  - flush_work compat wrapper
>>  - fix msi_enabled hack
>>  - hack eventfd.c for INIT_WORK
>>   
> 
> 
> Please split into separate patches.

OK, will do.

> 
> 
>>  - move phys_addr_t and true/false definitions as headers require it
>>    earlier
>>  - add MSR_K7_HWCR definition
>>
>>   
> 
> I had these two already, but not pushed.  Maybe I need to have a script
> push my master branch somewhere, so you don't duplicate my work needlessly.
> 

That would be highly appreciated. There is another MSR-related one
pending here (MSR_IA32_TSC).

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kvm-kmod: Various compat fixes for older kernels
  2009-05-26  9:01   ` Jan Kiszka
@ 2009-05-26  9:11     ` Avi Kivity
  2009-05-26  9:22       ` Jan Kiszka
  0 siblings, 1 reply; 7+ messages in thread
From: Avi Kivity @ 2009-05-26  9:11 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: kvm-devel

Jan Kiszka wrote:

  

>> Maybe I need to have a script
>> push my master branch somewhere, so you don't duplicate my work needlessly.
>>
>>     
>
> That would be highly appreciated.
>   

I'm thinking how to do it.  pushing requires an ssh key, and I don't 
want to leave one around without a passphrase, which would be required 
by a cron job.

Any ideas?


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kvm-kmod: Various compat fixes for older kernels
  2009-05-26  9:11     ` Avi Kivity
@ 2009-05-26  9:22       ` Jan Kiszka
  2009-05-26  9:30         ` Avi Kivity
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2009-05-26  9:22 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel

Avi Kivity wrote:
> Jan Kiszka wrote:
> 
>  
> 
>>> Maybe I need to have a script
>>> push my master branch somewhere, so you don't duplicate my work
>>> needlessly.
>>>
>>>     
>>
>> That would be highly appreciated.
>>   
> 
> I'm thinking how to do it.  pushing requires an ssh key, and I don't
> want to leave one around without a passphrase, which would be required
> by a cron job.
> 
> Any ideas?
> 

Local commit hook that triggers the push (and ask you for the phrase
interactively)? But that also depends on how frequent you would like to
publish the tree.

Jan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] kvm-kmod: Various compat fixes for older kernels
  2009-05-26  9:22       ` Jan Kiszka
@ 2009-05-26  9:30         ` Avi Kivity
  0 siblings, 0 replies; 7+ messages in thread
From: Avi Kivity @ 2009-05-26  9:30 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: kvm-devel

Jan Kiszka wrote:

  

>> I'm thinking how to do it.  pushing requires an ssh key, and I don't
>> want to leave one around without a passphrase, which would be required
>> by a cron job.
>>
>> Any ideas?
>>
>>     
>
> Local commit hook that triggers the push (and ask you for the phrase
> interactively)? But that also depends on how frequent you would like to
> publish the tree.
>   

When I'm working interactively the ssh key is in my keyring, so it would 
be transparent for me.  But the problem is that I sometimes work from 
home and push into the repository, so there'd be no commit to trigger 
the hook.

(hmm, when I push I also have the kernel.org ssh key in my keyring, and 
with ssh-agent, maybe it could work remotely)

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-05-26  9:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-25  7:06 [PATCH] kvm-kmod: Various compat fixes for older kernels Jan Kiszka
2009-05-26  7:49 ` Avi Kivity
2009-05-26  8:26   ` Amit Shah
2009-05-26  9:01   ` Jan Kiszka
2009-05-26  9:11     ` Avi Kivity
2009-05-26  9:22       ` Jan Kiszka
2009-05-26  9:30         ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox