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

Commit 089d7b6e authored by Wanpeng Li's avatar Wanpeng Li Committed by Paolo Bonzini
Browse files

KVM: nVMX: expose VPID capability to L1



Expose VPID capability to L1. For nested guests, we don't do anything
specific for single context invalidation. Hence, only advertise support
for global context invalidation. The major benefit of nested VPID comes
from having separate vpids when switching between L1 and L2, and also
when L2's vCPUs not sched in/out on L1.

Reviewed-by: default avatarWincy Van <fanwenyi0529@gmail.com>
Signed-off-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 5c614b35
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -2622,6 +2622,10 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx)
	} else
	} else
		vmx->nested.nested_vmx_ept_caps = 0;
		vmx->nested.nested_vmx_ept_caps = 0;


	if (enable_vpid)
		vmx->nested.nested_vmx_vpid_caps = VMX_VPID_INVVPID_BIT |
				VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT;
	else
		vmx->nested.nested_vmx_vpid_caps = 0;
		vmx->nested.nested_vmx_vpid_caps = 0;


	if (enable_unrestricted_guest)
	if (enable_unrestricted_guest)
@@ -2739,7 +2743,8 @@ static int vmx_get_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
		break;
		break;
	case MSR_IA32_VMX_EPT_VPID_CAP:
	case MSR_IA32_VMX_EPT_VPID_CAP:
		/* Currently, no nested vpid support */
		/* Currently, no nested vpid support */
		*pdata = vmx->nested.nested_vmx_ept_caps;
		*pdata = vmx->nested.nested_vmx_ept_caps |
			((u64)vmx->nested.nested_vmx_vpid_caps << 32);
		break;
		break;
	default:
	default:
		return 1;
		return 1;