2014-06-25 11:24:53 +00:00
|
|
|
/*
|
|
|
|
* domain_capabilities.h: domain capabilities XML processing
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-06-07 20:20:16 +00:00
|
|
|
#pragma once
|
2014-06-25 11:24:53 +00:00
|
|
|
|
2019-06-07 20:20:16 +00:00
|
|
|
#include "internal.h"
|
|
|
|
#include "domain_conf.h"
|
|
|
|
#include "virenum.h"
|
2014-06-25 11:24:53 +00:00
|
|
|
|
|
|
|
typedef const char * (*virDomainCapsValToStr)(int value);
|
|
|
|
|
|
|
|
typedef struct _virDomainCaps virDomainCaps;
|
|
|
|
typedef virDomainCaps *virDomainCapsPtr;
|
|
|
|
|
|
|
|
typedef struct _virDomainCapsEnum virDomainCapsEnum;
|
|
|
|
typedef virDomainCapsEnum *virDomainCapsEnumPtr;
|
|
|
|
struct _virDomainCapsEnum {
|
2019-03-06 23:11:01 +00:00
|
|
|
bool report; /* Whether the format the enum at all */
|
2014-06-25 11:24:53 +00:00
|
|
|
unsigned int values; /* Bitmask of values supported in the corresponding enum */
|
|
|
|
};
|
|
|
|
|
2014-09-16 23:52:54 +00:00
|
|
|
typedef struct _virDomainCapsStringValues virDomainCapsStringValues;
|
|
|
|
typedef virDomainCapsStringValues *virDomainCapsStringValuesPtr;
|
|
|
|
struct _virDomainCapsStringValues {
|
|
|
|
char **values; /* raw string values */
|
|
|
|
size_t nvalues; /* number of strings */
|
|
|
|
};
|
|
|
|
|
2014-09-16 12:47:47 +00:00
|
|
|
typedef struct _virDomainCapsLoader virDomainCapsLoader;
|
|
|
|
typedef virDomainCapsLoader *virDomainCapsLoaderPtr;
|
|
|
|
struct _virDomainCapsLoader {
|
2019-02-08 23:03:20 +00:00
|
|
|
virTristateBool supported;
|
2014-09-16 23:52:54 +00:00
|
|
|
virDomainCapsStringValues values; /* Info about values for the element */
|
2014-09-16 12:47:47 +00:00
|
|
|
virDomainCapsEnum type; /* Info about virDomainLoader */
|
|
|
|
virDomainCapsEnum readonly; /* Info about readonly:virTristateBool */
|
2019-04-04 10:42:14 +00:00
|
|
|
virDomainCapsEnum secure; /* Info about secure:virTristateBool */
|
2014-09-16 12:47:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virDomainCapsOS virDomainCapsOS;
|
|
|
|
typedef virDomainCapsOS *virDomainCapsOSPtr;
|
|
|
|
struct _virDomainCapsOS {
|
2019-02-08 23:03:20 +00:00
|
|
|
virTristateBool supported;
|
2019-04-04 10:42:14 +00:00
|
|
|
virDomainCapsEnum firmware; /* Info about virDomainOsDefFirmware */
|
2014-09-16 12:47:47 +00:00
|
|
|
virDomainCapsLoader loader; /* Info about virDomainLoaderDef */
|
|
|
|
};
|
|
|
|
|
2014-06-25 11:24:53 +00:00
|
|
|
typedef struct _virDomainCapsDeviceDisk virDomainCapsDeviceDisk;
|
|
|
|
typedef virDomainCapsDeviceDisk *virDomainCapsDeviceDiskPtr;
|
|
|
|
struct _virDomainCapsDeviceDisk {
|
2019-02-08 23:03:20 +00:00
|
|
|
virTristateBool supported;
|
2014-06-25 11:24:53 +00:00
|
|
|
virDomainCapsEnum diskDevice; /* Info about virDomainDiskDevice enum values */
|
|
|
|
virDomainCapsEnum bus; /* Info about virDomainDiskBus enum values */
|
2019-02-20 19:18:40 +00:00
|
|
|
virDomainCapsEnum model; /* Info about virDomainDiskModel enum values */
|
2014-06-25 11:24:53 +00:00
|
|
|
/* add new fields here */
|
|
|
|
};
|
|
|
|
|
2016-05-08 15:57:20 +00:00
|
|
|
typedef struct _virDomainCapsDeviceGraphics virDomainCapsDeviceGraphics;
|
|
|
|
typedef virDomainCapsDeviceGraphics *virDomainCapsDeviceGraphicsPtr;
|
|
|
|
struct _virDomainCapsDeviceGraphics {
|
2019-02-08 23:03:20 +00:00
|
|
|
virTristateBool supported;
|
2016-05-08 15:57:20 +00:00
|
|
|
virDomainCapsEnum type; /* virDomainGraphicsType */
|
|
|
|
};
|
|
|
|
|
2016-05-08 16:11:39 +00:00
|
|
|
typedef struct _virDomainCapsDeviceVideo virDomainCapsDeviceVideo;
|
|
|
|
typedef virDomainCapsDeviceVideo *virDomainCapsDeviceVideoPtr;
|
|
|
|
struct _virDomainCapsDeviceVideo {
|
2019-02-08 23:03:20 +00:00
|
|
|
virTristateBool supported;
|
2016-05-08 16:11:39 +00:00
|
|
|
virDomainCapsEnum modelType; /* virDomainVideoType */
|
|
|
|
};
|
|
|
|
|
2014-06-25 11:24:53 +00:00
|
|
|
typedef struct _virDomainCapsDeviceHostdev virDomainCapsDeviceHostdev;
|
|
|
|
typedef virDomainCapsDeviceHostdev *virDomainCapsDeviceHostdevPtr;
|
|
|
|
struct _virDomainCapsDeviceHostdev {
|
2019-02-08 23:03:20 +00:00
|
|
|
virTristateBool supported;
|
2014-06-25 11:24:53 +00:00
|
|
|
virDomainCapsEnum mode; /* Info about virDomainHostdevMode */
|
|
|
|
virDomainCapsEnum startupPolicy; /* Info about virDomainStartupPolicy */
|
|
|
|
virDomainCapsEnum subsysType; /* Info about virDomainHostdevSubsysType */
|
|
|
|
virDomainCapsEnum capsType; /* Info about virDomainHostdevCapsType */
|
|
|
|
virDomainCapsEnum pciBackend; /* Info about virDomainHostdevSubsysPCIBackendType */
|
|
|
|
/* add new fields here */
|
|
|
|
};
|
|
|
|
|
2019-03-31 21:19:33 +00:00
|
|
|
typedef struct _virDomainCapsDeviceRNG virDomainCapsDeviceRNG;
|
|
|
|
typedef virDomainCapsDeviceRNG *virDomainCapsDeviceRNGPtr;
|
|
|
|
struct _virDomainCapsDeviceRNG {
|
|
|
|
virTristateBool supported;
|
|
|
|
virDomainCapsEnum model; /* virDomainRNGModel */
|
|
|
|
virDomainCapsEnum backendModel; /* virDomainRNGBackend */
|
|
|
|
};
|
|
|
|
|
2016-03-09 17:28:59 +00:00
|
|
|
typedef struct _virDomainCapsFeatureGIC virDomainCapsFeatureGIC;
|
|
|
|
typedef virDomainCapsFeatureGIC *virDomainCapsFeatureGICPtr;
|
|
|
|
struct _virDomainCapsFeatureGIC {
|
2019-02-08 23:03:20 +00:00
|
|
|
virTristateBool supported;
|
2016-03-09 17:28:59 +00:00
|
|
|
virDomainCapsEnum version; /* Info about virGICVersion */
|
|
|
|
};
|
|
|
|
|
2016-06-15 14:15:44 +00:00
|
|
|
typedef enum {
|
|
|
|
VIR_DOMCAPS_CPU_USABLE_UNKNOWN,
|
|
|
|
VIR_DOMCAPS_CPU_USABLE_YES,
|
|
|
|
VIR_DOMCAPS_CPU_USABLE_NO,
|
|
|
|
|
|
|
|
VIR_DOMCAPS_CPU_USABLE_LAST
|
|
|
|
} virDomainCapsCPUUsable;
|
|
|
|
VIR_ENUM_DECL(virDomainCapsCPUUsable);
|
|
|
|
|
2016-04-22 09:08:57 +00:00
|
|
|
typedef struct _virDomainCapsCPUModel virDomainCapsCPUModel;
|
|
|
|
typedef virDomainCapsCPUModel *virDomainCapsCPUModelPtr;
|
|
|
|
struct _virDomainCapsCPUModel {
|
|
|
|
char *name;
|
2016-06-15 14:15:44 +00:00
|
|
|
virDomainCapsCPUUsable usable;
|
2017-09-19 16:35:08 +00:00
|
|
|
char **blockers; /* NULL-terminated list of usability blockers */
|
2016-04-22 09:08:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _virDomainCapsCPUModels virDomainCapsCPUModels;
|
|
|
|
typedef virDomainCapsCPUModels *virDomainCapsCPUModelsPtr;
|
|
|
|
struct _virDomainCapsCPUModels {
|
|
|
|
virObject parent;
|
|
|
|
|
|
|
|
size_t nmodels_max;
|
|
|
|
size_t nmodels;
|
|
|
|
virDomainCapsCPUModelPtr models;
|
|
|
|
};
|
|
|
|
|
2019-09-20 20:41:34 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainCapsCPUModels, virObjectUnref);
|
|
|
|
|
2016-04-22 09:08:57 +00:00
|
|
|
typedef struct _virDomainCapsCPU virDomainCapsCPU;
|
|
|
|
typedef virDomainCapsCPU *virDomainCapsCPUPtr;
|
|
|
|
struct _virDomainCapsCPU {
|
|
|
|
bool hostPassthrough;
|
2020-06-02 22:28:10 +00:00
|
|
|
virDomainCapsEnum hostPassthroughMigratable;
|
2016-06-15 14:45:47 +00:00
|
|
|
virCPUDefPtr hostModel;
|
2016-04-22 09:08:57 +00:00
|
|
|
virDomainCapsCPUModelsPtr custom;
|
|
|
|
};
|
|
|
|
|
2018-06-08 14:40:51 +00:00
|
|
|
typedef struct _virSEVCapability virSEVCapability;
|
|
|
|
typedef virSEVCapability *virSEVCapabilityPtr;
|
|
|
|
struct _virSEVCapability {
|
|
|
|
char *pdh;
|
|
|
|
char *cert_chain;
|
|
|
|
unsigned int cbitpos;
|
|
|
|
unsigned int reduced_phys_bits;
|
|
|
|
};
|
|
|
|
|
2019-11-13 15:34:11 +00:00
|
|
|
typedef enum {
|
|
|
|
VIR_DOMAIN_CAPS_FEATURE_IOTHREADS = 0,
|
|
|
|
VIR_DOMAIN_CAPS_FEATURE_VMCOREINFO,
|
|
|
|
VIR_DOMAIN_CAPS_FEATURE_GENID,
|
2019-10-30 15:54:56 +00:00
|
|
|
VIR_DOMAIN_CAPS_FEATURE_BACKING_STORE_INPUT,
|
2019-12-03 16:36:35 +00:00
|
|
|
VIR_DOMAIN_CAPS_FEATURE_BACKUP,
|
2019-11-13 15:34:11 +00:00
|
|
|
|
|
|
|
VIR_DOMAIN_CAPS_FEATURE_LAST
|
|
|
|
} virDomainCapsFeature;
|
|
|
|
|
2014-06-25 11:24:53 +00:00
|
|
|
struct _virDomainCaps {
|
|
|
|
virObjectLockable parent;
|
|
|
|
|
|
|
|
char *path; /* path to emulator binary */
|
|
|
|
virDomainVirtType virttype; /* virtualization type */
|
|
|
|
char *machine; /* machine type */
|
|
|
|
virArch arch; /* domain architecture */
|
|
|
|
|
|
|
|
/* Some machine specific info */
|
|
|
|
int maxvcpus;
|
|
|
|
|
2014-09-16 12:47:47 +00:00
|
|
|
virDomainCapsOS os;
|
2016-04-22 09:08:57 +00:00
|
|
|
virDomainCapsCPU cpu;
|
2014-06-25 11:24:53 +00:00
|
|
|
virDomainCapsDeviceDisk disk;
|
2016-05-08 15:57:20 +00:00
|
|
|
virDomainCapsDeviceGraphics graphics;
|
2016-05-08 16:11:39 +00:00
|
|
|
virDomainCapsDeviceVideo video;
|
2014-06-25 11:24:53 +00:00
|
|
|
virDomainCapsDeviceHostdev hostdev;
|
2019-03-31 21:19:33 +00:00
|
|
|
virDomainCapsDeviceRNG rng;
|
2014-06-25 11:24:53 +00:00
|
|
|
/* add new domain devices here */
|
2016-03-09 17:28:59 +00:00
|
|
|
|
|
|
|
virDomainCapsFeatureGIC gic;
|
2018-06-08 14:40:52 +00:00
|
|
|
virSEVCapabilityPtr sev;
|
2016-03-09 17:28:59 +00:00
|
|
|
/* add new domain features here */
|
2019-11-13 15:34:11 +00:00
|
|
|
|
|
|
|
virTristateBool features[VIR_DOMAIN_CAPS_FEATURE_LAST];
|
2014-06-25 11:24:53 +00:00
|
|
|
};
|
|
|
|
|
2019-10-04 16:14:10 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainCaps, virObjectUnref);
|
|
|
|
|
|
|
|
|
2014-06-25 11:24:53 +00:00
|
|
|
virDomainCapsPtr virDomainCapsNew(const char *path,
|
|
|
|
const char *machine,
|
|
|
|
virArch arch,
|
|
|
|
virDomainVirtType virttype);
|
|
|
|
|
2016-04-22 09:08:57 +00:00
|
|
|
virDomainCapsCPUModelsPtr virDomainCapsCPUModelsNew(size_t nmodels);
|
|
|
|
virDomainCapsCPUModelsPtr virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr old);
|
|
|
|
int virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels,
|
|
|
|
const char *name,
|
2017-09-19 16:35:08 +00:00
|
|
|
virDomainCapsCPUUsable usable,
|
|
|
|
char **blockers);
|
2017-10-13 15:37:34 +00:00
|
|
|
virDomainCapsCPUModelPtr
|
|
|
|
virDomainCapsCPUModelsGet(virDomainCapsCPUModelsPtr cpuModels,
|
|
|
|
const char *name);
|
|
|
|
|
2016-04-22 09:08:57 +00:00
|
|
|
|
2019-06-07 20:20:16 +00:00
|
|
|
#define VIR_DOMAIN_CAPS_ENUM_SET(capsEnum, ...) \
|
2017-11-03 12:09:47 +00:00
|
|
|
do { \
|
|
|
|
unsigned int __values[] = {__VA_ARGS__}; \
|
2019-10-15 11:55:26 +00:00
|
|
|
size_t __nvalues = G_N_ELEMENTS(__values); \
|
2017-11-03 12:09:47 +00:00
|
|
|
virDomainCapsEnumSet(&(capsEnum), #capsEnum, \
|
|
|
|
__nvalues, __values); \
|
2014-06-25 11:24:53 +00:00
|
|
|
} while (0)
|
|
|
|
|
2019-03-31 21:56:48 +00:00
|
|
|
|
2014-06-25 11:24:53 +00:00
|
|
|
int virDomainCapsEnumSet(virDomainCapsEnumPtr capsEnum,
|
|
|
|
const char *capsEnumName,
|
|
|
|
size_t nvalues,
|
|
|
|
unsigned int *values);
|
|
|
|
void virDomainCapsEnumClear(virDomainCapsEnumPtr capsEnum);
|
|
|
|
|
2019-10-25 12:21:08 +00:00
|
|
|
char * virDomainCapsFormat(const virDomainCaps *caps);
|
2018-06-08 14:40:51 +00:00
|
|
|
|
2019-10-25 12:21:08 +00:00
|
|
|
int virDomainCapsDeviceDefValidate(const virDomainCaps *caps,
|
2019-04-04 17:09:18 +00:00
|
|
|
const virDomainDeviceDef *dev,
|
|
|
|
const virDomainDef *def);
|
|
|
|
|
2018-06-08 14:40:51 +00:00
|
|
|
void
|
|
|
|
virSEVCapabilitiesFree(virSEVCapability *capabilities);
|
2018-08-15 15:02:06 +00:00
|
|
|
|
2019-10-15 12:47:50 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSEVCapability, virSEVCapabilitiesFree);
|