From: Alexey G <x1917x@gmail.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "Andri Möll" <andri@dot.ee>, "Jan Beulich" <JBeulich@suse.com>,
xen-devel@lists.xen.org
Subject: Re: "MMIO emulation failed" from booting OVMF on Xen v4.9.0
Date: Thu, 17 Aug 2017 23:53:18 +1000 [thread overview]
Message-ID: <20170817235318.00002269@gmail.com> (raw)
In-Reply-To: <4b962670-1a7a-d09d-0dec-b03dc4cdfbed@citrix.com>
On Thu, 17 Aug 2017 11:56:06 +0100
Andrew Cooper <andrew.cooper3@citrix.com> wrote:
> On 17/08/17 09:49, Jan Beulich wrote:
> >>>> On 16.08.17 at 20:47, <andri@dot.ee> wrote:
> >> Hey,
> >>
> >> As per Andrew [Cooper]'s suggestion, writing here instead of #xen on
> >> Freenode.
> >>
> >> I'm trying out Xen (4.9.0) with OVMF (r21243.3858b4a1ff-1) and having
> >> it crash right on boot both with the 32b and 64b OVMF binaries. This
> >> is on Arch Linux, AMD Ryzen on a X370 motherboard.
> >>
> >> Given the following minimal VM declaration:
> >>> builder = "hvm"
> >>> maxmem = 512
> >>> memory = 512
> >>> vcpus = 1
> >>> on_poweroff = "destroy"
> >>> on_reboot = "destroy"
> >>> on_crash = "destroy"
> >>> bios = "ovmf"
> >>> device_model_version = "qemu-xen"
> >>> bios_path_override = "/usr/share/ovmf/ovmf_code_ia32.bin"
> >> and running it with `xl create vm.cfg`, I see it crash while booting
> >> with the following displayed by `xl dmesg`:
> >>
> >>> (XEN) MMIO emulation failed: d1v0 16bit @ f000:0000ff54 -> 66 ea 5c
> >>> ff ff ff 10 00 b8 40 06 00 00 0f 22
> >>> (XEN) d1v0 Triple fault - invoking HVM shutdown action 1
> >> I've run the hypervisor with `guest_loglvl=all` for more output and
> >> attached it here and uploaded it at
> >> https://gist.github.com/moll/a46dffc7466ced93a0365a6916a4db96 in case
> >> the file doesn't go through.
> > Looks to be an ordinary 32-bit far branch after having switched to
> > protected mode. I'm afraid without seeing the involved GDT entry
> > there's little chance of guessing what may go wrong in this case.
> > One question is why the emulator is being invoked in the first place:
> > Since you've truncated the log at the beginning, it's impossible to
> > tell whether you're using old Intel hardware lacking the Unrestricted
> > Guest feature.
>
> (As included above), This is on Arch Linux, AMD Ryzen on a X370
> motherboard.
>
> I can't work out why we hitting the MMIO path in this case,
> independently of why the emulation of this instruction failed.
Seems like the root cause of the issue is supplying ovmf image of
non-aligned size.
(OVMF_MAXOFFSET is 0FFFFFh, bios_length is 1920Kb in our case)
uint64_t addr = OVMF_END - ((bios_length + OVMF_MAXOFFSET) & ~OVMF_MAXOFFSET);
uint64_t ovmf_end = addr + bios_length;
-- this code expects bios_length to be aligned to 1MB boundary, otherwise
it won't be written next to 4Gb boundary. In this case bios image
actually written to the address (4GB - 2MB), while its length is less than
2MB.
Due to this, high memory copy of the BIOS appears shifted down. And
mem_hole_populate_ram() leaves gap between (4GB - 2MB + 1920Kb) and 4GB. So
when it jumps from 16bit F-seg to PM32 linear address space via jmp far
10h:0FFFFFF5Ch, there is no RAM mapped here, hence MMIO.
A proper OVMF build (with ovmf_code_ia32.bin and ovmf_vars_ia32.bin
merging) will likely fix the issue, but above code looks a bit strange
anyway -- it does 1MB alignment, but if there was actual alignment, the
BIOS will be loaded to the wrong address, not near 4GB boundary.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-08-17 13:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 18:47 "MMIO emulation failed" from booting OVMF on Xen v4.9.0 Andri Möll
2017-08-17 8:49 ` Jan Beulich
2017-08-17 10:56 ` Andrew Cooper
2017-08-17 13:53 ` Alexey G [this message]
2017-08-17 10:51 ` Anthony PERARD
2017-08-18 15:55 ` Konrad Rzeszutek Wilk
2017-08-18 16:24 ` Andrew Cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170817235318.00002269@gmail.com \
--to=x1917x@gmail.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=andri@dot.ee \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.