Signed-off-by: zhenwei pi <pizhenwei(a)bytedance.com>
---
src/conf/domain_capabilities.c | 15 +++++++++++++++
src/conf/domain_capabilities.h | 12 ++++++++++++
2 files changed, 27 insertions(+)
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 247cfa49de..aacd590601 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -598,6 +598,20 @@ virDomainCapsDeviceChannelFormat(virBuffer *buf,
}
+static void
+virDomainCapsDeviceCryptoFormat(virBuffer *buf,
+ const virDomainCapsDeviceCrypto *crypto)
+{
+ FORMAT_PROLOGUE(crypto);
+
+ ENUM_PROCESS(crypto, model, virDomainCryptoModelTypeToString);
+ ENUM_PROCESS(crypto, type, virDomainCryptoTypeTypeToString);
+ ENUM_PROCESS(crypto, backendModel, virDomainCryptoBackendTypeToString);
+
+ FORMAT_EPILOGUE(crypto);
+}
+
+
/**
* virDomainCapsFeatureGICFormat:
* @buf: target buffer
@@ -748,6 +762,7 @@ virDomainCapsFormat(const virDomainCaps *caps)
virDomainCapsDeviceTPMFormat(&buf, &caps->tpm);
virDomainCapsDeviceRedirdevFormat(&buf, &caps->redirdev);
virDomainCapsDeviceChannelFormat(&buf, &caps->channel);
+ virDomainCapsDeviceCryptoFormat(&buf, &caps->crypto);
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</devices>\n");
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index 1d504a3506..1b128a3a3c 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -224,6 +224,17 @@ struct _virSGXCapability {
virSGXSection *sgxSections;
};
+STATIC_ASSERT_ENUM(VIR_DOMAIN_CRYPTO_MODEL_LAST);
+STATIC_ASSERT_ENUM(VIR_DOMAIN_CRYPTO_TYPE_LAST);
+STATIC_ASSERT_ENUM(VIR_DOMAIN_CRYPTO_BACKEND_LAST);
+typedef struct _virDomainCapsDeviceCrypto virDomainCapsDeviceCrypto;
+struct _virDomainCapsDeviceCrypto {
+ virTristateBool supported;
+ virDomainCapsEnum model; /* virDomainCryptoModel */
+ virDomainCapsEnum type; /* virDomainCryptoType */
+ virDomainCapsEnum backendModel; /* virDomainCryptoBackend */
+};
+
typedef enum {
VIR_DOMAIN_CAPS_FEATURE_IOTHREADS = 0,
VIR_DOMAIN_CAPS_FEATURE_VMCOREINFO,
@@ -258,6 +269,7 @@ struct _virDomainCaps {
virDomainCapsDeviceTPM tpm;
virDomainCapsDeviceRedirdev redirdev;
virDomainCapsDeviceChannel channel;
+ virDomainCapsDeviceCrypto crypto;
/* add new domain devices here */
virDomainCapsFeatureGIC gic;
--
2.34.1