/*
* Currently libxl only allows specifying the type of BIOS.
- * If the type is PFLASH, we assume OVMF and set libxl_bios_type
+ * If automatic firmware selection is enabled or the loader
+ * type is PFLASH, we assume OVMF and set libxl_bios_type
* to LIBXL_BIOS_TYPE_OVMF. The path to the OVMF firmware is
* configured when building Xen using '--with-system-ovmf='. If
* not specified, LIBXL_FIRMWARE_DIR/ovmf.bin is used. In the
* future, Xen will support a user-specified firmware path. See
* https://lists.xenproject.org/archives/html/xen-devel/2016-03/msg01628.html
*/
- if (virDomainDefHasOldStyleUEFI(def))
+ if (def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_EFI) {
+ if (def->os.loader == NULL)
+ def->os.loader = g_new0(virDomainLoaderDef, 1);
+ if (def->os.loader->path == NULL)
+ def->os.loader->path = g_strdup(cfg->firmwares[0]->name);
+ if (def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_NONE)
+ def->os.loader->type = VIR_DOMAIN_LOADER_TYPE_PFLASH;
+ if (def->os.loader->readonly == VIR_TRISTATE_BOOL_ABSENT)
+ def->os.loader->readonly = VIR_TRISTATE_BOOL_YES;
b_info->u.hvm.bios = LIBXL_BIOS_TYPE_OVMF;
+ def->os.firmware = VIR_DOMAIN_OS_DEF_FIRMWARE_NONE;
+ } else if (virDomainDefHasOldStyleUEFI(def)) {
+ b_info->u.hvm.bios = LIBXL_BIOS_TYPE_OVMF;
+ }
if (def->emulator) {
if (!virFileExists(def->emulator)) {
{
libxlDriverPrivate *driver = opaque;
g_autoptr(libxlDriverConfig) cfg = libxlDriverConfigGet(driver);
+ bool reqSecureBoot = false;
if (!virCapabilitiesDomainSupported(cfg->caps, def->os.type,
def->os.arch,
return -1;
/* Xen+ovmf does not support secure boot */
+ if (def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_EFI) {
+ if (def->os.firmwareFeatures &&
+ def->os.firmwareFeatures[VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_SECURE_BOOT])
+ reqSecureBoot = true;
+ }
if (virDomainDefHasOldStyleUEFI(def)) {
if (def->os.loader &&
- def->os.loader->secure == VIR_TRISTATE_BOOL_YES) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Secure boot is not supported on Xen"));
- return -1;
- }
+ def->os.loader->secure == VIR_TRISTATE_BOOL_YES)
+ reqSecureBoot = true;
+ }
+ if (reqSecureBoot) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Secure boot is not supported on Xen"));
+ return -1;
}
return 0;
.devicesPostParseCallback = libxlDomainDeviceDefPostParse,
.domainPostParseCallback = libxlDomainDefPostParse,
.domainValidateCallback = libxlDomainDefValidate,
- .features = VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING,
+
+ .features = VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT |
+ VIR_DOMAIN_DEF_FEATURE_NET_MODEL_STRING,
};