mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-09 20:58:33 +03:00
qemu: Enforce ACPI, UEFI requirements
Depending on the architecture, requirements for ACPI and UEFI can be different; more specifically, while on x86 UEFI requires ACPI, on aarch64 it's the other way around. Enforce these requirements when validating the domain, and make the error message more accurate by mentioning that they're not necessarily applicable to all architectures. Several aarch64 test cases had to be tweaked because they would have failed the validation step otherwise.
This commit is contained in:
parent
560335c35c
commit
396ca36cb0
@ -9324,18 +9324,16 @@ qemuBuildRedirdevCommandLine(virLogManagerPtr logManager,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static void
|
||||||
qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
|
qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
|
||||||
virDomainDefPtr def,
|
virDomainDefPtr def)
|
||||||
virQEMUCapsPtr qemuCaps)
|
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
virDomainLoaderDefPtr loader = def->os.loader;
|
virDomainLoaderDefPtr loader = def->os.loader;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
int unit = 0;
|
int unit = 0;
|
||||||
|
|
||||||
if (!loader)
|
if (!loader)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
switch ((virDomainLoader) loader->type) {
|
switch ((virDomainLoader) loader->type) {
|
||||||
case VIR_DOMAIN_LOADER_TYPE_ROM:
|
case VIR_DOMAIN_LOADER_TYPE_ROM:
|
||||||
@ -9344,12 +9342,6 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_LOADER_TYPE_PFLASH:
|
case VIR_DOMAIN_LOADER_TYPE_PFLASH:
|
||||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI) &&
|
|
||||||
def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("ACPI must be enabled in order to use UEFI"));
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (loader->secure == VIR_TRISTATE_BOOL_YES) {
|
if (loader->secure == VIR_TRISTATE_BOOL_YES) {
|
||||||
virCommandAddArgList(cmd,
|
virCommandAddArgList(cmd,
|
||||||
@ -9387,10 +9379,7 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
cleanup:
|
|
||||||
virBufferFreeAndReset(&buf);
|
virBufferFreeAndReset(&buf);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -9827,8 +9816,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
|
|||||||
if (qemuBuildCpuCommandLine(cmd, driver, def, qemuCaps) < 0)
|
if (qemuBuildCpuCommandLine(cmd, driver, def, qemuCaps) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (qemuBuildDomainLoaderCommandLine(cmd, def, qemuCaps) < 0)
|
qemuBuildDomainLoaderCommandLine(cmd, def);
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (!migrateURI && !snapshot && qemuDomainAlignMemorySizes(def) < 0)
|
if (!migrateURI && !snapshot && qemuDomainAlignMemorySizes(def) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -2884,6 +2884,26 @@ qemuDomainDefValidate(const virDomainDef *def,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* On x86, UEFI requires ACPI */
|
||||||
|
if (def->os.loader &&
|
||||||
|
def->os.loader->type == VIR_DOMAIN_LOADER_TYPE_PFLASH &&
|
||||||
|
ARCH_IS_X86(def->os.arch) &&
|
||||||
|
def->features[VIR_DOMAIN_FEATURE_ACPI] != VIR_TRISTATE_SWITCH_ON) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("UEFI requires ACPI on this architecture"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* On aarch64, ACPI requires UEFI */
|
||||||
|
if (def->features[VIR_DOMAIN_FEATURE_ACPI] == VIR_TRISTATE_SWITCH_ON &&
|
||||||
|
def->os.arch == VIR_ARCH_AARCH64 &&
|
||||||
|
(!def->os.loader ||
|
||||||
|
def->os.loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("ACPI requires UEFI on this architecture"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (def->os.loader &&
|
if (def->os.loader &&
|
||||||
def->os.loader->secure == VIR_TRISTATE_BOOL_YES) {
|
def->os.loader->secure == VIR_TRISTATE_BOOL_YES) {
|
||||||
/* These are the QEMU implementation limitations. But we
|
/* These are the QEMU implementation limitations. But we
|
||||||
|
@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \
|
|||||||
-nodefconfig \
|
-nodefconfig \
|
||||||
-nodefaults \
|
-nodefaults \
|
||||||
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
||||||
|
-no-acpi \
|
||||||
-boot c \
|
-boot c \
|
||||||
-kernel /aarch64.kernel \
|
-kernel /aarch64.kernel \
|
||||||
-initrd /aarch64.initrd \
|
-initrd /aarch64.initrd \
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<acpi/>
|
|
||||||
<apic/>
|
<apic/>
|
||||||
<pae/>
|
<pae/>
|
||||||
<gic version='2'/>
|
<gic version='2'/>
|
||||||
|
@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \
|
|||||||
-nodefconfig \
|
-nodefconfig \
|
||||||
-nodefaults \
|
-nodefaults \
|
||||||
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
||||||
|
-no-acpi \
|
||||||
-boot c \
|
-boot c \
|
||||||
-drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \
|
-drive file=/aarch64.raw,format=raw,if=none,id=drive-virtio-disk0 \
|
||||||
-device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0
|
-device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
<type arch="aarch64" machine="virt">hvm</type>
|
<type arch="aarch64" machine="virt">hvm</type>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<acpi/>
|
|
||||||
<apic/>
|
<apic/>
|
||||||
<pae/>
|
<pae/>
|
||||||
</features>
|
</features>
|
||||||
|
@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \
|
|||||||
-nodefconfig \
|
-nodefconfig \
|
||||||
-nodefaults \
|
-nodefaults \
|
||||||
-monitor unix:/tmp/lib/domain--1-aarch64-vgpu/monitor.sock,server,nowait \
|
-monitor unix:/tmp/lib/domain--1-aarch64-vgpu/monitor.sock,server,nowait \
|
||||||
|
-no-acpi \
|
||||||
-device ioh3420,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
|
-device ioh3420,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,\
|
||||||
addr=0x1 \
|
addr=0x1 \
|
||||||
-device ioh3420,port=0x9,chassis=2,id=pci.2,bus=pcie.0,multifunction=on,\
|
-device ioh3420,port=0x9,chassis=2,id=pci.2,bus=pcie.0,multifunction=on,\
|
||||||
|
@ -7,9 +7,6 @@
|
|||||||
<os>
|
<os>
|
||||||
<type arch='aarch64' machine='virt'>hvm</type>
|
<type arch='aarch64' machine='virt'>hvm</type>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
|
||||||
<acpi/>
|
|
||||||
</features>
|
|
||||||
<cpu mode='custom' match='exact'>
|
<cpu mode='custom' match='exact'>
|
||||||
<model fallback='allow'>cortex-a57</model>
|
<model fallback='allow'>cortex-a57</model>
|
||||||
</cpu>
|
</cpu>
|
||||||
|
@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \
|
|||||||
-nodefconfig \
|
-nodefconfig \
|
||||||
-nodefaults \
|
-nodefaults \
|
||||||
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
||||||
|
-no-acpi \
|
||||||
-boot c \
|
-boot c \
|
||||||
-kernel /aarch64.kernel \
|
-kernel /aarch64.kernel \
|
||||||
-initrd /aarch64.initrd \
|
-initrd /aarch64.initrd \
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
<cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
|
<cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<acpi/>
|
|
||||||
<apic/>
|
<apic/>
|
||||||
<pae/>
|
<pae/>
|
||||||
</features>
|
</features>
|
||||||
|
@ -17,6 +17,7 @@ QEMU_AUDIO_DRV=none \
|
|||||||
-nodefaults \
|
-nodefaults \
|
||||||
-monitor unix:/tmp/lib/domain--1-aarch64-virt-default/monitor.sock,server,\
|
-monitor unix:/tmp/lib/domain--1-aarch64-virt-default/monitor.sock,server,\
|
||||||
nowait \
|
nowait \
|
||||||
|
-no-acpi \
|
||||||
-boot c \
|
-boot c \
|
||||||
-kernel /aarch64.kernel \
|
-kernel /aarch64.kernel \
|
||||||
-initrd /aarch64.initrd \
|
-initrd /aarch64.initrd \
|
||||||
|
@ -4,9 +4,6 @@
|
|||||||
<memory>1048576</memory>
|
<memory>1048576</memory>
|
||||||
<currentMemory>1048576</currentMemory>
|
<currentMemory>1048576</currentMemory>
|
||||||
<vcpu>1</vcpu>
|
<vcpu>1</vcpu>
|
||||||
<features>
|
|
||||||
<acpi/>
|
|
||||||
</features>
|
|
||||||
<cpu match='exact'>
|
<cpu match='exact'>
|
||||||
<model>cortex-a53</model>
|
<model>cortex-a53</model>
|
||||||
</cpu>
|
</cpu>
|
||||||
|
@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \
|
|||||||
-nodefconfig \
|
-nodefconfig \
|
||||||
-nodefaults \
|
-nodefaults \
|
||||||
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
||||||
|
-no-acpi \
|
||||||
-boot c \
|
-boot c \
|
||||||
-kernel /aarch64.kernel \
|
-kernel /aarch64.kernel \
|
||||||
-initrd /aarch64.initrd \
|
-initrd /aarch64.initrd \
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
<cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
|
<cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<acpi/>
|
|
||||||
<apic/>
|
<apic/>
|
||||||
<pae/>
|
<pae/>
|
||||||
</features>
|
</features>
|
||||||
|
@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \
|
|||||||
-nodefconfig \
|
-nodefconfig \
|
||||||
-nodefaults \
|
-nodefaults \
|
||||||
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
||||||
|
-no-acpi \
|
||||||
-boot c \
|
-boot c \
|
||||||
-kernel /aarch64.kernel \
|
-kernel /aarch64.kernel \
|
||||||
-initrd /aarch64.initrd \
|
-initrd /aarch64.initrd \
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
<cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
|
<cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<acpi/>
|
|
||||||
<apic/>
|
<apic/>
|
||||||
<pae/>
|
<pae/>
|
||||||
</features>
|
</features>
|
||||||
|
@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \
|
|||||||
-nodefconfig \
|
-nodefconfig \
|
||||||
-nodefaults \
|
-nodefaults \
|
||||||
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
||||||
|
-no-acpi \
|
||||||
-boot c \
|
-boot c \
|
||||||
-kernel /aarch64.kernel \
|
-kernel /aarch64.kernel \
|
||||||
-initrd /aarch64.initrd \
|
-initrd /aarch64.initrd \
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<acpi/>
|
|
||||||
<apic/>
|
<apic/>
|
||||||
<pae/>
|
<pae/>
|
||||||
</features>
|
</features>
|
||||||
|
@ -16,6 +16,7 @@ QEMU_AUDIO_DRV=none \
|
|||||||
-nodefconfig \
|
-nodefconfig \
|
||||||
-nodefaults \
|
-nodefaults \
|
||||||
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
-monitor unix:/tmp/lib/domain--1-aarch64test/monitor.sock,server,nowait \
|
||||||
|
-no-acpi \
|
||||||
-boot c \
|
-boot c \
|
||||||
-kernel /aarch64.kernel \
|
-kernel /aarch64.kernel \
|
||||||
-initrd /aarch64.initrd \
|
-initrd /aarch64.initrd \
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
<cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
|
<cmdline>earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait</cmdline>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<acpi/>
|
|
||||||
<apic/>
|
<apic/>
|
||||||
<pae/>
|
<pae/>
|
||||||
</features>
|
</features>
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<acpi/>
|
|
||||||
<apic/>
|
<apic/>
|
||||||
<pae/>
|
<pae/>
|
||||||
<gic version='2'/>
|
<gic version='2'/>
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
<type arch='aarch64' machine='virt'>hvm</type>
|
<type arch='aarch64' machine='virt'>hvm</type>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<acpi/>
|
|
||||||
<gic version='2'/>
|
<gic version='2'/>
|
||||||
</features>
|
</features>
|
||||||
<cpu mode='custom' match='exact' check='none'>
|
<cpu mode='custom' match='exact' check='none'>
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<acpi/>
|
|
||||||
<apic/>
|
<apic/>
|
||||||
<pae/>
|
<pae/>
|
||||||
<gic version='2'/>
|
<gic version='2'/>
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
<boot dev='hd'/>
|
<boot dev='hd'/>
|
||||||
</os>
|
</os>
|
||||||
<features>
|
<features>
|
||||||
<acpi/>
|
|
||||||
<apic/>
|
<apic/>
|
||||||
<pae/>
|
<pae/>
|
||||||
<gic version='2'/>
|
<gic version='2'/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user