Page MenuHomeFreeBSD

efirt: Don't enter EFI context early, convert addrs to KVA instead
ClosedPublic

Authored by kevans on Aug 4 2018, 3:44 PM.

Details

Summary

efi_enter here was needed because efi_runtime dereference causes a fault outside of EFI context, due to runtime table living in runtime service space. This may cause problems early in boot, though, so instead access it by converting paddr to KVA.

While here, remove the other direct PHYS_TO_DMAP calls and the DMAP requirement from efidev.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Unit Tests Skipped
Build Status
Buildable 18582

Event Timeline

Upload correct version of patch, with (void *) cast.

No, this is not enough to support arbitrary arch for RT. There is no way we can prevent EFIRT runtime memory overlapping with the vital kernel memory, so we generally need to relocate runtime memory during the loading. And this means that loader must know enough about the KVA layout.

Amd64 and arm64 use a trick which cannot be directly ported to i386 or armv7.

This revision is now accepted and ready to land.Aug 4 2018, 4:02 PM
In D16591#352449, @kib wrote:

No, this is not enough to support arbitrary arch for RT. There is no way we can prevent EFIRT runtime memory overlapping with the vital kernel memory, so we generally need to relocate runtime memory during the loading. And this means that loader must know enough about the KVA layout.

Right, no, I realize there's more. =) That comment was strictly directed at DMAP requirement in efidev, which is only there to do this conversion..

I was going to hold off on this a bit, but this would seem to be objectively the more correct way to do whether it fixes Eitan's and this other PR's problem or not.

This revision was automatically updated to reflect the committed changes.