Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55c1dcd8 authored by Krish Sadhukhan's avatar Krish Sadhukhan Committed by Paolo Bonzini
Browse files

nVMX x86: Make nested_vmx_check_pml_controls() concise

parent 3ff519f2
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -11779,15 +11779,12 @@ static int nested_vmx_check_msr_switch_controls(struct kvm_vcpu *vcpu,
static int nested_vmx_check_pml_controls(struct kvm_vcpu *vcpu,
					 struct vmcs12 *vmcs12)
{
	u64 address = vmcs12->pml_address;
	int maxphyaddr = cpuid_maxphyaddr(vcpu);
	if (!nested_cpu_has_pml(vmcs12))
		return 0;

	if (nested_cpu_has2(vmcs12, SECONDARY_EXEC_ENABLE_PML)) {
	if (!nested_cpu_has_ept(vmcs12) ||
		    !IS_ALIGNED(address, 4096)  ||
		    address >> maxphyaddr)
	    !page_address_valid(vcpu, vmcs12->pml_address))
		return -EINVAL;
	}

	return 0;
}