aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/svm
diff options
context:
space:
mode:
authorGianluca Guida <gianluca.guida@citrix.com>2012-04-17 08:29:26 +0100
committerGianluca Guida <gianluca.guida@citrix.com>2012-04-17 08:29:26 +0100
commit9cfc1be3b96e547b21fd3a53639ff51a08b05b5a (patch)
tree1da4dab23c0a2f6d3a80c74d04fb8764c18ab9e3 /xen/arch/x86/hvm/svm
parent625550282c299d6607eb4bdb35b3ebadb5ae77b3 (diff)
downloadxen-9cfc1be3b96e547b21fd3a53639ff51a08b05b5a.tar.gz
xen-9cfc1be3b96e547b21fd3a53639ff51a08b05b5a.tar.bz2
xen-9cfc1be3b96e547b21fd3a53639ff51a08b05b5a.zip
Fix save/restore of guest PAT table in HAP paging mode.
HAP paging mode guests use direct MSR read/write into the VMCS/VMCB for the guest PAT table, while the current save/restore code was accessing only the pat_cr field in hvm_vcpu, used when intercepting the MSR mostly in shadow mode (the Intel scenario is a bit more complicated). This patch fixes this issue creating a new couple of hvm_funcs, get/set_guest_pat, that access the right PAT table based on the paging mode and guest configuration. Signed-off-by: Gianluca Guida <gianluca.guida@citrix.com> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/hvm/svm')
-rw-r--r--xen/arch/x86/hvm/svm/svm.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 4c34813ae4..5d9db5694d 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -645,6 +645,28 @@ static void svm_set_segment_register(struct vcpu *v, enum x86_segment seg,
svm_vmload(vmcb);
}
+static int svm_set_guest_pat(struct vcpu *v, u64 gpat)
+{
+ struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+
+ if ( !paging_mode_hap(v->domain) )
+ return 0;
+
+ vmcb_set_g_pat(vmcb, gpat);
+ return 1;
+}
+
+static int svm_get_guest_pat(struct vcpu *v, u64 *gpat)
+{
+ struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+
+ if ( !paging_mode_hap(v->domain) )
+ return 0;
+
+ *gpat = vmcb_get_g_pat(vmcb);
+ return 1;
+}
+
static uint64_t svm_get_tsc_offset(uint64_t host_tsc, uint64_t guest_tsc,
uint64_t ratio)
{
@@ -1964,6 +1986,8 @@ static struct hvm_function_table __read_mostly svm_function_table = {
.update_host_cr3 = svm_update_host_cr3,
.update_guest_cr = svm_update_guest_cr,
.update_guest_efer = svm_update_guest_efer,
+ .set_guest_pat = svm_set_guest_pat,
+ .get_guest_pat = svm_get_guest_pat,
.set_tsc_offset = svm_set_tsc_offset,
.inject_exception = svm_inject_exception,
.init_hypercall_page = svm_init_hypercall_page,