public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] HYPERCALL] Update exit reason for vmcall
@ 2007-08-24 23:58 Dor Laor
       [not found] ` <64F9B87B6B770947A9F8391472E032160D59004E-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Dor Laor @ 2007-08-24 23:58 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

It provides user space hypercall handling.
Also add cpl == 0 check for svm, htat unlike VT let software decide.

Signed-off-by: Dor Laor <dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
---
 drivers/kvm/kvm_main.c |    2 ++
 drivers/kvm/svm.c      |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index d154487..abd7498 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1305,6 +1305,8 @@ int kvm_hypercall(struct kvm_vcpu *vcpu, struct
kvm_run *run)
 		run->hypercall.ret = ret;
 		run->hypercall.longmode = is_long_mode(vcpu);
 		kvm_arch_ops->decache_regs(vcpu);
+		run->exit_reason = KVM_EXIT_HYPERCALL;
+
 		return 0;
 	}
 	vcpu->regs[VCPU_REGS_RAX] = ret;
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index cc674bf..9bfd11e 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -1022,6 +1022,11 @@ static int halt_interception(struct vcpu_svm
*svm, struct kvm_run *kvm_run)
 
 static int vmmcall_interception(struct vcpu_svm *svm, struct kvm_run
*kvm_run)
 {
+	if (svm->vmcb->save.cpl != 0) {
+		inject_ud(&svm->vcpu);
+		return 1;
+	}
+
 	svm->next_rip = svm->vmcb->save.rip + 3;
 	skip_emulated_instruction(&svm->vcpu);
 	return kvm_hypercall(&svm->vcpu, kvm_run);

-----
In simplicity there is elegance.
Dor Laor ;)


-------------------------------------------------------------------------
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 related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/4] HYPERCALL] Update exit reason for vmcall
       [not found] ` <64F9B87B6B770947A9F8391472E032160D59004E-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
@ 2007-08-25  8:11   ` Avi Kivity
  2007-08-27 22:16   ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2007-08-25  8:11 UTC (permalink / raw)
  To: Dor Laor; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Dor Laor wrote:
> It provides user space hypercall handling.
> Also add cpl == 0 check for svm, htat unlike VT let software decide.
>
>   

Separate patches please.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
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] 3+ messages in thread

* Re: [PATCH 3/4] HYPERCALL] Update exit reason for vmcall
       [not found] ` <64F9B87B6B770947A9F8391472E032160D59004E-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
  2007-08-25  8:11   ` Avi Kivity
@ 2007-08-27 22:16   ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2007-08-27 22:16 UTC (permalink / raw)
  To: Dor Laor; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Fri, 2007-08-24 at 16:58 -0700, Dor Laor wrote:
> diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
> index cc674bf..9bfd11e 100644
> --- a/drivers/kvm/svm.c
> +++ b/drivers/kvm/svm.c
> @@ -1022,6 +1022,11 @@ static int halt_interception(struct vcpu_svm
> *svm, struct kvm_run *kvm_run)
>  
>  static int vmmcall_interception(struct vcpu_svm *svm, struct kvm_run
> *kvm_run)
>  {
> +	if (svm->vmcb->save.cpl != 0) {
> +		inject_ud(&svm->vcpu);
> +		return 1;
> +	}
> +
>  	svm->next_rip = svm->vmcb->save.rip + 3;
>  	skip_emulated_instruction(&svm->vcpu);
>  	return kvm_hypercall(&svm->vcpu, kvm_run);

Can you split this out and submit the patch separately.  This is
actually a pretty nasty bug as SVM doesn't check for CPL=0 in hardware.
This patch is independent of your series.

Regards,

Anthony Liguori

> -----
> In simplicity there is elegance.
> Dor Laor ;)
> 
> 
> -------------------------------------------------------------------------
> 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/
> _______________________________________________
> kvm-devel mailing list
> kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/kvm-devel


-------------------------------------------------------------------------
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] 3+ messages in thread

end of thread, other threads:[~2007-08-27 22:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-24 23:58 [PATCH 3/4] HYPERCALL] Update exit reason for vmcall Dor Laor
     [not found] ` <64F9B87B6B770947A9F8391472E032160D59004E-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-08-25  8:11   ` Avi Kivity
2007-08-27 22:16   ` Anthony Liguori

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