Bug 1729604 - weirdness with firmware='efi' and aarch64
Summary: weirdness with firmware='efi' and aarch64
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Michal Privoznik
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2019-07-12 19:49 UTC by Cole Robinson
Modified: 2019-09-12 17:57 UTC (History)
5 users (show)

Fixed In Version: libvirt-5.6.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-07-15 11:26:47 UTC

Attachments (Terms of Use)

Description Cole Robinson 2019-07-12 19:49:27 UTC
I'm playing with firmware='efi', with pending fedora edk2 packages, inprogress here: https://koji.fedoraproject.org/koji/buildinfo?buildID=1312544

virt-install from git with this command line: ./virt-install --os-variant fedora29 --disk none --transient --destroy-on-exit --boot firmware=efi --arch aarch64 --debug --rng none --channel none --network none

Generates this XML:
<domain type="qemu">
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://fedoraproject.org/fedora/29"/>
  <os firmware="efi">
    <type arch="aarch64" machine="virt">hvm</type>
    <loader readonly="yes" type="pflash">/usr/share/AAVMF/AAVMF_CODE.fd</loader>
    <boot dev="hd"/>
  <cpu mode="custom" match="exact">
  <clock offset="utc"/>
    <controller type="usb" index="0" model="qemu-xhci" ports="15"/>
    <console type="pty"/>
    <memballoon model="virtio"/>

Which raises this libvirt error: unsupported configuration: ACPI requires UEFI on this architecture

Which comes from this check in qemu_domain.c

    /* 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;                                                            

So virt-install is setting acpi=True, but not setting loader=pflash, and this fails. But it's weird for a few reasons

* qemu_command.c doesn't even have any way to turn off acpi for aarch64, so whether acpi is specified or not doesn't have any command line effect AFAICT.
* If I set --features acpi=off, the VM starts fine, and type='pflash' seems to get filled in by default anyways
* If I change the XML to have this:

  <os firmware="efi">
    <type arch="aarch64" machine="virt">hvm</type>
    <loader type="pflash"/>
    <boot dev="hd"/>

libvirt _still_ throws the same above error. I didn't dig into it more than that though. Basically via the XML I can't seem to get aarch64 firmware=efi to work with <acpi/> specified

Comment 1 Michal Privoznik 2019-07-13 07:30:23 UTC
Yes, this is a libvirt issue. The check needs to be relaxed. Patch proposed here:


Comment 2 Michal Privoznik 2019-07-15 11:26:47 UTC
Pushed upstream:

commit 7711a7346a990810603c0715d3c6ba922eb88c51
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Sat Jul 13 09:17:06 2019 +0200
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Mon Jul 15 13:24:09 2019 +0200

    qemu: Relax os.loader->type check when validating domain
    When validating a domain among all the checks there are two that
    concern VIR_DOMAIN_LOADER_TYPE_PFLASH specifically. The first
    check ensures that on x86 ACPI is enabled when UEFI is requested,
    the second ensures that UEFI is used when ACPI is requested on
    aarch64. However, check for UEFI is done by plain comparison of
    def->os.loader->type which is insufficient because we have
    def->os.firmware too.
    NB, this wouldn't be a problem for active domain, because on
    startup process def->os.loader->type gets filled by
    qemuFirmwareEnableFeatures(), but that's not the case for
    inactive domains.
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1729604
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
    Reviewed-by: Andrea Bolognani <abologna@redhat.com>


Note You need to log in before you can comment on or make changes to this bug.