Date: Sun, 6 Jul 2025 13:22:12 -0700 From: Ahmad Khalifa <ahmadkhalifa570@gmail.com> To: Konstantin Belousov <kostikbel@gmail.com> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 85dcdb7aad85 - main - amd64: allow the mapping of other regions for efirt Message-ID: <CAMLT6uDddXwxviLr3K94GeeXOsj_2Obb=aFqaEUav0qUDqvnCA@mail.gmail.com> In-Reply-To: <CAMLT6uCpHGpJYgmFX4u2iBuOCBX_4bRoDchU-s=Gtc_AaqOh5Q@mail.gmail.com> References: <202507061928.566JSLh9096963@gitrepo.freebsd.org> <aGrRxFtv0YG91_IW@kib.kiev.ua> <CAMLT6uCpHGpJYgmFX4u2iBuOCBX_4bRoDchU-s=Gtc_AaqOh5Q@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun Jul 6, 2025 at 11:02 PM +0300, Ahmad Khalifa wrote: > On Sun Jul 6, 2025 at 10:43 PM +0300, Konstantin Belousov wrote: >> On Sun, Jul 06, 2025 at 07:28:21PM +0000, Ahmad Khalifa wrote: >>> The branch main has been updated by vexeduxr: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=85dcdb7aad85498b3f497b8752e69b8612b27cb7 >>> >>> commit 85dcdb7aad85498b3f497b8752e69b8612b27cb7 >>> Author: Ahmad Khalifa <vexeduxr@FreeBSD.org> >>> AuthorDate: 2025-07-06 19:10:25 +0000 >>> Commit: Ahmad Khalifa <vexeduxr@FreeBSD.org> >>> CommitDate: 2025-07-06 19:26:07 +0000 >>> >>> amd64: allow the mapping of other regions for efirt >>> >>> Some BIOSes access data outside of regions marked as "runtime" in their >>> runtime EFI functions. Allow the mapping and preservation of other >>> regions through a tunable. >>> >>> The tunable is a bitmap specifying the regions to map. e.g bit 3 would >>> be set to map BootServicesCode. >>> >>> Currently allowed regions are: >>> BootServicesCode >>> BootServicesData >>> RuntimeServicesCode >>> RuntimeServicesData >>> ACPIMemoryNVS >>> >>> PR: 287422 >>> Reviewed by: kib >>> Approved by: imp (mentor) >>> Differential Revision: https://reviews.freebsd.org/D51146 >>> --- >>> sys/amd64/amd64/efirt_machdep.c | 18 +++++++++++++++++- >>> sys/amd64/amd64/machdep.c | 8 ++++++-- >>> sys/amd64/include/efi.h | 4 ++++ >>> 3 files changed, 27 insertions(+), 3 deletions(-) >>> >>> diff --git a/sys/amd64/amd64/efirt_machdep.c b/sys/amd64/amd64/efirt_machdep.c >>> index 81a28ebe97ee..75c357f6e3df 100644 >>> --- a/sys/amd64/amd64/efirt_machdep.c >>> +++ b/sys/amd64/amd64/efirt_machdep.c >>> @@ -56,6 +56,15 @@ >>> #include <vm/vm_pager.h> >>> #include <vm/vm_radix.h> >>> >>> +/* The EFI regions we're allowed to map. */ >>> +#define EFI_ALLOWED_TYPES_MASK ( \ >>> + 1u << EFI_MD_TYPE_BS_CODE | 1u << EFI_MD_TYPE_BS_DATA | \ >>> + 1u << EFI_MD_TYPE_RT_CODE | 1u << EFI_MD_TYPE_RT_DATA | \ >>> + 1u << EFI_MD_TYPE_FIRMWARE \ >>> +) >>> + >>> +uint32_t efi_map_regs; >>> + >> >> Apparently efi_map_regs must be defined in amd64/machdep.c and not in >> efirt_machdep.c. If efirt is compiled as module, efo_map_regs gets >> undefined in the kernel. > > Ah, nice catch. Review opened. Hmm, apparently active_efi_ops has this issue too.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMLT6uDddXwxviLr3K94GeeXOsj_2Obb=aFqaEUav0qUDqvnCA>