History log of /haiku/src/system/boot/platform/efi/arch/arm/arch_mmu.cpp
Revision Date Author Comments
# b799d160 15-Jun-2023 David Karoly <karolyd577@gmail.com>

kernel/arm/paging: implement Modified Flag

* Introduce SWDBM flag similarly to the arm64 port
* Reuse TEX[2] for SWDBM flag which should be availble
to be used by the operating system if TEX remap
is enabled.
* Introduce SetAndClearPageTableEntryFlags for updating
accessed and modified flags atomically
* Startup sequence is handled similarly to accessed flag, i.e.
set Modified flag in initially mapped pages in bootloader and early map.
* Once the kernel initialization has progressed enough,
pages are mapped as read-only and modified flag handling is done
in the page fault handler.

Change-Id: I8f761e2c6325d1b91481abd569d5e8befded0761
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6518
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# f61fb770 30-May-2023 David Karoly <karolyd577@gmail.com>

kernel/arm: don't set Accessed Flag when initially mapping a page

Pages should not be marked as accessed when initially mapping them.

However, there's a short interval during kernel startup when new pages
are mapped but the fault handler is not installed yet.

Therefore, we set Accessed Flag to 1 in early_map.
Once the kernel initialization has progressed enough, we start mapping
new pages with Accessed Flag set to 0.

The chicken and egg problem of initially mapping the vector page is
tackled by preallocating the vector page in the boot loader.

Change-Id: Ie3be4f81812d7a090af57e8c79420598d16182b9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6450
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 54fc4c3c 09-May-2023 David Karoly <karolyd577@gmail.com>

boot/arm: set trace level with constexprs

Change-Id: Ib5671238cd9c442f9948c6bee2aff30cbfbff0f0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6427
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: X512 <danger_mail@list.ru>


# a3c9f71e 25-Sep-2022 David Karoly <karolyd577@gmail.com>

boot/efi: factor out generic mmu functions

This change moves the common functions related to EFI memory map
to arch/generic for arm, arm64, x86.

riscv64 and x86_64 shall be handled separately as they use some
more architecture-specific logic:
* riscv64 needs special treatment for the M-mode resident code
located at 0x80000000 which is reported as available in the
EFI memory map provided by u-boot.
* x86_64 has a slightly different logic for building the
memory regions list so some additional rework and testing will be
needed before it can be unified with the generic mmu functions.

Change-Id: I430c84dfc693c5b6f04c170dec8ffb1db2c2ace1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5694
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# adc32659 22-Apr-2022 David Karoly <karolyd577@gmail.com>

arm: enable enforcing memory access permissions

Bootloader:
* set permissions to kernel read/write, no user access
for initially mapped memory areas
* set permissions to kernel read/write, no execute,
no user access for UART

Kernel:
* physical memory mapper uses kernel read/write mapping
with no-execute bit enabled
* all other pages are mapped as read/write/execute for
kernel and user
* proper access permissions and memory types to be
implemented later

Enforce memory access permissions by setting DACR to
client mode for domain #0, no access for other domains.

see ARM Architecture Reference Manual, section B3.7 Memory access control
and in particular the following subsections:
B3.7.1 Access permissions
B3.7.2 Execute-never restrictions on instruction fetching
B3.7.3 Domains, Short-descriptor format only

Change-Id: I8127b4c72dc516d013cb9751d80d6f3a9ec835e6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5233
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# ab78f824 20-Apr-2022 David Karoly <karolyd577@gmail.com>

boot/efi/arm: handle unaligned ranges in map_range_to_new_area()

Change-Id: Ia6c707bf8381b77aa8b256a007fb51f1c32e9e17
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5183
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# d283a8c5 27-Jan-2022 David Karoly <karolyd577@gmail.com>

kernel/arm: add range checking for early page tables

Change-Id: Ibbd367475482eb0cf839314014c8bf68612c5d6a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4891
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>


# 79ee0062 27-Jan-2022 David Karoly <karolyd577@gmail.com>

boot/efi/arm: don't add ranges below KERNEL_LOAD_BASE to virtual_allocated_ranges

Change-Id: I9dbb1c46bcfcdea6fe3e8287673557e54a29c008
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4889
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>


# a2d52824 27-Jan-2022 David Karoly <karolyd577@gmail.com>

boot/efi/arm: code cleanup

* Use TRACE() for logging
* Use B_PRI format strings
* Reformat local variables and function arguments to use camelCase
* Remove comment related to ConvertPointer
* Fix indentation for switch statements
* Remove variable sFirstPageTable as it's not really used

Change-Id: Iace275e5a3311f13a5018f497c3132e472a20848
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4885
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>


# 9a573968 21-Jan-2022 David Karoly <karolyd577@gmail.com>

boot/efi/arm: use insert_address_range for virtual_ranges_to_keep

Change-Id: Iaf67838e8ef3d9a9494791945bd777b92315a948
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4877
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# cc69b20b 21-Jan-2022 David Karoly <karolyd577@gmail.com>

boot/efi/arm: move arch_enter_kernel to identity mapped region

First try to allocate a page below 2GB.

If it fails, try to allocate a physical page at the address
returned by get_next_virtual_address so that we get an address
that is available in both virtual and physical space.

Finally try to allocate any available page. At this point
it's highly likely that it will be above 0x88000000 so it can be
used for trampoline code.

Change-Id: I3100a3e09efcd938bc630a52dcce74dc5f24beb5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4878
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 933430df 14-Jan-2022 David Karoly <karolyd577@gmail.com>

boot/efi/arm: remove identity mapping for EFI code and data segments

All the regions allocated via platform_allocate_region() are mapped to a
high virtual address so there's no need to do identity mapping for them
any more.

Copy kernel_args to a region allocated via platform_allocate_region() so it
will be mapped similarly.

Identity mapping is still needed for trampoline code for jumping to the kernel

Change-Id: I844a7a789b440a38521db49adc077bb77e658ddf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4865
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>


# 31f5f4d3 12-Jan-2022 David Karoly <karolyd577@gmail.com>

boot/efi/arm: remove identity mapping of EFI runtime services

EFI runtime service memory areas are remapped to a high virtual address
allocated with get_next_virtual_address() to avoid any address space
collision.

They are also added to virtual_ranges_to_keep so that the kernel knows
that these ranges should be reserved.

Change-Id: I63e1a2450fceff3b2404154907a2cf59dd1b373b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4863
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>


# a7c69a4b 11-Jan-2022 David Karoly <karolyd577@gmail.com>

boot/efi/arm: remove identity mapping of initial page tables

Change-Id: I37cb756c32e05a585ff224c1e48d1a40c83e5e2e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4858
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# f5f10a9e 28-Nov-2021 David Karoly <karolyd577@gmail.com>

boot/efi/arm: remap UART to kernel address space

Change-Id: Iff145a45e8efe28b710d5a948f6f69a944027885
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4744
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# b594d76c 24-Oct-2021 David Karoly <karolyd577@gmail.com>

boot/efi: use ROUNDUP for aligning the page directory

Change-Id: Ib52ca83cbc390f2e450c174741ed24e745fb7eab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4655
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# d88e69ae 20-Oct-2021 David Karoly <karolyd577@gmail.com>

boot/efi: generate page tables for arm

Change-Id: I975048d7721efc0557d60d27ddf5bd5296aa9e51
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4632
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# e6520f90 20-Oct-2021 David Karoly <karolyd577@gmail.com>

boot/efi: generate memory map for arm

Change-Id: I02a7f8c27187f6375dd4deeeaf3587dad1e3349c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4631
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 82a7c739 22-Feb-2020 Alexander von Gluck IV <kallisti5@unixzen.com>

efi/arm: Begin stubbing out the essentials, add fdt library

* We *might* no longer need FDT knowledge in the bootloader?
* For now though, arm sources reference gFDT, so we need it.
* Need to move away from lazy gFDT and store in arch_kernel_args.
(which is next and will be a larger commit)

Change-Id: I77cce0fc645143b78a7fd9f50ac8b96c97b5c862
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2268
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>