diff mbox series

[1/5] nSVM: Expose FLUSHBYASID CPUID feature to nested guests

Message ID 20210920235134.101970-2-krish.sadhukhan@oracle.com (mailing list archive)
State New, archived
Headers show
Series nSVM: Check for optional commands and reserved encodins of TLB_CONTROL in nested guests | expand

Commit Message

Krish Sadhukhan Sept. 20, 2021, 11:51 p.m. UTC
The FLUSHBYASID CPUID feature controls the availability of  commands
0x3 and 0x7 of TLB_CONTROL. If FLUSHBYASID is supported by the VCPU,
those TLB_CONTROL commands will be available to nested guests. Therefore,
expose FLUSHBYASID CPUID feature to nested guests.

Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
---
 arch/x86/kvm/svm/svm.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Paolo Bonzini Sept. 24, 2021, 10:58 a.m. UTC | #1
On 21/09/21 01:51, Krish Sadhukhan wrote:
> The FLUSHBYASID CPUID feature controls the availability of  commands
> 0x3 and 0x7 of TLB_CONTROL. If FLUSHBYASID is supported by the VCPU,
> those TLB_CONTROL commands will be available to nested guests.

The hypervisor would have to implement them.  Right now the VMCB12 
tlb_ctl is not used.

         /* Also overwritten later if necessary.  */
         svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING;

So this won't work.

Paolo

> Therefore,
> expose FLUSHBYASID CPUID feature to nested guests.
> 
> Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> ---
>   arch/x86/kvm/svm/svm.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 1a70e11f0487..0f8748af8569 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -931,6 +931,9 @@ static __init void svm_set_cpu_caps(void)
>   
>   		/* Nested VM can receive #VMEXIT instead of triggering #GP */
>   		kvm_cpu_cap_set(X86_FEATURE_SVME_ADDR_CHK);
> +
> +		if (boot_cpu_has(X86_FEATURE_FLUSHBYASID))
> +			kvm_cpu_cap_set(X86_FEATURE_FLUSHBYASID);
>   	}
>   
>   	/* CPUID 0x80000008 */
>
diff mbox series

Patch

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 1a70e11f0487..0f8748af8569 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -931,6 +931,9 @@  static __init void svm_set_cpu_caps(void)
 
 		/* Nested VM can receive #VMEXIT instead of triggering #GP */
 		kvm_cpu_cap_set(X86_FEATURE_SVME_ADDR_CHK);
+
+		if (boot_cpu_has(X86_FEATURE_FLUSHBYASID))
+			kvm_cpu_cap_set(X86_FEATURE_FLUSHBYASID);
 	}
 
 	/* CPUID 0x80000008 */