qemu: Fill launchSecurity in domaincaps

The inspiration for these rules comes from
qemuValidateDomainDef().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Michal Privoznik 2024-06-25 10:45:43 +02:00
parent d460e17282
commit 66df7992d8
86 changed files with 134 additions and 0 deletions

View File

@ -6514,6 +6514,27 @@ virQEMUCapsFillDomainDeviceCryptoCaps(virQEMUCaps *qemuCaps,
}
void
virQEMUCapsFillDomainLaunchSecurity(virQEMUCaps *qemuCaps,
virDomainCapsLaunchSecurity *launchSecurity)
{
launchSecurity->supported = VIR_TRISTATE_BOOL_YES;
launchSecurity->sectype.report = true;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST))
VIR_DOMAIN_CAPS_ENUM_SET(launchSecurity->sectype, VIR_DOMAIN_LAUNCH_SECURITY_SEV);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_SNP_GUEST))
VIR_DOMAIN_CAPS_ENUM_SET(launchSecurity->sectype, VIR_DOMAIN_LAUNCH_SECURITY_SEV_SNP);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_S390_PV_GUEST) &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_CONFIDENTAL_GUEST_SUPPORT))
VIR_DOMAIN_CAPS_ENUM_SET(launchSecurity->sectype, VIR_DOMAIN_LAUNCH_SECURITY_PV);
if (launchSecurity->sectype.values == 0) {
launchSecurity->supported = VIR_TRISTATE_BOOL_NO;
}
}
/**
* virQEMUCapsSupportsGICVersion:
* @qemuCaps: QEMU capabilities
@ -6678,6 +6699,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps,
virDomainCapsDeviceChannel *channel = &domCaps->channel;
virDomainCapsMemoryBacking *memoryBacking = &domCaps->memoryBacking;
virDomainCapsDeviceCrypto *crypto = &domCaps->crypto;
virDomainCapsLaunchSecurity *launchSecurity = &domCaps->launchSecurity;
virQEMUCapsFillDomainFeaturesFromQEMUCaps(qemuCaps, domCaps);
@ -6717,6 +6739,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps,
virQEMUCapsFillDomainFeatureSGXCaps(qemuCaps, domCaps);
virQEMUCapsFillDomainFeatureHypervCaps(qemuCaps, domCaps);
virQEMUCapsFillDomainDeviceCryptoCaps(qemuCaps, crypto);
virQEMUCapsFillDomainLaunchSecurity(qemuCaps, launchSecurity);
return 0;
}

View File

@ -867,6 +867,9 @@ void virQEMUCapsFillDomainDeviceChannelCaps(virQEMUCaps *qemuCaps,
void virQEMUCapsFillDomainDeviceCryptoCaps(virQEMUCaps *qemuCaps,
virDomainCapsDeviceCrypto *crypto);
void virQEMUCapsFillDomainLaunchSecurity(virQEMUCaps *qemuCaps,
virDomainCapsLaunchSecurity *launchSecurity);
bool virQEMUCapsGuestIsNative(virArch host,
virArch guest);

View File

@ -319,5 +319,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -264,5 +264,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -196,5 +196,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -196,5 +196,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -164,5 +164,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -270,5 +270,6 @@
<s390-pv supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -319,5 +319,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -321,5 +321,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -149,5 +149,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -266,5 +266,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -209,5 +209,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -152,5 +152,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -209,5 +209,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -171,5 +171,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -321,5 +321,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -253,5 +253,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -266,5 +266,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -135,5 +135,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -253,5 +253,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -253,5 +253,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -149,5 +149,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -266,5 +266,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -209,5 +209,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -152,5 +152,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -209,5 +209,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -171,5 +171,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -272,5 +272,6 @@
<s390-pv supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -253,5 +253,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -260,5 +260,10 @@
<maxESGuests>450</maxESGuests>
</sev>
<sgx supported='no'/>
<launchSecurity supported='yes'>
<enum name='sectype'>
<value>sev</value>
</enum>
</launchSecurity>
</features>
</domainCapabilities>

View File

@ -274,5 +274,10 @@
<maxESGuests>450</maxESGuests>
</sev>
<sgx supported='no'/>
<launchSecurity supported='yes'>
<enum name='sectype'>
<value>sev</value>
</enum>
</launchSecurity>
</features>
</domainCapabilities>

View File

@ -211,5 +211,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -211,5 +211,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -273,5 +273,10 @@
<s390-pv supported='yes'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='yes'>
<enum name='sectype'>
<value>s390-pv</value>
</enum>
</launchSecurity>
</features>
</domainCapabilities>

View File

@ -260,5 +260,10 @@
<maxESGuests>450</maxESGuests>
</sev>
<sgx supported='no'/>
<launchSecurity supported='yes'>
<enum name='sectype'>
<value>sev</value>
</enum>
</launchSecurity>
</features>
</domainCapabilities>

View File

@ -256,5 +256,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -269,5 +269,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -256,5 +256,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -256,5 +256,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -271,5 +271,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -218,5 +218,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -218,5 +218,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -170,5 +170,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -256,5 +256,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -172,5 +172,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -266,5 +266,6 @@
<section node='1' size='262144' unit='KiB'/>
</sections>
</sgx>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -281,5 +281,6 @@
<section node='1' size='262144' unit='KiB'/>
</sections>
</sgx>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -217,5 +217,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -217,5 +217,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -175,5 +175,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -266,5 +266,6 @@
<section node='1' size='262144' unit='KiB'/>
</sections>
</sgx>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -256,5 +256,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -270,5 +270,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -168,5 +168,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -256,5 +256,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -179,5 +179,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -262,5 +262,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -260,5 +260,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -260,5 +260,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -154,5 +154,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -262,5 +262,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -281,5 +281,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -155,5 +155,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -283,5 +283,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -158,5 +158,6 @@
<async-teardown supported='no'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -281,5 +281,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -283,5 +283,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -284,5 +284,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -268,5 +268,10 @@
<s390-pv supported='yes'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='yes'>
<enum name='sectype'>
<value>s390-pv</value>
</enum>
</launchSecurity>
</features>
</domainCapabilities>

View File

@ -283,5 +283,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -285,5 +285,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -161,5 +161,6 @@
<async-teardown supported='yes'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -284,5 +284,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -223,5 +223,6 @@
<async-teardown supported='yes'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -165,5 +165,6 @@
<async-teardown supported='yes'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -223,5 +223,6 @@
<async-teardown supported='yes'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -171,5 +171,6 @@
<async-teardown supported='yes'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -268,5 +268,10 @@
<s390-pv supported='yes'/>
<sev supported='no'/>
<sgx supported='no'/>
<launchSecurity supported='yes'>
<enum name='sectype'>
<value>s390-pv</value>
</enum>
</launchSecurity>
</features>
</domainCapabilities>

View File

@ -285,5 +285,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -285,5 +285,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -286,5 +286,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -285,5 +285,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -286,5 +286,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -285,5 +285,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>

View File

@ -286,5 +286,6 @@
<value>avic</value>
</enum>
</hyperv>
<launchSecurity supported='no'/>
</features>
</domainCapabilities>