QEMU boot fails with "Panic: EL2 exception"

79 views
Skip to first unread message

Jeehoon Kang

unread,
Jun 16, 2019, 9:04:27 AM6/16/19
to Hafnium
From the commit b208b4ab0fc314c800ef0d3d3f9cd4e31443212a (`master~1`, currently),


The image fails to boot for my machine (AMD Ryzen 2700X, Archlinux):

```
$ qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -machine virtualization=true -kernel out/reference/qemu_aarch64_clang/hafnium.bin -initrd initrd.img -append "rdinit=/sbin
/init"
Initialising hafnium
Found PSCI version: 0x2
text: 0x40001000 - 0x4000b318
rodata: 0x4000c000 - 0x4000ce80
data: 0x4000d000 - 0x40078e70
Supported bits in physical address: 44
Stage 2 has 4 page table levels with 1 pages at the root.
Memory range:  0x40000000 - 0x47ffffff
Ramdisk range: 0x44000000 - 0x4550d7ff
Copying primary to 0000000040280000
Loading vmlinuz
Kernel is larger than available memory
Loading vmlinuz
Kernel is larger than available memory
Hafnium initialisation completed
Unknown current sync exception pc=0x40002af0, esr=0x2000000, ec=0x0
Panic: EL2 exception
```


I created vmlinuz and a busybox userland vmfrom the repo's documentation.

My `vms.txt` is:
```
2097152 2 vmlinuz
2097152 4 vmlinuz
```


Did anyone experienced the same problem with mine?  Thank you in advance!

Best,
Jeehoon

Andrew Walbran

unread,
Jun 17, 2019, 5:46:54 AM6/17/19
to Jeehoon Kang, Hafnium
So firstly, you're trying to load a kernel image larger than the amount of memory you're giving to each secondary VM, so that's not going to work. Secondly, Linux is not going to work in a secondary VM anyway, as it doesn't provide most of the hardware Linux expects. You can only run Linux in the primary VM.

We should probably fail in a slightly nicer way though, so I'll look into that.

If you want to write your own secondary VM you can see https://hafnium-review.googlesource.com/c/hafnium/+/4720 for a simple example. We are working on getting Trusty running as a secondary VM and have it mostly working, but not all the code is in yet.

--
You received this message because you are subscribed to the Google Groups "Hafnium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hafnium-discu...@googlegroups.com.
To post to this group, send email to hafnium...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/hafnium-discuss/29d9e401-4b1d-4c36-8ea8-7c7ed1144908%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew Walbran

unread,
Jun 17, 2019, 6:54:29 AM6/17/19
to Jeehoon Kang, Hafnium
Hmm, actually it looks like the current sync exception you are seeing is unrelated to the secondary VMs, as those that fail to load are just ignored. Do you get the same error if you remove both of them from vms.txt? Do you have anything else in there?

If you can send my your initrd.img and vms.txt I'll try to reproduce it.

Jeehoon Kang

unread,
Jun 17, 2019, 9:52:20 PM6/17/19
to Hafnium
Thank you for prompt reply.  I tried again with empty `vms.txt`, but it fails with the same error message.
My `initrd.img` (generated from empty `vms.txt`) is here: https://cp.kaist.ac.kr/breaking-bad/initrd.img

Thanks,
Jeehoon

On Monday, June 17, 2019 at 7:54:29 PM UTC+9, Andrew Walbran wrote:
Hmm, actually it looks like the current sync exception you are seeing is unrelated to the secondary VMs, as those that fail to load are just ignored. Do you get the same error if you remove both of them from vms.txt? Do you have anything else in there?

If you can send my your initrd.img and vms.txt I'll try to reproduce it.

On Mon, 17 Jun 2019 at 10:46, Andrew Walbran <qwa...@google.com> wrote:
So firstly, you're trying to load a kernel image larger than the amount of memory you're giving to each secondary VM, so that's not going to work. Secondly, Linux is not going to work in a secondary VM anyway, as it doesn't provide most of the hardware Linux expects. You can only run Linux in the primary VM.

We should probably fail in a slightly nicer way though, so I'll look into that.

If you want to write your own secondary VM you can see https://hafnium-review.googlesource.com/c/hafnium/+/4720 for a simple example. We are working on getting Trusty running as a secondary VM and have it mostly working, but not all the code is in yet.

To unsubscribe from this group and stop receiving emails from it, send an email to hafnium...@googlegroups.com.

Andrew Scull

unread,
Jun 20, 2019, 7:01:01 AM6/20/19
to Jeehoon Kang, Hafnium
Please check whether you can run the test suite (instructions in the getting started doc linked from readme) starting from a clean repo and a clean build.

If this succeeds and you still have a problem with your custom initrd, please resolve the PC of the EL2 exception against the hafnium.elf file in your out directory.

To unsubscribe from this group and stop receiving emails from it, send an email to hafnium-discu...@googlegroups.com.

To post to this group, send email to hafnium...@googlegroups.com.

Andrew Scull

unread,
Jun 27, 2019, 9:54:29 AM6/27/19
to Jeehoon Kang, Hafnium
We got to reproduce this and tracked it down to it the GICv3 registers that need to be enabled in qemu. You'll want to update `-M virt` to `-M virt,gic_version=3` to avoid the exception. We'll be updating the docs to reflect this.
Reply all
Reply to author
Forward
0 new messages