-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable HYP mode on RPi-2 when booting #369
Comments
Ping? ;-) Would it be possible to at least get a status on this, even if it takes some time to solve? Thanks! :-) |
You can always use your own startup code. See: |
Oh, someone's already working on this! Great! Thanks! :-) |
BTW, it is safe to leave the CPU in HYP mode, even when booting a non-virtualisation-aware Linux kernel, as the Linux kernel has historically always issued a switch to SVC at boot time. See this excellent LWN.net article: https://lwn.net/Articles/557132/ . Quoting:
Regards. |
If you have a patched version of the startup code linked in the forum that leaves the processor in HYP mode, I'd be happy to consider including it. |
Looking forward to see the bootloader running the kernel in HYP mode. |
++, I'm excited to see this land as well! |
Do we have source code for the bootcode.bin ? , I have experience and I could look at this, even if I used RE to find and modify when the processor flags are changed, it seems that I couldn't redistribute the binary due to the license?, that's not cool |
bootcode.bin is the GPU bootcode - nothing to do with the arm startup code. |
@mangelajo any progressive on this one? It looks like it is a wanted feature :-) |
I've written about a technique to enable HYP booting with u-boot on the Pi2 if that helps: |
@TimJDFletcher This is very interresting! I indeed had a look to U-Boot, but I don't personally see the point of using such a "big" bootloader, when all I need is running a kernel. What is nice about U-Boot is that it already has support for booting various boards with HYP mode enabled, and the sole reason I looked at it: to see what they were doing that was missing on the RPi-2 (but I have to admit it is striding off limits to my understanding at some points! ;-) ). What is very interesting about your post, however, is this rpi2-hyp-boot. That is very promising! Do you think this is something that may land into U-Boot itself at some point? Thanks! :-) Regards. |
rpi2-hyp-boot is separate to u-boot and can be used without u-boot just by glueing it on the front of the kernel image. I lifted it from https://github.com/slp/rpi2-hyp-boot documented here: http://blog.flexvdi.es//?p=139 My hope is that u-boot picks this up and includes in it the RPi boot loader, I can see that Raspbian might even want to use it. The down side to this is that QEMU on the Pi is finicky due to IRQ routing so this is likely to be a niche feature at best. I have various embedded systems that use u-boot and find it useful as a boot loaded, especially as I have a serial console but no keyboard etc on my Pi. |
How useful would it be to enable HYP mode (like https://github.com/slp/rpi2-hyp-boot/blob/master/rpi2-hyp-boot.S does) in the default boot code that runs before kernel starts? I've have tested this before and it seems to cause no observable change in behaviour for linux. |
Lots of background from the LWM article linked above https://lwn.net/Articles/557132/ Basic answer is that since 3.6 the kernel is aware of HYP mode and will switch out of it automatically and transparently. Another good selling point for the Pi2 is that it's the cheapest KVM capable ARM board by a fairly long way. |
It looks like a desirable feature, and if the standard kernel does indeed switch to SVC mode (which it appears to do here) then it should be transparent to most users. |
Yes, that would be a good thing. As I already mentioned (and others have also confirmed), the kernel explicitly does a switch to SVC very early, and does not care to be started in HYP mode. Of course, this requires at least a 3.6 kernel, but I would take for granted that the RPi2 will always boot such a kernel. Thanks! ;-) |
@popcornmix Sounds good, let's HYP! ;) |
kernel: config: Add CONFIG_UHID See: raspberrypi/linux#1148 firmware: gencmd: Add ability to dump display lists See: #407 firmware: arm_loader: Enable hypervisor mode and modify common startup code for 2836 See: #369
kernel: config: Add CONFIG_UHID See: raspberrypi/linux#1148 firmware: gencmd: Add ability to dump display lists See: raspberrypi/firmware#407 firmware: arm_loader: Enable hypervisor mode and modify common startup code for 2836 See: raspberrypi/firmware#369
Can you test latest rpi-update firmware? |
Hypervisor seems OK, but bcm2709_boot_secondary is now reporting errors despite the CPUs coming online anyway? Confirmed that this change is causing the error - here's from the last firmware push:
|
kernel: config: Add CONFIG_CRYPTO_USER_API_SKCIPHER See: https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=121892&p=824204&hilit=cryptsetup#p824204 kernel: config: Add options for supporting openlabs 802.15.4 radio See: raspberrypi/linux#1151 firmware: arm_loader: Add clear of polled register so linux doesn't report a timeout in bcm2709_boot_secondary See: #369 firmware: arm_loader: Fix HAT probing to always restore the original state See: raspberrypi/linux#1144
kernel: config: Add CONFIG_CRYPTO_USER_API_SKCIPHER See: https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=121892&p=824204&hilit=cryptsetup#p824204 kernel: config: Add options for supporting openlabs 802.15.4 radio See: raspberrypi/linux#1151 firmware: arm_loader: Add clear of polled register so linux doesn't report a timeout in bcm2709_boot_secondary See: raspberrypi/firmware#369 firmware: arm_loader: Fix HAT probing to always restore the original state See: raspberrypi/linux#1144
@P33M can you try with latest rpi-update code. |
I just did and not sure if it's related but I updated yesterday things worked fine, updated today and now when I run chromium-browser I get
Still trying to debug just wanted to report it incase you knew and it was related to this kernel update |
@TheSin- |
okay I'll try both thanks, don't want to spam this thread, just been following it and noticed this issue directly after updating to the latest firmware git checkout. I'll use google for 4.1.10 and try the older elf/dat files see if it helps. |
@popcornmix terribly embarrassed, somehow my config.txt and cmdline.txt got lost, please disregard everything I posted here, 4.1.10 and the new firmware both work fine for me now that I fixed that issue. |
As far as I can tell from disassembling the latest VC-FW-provided ARM boot stub, the system now does boot in HYP mode. Can this bug be closed? |
Indeed, Linux now reports that all CPUs were booted inHYP mode:
Closing this bug. Thanks! :-) |
kernel: config: Add CONFIG_UHID See: raspberrypi/linux#1148 firmware: gencmd: Add ability to dump display lists See: raspberrypi#407 firmware: arm_loader: Enable hypervisor mode and modify common startup code for 2836 See: raspberrypi#369
kernel: config: Add CONFIG_CRYPTO_USER_API_SKCIPHER See: https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=121892&p=824204&hilit=cryptsetup#p824204 kernel: config: Add options for supporting openlabs 802.15.4 radio See: raspberrypi/linux#1151 firmware: arm_loader: Add clear of polled register so linux doesn't report a timeout in bcm2709_boot_secondary See: raspberrypi#369 firmware: arm_loader: Fix HAT probing to always restore the original state See: raspberrypi/linux#1144
Hello!
The Raspberry Pi 2 has a Cortex-A7. This processor has the virtualisation extensions:
Both ARM and Wikipedia agree that Cortex-A7 has hardware virtualisation:
https://en.wikipedia.org/wiki/ARM_Cortex-A7
http://www.arm.com/products/processors/cortex-a/cortex-a7.php
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0464f/BABHJJBC.html
Unfortunately, virtualisation is not usable, as the bootloader disables HYP mode before booting the kernel:
which makes it impossible to use virtualisation, even though the processor is supposedly capable.
Would it be possible to keep the CPU in HYP mode prior to booting the OS (linux or whatever), please?
Thanks! :-)
The text was updated successfully, but these errors were encountered: