From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Jason Andryuk" <jason.andryuk@amd.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Julien Grall" <julien@xen.org>,
"Bertrand Marquis" <bertrand.marquis@arm.com>,
"Michal Orzel" <michal.orzel@amd.com>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
"Daniel P. Smith" <dpsmith@apertussolutions.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger@xenproject.org>,
"Teddy Astie" <teddy.astie@vates.tech>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH] xen/efi: Handle efi_memmap with Xen relocating itself
Date: Tue, 17 Nov 2026 15:44:21 +0100 [thread overview]
Message-ID: <avxoRfWuynbmX6eg@mail-itl> (raw)
In-Reply-To: <81193399-c673-464a-b58a-979c3bae4691@suse.com>
[-- Attachment #1: Type: text/plain, Size: 2487 bytes --]
On Tue, Nov 10, 2026 at 04:16:49PM +0100, Jan Beulich wrote:
> On 10.11.2026 16:14, Jan Beulich wrote:
> > On 10.11.2026 15:42, Jason Andryuk wrote:
> >> 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.
> >
> > Hmm, right.
If the current name is confusing, maybe name it
efi_arch_mmap_buffer_to_virt()? But IMHO the current version is clear
enough.
> > And this is entirely different between x86 and Arm. So common
> > code wants to call a function of this name, but on x86 this may then want
> > to be a thin wrapper around ...
> >
> >> 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()
> >
> > ... a function of any of these names (which in turn would be possible to
> > use for other purposes). Marek - thoughts?
efi_arch_image_phys_to_virt() for a helper function sounds okay
(efi_arch_xen_image_to_virt would work too, but IMO a little less
clear).
> > With this constraint on the x86 side, wouldn't you then better add an
> > ASSERT()-like construct to the actual translation function?
>
> Or use the existing (and Arm) logic when the pointer isn't within the Xen
> image. (There can be ambiguous cases, though, I fear.)
Automatic fallback I fear could hide some issues and make them harder to
debug (like the original issue this patch attempts to fix). But an
assert for the argument may be a good idea.
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2026-11-17 14:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 23:18 [PATCH] xen/efi: Handle efi_memmap with Xen relocating itself Jason Andryuk
2026-11-09 15:11 ` Marek Marczykowski-Górecki
2026-11-17 8:40 ` Jan Beulich
2026-11-17 14:11 ` Jason Andryuk
2026-11-10 8:42 ` Jan Beulich
2026-11-10 14:42 ` Jason Andryuk
2026-11-10 15:14 ` Jan Beulich
2026-11-10 15:16 ` Jan Beulich
2026-11-17 14:44 ` Marek Marczykowski-Górecki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avxoRfWuynbmX6eg@mail-itl \
--to=marmarek@invisiblethingslab.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=dpsmith@apertussolutions.com \
--cc=jason.andryuk@amd.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger@xenproject.org \
--cc=sstabellini@kernel.org \
--cc=teddy.astie@vates.tech \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.