Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 215864
b: refs/heads/master
c: 1c97f0a
h: refs/heads/master
v: v3
  • Loading branch information
Joerg Roedel authored and Avi Kivity committed Oct 24, 2010
1 parent dabbb60 commit 641ac6b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f43addd46168110d572dcf69100cb215a4e9fd08
refs/heads/master: 1c97f0a04c74196880f22a563134c8f6d0b9d752
2 changes: 2 additions & 0 deletions trunk/arch/x86/include/asm/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ struct kvm_x86_ops {
bool (*rdtscp_supported)(void);
void (*adjust_tsc_offset)(struct kvm_vcpu *vcpu, s64 adjustment);

void (*set_tdp_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3);

void (*set_supported_cpuid)(u32 func, struct kvm_cpuid_entry2 *entry);

bool (*has_wbinvd_exit)(void);
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/x86/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2714,7 +2714,7 @@ static int init_kvm_tdp_mmu(struct kvm_vcpu *vcpu)
context->shadow_root_level = kvm_x86_ops->get_tdp_level();
context->root_hpa = INVALID_PAGE;
context->direct_map = true;
context->set_cr3 = kvm_x86_ops->set_cr3;
context->set_cr3 = kvm_x86_ops->set_tdp_cr3;

if (!is_paging(vcpu)) {
context->gva_to_gpa = nonpaging_gva_to_gpa;
Expand Down
23 changes: 14 additions & 9 deletions trunk/arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3216,9 +3216,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
savesegment(gs, gs_selector);
ldt_selector = kvm_read_ldt();
svm->vmcb->save.cr2 = vcpu->arch.cr2;
/* required for live migration with NPT */
if (npt_enabled)
svm->vmcb->save.cr3 = vcpu->arch.cr3;

clgi();

Expand Down Expand Up @@ -3340,16 +3337,22 @@ static void svm_set_cr3(struct kvm_vcpu *vcpu, unsigned long root)
{
struct vcpu_svm *svm = to_svm(vcpu);

if (npt_enabled) {
svm->vmcb->control.nested_cr3 = root;
force_new_asid(vcpu);
return;
}

svm->vmcb->save.cr3 = root;
force_new_asid(vcpu);
}

static void set_tdp_cr3(struct kvm_vcpu *vcpu, unsigned long root)
{
struct vcpu_svm *svm = to_svm(vcpu);

svm->vmcb->control.nested_cr3 = root;

/* Also sync guest cr3 here in case we live migrate */
svm->vmcb->save.cr3 = vcpu->arch.cr3;

force_new_asid(vcpu);
}

static int is_disabled(void)
{
u64 vm_cr;
Expand Down Expand Up @@ -3576,6 +3579,8 @@ static struct kvm_x86_ops svm_x86_ops = {

.write_tsc_offset = svm_write_tsc_offset,
.adjust_tsc_offset = svm_adjust_tsc_offset,

.set_tdp_cr3 = set_tdp_cr3,
};

static int __init svm_init(void)
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/x86/kvm/vmx.c
Original file line number Diff line number Diff line change
Expand Up @@ -4341,6 +4341,8 @@ static struct kvm_x86_ops vmx_x86_ops = {

.write_tsc_offset = vmx_write_tsc_offset,
.adjust_tsc_offset = vmx_adjust_tsc_offset,

.set_tdp_cr3 = vmx_set_cr3,
};

static int __init vmx_init(void)
Expand Down

0 comments on commit 641ac6b

Please sign in to comment.