This function looks in the efi memory map for a physical address
and returns the attribute.
This is needed when we want to correctly map some region.
Sponsored by: Ampere Computing, LLC
Differential D20347
efirt: Add efi_memory_attribute manu on May 22 2019, 5:06 AM. Authored by Tags None Referenced Files
Subscribers
Details This function looks in the efi memory map for a physical address Sponsored by: Ampere Computing, LLC On the Ampere eMAG where there is ~150 efi region in the map this is the distribution or the bsearch rounds : 37 num=2 87 num=7 24 num=8 37 num=9
Diff Detail
Event Timeline
Comment Actions Add helper function that get the memory map from efi.
Comment Actions Address kib comments. Comment Actions This all looks fine, except one detail. I reviewed UEFI 2.8 description of EFI_BOOT_SERVICES.GetMemoryMap() but did not found a mention that they require the map ordered by phys address. Did you miss the code to sort the map ? For the task of DMAP creation with correct attributes, I definitely do not want to call efi_memory_attribute() for each 4K page. Perhaps add optional out argument which returns amount of memory with the same attribute as pa, after pa. Comment Actions In chapter 4.6, EFI_MEMORY_ATTRIBUTES_TABLE it is said : The list must be sorted by physical start address in ascending order.
Ok I'll do that. Comment Actions I am even more confused. The description said that about EFI_MEMORY_ATTRIBUTE, not about memory map. And you correctly use memory map, because MEMORY_ATTRIBUTE seems to be some after-thought patch only applicable to EFI runtime code and data. Comment Actions qsort the efi map
Comment Actions Tested on X86? I had an earlier version of this in my WIP tree for testing on eMAG/ThunderX2 (where it worked) but encountered a panic on x86. I do have some other WIP in that tree though. https://cirrus-ci.com/task/5146266359562240 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff824d98e0 vpanic() at vpanic+0x19d/frame 0xffffffff824d9930 panic() at panic+0x43/frame 0xffffffff824d9990 trap_fatal() at trap_fatal+0x394/frame 0xffffffff824d99f0 trap_pfault() at trap_pfault+0x62/frame 0xffffffff824d9a40 trap() at trap+0x562/frame 0xffffffff824d9b50 calltrap() at calltrap+0x8/frame 0xffffffff824d9b50 --- trap 0xc, rip = 0xffffffff80605115, rsp = 0xffffffff824d9c20, rbp = 0xffffffff824d9c30 --- efirt_modevents() at efirt_modevents+0x355/frame 0xffffffff824d9c30 module_register_init() at module_register_init+0xc6/frame 0xffffffff824d9c60 mi_startup() at mi_startup+0x216/frame 0xffffffff824d9cb0 btext() at btext+0x2c KDB: enter: panic [ thread pid 0 tid 100000 ] Stopped at kdb_enter+0x3b: movq $0,kdb_why db> qemu-system-x86_64: terminating on signal 15 from pid 52138 (timeout) Did not boot successfully, see /tmp/ci-qemu-test-boot.log
Comment Actions Is it possible to get this in head? It seems to be needed to run FreeBSD on Ampere systems... Comment Actions So long ago and I don't know if this is still really needed as we boot fine on Ampere machines. |