Page MenuHomeFreeBSD

arm64: Use the DMAP region in pmap_mapbios
AcceptedPublic

Authored by andrew on Nov 23 2023, 2:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 3, 4:33 PM
Unknown Object (File)
Oct 6 2024, 5:57 PM
Unknown Object (File)
Oct 6 2024, 1:38 PM
Unknown Object (File)
Oct 6 2024, 8:41 AM
Unknown Object (File)
Oct 5 2024, 9:36 PM
Unknown Object (File)
Oct 5 2024, 12:30 PM
Unknown Object (File)
Oct 5 2024, 5:03 AM
Unknown Object (File)
Sep 22 2024, 3:42 PM
Subscribers

Details

Reviewers
manu
jhb
alc
markj
Group Reviewers
arm64
Summary

As pmap_mapbios is used to map a physical address with a default memory
attribute we can try to use the DMAP region. For now check if all pages
are mapped, however it is expected this check can be removed later
after testing on more hardware.

Sponsored by: Arm Ltd

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 54588
Build 51477: arc lint + arc unit

Event Timeline

I expect most of the calls to pmap_mapbios to be mapping firmware tables that are in RAM and covered by the direct map.

This revision is now accepted and ready to land.Nov 28 2023, 5:41 PM
sys/arm64/arm64/pmap.c
6527

Using pmap_pte() would be faster because it would tell you that the virtual address is mapped by an L1 or L2 block, allowing you to advance by 2M or 1G in a single iteration.

sys/arm64/arm64/pmap.c
6527

I expect this is mostly used for small mappings as it's mostly used for ACPI to map in its tables.

I'm planning on moving pmap_mapbios to subr_devmap.c so won't be able to use pmap_pte. We could add a function to check if a range of memory is mapped that could use pmap_pte.

markj added inline comments.
sys/arm64/arm64/pmap.c
6526
6527

I expect this is mostly used for small mappings as it's mostly used for ACPI to map in its tables.

On its own this isn't a great argument: someone might copy and paste this code elsewhere, so all else being equal it's better to use a faster implementation.

6654

What if the caller called pmap_change_attr() or pmap_change_prot() on the mapped range? We would want to restore the old mapping attributes.

Hmm, pmap_unmapdev() on amd64 ignores this possibility. I suppose that the worst case, surrounding regions of the direct map might be using a smaller page size than necessary.