[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, 17 Nov 2026 09:11:26 -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=qBeZO9jutPDoxJSJBfsdPmeW2dgW3480L0tWp4LCETs=; b=cPCSCSIdhO9GHHE5n9Kg7UnN+KgH1g03HEnpCUnsX/UVj1K79PrK9qIjRFEEAq1h0Xlb18ZKzeUe+uqro+VIKvhAk9NckG9bJXlKiGs6GXD4GpPTRxW7tSrb9DliMtb4gnJX9EQfWkkPHgHu565MkvfzE2iCrfpf+vMB6UHfFWcX10HTWBUNIek/qCp+xbUCYENfTboWTtsYa268uo/JhDshCKSgnDgk0PF31KYVBMvkRyoHsDOdMuW8Javfwg0cU/ap5BvCXI2L0QH4HSy6Su3QZS1kAWP2Z80OyQV0EgmnNryptkqY8XGn4L7SjCNQPZIn7QHLNtsiLyshAWbIHw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RF765hUOv62NgKC8ZGNxRPlpbZAmGfEaNR6YgEaEH60NIFNId6h44PPKSCTqZ44163CD7HglxmpK7u5r8dMuFKkjiZe8HteaEH/3dBq7I+MHTR7Wt2U/V4YmwCzKflJDdVxk/hfdR4BzHZ5O4AXfvGMhfxlGyAEWFZoYN/X+qEOT60kR5xvmatEhAkpJS2yS8imbWEp/e7yP3JONUM6lPpAk99nzrlGmEQBnk5v5MiaVqbnnq+Lz0y0nP1pS2x+WCjWYO4W5zjbzLopQ/fKt6x5kLWk+KzLGb0bVUonlBifsZqJQXLvRsgHBYWtGUILuknUA9uObKyWvLThoIPldhQ==
- 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: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, 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>
- Delivery-date: Tue, 17 Nov 2026 14:27:16 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 2026-11-17 03:40, Jan Beulich wrote:
On 09.11.2026 16:11, Marek Marczykowski-Górecki wrote:
On Fri, Nov 06, 2026 at 06:18:18PM -0500, Jason Andryuk wrote:
With Xen booting via Multiboot2/GRUB on an EFI platform, and modified to
use MULTIBOOT2_LOAD_PREFERENCE_LOW, Xen relocates itself with
move_xen().
However a PVH dom0 shows:
kernel: Failed to lookup header 0x77ffd000 in Xen memory map: error -3
kernel: ACPI=0x77ffd000
... for all the Xen efi memory map lookups. Dumping the memory map at
runtime showed it was scrubbed. Because Xen relocated itself, the
original physical address referenced through a directmap address goes
stale.
Add efi_arch_mmap_buffer_virt() to convert from the initial value to an
appropriate runtime value. ARM uses Boot Services AllocatePool(), so it
must continue to use DIRECTMAP_VIRT_START.
For x86, we use an offset into the loaded Xen binary at the time of the
call and add the to XEN_VIRT_START. ebmalloc() allocates from the Xen
image memory, so it moves during relocation. xen_phys_start is set for
xen.efi in efi_exit_boot(), but not for xen.gz, so it cannot be used
Use `lea __image_base__(%rip)` to get the current load address, and use
that to calculate the offset into the Xen image. That offset is also
valid from XEN_VIRT_START.
Fixes: c5b9805bc1f7 ("efi: create new early memory allocator")
Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
I did not tested this, but looks correct:
Reviewed-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
Subsequent to you supplying this R-b I commented on naming aspects, which
(after Jason's response) turned into a possible slight functional change
as well. You're the maintainer, so if you say "commit as-is" I'll do so
(with just the style issue taken care of), but as this isn't the only
possible outcome, I'd like to ask for the decision either way to be made
explicit.
I am okay with Jan's suggestions from the other email. FWIW, I was
leaning toward efi_arch_xen_image_to_virt() as the helper name, but was
looking for feedback on the preferred name before re-posting.
Regards,
Jason
|