Implement support for nested virt on Linux#630
Conversation
For the VMM, supporting nested virt on KVM basically implies exposing the svm (for AMD) or vmx (for Intel) flag to the guest. Extend the cpuid crate to support doing so when requested. Signed-off-by: Sergio Lopez <slp@redhat.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request enables nested virtualization support on Linux by updating CPUID transformations to advertise VMX and SVM features and implementing a system check via KVM module parameters. Feedback was provided regarding a logic bug in the Linux support check where an early return prevents checking for AMD support if the Intel module is present but disabled.
In the previous commit, we extended cpuid to be able to expose the required flags to the guest. Here, we add a field to VmResources to store whether the VM should enable nested virt or not, and allow krun_set_nested_virt to be used on Linux. Signed-off-by: Sergio Lopez <slp@redhat.com>
So far, we only supported krun_check_nested_virt on macOS. Extend it to check for nested support on Linux too. Signed-off-by: Sergio Lopez <slp@redhat.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request enables nested virtualization support on Linux, which was previously restricted to macOS. The changes introduce a nested_enabled flag within the VmSpec and VcpuConfig structures and update the CPUID transformation logic for both Intel (VMX) and AMD (SVM) to advertise these capabilities to the guest when appropriate. Additionally, the Linux implementation of krun_check_nested_virt now verifies host support by reading KVM module parameters. Feedback was provided regarding the error handling in the Linux support check, suggesting that silent failures when reading system paths could mask configuration issues.
So far, we supported enabling nested virt on macOS but not on Linux. Let's do that now.
Fixes: #625