public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Move KVM_CHECK_EXTENSIONMove case to arch
@ 2007-11-14 12:00 Zhang, Xiantao
       [not found] ` <42DFA526FC41B1429CE7279EF83C6BDC94FBF3-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Zhang, Xiantao @ 2007-11-14 12:00 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

Moving KVM_CHECK_EXTENSION case to arch, since different archs should
have different capabilities. 
Xiantao

[-- Attachment #2: 0001-Move-KVM_CHECK_EXTENSION-case-to-arch-since-differe.patch --]
[-- Type: application/octet-stream, Size: 1754 bytes --]

From 518128ecb0c4a00956f2c6437fbd0b40e895b6c9 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao <xiantao.zhang@intel.com>
Date: Wed, 14 Nov 2007 19:57:33 +0800
Subject: [PATCH] Move KVM_CHECK_EXTENSION case to arch, since different archs have different Capability

Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
---
 drivers/kvm/kvm_main.c |   17 -----------------
 drivers/kvm/x86.c      |   17 +++++++++++++++++
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index fb939ab..2bac22b 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1244,23 +1244,6 @@ static long kvm_dev_ioctl(struct file *filp,
 			goto out;
 		r = kvm_dev_ioctl_create_vm();
 		break;
-	case KVM_CHECK_EXTENSION: {
-		int ext = (long)argp;
-
-		switch (ext) {
-		case KVM_CAP_IRQCHIP:
-		case KVM_CAP_HLT:
-		case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:
-		case KVM_CAP_USER_MEMORY:
-		case KVM_CAP_SET_TSS_ADDR:
-			r = 1;
-			break;
-		default:
-			r = 0;
-			break;
-		}
-		break;
-	}
 	case KVM_GET_VCPU_MMAP_SIZE:
 		r = -EINVAL;
 		if (arg)
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index aa6c3d8..9f101c5 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -567,6 +567,23 @@ long kvm_arch_dev_ioctl(struct file *filp,
 	long r;
 
 	switch (ioctl) {
+	case KVM_CHECK_EXTENSION: {
+		int ext = (long)argp;
+
+		switch (ext) {
+		case KVM_CAP_IRQCHIP:
+		case KVM_CAP_HLT:
+		case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:
+		case KVM_CAP_USER_MEMORY:
+		case KVM_CAP_SET_TSS_ADDR:
+			r = 1;
+			break;
+		default:
+			r = 0;
+			break;
+		}
+		break;
+	}
 	case KVM_GET_MSR_INDEX_LIST: {
 		struct kvm_msr_list __user *user_msr_list = argp;
 		struct kvm_msr_list msr_list;
-- 
1.5.1.2


[-- Attachment #3: Type: text/plain, Size: 314 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

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

* Re: [PATCH] Move KVM_CHECK_EXTENSIONMove case to arch
       [not found] ` <42DFA526FC41B1429CE7279EF83C6BDC94FBF3-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2007-11-14 12:09   ` Carsten Otte
  2007-11-14 12:12   ` Carsten Otte
  1 sibling, 0 replies; 6+ messages in thread
From: Carsten Otte @ 2007-11-14 12:09 UTC (permalink / raw)
  To: Zhang, Xiantao; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Avi Kivity

Zhang, Xiantao wrote:
> Moving KVM_CHECK_EXTENSION case to arch, since different archs should
> have different capabilities. 
Acked-by: Carsten Otte <cotte-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

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

* Re: [PATCH] Move KVM_CHECK_EXTENSIONMove case to arch
       [not found] ` <42DFA526FC41B1429CE7279EF83C6BDC94FBF3-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  2007-11-14 12:09   ` Carsten Otte
@ 2007-11-14 12:12   ` Carsten Otte
       [not found]     ` <473AE62B.5000509-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Carsten Otte @ 2007-11-14 12:12 UTC (permalink / raw)
  To: Zhang, Xiantao; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Avi Kivity

Zhang, Xiantao wrote:
> Moving KVM_CHECK_EXTENSION case to arch, since different archs should
> have different capabilities. 
I believe we want to keep the existence of the ioctl 
KVM_CHECK_EXTENSION common.  Just the extension flags should be arch 
specific. This patch has the danger, that we might end up with 
architectures that don't have KVM_CHECK_EXTENSION at all.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

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

* Re: [PATCH] Move KVM_CHECK_EXTENSIONMove case to arch
       [not found]     ` <473AE62B.5000509-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
@ 2007-11-15 15:11       ` Zhang, Xiantao
       [not found]         ` <42DFA526FC41B1429CE7279EF83C6BDC9A0461-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Zhang, Xiantao @ 2007-11-15 15:11 UTC (permalink / raw)
  To: carsteno-tA70FqPdS9bQT0dZR+AlfA
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Avi Kivity

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

Carsten Otte wrote:
> Zhang, Xiantao wrote:
>> Moving KVM_CHECK_EXTENSION case to arch, since different archs should
>> have different capabilities.
> I believe we want to keep the existence of the ioctl
> KVM_CHECK_EXTENSION common.  Just the extension flags should be arch
> specific. This patch has the danger, that we might end up with
> architectures that don't have KVM_CHECK_EXTENSION at all.

How about attached patch?  Agree to keep this ioctl in common, and
instead define an arch-specific function in x86.

Xiantao

[-- Attachment #2: 0006-KVM-Portability-move.patch --]
[-- Type: application/octet-stream, Size: 2306 bytes --]

From ef179d89358de4ad7d721a224afca0076ebe8276 Mon Sep 17 00:00:00 2001
From: Zhang Xiantao <xiantao.zhang@intel.com>
Date: Thu, 15 Nov 2007 23:07:47 +0800
Subject: [PATCH] KVM:Portability move
Make KVM_CHECK_EXTENSION code into a function, all archs can define its capability.
Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com>
---
 drivers/kvm/kvm.h      |    3 +++
 drivers/kvm/kvm_main.c |   18 ++----------------
 drivers/kvm/x86.c      |   20 ++++++++++++++++++++
 3 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 5162d29..d4b2f99 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -626,6 +626,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
 			 unsigned int ioctl, unsigned long arg);
 void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
 void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
+
+int kvm_dev_ioctl_check_extension(long ext);
+
 int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
 				   struct
 				   kvm_userspace_memory_region *mem,
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index c7d7a9c..69a81ad 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1199,23 +1199,9 @@ static long kvm_dev_ioctl(struct file *filp,
 			goto out;
 		r = kvm_dev_ioctl_create_vm();
 		break;
-	case KVM_CHECK_EXTENSION: {
-		int ext = (long)argp;
-
-		switch (ext) {
-		case KVM_CAP_IRQCHIP:
-		case KVM_CAP_HLT:
-		case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:
-		case KVM_CAP_USER_MEMORY:
-		case KVM_CAP_SET_TSS_ADDR:
-			r = 1;
-			break;
-		default:
-			r = 0;
-			break;
-		}
+	case KVM_CHECK_EXTENSION:
+		r = kvm_dev_ioctl_check_extension((long)argp);
 		break;
-	}
 	case KVM_GET_VCPU_MMAP_SIZE:
 		r = -EINVAL;
 		if (arg)
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index ddfb3f4..cc84543 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -564,6 +564,26 @@ out:
 	return r;
 }
 
+int kvm_dev_ioctl_check_extension(long ext)
+{
+	int r;
+
+	switch (ext) {
+	case KVM_CAP_IRQCHIP:
+	case KVM_CAP_HLT:
+	case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:
+	case KVM_CAP_USER_MEMORY:
+	case KVM_CAP_SET_TSS_ADDR:
+		r = 1;
+		break;
+	default:
+		r = 0;
+		break;
+	}
+	return r;
+
+}
+
 long kvm_arch_dev_ioctl(struct file *filp,
 			unsigned int ioctl, unsigned long arg)
 {
-- 
1.5.1.2


[-- Attachment #3: Type: text/plain, Size: 314 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

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

* Re: [PATCH] Move KVM_CHECK_EXTENSIONMove case to arch
       [not found]         ` <42DFA526FC41B1429CE7279EF83C6BDC9A0461-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2007-11-15 15:15           ` Carsten Otte
  2007-11-15 15:35           ` Avi Kivity
  1 sibling, 0 replies; 6+ messages in thread
From: Carsten Otte @ 2007-11-15 15:15 UTC (permalink / raw)
  To: Zhang, Xiantao
  Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	carsteno-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8, Avi Kivity

Zhang, Xiantao wrote:
> How about attached patch?  Agree to keep this ioctl in common, and
> instead define an arch-specific function in x86.
Yea, that looks good to me.
Acked-by: Carsten Otte <cotte-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

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

* Re: [PATCH] Move KVM_CHECK_EXTENSIONMove case to arch
       [not found]         ` <42DFA526FC41B1429CE7279EF83C6BDC9A0461-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  2007-11-15 15:15           ` Carsten Otte
@ 2007-11-15 15:35           ` Avi Kivity
  1 sibling, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2007-11-15 15:35 UTC (permalink / raw)
  To: Zhang, Xiantao
  Cc: carsteno-tA70FqPdS9bQT0dZR+AlfA,
	kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Zhang, Xiantao wrote:
> Carsten Otte wrote:
>   
>> Zhang, Xiantao wrote:
>>     
>>> Moving KVM_CHECK_EXTENSION case to arch, since different archs should
>>> have different capabilities.
>>>       
>> I believe we want to keep the existence of the ioctl
>> KVM_CHECK_EXTENSION common.  Just the extension flags should be arch
>> specific. This patch has the danger, that we might end up with
>> architectures that don't have KVM_CHECK_EXTENSION at all.
>>     
>
> How about attached patch?  Agree to keep this ioctl in common, and
> instead define an arch-specific function in x86.
>
>   

Applied; thanks.

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


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/

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

end of thread, other threads:[~2007-11-15 15:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-14 12:00 [PATCH] Move KVM_CHECK_EXTENSIONMove case to arch Zhang, Xiantao
     [not found] ` <42DFA526FC41B1429CE7279EF83C6BDC94FBF3-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-11-14 12:09   ` Carsten Otte
2007-11-14 12:12   ` Carsten Otte
     [not found]     ` <473AE62B.5000509-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-11-15 15:11       ` Zhang, Xiantao
     [not found]         ` <42DFA526FC41B1429CE7279EF83C6BDC9A0461-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-11-15 15:15           ` Carsten Otte
2007-11-15 15:35           ` Avi Kivity

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