git: ecb167daf761 - main - efi: Add linux memory reserve table defniitions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 25 Oct 2022 15:33:03 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ecb167daf761b75e71607e3b216e162cad99dad0 commit ecb167daf761b75e71607e3b216e162cad99dad0 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2022-10-06 02:56:43 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2022-10-25 15:32:49 +0000 efi: Add linux memory reserve table defniitions There is some hardware which can't be completely reset to release the memory it is using(so far only the GICv3 on arm has fit this bill). Since that meory needs to be reserved by the OS for that hardware's later use of it, create defines for code that will parse that memory table. Otherise the system may allocate the memory for block I/O, network packets, etc which will lead to memory corruption. When booting via Linux's kexec protocol, it will add this table to the EFI systbl's cfgtbl array. While the mechanism to pass 'configuration' is standardized, these specific tables are not documented except in the Linux source. Include comments gleened from its study. Sponsored by: Netflix --- sys/sys/efi.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sys/sys/efi.h b/sys/sys/efi.h index f5dc15ae418f..4714dd137551 100644 --- a/sys/sys/efi.h +++ b/sys/sys/efi.h @@ -44,6 +44,8 @@ {0xb122a263,0x3661,0x4f68,0x99,0x29,{0x78,0xf8,0xb0,0xd6,0x21,0x80}} #define EFI_PROPERTIES_TABLE \ {0x880aaca3,0x4adc,0x4a04,0x90,0x79,{0xb7,0x47,0x34,0x08,0x25,0xe5}} +#define LINUX_EFI_MEMRESERVE_TABLE \ + {0x888eb0c6,0x8ede,0x4ff5,0xa8,0xf0,{0x9a,0xee,0x5c,0xb9,0x77,0xc2}} enum efi_reset { EFI_RESET_COLD = 0, @@ -201,6 +203,34 @@ struct efi_systbl { extern vm_paddr_t efi_systbl_phys; +/* + * When memory is reserved for some use, Linux will add a + * LINUX_EFI_MEMSERVE_TABLE to the cfgtbl array of tables to communicate + * this. At present, Linux only uses this as part of its workaround for a GICv3 + * issue where you can't stop the controller long enough to move it's config and + * pending vectors. When the LinuxBoot environment kexec's a new kernel, the new + * kernel needs to use this old memory (and not use it for any other purpose). + * + * Linux stores the PA of this table in the cfgtbl. And all the addresses are + * the physical address of 'reserved' memory. The mr_next field creates a linked + * list of these tables, and all must be walked. If mr_count is 0, that entry + * should be ignored. There is no checksum for these tables, nor do they have + * a efi_tblhdr. + * + * This table is only documented in the Linux code in drivers/firmware/efi/efi.c. + */ +struct linux_efi_memreserve_entry { + vm_offset_t mre_base; /* PA of reserved area */ + vm_offset_t mre_size; /* Size of area */ +}; + +struct linux_efi_memreserve { + uint32_t mr_size; /* Total size of table in bytes */ + uint32_t mr_count; /* Count of entries used */ + vm_offset_t mr_next; /* Next in chain (though unused?) */ + struct linux_efi_memreserve_entry mr_entry[]; +}; + struct efirt_callinfo; /* Internal MD EFI functions */