Page MenuHomeFreeBSD

[RFC] Split EFI map parsing code to a common file
Needs ReviewPublic

Authored by mhorne on Nov 25 2024, 10:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jan 29, 11:01 AM
Unknown Object (File)
Sun, Jan 26, 7:36 AM
Unknown Object (File)
Mon, Jan 20, 1:10 PM
Unknown Object (File)
Sat, Jan 18, 2:43 AM
Unknown Object (File)
Wed, Jan 15, 10:02 AM
Unknown Object (File)
Dec 12 2024, 7:32 PM
Unknown Object (File)
Dec 3 2024, 7:28 PM
Unknown Object (File)
Dec 1 2024, 11:20 PM
Subscribers

Details

Summary

Motivation: I would like to enable the EFI map parsing on riscv, which
is preferable to parsing memory regions from the device tree. I could
easily duplicate the functionality, but it can be shared without much
extra effort.

In this commit, the arm64 code is moved to the new file, and enabled for
that platform. No functional change intended.

The memreserve/kboot early map parsing is necessarily moved as well, but
is not inherently machine-dependent. I gated it behind a feature flag,
EFI_HAS_MEMRESERVE. Naming and placement is up for discussion. Note: the
argument to exclude_efi_memreserve() is changed to a vm_paddr_t, the
more correct type.

armv7 is yet unchanged; there are slight differences in its (older)
version of the map parsing code, so testing is required to enable it,
but this would be the plan in the near term.

amd64 could be converted to use this interface too, but it doesn't use
the common "physmem" interfaces for managing physical memory, and would
therefore require further tweaks. I am not inclined to make this change
right away.

Further: struct efi_map_header and struct efi_fb can be de-duplicated,
and don't really belong in metadata.h.

Diff Detail

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

Event Timeline

sys/kern/subr_efi_map.c
2

Need copyright and license

178

I think this is only on arm64.
It's only used, even in Linux, for the gicv3, so I'm not sure it belongs here...
So if it's easy, I'd prefer this remains in arm and uses this generic mechanism.

sys/sys/efi_map.h
2

Need copyright and License

sys/kern/subr_efi_map.c
2

Of course. Figuring out the copyright list requires a bit of investigation.

178

If it has no hope of reuse then no problem, I'll split it differently. My thinking was that they may find other reasons to use this interface in the future.

Restore the Linux memreserve stuff to arm64 MD code.

Change the public functions to be prefixed with efi_map_, e.g. efi_map_add_entries().

Add the copyright attribution according to the following code lineage:

  1. First version of map parsing code appears in amd64. Commit c018226f1a8e1 (2014) by @emaste, sponsored by FF.
  2. Code is copied independently to arm64, and later armv7 implementations.
  3. arm64 version is modified substantially. Commit 2dd5ae7a9087 (2018) by @andrew, sponsored by DARPA, AFRL. (I do not know the specific contract details so this text is not added to the notice).

Ed or Andrew, please advise on how you'd like the notice modified, if at all.