mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
hyperv: report nested virtualization setting in domain XML
When Hyper-V is configured to expose virtualization extensions to a guest, report this in the domain XML by adding the vendor-appropriate CPU feature flag: - Intel hosts: <feature policy='require' name='vmx'/> - AMD hosts: <feature policy='require' name='svm'/> This requires adding ExposeVirtualizationExtensions and several other fields introduced in Windows 10 to the Msvm_ProcessorSettingData WMI class definition. Resolves: https://redhat.atlassian.net/browse/RHEL-159129 Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
1 parent
c072aea5a9
commit
0f014efea3
2 files changed
+28
No files matched your search
@@ -44,6 +44,7 @@
|
||||
#include "snapshot_conf.h"
|
||||
#include "virfdstream.h"
|
||||
#include "virfile.h"
|
||||
#include "cpu_conf.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_HYPERV
|
||||
|
||||
@@ -2766,6 +2767,28 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
if (virDomainDefSetVcpus(def, processorSettingData->data->VirtualQuantity) < 0)
|
||||
return NULL;
|
||||
|
||||
if (processorSettingData->data->ExposeVirtualizationExtensions) {
|
||||
g_autoptr(Win32_Processor) processors = NULL;
|
||||
const char *cpuFeature = NULL;
|
||||
|
||||
if (hypervGetProcessorList(priv, NULL, &processors) < 0)
|
||||
return NULL;
|
||||
|
||||
if (STREQ_NULLABLE(processors->data->Manufacturer, "GenuineIntel"))
|
||||
cpuFeature = "vmx";
|
||||
else if (STREQ_NULLABLE(processors->data->Manufacturer, "AuthenticAMD"))
|
||||
cpuFeature = "svm";
|
||||
|
||||
if (cpuFeature) {
|
||||
def->cpu = virCPUDefNew();
|
||||
def->cpu->mode = VIR_CPU_MODE_HOST_PASSTHROUGH;
|
||||
def->cpu->type = VIR_CPU_TYPE_GUEST;
|
||||
|
||||
if (virCPUDefAddFeature(def->cpu, cpuFeature, VIR_CPU_FEATURE_REQUIRE) < 0)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
def->os.type = VIR_DOMAIN_OSTYPE_HVM;
|
||||
|
||||
/* Generation 2 VMs use UEFI firmware */
|
||||
|
||||
@@ -174,9 +174,14 @@ class Msvm_ProcessorSettingData
|
||||
string AddressOnParent
|
||||
string VirtualQuantityUnits
|
||||
boolean LimitCPUID
|
||||
uint64 HwThreadsPerCore
|
||||
boolean LimitProcessorFeatures
|
||||
uint64 MaxProcessorsPerNumaNode
|
||||
uint64 MaxNumaNodesPerSocket
|
||||
boolean EnableHostResourceProtection
|
||||
string CpuGroupId
|
||||
boolean HideHypervisorPresent
|
||||
boolean ExposeVirtualizationExtensions
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user