mirror of https://gitee.com/openkylin/libvirt.git
conf: introduce 'msrs' feature
Introduce the 'msrs' feature element that controls Model Specific Registers related behaviour. At this moment it allows only single tunable attribute "unknown": <msrs unknown='ignore|fault'/> Which tells hypervisor to ignore accesses to unimplemented Model Specific Registers. The only user of that for now is going to be the bhyve driver. Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
ac5d4e6cb0
commit
b71de701b8
|
@ -4997,6 +4997,9 @@
|
|||
<ref name="featurestate"/>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<ref name="msrs"/>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
|
@ -5245,6 +5248,17 @@
|
|||
</element>
|
||||
</define>
|
||||
|
||||
<define name="msrs">
|
||||
<element name="msrs">
|
||||
<attribute name="unknown">
|
||||
<choice>
|
||||
<value>ignore</value>
|
||||
<value>fault</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name="address">
|
||||
<element name="address">
|
||||
<choice>
|
||||
|
|
|
@ -157,6 +157,7 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST,
|
|||
"vmcoreinfo",
|
||||
"htm",
|
||||
"nested-hv",
|
||||
"msrs",
|
||||
);
|
||||
|
||||
VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST,
|
||||
|
@ -186,6 +187,11 @@ VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST,
|
|||
"hidden",
|
||||
);
|
||||
|
||||
VIR_ENUM_IMPL(virDomainMsrsUnknown, VIR_DOMAIN_MSRS_UNKNOWN_LAST,
|
||||
"ignore",
|
||||
"fault",
|
||||
);
|
||||
|
||||
VIR_ENUM_IMPL(virDomainCapsFeature, VIR_DOMAIN_CAPS_FEATURE_LAST,
|
||||
"audit_control",
|
||||
"audit_write",
|
||||
|
@ -20365,6 +20371,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||
case VIR_DOMAIN_FEATURE_PRIVNET:
|
||||
case VIR_DOMAIN_FEATURE_HYPERV:
|
||||
case VIR_DOMAIN_FEATURE_KVM:
|
||||
case VIR_DOMAIN_FEATURE_MSRS:
|
||||
def->features[val] = VIR_TRISTATE_SWITCH_ON;
|
||||
break;
|
||||
|
||||
|
@ -20653,6 +20660,26 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||
def->tseg_specified = rv;
|
||||
}
|
||||
|
||||
if (def->features[VIR_DOMAIN_FEATURE_MSRS] == VIR_TRISTATE_SWITCH_ON) {
|
||||
if ((node = virXPathNode("./features/msrs", ctxt)) == NULL)
|
||||
goto error;
|
||||
|
||||
if (!(tmp = virXMLPropString(node, "unknown"))) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("missing 'unknown' attribute for feature '%s'"),
|
||||
virDomainFeatureTypeToString(VIR_DOMAIN_FEATURE_MSRS));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((def->msrs_features[VIR_DOMAIN_MSRS_UNKNOWN] = virDomainMsrsUnknownTypeFromString(tmp)) < 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown 'unknown' value '%s'"),
|
||||
tmp);
|
||||
goto error;
|
||||
}
|
||||
VIR_FREE(tmp);
|
||||
}
|
||||
|
||||
if ((n = virXPathNodeSet("./features/capabilities/*", ctxt, &nodes)) < 0)
|
||||
goto error;
|
||||
|
||||
|
@ -22713,6 +22740,9 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
|
|||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FEATURE_MSRS:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FEATURE_LAST:
|
||||
break;
|
||||
}
|
||||
|
@ -28768,6 +28798,14 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_FEATURE_MSRS:
|
||||
if (def->features[i] != VIR_TRISTATE_SWITCH_ON)
|
||||
break;
|
||||
|
||||
virBufferAsprintf(buf, "<msrs unknown='%s'/>\n",
|
||||
virDomainMsrsUnknownTypeToString(def->msrs_features[VIR_DOMAIN_MSRS_UNKNOWN]));
|
||||
break;
|
||||
|
||||
/* coverity[dead_error_begin] */
|
||||
case VIR_DOMAIN_FEATURE_LAST:
|
||||
break;
|
||||
|
|
|
@ -1782,6 +1782,7 @@ typedef enum {
|
|||
VIR_DOMAIN_FEATURE_VMCOREINFO,
|
||||
VIR_DOMAIN_FEATURE_HTM,
|
||||
VIR_DOMAIN_FEATURE_NESTED_HV,
|
||||
VIR_DOMAIN_FEATURE_MSRS,
|
||||
|
||||
VIR_DOMAIN_FEATURE_LAST
|
||||
} virDomainFeature;
|
||||
|
@ -1813,6 +1814,19 @@ typedef enum {
|
|||
VIR_DOMAIN_KVM_LAST
|
||||
} virDomainKVM;
|
||||
|
||||
typedef enum {
|
||||
VIR_DOMAIN_MSRS_UNKNOWN = 0,
|
||||
|
||||
VIR_DOMAIN_MSRS_LAST
|
||||
} virDomainMsrs;
|
||||
|
||||
typedef enum {
|
||||
VIR_DOMAIN_MSRS_UNKNOWN_IGNORE = 0,
|
||||
VIR_DOMAIN_MSRS_UNKNOWN_FAULT,
|
||||
|
||||
VIR_DOMAIN_MSRS_UNKNOWN_LAST
|
||||
} virDomainMsrsUnknown;
|
||||
|
||||
typedef enum {
|
||||
VIR_DOMAIN_CAPABILITIES_POLICY_DEFAULT = 0,
|
||||
VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW,
|
||||
|
@ -2466,6 +2480,7 @@ struct _virDomainDef {
|
|||
int caps_features[VIR_DOMAIN_CAPS_FEATURE_LAST];
|
||||
int hyperv_features[VIR_DOMAIN_HYPERV_LAST];
|
||||
int kvm_features[VIR_DOMAIN_KVM_LAST];
|
||||
int msrs_features[VIR_DOMAIN_MSRS_LAST];
|
||||
unsigned int hyperv_spinlocks;
|
||||
virGICVersion gic_version;
|
||||
virDomainHPTResizing hpt_resizing;
|
||||
|
@ -3477,6 +3492,7 @@ VIR_ENUM_DECL(virDomainGraphicsSpiceMouseMode);
|
|||
VIR_ENUM_DECL(virDomainGraphicsVNCSharePolicy);
|
||||
VIR_ENUM_DECL(virDomainHyperv);
|
||||
VIR_ENUM_DECL(virDomainKVM);
|
||||
VIR_ENUM_DECL(virDomainMsrsUnknown);
|
||||
VIR_ENUM_DECL(virDomainRNGModel);
|
||||
VIR_ENUM_DECL(virDomainRNGBackend);
|
||||
VIR_ENUM_DECL(virDomainTPMModel);
|
||||
|
|
|
@ -4021,6 +4021,7 @@ qemuDomainDefValidateFeatures(const virDomainDef *def,
|
|||
case VIR_DOMAIN_FEATURE_PMU:
|
||||
case VIR_DOMAIN_FEATURE_VMPORT:
|
||||
case VIR_DOMAIN_FEATURE_VMCOREINFO:
|
||||
case VIR_DOMAIN_FEATURE_MSRS:
|
||||
case VIR_DOMAIN_FEATURE_LAST:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue