|
|
|
@ -5556,7 +5556,7 @@ static int handle_triple_fault(struct kvm_vcpu *vcpu)
|
|
|
|
|
static int handle_io(struct kvm_vcpu *vcpu)
|
|
|
|
|
{
|
|
|
|
|
unsigned long exit_qualification;
|
|
|
|
|
int size, in, string;
|
|
|
|
|
int size, in, string, ret;
|
|
|
|
|
unsigned port;
|
|
|
|
|
|
|
|
|
|
exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
|
|
|
|
@ -5570,9 +5570,14 @@ static int handle_io(struct kvm_vcpu *vcpu)
|
|
|
|
|
|
|
|
|
|
port = exit_qualification >> 16;
|
|
|
|
|
size = (exit_qualification & 7) + 1;
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
|
|
|
|
|
return kvm_fast_pio_out(vcpu, size, port);
|
|
|
|
|
ret = kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* TODO: we might be squashing a KVM_GUESTDBG_SINGLESTEP-triggered
|
|
|
|
|
* KVM_EXIT_DEBUG here.
|
|
|
|
|
*/
|
|
|
|
|
return kvm_fast_pio_out(vcpu, size, port) && ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
@ -5670,6 +5675,7 @@ static int handle_cr(struct kvm_vcpu *vcpu)
|
|
|
|
|
int cr;
|
|
|
|
|
int reg;
|
|
|
|
|
int err;
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
|
|
|
|
|
cr = exit_qualification & 15;
|
|
|
|
@ -5681,25 +5687,27 @@ static int handle_cr(struct kvm_vcpu *vcpu)
|
|
|
|
|
switch (cr) {
|
|
|
|
|
case 0:
|
|
|
|
|
err = handle_set_cr0(vcpu, val);
|
|
|
|
|
kvm_complete_insn_gp(vcpu, err);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_complete_insn_gp(vcpu, err);
|
|
|
|
|
case 3:
|
|
|
|
|
err = kvm_set_cr3(vcpu, val);
|
|
|
|
|
kvm_complete_insn_gp(vcpu, err);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_complete_insn_gp(vcpu, err);
|
|
|
|
|
case 4:
|
|
|
|
|
err = handle_set_cr4(vcpu, val);
|
|
|
|
|
kvm_complete_insn_gp(vcpu, err);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_complete_insn_gp(vcpu, err);
|
|
|
|
|
case 8: {
|
|
|
|
|
u8 cr8_prev = kvm_get_cr8(vcpu);
|
|
|
|
|
u8 cr8 = (u8)val;
|
|
|
|
|
err = kvm_set_cr8(vcpu, cr8);
|
|
|
|
|
kvm_complete_insn_gp(vcpu, err);
|
|
|
|
|
ret = kvm_complete_insn_gp(vcpu, err);
|
|
|
|
|
if (lapic_in_kernel(vcpu))
|
|
|
|
|
return 1;
|
|
|
|
|
return ret;
|
|
|
|
|
if (cr8_prev <= cr8)
|
|
|
|
|
return 1;
|
|
|
|
|
return ret;
|
|
|
|
|
/*
|
|
|
|
|
* TODO: we might be squashing a
|
|
|
|
|
* KVM_GUESTDBG_SINGLESTEP-triggered
|
|
|
|
|
* KVM_EXIT_DEBUG here.
|
|
|
|
|
*/
|
|
|
|
|
vcpu->run->exit_reason = KVM_EXIT_SET_TPR;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -5709,22 +5717,19 @@ static int handle_cr(struct kvm_vcpu *vcpu)
|
|
|
|
|
handle_clts(vcpu);
|
|
|
|
|
trace_kvm_cr_write(0, kvm_read_cr0(vcpu));
|
|
|
|
|
vmx_fpu_activate(vcpu);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
case 1: /*mov from cr*/
|
|
|
|
|
switch (cr) {
|
|
|
|
|
case 3:
|
|
|
|
|
val = kvm_read_cr3(vcpu);
|
|
|
|
|
kvm_register_write(vcpu, reg, val);
|
|
|
|
|
trace_kvm_cr_read(cr, val);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
case 8:
|
|
|
|
|
val = kvm_get_cr8(vcpu);
|
|
|
|
|
kvm_register_write(vcpu, reg, val);
|
|
|
|
|
trace_kvm_cr_read(cr, val);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 3: /* lmsw */
|
|
|
|
@ -5732,8 +5737,7 @@ static int handle_cr(struct kvm_vcpu *vcpu)
|
|
|
|
|
trace_kvm_cr_write(0, (kvm_read_cr0(vcpu) & ~0xful) | val);
|
|
|
|
|
kvm_lmsw(vcpu, val);
|
|
|
|
|
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -5804,8 +5808,7 @@ static int handle_dr(struct kvm_vcpu *vcpu)
|
|
|
|
|
if (kvm_set_dr(vcpu, dr, kvm_register_readl(vcpu, reg)))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static u64 vmx_get_dr6(struct kvm_vcpu *vcpu)
|
|
|
|
@ -5858,8 +5861,7 @@ static int handle_rdmsr(struct kvm_vcpu *vcpu)
|
|
|
|
|
/* FIXME: handling of bits 32:63 of rax, rdx */
|
|
|
|
|
vcpu->arch.regs[VCPU_REGS_RAX] = msr_info.data & -1u;
|
|
|
|
|
vcpu->arch.regs[VCPU_REGS_RDX] = (msr_info.data >> 32) & -1u;
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int handle_wrmsr(struct kvm_vcpu *vcpu)
|
|
|
|
@ -5879,8 +5881,7 @@ static int handle_wrmsr(struct kvm_vcpu *vcpu)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trace_kvm_msr_write(ecx, data);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int handle_tpr_below_threshold(struct kvm_vcpu *vcpu)
|
|
|
|
@ -5924,8 +5925,7 @@ static int handle_invlpg(struct kvm_vcpu *vcpu)
|
|
|
|
|
unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
|
|
|
|
|
|
|
|
|
|
kvm_mmu_invlpg(vcpu, exit_qualification);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int handle_rdpmc(struct kvm_vcpu *vcpu)
|
|
|
|
@ -5933,15 +5933,12 @@ static int handle_rdpmc(struct kvm_vcpu *vcpu)
|
|
|
|
|
int err;
|
|
|
|
|
|
|
|
|
|
err = kvm_rdpmc(vcpu);
|
|
|
|
|
kvm_complete_insn_gp(vcpu, err);
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_complete_insn_gp(vcpu, err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int handle_wbinvd(struct kvm_vcpu *vcpu)
|
|
|
|
|
{
|
|
|
|
|
kvm_emulate_wbinvd(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_emulate_wbinvd(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int handle_xsetbv(struct kvm_vcpu *vcpu)
|
|
|
|
@ -5950,20 +5947,20 @@ static int handle_xsetbv(struct kvm_vcpu *vcpu)
|
|
|
|
|
u32 index = kvm_register_read(vcpu, VCPU_REGS_RCX);
|
|
|
|
|
|
|
|
|
|
if (kvm_set_xcr(vcpu, index, new_bv) == 0)
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int handle_xsaves(struct kvm_vcpu *vcpu)
|
|
|
|
|
{
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
WARN(1, "this should never happen\n");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int handle_xrstors(struct kvm_vcpu *vcpu)
|
|
|
|
|
{
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
WARN(1, "this should never happen\n");
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
@ -5984,8 +5981,7 @@ static int handle_apic_access(struct kvm_vcpu *vcpu)
|
|
|
|
|
if ((access_type == TYPE_LINEAR_APIC_INST_WRITE) &&
|
|
|
|
|
(offset == APIC_EOI)) {
|
|
|
|
|
kvm_lapic_set_eoi(vcpu);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return emulate_instruction(vcpu, 0) == EMULATE_DONE;
|
|
|
|
@ -6134,8 +6130,7 @@ static int handle_ept_misconfig(struct kvm_vcpu *vcpu)
|
|
|
|
|
gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS);
|
|
|
|
|
if (!kvm_io_bus_write(vcpu, KVM_FAST_MMIO_BUS, gpa, 0, NULL)) {
|
|
|
|
|
trace_kvm_fast_mmio(gpa);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = handle_mmio_page_fault(vcpu, gpa, true);
|
|
|
|
@ -6508,15 +6503,12 @@ static int handle_pause(struct kvm_vcpu *vcpu)
|
|
|
|
|
grow_ple_window(vcpu);
|
|
|
|
|
|
|
|
|
|
kvm_vcpu_on_spin(vcpu);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int handle_nop(struct kvm_vcpu *vcpu)
|
|
|
|
|
{
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int handle_mwait(struct kvm_vcpu *vcpu)
|
|
|
|
@ -6823,8 +6815,7 @@ static int nested_vmx_check_vmptr(struct kvm_vcpu *vcpu, int exit_reason,
|
|
|
|
|
*/
|
|
|
|
|
if (!PAGE_ALIGNED(vmptr) || (vmptr >> maxphyaddr)) {
|
|
|
|
|
nested_vmx_failInvalid(vcpu);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
page = nested_get_page(vcpu, vmptr);
|
|
|
|
@ -6832,8 +6823,7 @@ static int nested_vmx_check_vmptr(struct kvm_vcpu *vcpu, int exit_reason,
|
|
|
|
|
*(u32 *)kmap(page) != VMCS12_REVISION) {
|
|
|
|
|
nested_vmx_failInvalid(vcpu);
|
|
|
|
|
kunmap(page);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
kunmap(page);
|
|
|
|
|
vmx->nested.vmxon_ptr = vmptr;
|
|
|
|
@ -6842,30 +6832,26 @@ static int nested_vmx_check_vmptr(struct kvm_vcpu *vcpu, int exit_reason,
|
|
|
|
|
if (!PAGE_ALIGNED(vmptr) || (vmptr >> maxphyaddr)) {
|
|
|
|
|
nested_vmx_failValid(vcpu,
|
|
|
|
|
VMXERR_VMCLEAR_INVALID_ADDRESS);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (vmptr == vmx->nested.vmxon_ptr) {
|
|
|
|
|
nested_vmx_failValid(vcpu,
|
|
|
|
|
VMXERR_VMCLEAR_VMXON_POINTER);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case EXIT_REASON_VMPTRLD:
|
|
|
|
|
if (!PAGE_ALIGNED(vmptr) || (vmptr >> maxphyaddr)) {
|
|
|
|
|
nested_vmx_failValid(vcpu,
|
|
|
|
|
VMXERR_VMPTRLD_INVALID_ADDRESS);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (vmptr == vmx->nested.vmxon_ptr) {
|
|
|
|
|
nested_vmx_failValid(vcpu,
|
|
|
|
|
VMXERR_VMCLEAR_VMXON_POINTER);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
@ -6921,8 +6907,7 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
|
|
|
|
|
|
|
|
|
|
if (vmx->nested.vmxon) {
|
|
|
|
|
nested_vmx_failValid(vcpu, VMXERR_VMXON_IN_VMX_ROOT_OPERATION);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((vmx->msr_ia32_feature_control & VMXON_NEEDED_FEATURES)
|
|
|
|
@ -6963,8 +6948,7 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
|
|
|
|
|
vmx->nested.vmxon = true;
|
|
|
|
|
|
|
|
|
|
nested_vmx_succeed(vcpu);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
|
|
|
|
|
out_shadow_vmcs:
|
|
|
|
|
kfree(vmx->nested.cached_vmcs12);
|
|
|
|
@ -7084,8 +7068,7 @@ static int handle_vmoff(struct kvm_vcpu *vcpu)
|
|
|
|
|
return 1;
|
|
|
|
|
free_nested(to_vmx(vcpu));
|
|
|
|
|
nested_vmx_succeed(vcpu);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Emulate the VMCLEAR instruction */
|
|
|
|
@ -7125,8 +7108,7 @@ static int handle_vmclear(struct kvm_vcpu *vcpu)
|
|
|
|
|
nested_free_vmcs02(vmx, vmptr);
|
|
|
|
|
|
|
|
|
|
nested_vmx_succeed(vcpu);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch);
|
|
|
|
@ -7340,18 +7322,15 @@ static int handle_vmread(struct kvm_vcpu *vcpu)
|
|
|
|
|
if (!nested_vmx_check_permission(vcpu))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
if (!nested_vmx_check_vmcs12(vcpu)) {
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (!nested_vmx_check_vmcs12(vcpu))
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
|
|
|
|
|
/* Decode instruction info and find the field to read */
|
|
|
|
|
field = kvm_register_readl(vcpu, (((vmx_instruction_info) >> 28) & 0xf));
|
|
|
|
|
/* Read the field, zero-extended to a u64 field_value */
|
|
|
|
|
if (vmcs12_read_any(vcpu, field, &field_value) < 0) {
|
|
|
|
|
nested_vmx_failValid(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
* Now copy part of this value to register or memory, as requested.
|
|
|
|
@ -7371,8 +7350,7 @@ static int handle_vmread(struct kvm_vcpu *vcpu)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nested_vmx_succeed(vcpu);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -7394,10 +7372,8 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu)
|
|
|
|
|
if (!nested_vmx_check_permission(vcpu))
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
if (!nested_vmx_check_vmcs12(vcpu)) {
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (!nested_vmx_check_vmcs12(vcpu))
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
|
|
|
|
|
if (vmx_instruction_info & (1u << 10))
|
|
|
|
|
field_value = kvm_register_readl(vcpu,
|
|
|
|
@ -7418,19 +7394,16 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu)
|
|
|
|
|
if (vmcs_field_readonly(field)) {
|
|
|
|
|
nested_vmx_failValid(vcpu,
|
|
|
|
|
VMXERR_VMWRITE_READ_ONLY_VMCS_COMPONENT);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (vmcs12_write_any(vcpu, field, field_value) < 0) {
|
|
|
|
|
nested_vmx_failValid(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nested_vmx_succeed(vcpu);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Emulate the VMPTRLD instruction */
|
|
|
|
@ -7451,8 +7424,7 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
|
|
|
|
|
page = nested_get_page(vcpu, vmptr);
|
|
|
|
|
if (page == NULL) {
|
|
|
|
|
nested_vmx_failInvalid(vcpu);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
new_vmcs12 = kmap(page);
|
|
|
|
|
if (new_vmcs12->revision_id != VMCS12_REVISION) {
|
|
|
|
@ -7460,8 +7432,7 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
|
|
|
|
|
nested_release_page_clean(page);
|
|
|
|
|
nested_vmx_failValid(vcpu,
|
|
|
|
|
VMXERR_VMPTRLD_INCORRECT_VMCS_REVISION_ID);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nested_release_vmcs12(vmx);
|
|
|
|
@ -7485,8 +7456,7 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nested_vmx_succeed(vcpu);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Emulate the VMPTRST instruction */
|
|
|
|
@ -7511,8 +7481,7 @@ static int handle_vmptrst(struct kvm_vcpu *vcpu)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
nested_vmx_succeed(vcpu);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Emulate the INVEPT instruction */
|
|
|
|
@ -7550,8 +7519,7 @@ static int handle_invept(struct kvm_vcpu *vcpu)
|
|
|
|
|
if (type >= 32 || !(types & (1 << type))) {
|
|
|
|
|
nested_vmx_failValid(vcpu,
|
|
|
|
|
VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* According to the Intel VMX instruction reference, the memory
|
|
|
|
@ -7582,8 +7550,7 @@ static int handle_invept(struct kvm_vcpu *vcpu)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int handle_invvpid(struct kvm_vcpu *vcpu)
|
|
|
|
@ -7614,8 +7581,7 @@ static int handle_invvpid(struct kvm_vcpu *vcpu)
|
|
|
|
|
if (type >= 32 || !(types & (1 << type))) {
|
|
|
|
|
nested_vmx_failValid(vcpu,
|
|
|
|
|
VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* according to the intel vmx instruction reference, the memory
|
|
|
|
@ -7637,23 +7603,20 @@ static int handle_invvpid(struct kvm_vcpu *vcpu)
|
|
|
|
|
if (!vpid) {
|
|
|
|
|
nested_vmx_failValid(vcpu,
|
|
|
|
|
VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case VMX_VPID_EXTENT_ALL_CONTEXT:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
WARN_ON_ONCE(1);
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
__vmx_flush_tlb(vcpu, vmx->nested.vpid02);
|
|
|
|
|
nested_vmx_succeed(vcpu);
|
|
|
|
|
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int handle_pml_full(struct kvm_vcpu *vcpu)
|
|
|
|
@ -10194,6 +10157,11 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
|
|
|
|
|
if (!vmcs02)
|
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* After this point, the trap flag no longer triggers a singlestep trap
|
|
|
|
|
* on the vm entry instructions. Don't call
|
|
|
|
|
* kvm_skip_emulated_instruction.
|
|
|
|
|
*/
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
enter_guest_mode(vcpu);
|
|
|
|
|
|
|
|
|
@ -10238,8 +10206,7 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
skip_emulated_instruction(vcpu);
|
|
|
|
|
return 1;
|
|
|
|
|
return kvm_skip_emulated_instruction(vcpu);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|