[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen/efi: Handle efi_memmap with Xen relocating itself
- To: Jan Beulich <jbeulich@xxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
- From: Jason Andryuk <jason.andryuk@xxxxxxx>
- Date: Tue, 10 Nov 2026 09:42:06 -0500
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=S8TcAOni+Qh7k7bIA00RkRD3Nyf7J5RQOKbwSAJ9zIU=; b=PAgCEGG9+lvIhdca0eVMz27i3BpJxzlp3ogJGYVrL1gX19vixy+LxxD0zFmvdRKeam3OFA60zRHBttGJ94mijijtYE/8Vnf2qo1KhCUWoa/hcpdTAH7NHUzLbnUt3K1G4aFqOyIJUEKzURbqyHKt2p+Ywbreku20NnGm6WHjlUDXRGrBLQS2OOpl0iYl4K0GKuj45+3+3sLbBCpv+sT4gP/bYajJ2HthTOSquifIo0xP+yx9hx8sVKYZVgZRgl9KAj7SW9w9wctdlLuceo1wD2jaz8zy3TdGUnvbqXEOVVI+R78vw+d6ojZ+pZ4Ks8QL4BFgYCnG8jyWmKp3iA9olQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uZgtm4+uKcQwahlPFMJElxLNgtB7dS9SrJqif2AYR7EQ2A9GUHwEhBC1SQ2j/5KuwDb76/laPRwXer4VfXiEGwrri6ujuZrqrAAmBAA8l9gZ2y8HqvFPxRXaTOXclGN8jvNKuHPr+vdEVMnqQq2HtMb48BL2kNKd8hFWGATMWhAkDZL78JHhe/h9W47NtHf5js5sskLZlDBMpE2e57bAH8NfepUX0lVUo82LFf/LP8YytLeYZ2YfriUJzkfj7PS6JKags+EDmdTfzpFKuyfBgoGBmg5K742PnhdfPqRst+4MMlqLcg76NC2+MKrsNlzmc2WjK5mpGgEzM2kDjHFNpw==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Tue, 10 Nov 2026 14:43:14 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 2026-11-10 03:42, Jan Beulich wrote:
On 07.11.2026 00:18, Jason Andryuk wrote:
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -224,6 +224,16 @@ static void *__init efi_arch_allocate_mmap_buffer(UINTN
map_size)
return ebmalloc(map_size);
}
+static void *__init efi_arch_mmap_buffer_virt(void *ptr)
+{
+ unsigned long load_base;
+
+ /* RIP-relative address is the current Xen load address. */
+ asm("lea __image_base__(%%rip), %0" : "=r" (load_base));
+
+ return ptr - load_base + XEN_VIRT_START;
+}
There's nothing specific to the mmap in this function, hence it's name is
a little odd.
It is paired with efi_arch_allocate_mmap_buffer() above, so I wanted the
name to indicate that it is converting mmap_buffer to a virt address.
`ptr` needs to be within the image, so it has limited applicability.
It's handling a special case, so naming it for that special case helps
limit its use. A generic name could be misused.
Having said that, I am open to renaming if that is desired.
Alternatives could be:
efi_arch_xen_phys_to_virt()
or
efi_arch_image_phys_to_virt()
or
efi_arch_xen_image_to_virt()
Also the asm() is lacking a number of blanks. (This aspect could be dealt
with while committing, but a possible rename I'd prefer to be done in a v2.)
Oh, yes, sorry about that.
Thanks,
Jason
|