KVM: SVM: clean up nested vmrun path
This patch removes the usage of nested_svm_do from the vmrun emulation path. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
@@ -1724,25 +1724,35 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nested_svm_vmrun_msrpm(struct vcpu_svm *svm, void *arg1,
|
static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm)
|
||||||
void *arg2, void *opaque)
|
|
||||||
{
|
{
|
||||||
|
u32 *nested_msrpm;
|
||||||
int i;
|
int i;
|
||||||
u32 *nested_msrpm = (u32*)arg1;
|
|
||||||
|
nested_msrpm = nested_svm_map(svm, svm->nested.vmcb_msrpm, KM_USER0);
|
||||||
|
if (!nested_msrpm)
|
||||||
|
return false;
|
||||||
|
|
||||||
for (i=0; i< PAGE_SIZE * (1 << MSRPM_ALLOC_ORDER) / 4; i++)
|
for (i=0; i< PAGE_SIZE * (1 << MSRPM_ALLOC_ORDER) / 4; i++)
|
||||||
svm->nested.msrpm[i] = svm->msrpm[i] | nested_msrpm[i];
|
svm->nested.msrpm[i] = svm->msrpm[i] | nested_msrpm[i];
|
||||||
|
|
||||||
svm->vmcb->control.msrpm_base_pa = __pa(svm->nested.msrpm);
|
svm->vmcb->control.msrpm_base_pa = __pa(svm->nested.msrpm);
|
||||||
|
|
||||||
return 0;
|
nested_svm_unmap(nested_msrpm, KM_USER0);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nested_svm_vmrun(struct vcpu_svm *svm, void *arg1,
|
static bool nested_svm_vmrun(struct vcpu_svm *svm)
|
||||||
void *arg2, void *opaque)
|
|
||||||
{
|
{
|
||||||
struct vmcb *nested_vmcb = (struct vmcb *)arg1;
|
struct vmcb *nested_vmcb;
|
||||||
struct vmcb *hsave = svm->nested.hsave;
|
struct vmcb *hsave = svm->nested.hsave;
|
||||||
struct vmcb *vmcb = svm->vmcb;
|
struct vmcb *vmcb = svm->vmcb;
|
||||||
|
|
||||||
|
nested_vmcb = nested_svm_map(svm, svm->vmcb->save.rax, KM_USER0);
|
||||||
|
if (!nested_vmcb)
|
||||||
|
return false;
|
||||||
|
|
||||||
/* nested_vmcb is our indicator if nested SVM is activated */
|
/* nested_vmcb is our indicator if nested SVM is activated */
|
||||||
svm->nested.vmcb = svm->vmcb->save.rax;
|
svm->nested.vmcb = svm->vmcb->save.rax;
|
||||||
|
|
||||||
@@ -1858,9 +1868,11 @@ static int nested_svm_vmrun(struct vcpu_svm *svm, void *arg1,
|
|||||||
svm->vmcb->control.event_inj = nested_vmcb->control.event_inj;
|
svm->vmcb->control.event_inj = nested_vmcb->control.event_inj;
|
||||||
svm->vmcb->control.event_inj_err = nested_vmcb->control.event_inj_err;
|
svm->vmcb->control.event_inj_err = nested_vmcb->control.event_inj_err;
|
||||||
|
|
||||||
|
nested_svm_unmap(nested_vmcb, KM_USER0);
|
||||||
|
|
||||||
enable_gif(svm);
|
enable_gif(svm);
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nested_svm_vmloadsave(struct vmcb *from_vmcb, struct vmcb *to_vmcb)
|
static void nested_svm_vmloadsave(struct vmcb *from_vmcb, struct vmcb *to_vmcb)
|
||||||
@@ -1928,12 +1940,10 @@ static int vmrun_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
|
|||||||
svm->next_rip = kvm_rip_read(&svm->vcpu) + 3;
|
svm->next_rip = kvm_rip_read(&svm->vcpu) + 3;
|
||||||
skip_emulated_instruction(&svm->vcpu);
|
skip_emulated_instruction(&svm->vcpu);
|
||||||
|
|
||||||
if (nested_svm_do(svm, svm->vmcb->save.rax, 0,
|
if (!nested_svm_vmrun(svm))
|
||||||
NULL, nested_svm_vmrun))
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (nested_svm_do(svm, svm->nested.vmcb_msrpm, 0,
|
if (!nested_svm_vmrun_msrpm(svm))
|
||||||
NULL, nested_svm_vmrun_msrpm))
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Reference in New Issue
Block a user