Fix HVM MSR save/restore.

Signed-off-by: Keir Fraser <keir@xensource.com>
Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Xin Li <xin.b.li@intel.com>
This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2006-02-17 16:29:24 +01:00
1 parent 47421a278a
commit 0a64e72ee7
6 files changed
+12 -22

No files matched your search

+7 -9
View File
@@ -435,8 +435,6 @@ int arch_set_info_guest(
if ( !hvm_initialize_guest_resources(v) )
return -EINVAL;
hvm_switch_on = 1;
}
update_pagetables(v);
@@ -685,6 +683,8 @@ static void __context_switch(void)
CTXT_SWITCH_STACK_BYTES);
unlazy_fpu(p);
save_segments(p);
if ( HVM_DOMAIN(p) )
hvm_load_msrs();
}
if ( !is_idle_vcpu(n) )
@@ -710,6 +710,10 @@ static void __context_switch(void)
set_int80_direct_trap(n);
switch_kernel_stack(n, cpu);
}
else
{
hvm_restore_msrs(next);
}
}
if ( p->domain != n->domain )
@@ -765,16 +769,10 @@ void context_switch(struct vcpu *prev, struct vcpu *next)
/* Re-enable interrupts before restoring state which may fault. */
local_irq_enable();
if ( HVM_DOMAIN(next) )
{
hvm_restore_msrs(next);
}
else
if ( !HVM_DOMAIN(next) )
{
load_LDT(next);
load_segments(next);
if ( HVM_DOMAIN(next) )
hvm_load_msrs(next);
}
}
-1
View File
@@ -46,7 +46,6 @@
#include <public/hvm/hvm_info_table.h>
int hvm_enabled = 0;
int hvm_switch_on = 0;
unsigned int opt_hvm_debug_level = 0;
integer_param("hvm_debug", opt_hvm_debug_level);
+1 -4
View File
@@ -251,14 +251,11 @@ void svm_save_segments(struct vcpu *v)
* are not modified once set for generic domains, we don't save them,
* but simply reset them to the values set at percpu_traps_init().
*/
void svm_load_msrs(struct vcpu *n)
void svm_load_msrs(void)
{
struct svm_msr_state *host_state = &percpu_msr[smp_processor_id()];
int i;
if ( !hvm_switch_on )
return;
while ( host_state->flags )
{
i = find_first_set_bit(host_state->flags);
+1 -4
View File
@@ -124,14 +124,11 @@ void vmx_save_segments(struct vcpu *v)
* are not modified once set for generic domains, we don't save them,
* but simply reset them to the values set at percpu_traps_init().
*/
void vmx_load_msrs(struct vcpu *n)
void vmx_load_msrs(void)
{
struct vmx_msr_state *host_state = &percpu_msr[smp_processor_id()];
int i;
if ( !hvm_switch_on )
return;
while ( host_state->flags )
{
i = find_first_set_bit(host_state->flags);
+3 -3
View File
@@ -50,7 +50,7 @@ struct hvm_function_table {
void (*load_cpu_guest_regs)(struct vcpu *v, struct cpu_user_regs *r);
#ifdef __x86_64__
void (*save_segments)(struct vcpu *v);
void (*load_msrs)(struct vcpu *v);
void (*load_msrs)(void);
void (*restore_msrs)(struct vcpu *v);
#endif
void (*store_cpu_guest_ctrl_regs)(struct vcpu *v, unsigned long crs[8]);
@@ -116,10 +116,10 @@ hvm_save_segments(struct vcpu *v)
}
static inline void
hvm_load_msrs(struct vcpu *v)
hvm_load_msrs(void)
{
if (hvm_funcs.load_msrs)
hvm_funcs.load_msrs(v);
hvm_funcs.load_msrs();
}
static inline void
-1
View File
@@ -133,7 +133,6 @@ extern unsigned int opt_hvm_debug_level;
} while (0)
extern int hvm_enabled;
extern int hvm_switch_on;
enum { HVM_COPY_IN = 0, HVM_COPY_OUT };
extern int hvm_copy(void *buf, unsigned long vaddr, int size, int dir);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.