Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/38534 )
Change subject: tmb/emulation/qemu-aarch64: Add MMU support ......................................................................
tmb/emulation/qemu-aarch64: Add MMU support
Enable MMU in bootblock.
Change-Id: Ifaed9d3cc11520f180a732d51adce634621b5844 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/mainboard/emulation/qemu-aarch64/Makefile.inc A src/mainboard/emulation/qemu-aarch64/bootblock.c M src/mainboard/emulation/qemu-aarch64/memlayout.ld 3 files changed, 35 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/34/38534/1
diff --git a/src/mainboard/emulation/qemu-aarch64/Makefile.inc b/src/mainboard/emulation/qemu-aarch64/Makefile.inc index dc0e9f4..4d5f2bd 100644 --- a/src/mainboard/emulation/qemu-aarch64/Makefile.inc +++ b/src/mainboard/emulation/qemu-aarch64/Makefile.inc @@ -5,6 +5,8 @@ # # SPDX-License-Identifier: GPL-2.0-or-later
+bootblock-y += bootblock.c + romstage-y += cbmem.c
bootblock-y += media.c diff --git a/src/mainboard/emulation/qemu-aarch64/bootblock.c b/src/mainboard/emulation/qemu-aarch64/bootblock.c new file mode 100644 index 0000000..2c878b6 --- /dev/null +++ b/src/mainboard/emulation/qemu-aarch64/bootblock.c @@ -0,0 +1,31 @@ +/* + * This file is part of the coreboot project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <arch/mmu.h> +#include <bootblock_common.h> +#include <symbols.h> + +void bootblock_mainboard_init(void) +{ + mmu_init(); + + mmu_config_range((void *)0, (uintptr_t)4 * GiB, MA_DEV | MA_RW); + + mmu_config_range(_ttb, REGION_SIZE(ttb), MA_MEM | MA_S | MA_RW); + mmu_config_range(_bootblock, REGION_SIZE(bootblock), MA_MEM | MA_S | MA_RW); + mmu_config_range(_romstage, REGION_SIZE(romstage), MA_MEM | MA_S | MA_RW); + mmu_config_range(_ramstage, REGION_SIZE(ramstage), MA_MEM | MA_S | MA_RW); + + mmu_enable(); +} diff --git a/src/mainboard/emulation/qemu-aarch64/memlayout.ld b/src/mainboard/emulation/qemu-aarch64/memlayout.ld index aba4205..cd86073 100644 --- a/src/mainboard/emulation/qemu-aarch64/memlayout.ld +++ b/src/mainboard/emulation/qemu-aarch64/memlayout.ld @@ -29,6 +29,6 @@ ROMSTAGE(0x60030000, 128K) RAMSTAGE(0x60070000, 16M)
- TTB(0x61100000, 16K) - POSTRAM_CBFS_CACHE(0x61110000, 1M) + TTB(0x61100000, 1M) + POSTRAM_CBFS_CACHE(0x61200000, 1M) }
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38534 )
Change subject: tmb/emulation/qemu-aarch64: Add MMU support ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38534/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/38534/1//COMMIT_MSG@6 PS1, Line 6: : tmb/emulation/qemu-aarch64 Remove t in the beginning.
Hello Julius Werner, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38534
to look at the new patch set (#2).
Change subject: mb/emulation/qemu-aarch64: Add MMU support ......................................................................
mb/emulation/qemu-aarch64: Add MMU support
Enable MMU in bootblock. Makes qemu look more similar to real hardware. There's no real need to active the MMU.
Tested on qemu-system-aarch64.
Change-Id: Ifaed9d3cc11520f180a732d51adce634621b5844 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/mainboard/emulation/qemu-aarch64/Makefile.inc A src/mainboard/emulation/qemu-aarch64/bootblock.c M src/mainboard/emulation/qemu-aarch64/memlayout.ld 3 files changed, 38 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/34/38534/2
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38534 )
Change subject: mb/emulation/qemu-aarch64: Add MMU support ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/38534/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/38534/1//COMMIT_MSG@6 PS1, Line 6: : tmb/emulation/qemu-aarch64
Remove t in the beginning.
Done
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38534 )
Change subject: mb/emulation/qemu-aarch64: Add MMU support ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/c/coreboot/+/38534/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/38534/2//COMMIT_MSG@10 PS2, Line 10: active activate ?
https://review.coreboot.org/c/coreboot/+/38534/2/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-aarch64/bootblock.c:
https://review.coreboot.org/c/coreboot/+/38534/2/src/mainboard/emulation/qem... PS2, Line 12: * please remove this empty line
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38534 )
Change subject: mb/emulation/qemu-aarch64: Add MMU support ......................................................................
Patch Set 2: Code-Review+1
(1 comment)
https://review.coreboot.org/c/coreboot/+/38534/2/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-aarch64/memlayout.ld:
https://review.coreboot.org/c/coreboot/+/38534/2/src/mainboard/emulation/qem... PS2, Line 32: 1M) That's unusually large?
Hello Asami Doi, Julius Werner, Arthur Heymans, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/38534
to look at the new patch set (#3).
Change subject: mb/emulation/qemu-aarch64: Add MMU support ......................................................................
mb/emulation/qemu-aarch64: Add MMU support
Enable MMU in bootblock. Makes qemu look more similar to real hardware. There's no real need to activate the MMU.
Tested on qemu-system-aarch64: 5 page entries are used out of 32.
Change-Id: Ifaed9d3cc11520f180a732d51adce634621b5844 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/mainboard/emulation/qemu-aarch64/Makefile.inc A src/mainboard/emulation/qemu-aarch64/bootblock.c M src/mainboard/emulation/qemu-aarch64/memlayout.ld 3 files changed, 38 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/34/38534/3
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38534 )
Change subject: mb/emulation/qemu-aarch64: Add MMU support ......................................................................
Patch Set 3:
(3 comments)
https://review.coreboot.org/c/coreboot/+/38534/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/38534/2//COMMIT_MSG@10 PS2, Line 10: active
activate ?
Done
https://review.coreboot.org/c/coreboot/+/38534/2/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-aarch64/bootblock.c:
https://review.coreboot.org/c/coreboot/+/38534/2/src/mainboard/emulation/qem... PS2, Line 12: *
please remove this empty line
Done
https://review.coreboot.org/c/coreboot/+/38534/2/src/mainboard/emulation/qem... File src/mainboard/emulation/qemu-aarch64/memlayout.ld:
https://review.coreboot.org/c/coreboot/+/38534/2/src/mainboard/emulation/qem... PS2, Line 32: 1M)
That's unusually large?
Reduced to 128K
Philipp Deppenwiese has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38534 )
Change subject: mb/emulation/qemu-aarch64: Add MMU support ......................................................................
Patch Set 5: Code-Review+2
Philipp Deppenwiese has submitted this change. ( https://review.coreboot.org/c/coreboot/+/38534 )
Change subject: mb/emulation/qemu-aarch64: Add MMU support ......................................................................
mb/emulation/qemu-aarch64: Add MMU support
Enable MMU in bootblock. Makes qemu look more similar to real hardware. There's no real need to activate the MMU.
Tested on qemu-system-aarch64: 5 page entries are used out of 32.
Change-Id: Ifaed9d3cc11520f180a732d51adce634621b5844 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/38534 Reviewed-by: Philipp Deppenwiese zaolin.daisuki@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/mainboard/emulation/qemu-aarch64/Makefile.inc A src/mainboard/emulation/qemu-aarch64/bootblock.c M src/mainboard/emulation/qemu-aarch64/memlayout.ld 3 files changed, 38 insertions(+), 3 deletions(-)
Approvals: build bot (Jenkins): Verified Philipp Deppenwiese: Looks good to me, approved
diff --git a/src/mainboard/emulation/qemu-aarch64/Makefile.inc b/src/mainboard/emulation/qemu-aarch64/Makefile.inc index dc0e9f4..4d5f2bd 100644 --- a/src/mainboard/emulation/qemu-aarch64/Makefile.inc +++ b/src/mainboard/emulation/qemu-aarch64/Makefile.inc @@ -5,6 +5,8 @@ # # SPDX-License-Identifier: GPL-2.0-or-later
+bootblock-y += bootblock.c + romstage-y += cbmem.c
bootblock-y += media.c diff --git a/src/mainboard/emulation/qemu-aarch64/bootblock.c b/src/mainboard/emulation/qemu-aarch64/bootblock.c new file mode 100644 index 0000000..280f77e --- /dev/null +++ b/src/mainboard/emulation/qemu-aarch64/bootblock.c @@ -0,0 +1,33 @@ +/* + * This file is part of the coreboot project. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <arch/mmu.h> +#include <bootblock_common.h> +#include <symbols.h> + +void bootblock_mainboard_init(void) +{ + mmu_init(); + + /* Everything below DRAM is device memory */ + mmu_config_range((void *)0, (uintptr_t)_dram, MA_DEV | MA_RW); + /* Set a dummy value for DRAM. ramstage should update the mapping. */ + mmu_config_range(_dram, 1 * GiB, MA_MEM | MA_RW); + + mmu_config_range(_ttb, REGION_SIZE(ttb), MA_MEM | MA_S | MA_RW); + mmu_config_range(_bootblock, REGION_SIZE(bootblock), MA_MEM | MA_S | MA_RW); + mmu_config_range(_romstage, REGION_SIZE(romstage), MA_MEM | MA_S | MA_RW); + mmu_config_range(_ramstage, REGION_SIZE(ramstage), MA_MEM | MA_S | MA_RW); + + mmu_enable(); +} diff --git a/src/mainboard/emulation/qemu-aarch64/memlayout.ld b/src/mainboard/emulation/qemu-aarch64/memlayout.ld index aba4205..248d0ab 100644 --- a/src/mainboard/emulation/qemu-aarch64/memlayout.ld +++ b/src/mainboard/emulation/qemu-aarch64/memlayout.ld @@ -27,8 +27,8 @@ STACK(0x60020000, 62K) FMAP_CACHE(0x6002F800, 2K) ROMSTAGE(0x60030000, 128K) - RAMSTAGE(0x60070000, 16M) + TTB(0x60070000, 128K) + RAMSTAGE(0x600b0000, 16M)
- TTB(0x61100000, 16K) - POSTRAM_CBFS_CACHE(0x61110000, 1M) + POSTRAM_CBFS_CACHE(0x61200000, 1M) }
9elements QA has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38534 )
Change subject: mb/emulation/qemu-aarch64: Add MMU support ......................................................................
Patch Set 6:
Automatic boot test returned (PASS/FAIL/TOTAL): 3/0/3 Emulation targets: EMULATION_QEMU_X86_Q35 using payload TianoCore : SUCCESS : https://lava.9esec.io/r/999 EMULATION_QEMU_X86_Q35 using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/998 EMULATION_QEMU_X86_I440FX using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/997
Please note: This test is under development and might not be accurate at all!