Re: [PATCH 2/5] kvm/svm: enhance MOV CR intercept handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/10/2010 03:51 PM, Andre Przywara wrote:
Newer SVM implementations provide the GPR number in the VMCB, so
that the emulation path is no longer necesarry to handle CR
register access intercepts. Implement the handling in svm.c and
use it when the info is provided.

Signed-off-by: Andre Przywara<andre.przywara@xxxxxxx>
---
  arch/x86/include/asm/svm.h |    2 +
  arch/x86/kvm/svm.c         |   91 ++++++++++++++++++++++++++++++++++++++-----
  2 files changed, 82 insertions(+), 11 deletions(-)

diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h
index 11dbca7..589fc25 100644
--- a/arch/x86/include/asm/svm.h
+++ b/arch/x86/include/asm/svm.h
@@ -256,6 +256,8 @@ struct __attribute__ ((__packed__)) vmcb {
  #define SVM_EXITINFOSHIFT_TS_REASON_JMP 38
  #define SVM_EXITINFOSHIFT_TS_HAS_ERROR_CODE 44

+#define SVM_EXITINFO_REG_MASK 0x0F
+
  #define	SVM_EXIT_READ_CR0 	0x000
  #define	SVM_EXIT_READ_CR3 	0x003
  #define	SVM_EXIT_READ_CR4 	0x004
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 298ff79..ee5f100 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2594,12 +2594,81 @@ static int emulate_on_interception(struct vcpu_svm *svm)
  	return emulate_instruction(&svm->vcpu, 0, 0, 0) == EMULATE_DONE;
  }

+static int cr_interception(struct vcpu_svm *svm)
+{
+	int reg, cr;
+	unsigned long val;
+	int err;
+
+	if (!static_cpu_has(X86_FEATURE_DECODEASSISTS))
+		return emulate_on_interception(svm);
+
+	/* bit 63 is the valid bit, as not all instructions (like lmsw)
+	   provide the information */

Please use kernel style comments:

 /*
  * text
  * text
  */

Even better, use a name for the bit, which will obviate the need for a comment.


--
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux