Nested Virtualization: svm specific implementation
PATCH 9/12 Nested Virtualization: svm specific implementation
Signature · 7 lines
-- ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632
# HG changeset patch
# User cegger
# Date 1292860414 -3600
Implement SVM specific part for Nested Virtualization
Signed-off-by Christoph Egger <[email protected]>
xen/arch/x86/hvm/svm/Makefile +2 -0
@@ -2,6 +2,8 @@ obj-y += asid.o obj-y += emulate.o obj-y += entry.o obj-y += intr.o +obj-y += nestedsvm.o obj-y += svm.o +obj-y += svmdebug.o obj-y += vmcb.o obj-y += vpmu.o
xen/arch/x86/hvm/svm/emulate.c +10 -0
@@ -102,6 +102,11 @@ MAKE_INSTR(INT3, 1, 0xcc);MAKE_INSTR (RDTSC ,2 ,0x0f ,0x31 );MAKE_INSTR (PAUSE ,1 ,0x90 );MAKE_INSTR (XSETBV ,3 ,0x0f ,0x01 ,0xd1 ); +MAKE_INSTR (VMRUN ,3 ,0x0f ,0x01 ,0xd8 ); +MAKE_INSTR (VMLOAD ,3 ,0x0f ,0x01 ,0xda ); +MAKE_INSTR (VMSAVE ,3 ,0x0f ,0x01 ,0xdb ); +MAKE_INSTR (STGI ,3 ,0x0f ,0x01 ,0xdc ); +MAKE_INSTR (CLGI ,3 ,0x0f ,0x01 ,0xdd );static const u8 *opc_bytes[INSTR_MAX_COUNT ] = {
@@ -116,6 +121,11 @@ static const u8 *opc_bytes[INSTR_MAX_COU [INSTR_RDTSC] = OPCODE_RDTSC, [INSTR_PAUSE] = OPCODE_PAUSE, [INSTR_XSETBV] = OPCODE_XSETBV, + [INSTR_VMRUN] = OPCODE_VMRUN, + [INSTR_VMLOAD] = OPCODE_VMLOAD, + [INSTR_VMSAVE] = OPCODE_VMSAVE, + [INSTR_STGI] = OPCODE_STGI, + [INSTR_CLGI] = OPCODE_CLGI, };static int fetch (struct vcpu *v,u8 *buf,unsigned long addr,int len)
xen/arch/x86/hvm/svm/entry.S +1 -0
@@ -54,6 +54,7 @@ ENTRY(svm_asm_do_resume) call svm_intr_assist + call_with_regs(nsvm_vcpu_switch) get_current(bx) CLGI
xen/arch/x86/hvm/svm/nestedsvm.c new file +1239 -0
1,239 lines not on this page · raw message
xen/arch/x86/hvm/svm/svm.c +279 -28
468 lines not on this page · raw message
xen/arch/x86/hvm/svm/svmdebug.c new file +191 -0
191 lines not on this page · raw message
xen/arch/x86/hvm/svm/vmcb.c +3 -108
147 lines not on this page · raw message
xen/include/asm-x86/hvm/svm/emulate.h +5 -0
@@ -33,6 +33,11 @@ enum instruction_index {INSTR_RDTSC ,INSTR_PAUSE ,INSTR_XSETBV , +INSTR_VMRUN , +INSTR_VMLOAD , +INSTR_VMSAVE , +INSTR_STGI , +INSTR_CLGI ,INSTR_MAX_COUNT /* Must be last - Number of instructions supported */ };
xen/include/asm-x86/hvm/svm/nestedsvm.h new file +126 -0
126 lines not on this page · raw message
xen/include/asm-x86/hvm/svm/svm.h +4 -2
@@ -29,8 +29,6 @@#include <asm/i387.h> #include <asm/hvm/vpmu.h> -void svm_dump_vmcb (const char *from,struct vmcb_struct *vmcb); -#define SVM_REG_EAX (0)#define SVM_REG_ECX (1)#define SVM_REG_EDX (2)
@@ -62,6 +60,8 @@ static inline void svm_vmsave(void *vmcb : : "a" (__pa(vmcb)) : "memory" ); } +unsigned long *svm_msrbit (unsigned long *msr_bitmap,uint32_t msr); +extern u32 svm_feature_flags;#define SVM_FEATURE_NPT 0
@@ -78,4 +78,6 @@ extern u32 svm_feature_flags;#define cpu_has_svm_cleanbits test_bit(SVM_FEATURE_CLEAN, &svm_feature_flags)#define cpu_has_pause_filter test_bit(SVM_FEATURE_PAUSEF, &svm_feature_flags) +#define SVM_PAUSEFILTER_INIT 3000 +#endif /* __ASM_X86_HVM_SVM_H__ */
xen/include/asm-x86/hvm/svm/svmdebug.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* svmdebug.h: SVM related debug defintions +* Copyright (c) 2010, AMD Corporation. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program; if not, write to the Free Software Foundation, Inc., 59 Temple +* Place - Suite 330, Boston, MA 02111-1307 USA. +* +*/ + +#ifndef __ASM_X86_HVM_SVM_SVMDEBUG_H__ +#define __ASM_X86_HVM_SVM_SVMDEBUG_H__ + +#include <asm/types.h> +#include <asm/hvm/svm/vmcb.h> + +void svm_vmcb_dump (const char *from,struct vmcb_struct *vmcb); +bool_t svm_vmcb_isvalid (const char *from,struct vmcb_struct *vmcb, +bool_t verbose); + +#endif /* __ASM_X86_HVM_SVM_SVMDEBUG_H__ */
xen/include/asm-x86/hvm/svm/vmcb.h +3 -0
@@ -398,6 +398,9 @@ typedef union } fields; } __attribute__ ((packed)) vmcbcleanbits_t; +#define IOPM_SIZE (12 * 1024) +#define MSRPM_SIZE (8 * 1024) +struct vmcb_struct {u32 _cr_intercepts;/* offset 0x00 - cleanbit 0 */ u32 _dr_intercepts;/* offset 0x04 - cleanbit 0 */
xen/include/asm-x86/hvm/vcpu.h +2 -0
@@ -25,6 +25,7 @@#include <asm/hvm/vlapic.h> #include <asm/hvm/vmx/vmcs.h> #include <asm/hvm/svm/vmcb.h> +#include <asm/hvm/svm/nestedsvm.h> #include <asm/mtrr.h> enum hvm_io_state {
@@ -45,6 +46,7 @@ struct nestedvcpu {/* SVM/VMX arch specific */ union { +struct nestedsvm nsvm; } u;bool_t nv_flushp2m;/* True, when p2m table must be flushed */
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel