From: Christoph Egger <Christoph.Egger@amd.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Cc: "Dong, Eddie" <eddie.dong@intel.com>, Tim Deegan <Tim.Deegan@citrix.com>
Subject: [PATCH 02/13] Nested Virtualization: data structure
Date: Fri, 15 Oct 2010 15:11:41 +0200 [thread overview]
Message-ID: <201010151511.42610.Christoph.Egger@amd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 264 bytes --]
--
---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
[-- Attachment #2: xen_nh02_structdata.diff --]
[-- Type: text/x-diff, Size: 3790 bytes --]
# HG changeset patch
# User cegger
# Date 1287064247 -7200
Data structures for Nested Virtualization
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
diff -r 0f5ddfbc1afe -r 85aa977891b6 xen/arch/x86/hvm/svm/vmcb.c
--- a/xen/arch/x86/hvm/svm/vmcb.c
+++ b/xen/arch/x86/hvm/svm/vmcb.c
@@ -40,9 +40,6 @@
extern int svm_dbg_on;
-#define IOPM_SIZE (12 * 1024)
-#define MSRPM_SIZE (8 * 1024)
-
struct vmcb_struct *alloc_vmcb(void)
{
struct vmcb_struct *vmcb;
diff -r 0f5ddfbc1afe -r 85aa977891b6 xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -52,7 +52,8 @@ enum hvm_intblk {
hvm_intblk_shadow, /* MOV-SS or STI shadow */
hvm_intblk_rflags_ie, /* RFLAGS.IE == 0 */
hvm_intblk_tpr, /* LAPIC TPR too high */
- hvm_intblk_nmi_iret /* NMI blocked until IRET */
+ hvm_intblk_nmi_iret, /* NMI blocked until IRET */
+ hvm_intblk_svm_gif, /* GIF cleared */
};
/* These happen to be the same as the VMX interrupt shadow definitions. */
diff -r 0f5ddfbc1afe -r 85aa977891b6 xen/include/asm-x86/hvm/svm/vmcb.h
--- a/xen/include/asm-x86/hvm/svm/vmcb.h
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h
@@ -364,6 +364,9 @@ typedef union
} fields;
} __attribute__ ((packed)) lbrctrl_t;
+#define IOPM_SIZE (12 * 1024)
+#define MSRPM_SIZE (8 * 1024)
+
struct vmcb_struct {
u32 cr_intercepts; /* offset 0x00 */
u32 dr_intercepts; /* offset 0x04 */
diff -r 0f5ddfbc1afe -r 85aa977891b6 xen/include/asm-x86/hvm/vcpu.h
--- a/xen/include/asm-x86/hvm/vcpu.h
+++ b/xen/include/asm-x86/hvm/vcpu.h
@@ -36,6 +36,56 @@ enum hvm_io_state {
HVMIO_completed
};
+struct nestedhvm {
+ bool_t nh_guestmode; /* vcpu in guestmode? */
+ void *nh_vmcx; /* l1 guest virtual VMCB/VMCS */
+
+ /* address of l1 guest virtual VMCB/VMCS, needed for VMEXIT */
+ uint64_t nh_vmaddr;
+
+ void *nh_arch; /* SVM/VMX specific data */
+ size_t nh_arch_size;
+
+ /* Cached real MSR permission bitmaps of the nested guest */
+ unsigned long *nh_cached_msrpm;
+ size_t nh_cached_msrpm_size;
+ /* Merged MSR permission bitmap */
+ unsigned long *nh_merged_msrpm;
+ size_t nh_merged_msrpm_size;
+
+ /* Cache guest cr3/host cr3 the guest sets up for the nested guest.
+ * Used by Shadow-on-Shadow and Nested-on-Nested.
+ * nh_vm_guestcr3: in l2 guest physical address space and points to
+ * the l2 guest page table
+ * nh_vm_hostcr3: in l1 guest physical address space and points to
+ * the l1 guest nested page table
+ */
+ uint64_t nh_vm_guestcr3, nh_vm_hostcr3;
+ uint32_t nh_guest_asid;
+ bool_t nh_flushp2m;
+ struct p2m_domain *nh_p2m; /* used p2m table for this vcpu */
+
+ /* Only meaningful when forcevmexit flag is set */
+ struct {
+ uint64_t exitcode; /* generic exitcode */
+ uint64_t exitinfo1; /* additional information to the exitcode */
+ uint64_t exitinfo2; /* additional information to the exitcode */
+ } nh_forcevmexit;
+ union {
+ uint32_t bytes;
+ struct {
+ uint32_t forcevmexit : 1;
+ uint32_t use_native_exitcode : 1;
+ uint32_t vmentry : 1; /* true during vmentry/vmexit emulation */
+ uint32_t reserved : 29;
+ } fields;
+ } nh_hostflags;
+
+ bool_t nh_hap_enabled;
+};
+
+#define vcpu_nestedhvm(v) ((v)->arch.hvm_vcpu.nestedhvm)
+
struct hvm_vcpu {
/* Guest control-register and EFER values, just as the guest sees them. */
unsigned long guest_cr[5];
@@ -87,6 +137,8 @@ struct hvm_vcpu {
struct tasklet assert_evtchn_irq_tasklet;
+ struct nestedhvm nestedhvm;
+
struct mtrr_state mtrr;
u64 pat_cr;
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2010-10-15 13:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-15 13:11 Christoph Egger [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-11-12 18:40 [PATCH 02/13] Nested Virtualization: data structure Christoph Egger
2010-09-01 14:56 Christoph Egger
2010-09-03 8:07 ` Dong, Eddie
2010-09-17 5:39 ` Dong, Eddie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201010151511.42610.Christoph.Egger@amd.com \
--to=christoph.egger@amd.com \
--cc=Tim.Deegan@citrix.com \
--cc=eddie.dong@intel.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.