domain_capabilities: Define SGX capabilities structs

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Haibin Huang <haibin.huang@intel.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Haibin Huang 2022-11-10 17:21:19 -08:00 committed by Michal Privoznik
parent 697e26fac6
commit fa0da364e7
3 changed files with 34 additions and 0 deletions

View File

@ -76,6 +76,17 @@ virSEVCapabilitiesFree(virSEVCapability *cap)
} }
void
virSGXCapabilitiesFree(virSGXCapability *cap)
{
if (!cap)
return;
g_free(cap->sgxSections);
g_free(cap);
}
static void static void
virDomainCapsDispose(void *obj) virDomainCapsDispose(void *obj)
{ {

View File

@ -208,6 +208,22 @@ struct _virSEVCapability {
unsigned int max_es_guests; unsigned int max_es_guests;
}; };
typedef struct _virSGXSection virSGXSection;
struct _virSGXSection {
unsigned long long size;
unsigned int node;
};
typedef struct _virSGXCapability virSGXCapability;
struct _virSGXCapability {
bool flc;
bool sgx1;
bool sgx2;
unsigned long long section_size;
size_t nSgxSections;
virSGXSection *sgxSections;
};
typedef enum { typedef enum {
VIR_DOMAIN_CAPS_FEATURE_IOTHREADS = 0, VIR_DOMAIN_CAPS_FEATURE_IOTHREADS = 0,
VIR_DOMAIN_CAPS_FEATURE_VMCOREINFO, VIR_DOMAIN_CAPS_FEATURE_VMCOREINFO,
@ -246,6 +262,7 @@ struct _virDomainCaps {
virDomainCapsFeatureGIC gic; virDomainCapsFeatureGIC gic;
virSEVCapability *sev; virSEVCapability *sev;
virSGXCapability *sgx;
/* add new domain features here */ /* add new domain features here */
virTristateBool features[VIR_DOMAIN_CAPS_FEATURE_LAST]; virTristateBool features[VIR_DOMAIN_CAPS_FEATURE_LAST];
@ -296,3 +313,8 @@ void
virSEVCapabilitiesFree(virSEVCapability *capabilities); virSEVCapabilitiesFree(virSEVCapability *capabilities);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSEVCapability, virSEVCapabilitiesFree); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSEVCapability, virSEVCapabilitiesFree);
void
virSGXCapabilitiesFree(virSGXCapability *capabilities);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSGXCapability, virSGXCapabilitiesFree);

View File

@ -218,6 +218,7 @@ virDomainCapsEnumSet;
virDomainCapsFormat; virDomainCapsFormat;
virDomainCapsNew; virDomainCapsNew;
virSEVCapabilitiesFree; virSEVCapabilitiesFree;
virSGXCapabilitiesFree;
# conf/domain_conf.h # conf/domain_conf.h