[PATCH v2] x86/nSVM: Expose the FlushByASID CPU feature support to L1 guests
Abdelkareem Abdelsaamad <[email protected]>
| Newsgroups | gmane.comp.emulators.xen.devel |
|---|---|
| Message-ID | <616bf3633e902f2fdba5d00691653d3bb82444ce.1787765809.git.abdelkareem.abdelsaamad@citrix.com> |
Some hypervisors explicitly require FlushByASID capability to function under nested virtualization; otherwise, they fail to boot or run nested guests, see see Xen's start_nested_svm and (1) and (2). To ensure functional nested virtualization support and allow L1 hypervisors to correctly detect this hardware capability, extend the exposed HVM CPU policy to surface the FlushByASID CPU feature to the L1 guests when nestedhvm is enabled. (1) VMWare (Launchpad Bug #2008583) https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2008583 (2) https://lore.kernel.org/all/[email protected]/T/#u Signed-off-by: Abdelkareem Abdelsaamad <[email protected]> --- Changes in V2: - Commit Message: Rephrased to clearly state that exposing this flag is a functional dependency for some hypervisors and hence for nested virtualization support. - Code Cleanup: Dropped the unrelated change that removed the dangling 'exitinfo1 = ns_vmcb->exitinfo1;' assignment inside svm_vmexit_handler(). - Testing: Updated the testing notes to the successful validation using the XTF CPUID test. --- Testing: - Using XTF CPUID test with nestedhvm=1 - without the change, EDX returns 0x4AB (the FlushByASID 6th bit is not set). 8000000a:ffffffff -> 00000001:00008000:00000000:000004ab - with the change, EDX returns 0x4EB (the FlushByASID 6th bit is set). 8000000a:ffffffff -> 00000001:00008000:00000000:000004eb - CI tests: https://gitlab.com/xen-project/people/aabdelsa/xen/-/pipelines/2793662718 --- xen/arch/x86/cpu-policy.c | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c index eddcd9778f..48a3185eed 100644 --- a/xen/arch/x86/cpu-policy.c +++ b/xen/arch/x86/cpu-policy.c @@ -843,6 +843,7 @@ static void __init calculate_hvm_max_policy(void) p->extd.raw[0xa].d &= ((1u << SVM_FEATURE_NPT) | (1u << SVM_FEATURE_LBRV) | (1u << SVM_FEATURE_NRIPS) | + (1u << SVM_FEATURE_FLUSHBYASID) | (1u << SVM_FEATURE_PAUSEFILTER) | (1u << SVM_FEATURE_DECODEASSISTS)); /* Enable features which are always emulated. */ -- 2.53.0