aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-05-31 09:49:53 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-05-31 09:49:53 +0100
commitf5e0354c5306bd16625e8ca5f612ce3d5fc0d59a (patch)
treef88c9ab62cd382572687ee6dad9d2f99386c51cb
parent29edaf88e2c851f4240a8bc995686dc158db5edd (diff)
downloadxen-f5e0354c5306bd16625e8ca5f612ce3d5fc0d59a.tar.gz
xen-f5e0354c5306bd16625e8ca5f612ce3d5fc0d59a.tar.bz2
xen-f5e0354c5306bd16625e8ca5f612ce3d5fc0d59a.zip
hvm: Correctly hook VLAPIC MSR change notification for VMX into
save/restore path. Signed-off-by: Keir Fraser <keir@xensource.com>
-rw-r--r--xen/arch/x86/hvm/vlapic.c6
-rw-r--r--xen/arch/x86/hvm/vmx/vmcs.c2
-rw-r--r--xen/arch/x86/hvm/vmx/vmx.c5
-rw-r--r--xen/include/asm-x86/hvm/vmx/vmx.h1
4 files changed, 12 insertions, 2 deletions
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 19ab01499a..a63a0fd94e 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -32,6 +32,7 @@
#include <xen/lib.h>
#include <xen/sched.h>
#include <asm/current.h>
+#include <asm/hvm/vmx/vmx.h>
#include <public/hvm/ioreq.h>
#include <public/hvm/params.h>
@@ -710,6 +711,8 @@ void vlapic_msr_set(struct vlapic *vlapic, uint64_t value)
vlapic->hw.apic_base_msr = value;
+ vmx_vlapic_msr_changed(vlapic_vcpu(vlapic));
+
HVM_DBG_LOG(DBG_LEVEL_VLAPIC,
"apic base msr is 0x%016"PRIx64, vlapic->hw.apic_base_msr);
}
@@ -877,6 +880,9 @@ static int lapic_load_hidden(struct domain *d, hvm_domain_context_t *h)
return -EINVAL;
lapic_info(s);
+
+ vmx_vlapic_msr_changed(v);
+
return 0;
}
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 7d263985f8..413981c061 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -456,6 +456,8 @@ static void construct_vmcs(struct vcpu *v)
vmx_vmcs_exit(v);
paging_update_paging_modes(v); /* will update HOST & GUEST_CR3 as reqd */
+
+ vmx_vlapic_msr_changed(v);
}
int vmx_create_vmcs(struct vcpu *v)
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 9d8ba90d0f..2aff3d295a 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2547,7 +2547,7 @@ static void vmx_install_vlapic_mapping(struct vcpu *v)
vmx_vmcs_exit(v);
}
-static void vmx_check_vlapic_msr(struct vcpu *v)
+void vmx_vlapic_msr_changed(struct vcpu *v)
{
struct vlapic *vlapic = vcpu_vlapic(v);
uint32_t ctl;
@@ -2555,12 +2555,14 @@ static void vmx_check_vlapic_msr(struct vcpu *v)
if ( !cpu_has_vmx_virtualize_apic_accesses )
return;
+ vmx_vmcs_enter(v);
ctl = __vmread(SECONDARY_VM_EXEC_CONTROL);
ctl &= ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
if ( !vlapic_hw_disabled(vlapic) &&
(vlapic_base_address(vlapic) == APIC_DEFAULT_PHYS_BASE) )
ctl |= SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
__vmwrite(SECONDARY_VM_EXEC_CONTROL, ctl);
+ vmx_vmcs_exit(v);
}
static inline int vmx_do_msr_write(struct cpu_user_regs *regs)
@@ -2591,7 +2593,6 @@ static inline int vmx_do_msr_write(struct cpu_user_regs *regs)
break;
case MSR_IA32_APICBASE:
vlapic_msr_set(vcpu_vlapic(v), msr_content);
- vmx_check_vlapic_msr(v);
break;
default:
if ( !long_mode_do_msr_write(regs) )
diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h b/xen/include/asm-x86/hvm/vmx/vmx.h
index d1bdd3b95e..37f4c4889d 100644
--- a/xen/include/asm-x86/hvm/vmx/vmx.h
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h
@@ -32,6 +32,7 @@ void vmx_asm_do_vmentry(void);
void vmx_intr_assist(void);
void vmx_do_resume(struct vcpu *);
void set_guest_time(struct vcpu *v, u64 gtime);
+void vmx_vlapic_msr_changed(struct vcpu *v);
/*
* Exit Reasons