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)
Mon, Apr 22, 7:36 PM
Unknown Object (File)
Fri, Apr 5, 3:22 PM
Unknown Object (File)
Thu, Apr 4, 10:41 AM
Unknown Object (File)
Mar 16 2024, 4:06 PM
Unknown Object (File)
Mar 4 2024, 11:02 PM
Unknown Object (File)
Mar 4 2024, 10:57 PM
Unknown Object (File)
Mar 4 2024, 10:45 PM
Unknown Object (File)
Feb 17 2024, 5:09 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.