[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 1/2] x86/hvm: introduce cr{0, 4}_host_mask to store trapped bits of CR accesses
At the moment this is currently set at VMC{S/B} creation and not changed, but further patches are going to change the CR4 mask at runtime. Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> --- Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> Cc: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx> Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Cc: Jun Nakajima <jun.nakajima@xxxxxxxxx> Cc: Kevin Tian <kevin.tian@xxxxxxxxx> --- Changes since v2: - Introduce masks only for CR4 and CR0. Changes since v1: - New in this version. --- xen/arch/x86/hvm/svm/vmcb.c | 1 + xen/arch/x86/hvm/vmx/vmcs.c | 1 + xen/include/asm-x86/hvm/vcpu.h | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/xen/arch/x86/hvm/svm/vmcb.c b/xen/arch/x86/hvm/svm/vmcb.c index 0e6cba5b7b..beeafad235 100644 --- a/xen/arch/x86/hvm/svm/vmcb.c +++ b/xen/arch/x86/hvm/svm/vmcb.c @@ -169,6 +169,7 @@ static int construct_vmcb(struct vcpu *v) vmcb->tr.base = 0; vmcb->tr.limit = 0xff; + v->arch.hvm_vcpu.cr0_host_mask = v->arch.hvm_vcpu.cr4_host_mask = ~0UL; v->arch.hvm_vcpu.guest_cr[0] = X86_CR0_PE | X86_CR0_ET; hvm_update_guest_cr(v, 0); diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index e7818caed0..6daf953563 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -1165,6 +1165,7 @@ static int construct_vmcs(struct vcpu *v) __vmwrite(CR0_GUEST_HOST_MASK, ~0UL); __vmwrite(CR4_GUEST_HOST_MASK, ~0UL); + v->arch.hvm_vcpu.cr0_host_mask = v->arch.hvm_vcpu.cr4_host_mask = ~0UL; __vmwrite(PAGE_FAULT_ERROR_CODE_MASK, 0); __vmwrite(PAGE_FAULT_ERROR_CODE_MATCH, 0); diff --git a/xen/include/asm-x86/hvm/vcpu.h b/xen/include/asm-x86/hvm/vcpu.h index d93166fb92..a3e5c21b4c 100644 --- a/xen/include/asm-x86/hvm/vcpu.h +++ b/xen/include/asm-x86/hvm/vcpu.h @@ -156,6 +156,10 @@ struct hvm_vcpu { */ unsigned long hw_cr[5]; + /* Cached copy of the trapped bits of CRs. */ + unsigned long cr0_host_mask, + cr4_host_mask; + struct vlapic vlapic; s64 cache_tsc_offset; u64 guest_time; -- 2.16.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |