diff options
author | Gianluca Guida <gianluca.guida@citrix.com> | 2012-04-17 08:29:26 +0100 |
---|---|---|
committer | Gianluca Guida <gianluca.guida@citrix.com> | 2012-04-17 08:29:26 +0100 |
commit | 9cfc1be3b96e547b21fd3a53639ff51a08b05b5a (patch) | |
tree | 1da4dab23c0a2f6d3a80c74d04fb8764c18ab9e3 /xen/arch/x86/hvm/mtrr.c | |
parent | 625550282c299d6607eb4bdb35b3ebadb5ae77b3 (diff) | |
download | xen-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/mtrr.c')
-rw-r--r-- | xen/arch/x86/hvm/mtrr.c | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c index 6a30a8e697..7807e03301 100644 --- a/xen/arch/x86/hvm/mtrr.c +++ b/xen/arch/x86/hvm/mtrr.c @@ -403,26 +403,6 @@ uint32_t get_pat_flags(struct vcpu *v, return pat_type_2_pte_flags(pat_entry_value); } -/* Helper funtions for seting mtrr/pat */ -bool_t pat_msr_set(uint64_t *pat, uint64_t msr_content) -{ - uint8_t *value = (uint8_t*)&msr_content; - int32_t i; - - if ( *pat != msr_content ) - { - for ( i = 0; i < 8; i++ ) - if ( unlikely(!(value[i] == 0 || value[i] == 1 || - value[i] == 4 || value[i] == 5 || - value[i] == 6 || value[i] == 7)) ) - return 0; - - *pat = msr_content; - } - - return 1; -} - bool_t mtrr_def_type_msr_set(struct mtrr_state *m, uint64_t msr_content) { uint8_t def_type = msr_content & 0xff; @@ -631,7 +611,7 @@ static int hvm_save_mtrr_msr(struct domain *d, hvm_domain_context_t *h) { mtrr_state = &v->arch.hvm_vcpu.mtrr; - hw_mtrr.msr_pat_cr = v->arch.hvm_vcpu.pat_cr; + hvm_get_guest_pat(v, &hw_mtrr.msr_pat_cr); hw_mtrr.msr_mtrr_def_type = mtrr_state->def_type | (mtrr_state->enabled << 10); @@ -677,7 +657,7 @@ static int hvm_load_mtrr_msr(struct domain *d, hvm_domain_context_t *h) mtrr_state = &v->arch.hvm_vcpu.mtrr; - pat_msr_set(&v->arch.hvm_vcpu.pat_cr, hw_mtrr.msr_pat_cr); + hvm_set_guest_pat(v, hw_mtrr.msr_pat_cr); mtrr_state->mtrr_cap = hw_mtrr.msr_mtrr_cap; |