Summary: | 13-CURRENT armv7 fails to boot under QEMU | ||
---|---|---|---|
Product: | Base System | Reporter: | Edward Tomasz Napierala <trasz> |
Component: | arm | Assignee: | Mark Johnston <markj> |
Status: | Closed FIXED | ||
Severity: | Affects Only Me | CC: | emaste, lwhsu, markj |
Priority: | --- | ||
Version: | CURRENT | ||
Hardware: | Any | ||
OS: | Any |
Description
Edward Tomasz Napierala
2020-11-16 15:13:56 UTC
Trying to debug this now. We hang when enabling the MMU, in init_mmu() in arm's locore. The problem is that u-boot or QEMU, not sure which, is leaving TTBCR.EAE set for some reason. This is ARM's PAE extension, implemented by the default CPU for the "virt" board. We don't set up page tables for PAE mode though, so the kernel crashes when the MMU is enabled. Clearing TTBCR first fixes the problem, though now we panic during boot on what looks like an unaligned data access in the UDP code. A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e9552d8b45d67ca44d91b3ec09c91253e7e99b28 commit e9552d8b45d67ca44d91b3ec09c91253e7e99b28 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2022-08-05 20:21:09 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2022-08-05 20:21:09 +0000 arm: Clear TTBCR before enabling the MMU Upon reset, this register is supposed to have a value of zero. But when booting certain v7 CPUs in QEMU, we enter the kernel with several bits set, including the EAE bit, which enables ARM's PAE extension. I'm not sure if QEMU is setting it or if it's the uboot loader. Because FreeBSD doesn't implement that extension and uses regular 32-bit page tables, the kernel hangs immediately after enabling the MMU. Just clear everything in TTBCR before enabling the MMU, to match the reset value. FreeBSD doesn't toggle anything in that register. PR: 251187 Reviewed by: imp MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D36041 sys/arm/arm/locore-v6.S | 7 +++++++ 1 file changed, 7 insertions(+) A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=363d4b3b42c1d5ec9a2543a0d1f8068cd7f8b87f commit 363d4b3b42c1d5ec9a2543a0d1f8068cd7f8b87f Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2022-08-05 20:21:09 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2022-08-19 11:54:14 +0000 arm: Clear TTBCR before enabling the MMU Upon reset, this register is supposed to have a value of zero. But when booting certain v7 CPUs in QEMU, we enter the kernel with several bits set, including the EAE bit, which enables ARM's PAE extension. I'm not sure if QEMU is setting it or if it's the uboot loader. Because FreeBSD doesn't implement that extension and uses regular 32-bit page tables, the kernel hangs immediately after enabling the MMU. Just clear everything in TTBCR before enabling the MMU, to match the reset value. FreeBSD doesn't toggle anything in that register. PR: 251187 Reviewed by: imp Sponsored by: The FreeBSD Foundation (cherry picked from commit e9552d8b45d67ca44d91b3ec09c91253e7e99b28) sys/arm/arm/locore-v6.S | 7 +++++++ 1 file changed, 7 insertions(+) |