From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] arm64/efi: use id mapping for Runtime Services
Date: Wed, 6 Aug 2014 17:32:38 +0100 [thread overview]
Message-ID: <20140806163238.GA25953@arm.com> (raw)
In-Reply-To: <CAKv+Gu9xtGRTbhzzyCbGt7CEL=ORkpEnuipweedzDbBJZGGxuw@mail.gmail.com>
On Wed, Aug 06, 2014 at 04:15:23PM +0100, Ard Biesheuvel wrote:
> On 6 August 2014 16:36, Will Deacon <will.deacon@arm.com> wrote:
> > On Thu, Jul 31, 2014 at 03:11:49PM +0100, Ard Biesheuvel wrote:
> >> #define efi_call_virt(f, ...) \
> >> ({ \
> >> - efi_##f##_t *__f = efi.systab->runtime->f; \
> >> + efi_##f##_t *__f; \
> >> efi_status_t __s; \
> >> \
> >> - kernel_neon_begin(); \
> >> + kernel_neon_begin(); /* disables preemption */ \
> >> + switch_pgd(idmap_pg_dir, &init_mm); \
> >> + __f = efi.systab->runtime->f; \
> >> __s = __f(__VA_ARGS__); \
> >> + switch_pgd(current->active_mm->pgd, current->active_mm); \
> >> kernel_neon_end(); \
> >> __s; \
> >> })
> >
> > This scares the bejesus out of me, but I can't put my finger on exactly why.
> > I think it does what you intend and I can't break it myself, so it would be
> > really good if the EFI folks could confirm that this looks good to them.
> >
>
> There is something similar in the x86 code (arch/x86/platform/efi/efi.c)
> """
> * The new method does a pagetable switch in a preemption-safe manner
> * so that we're in a different address space when calling a runtime
> * function. For function arguments passing we do copy the PGDs of the
> * kernel page table into ->trampoline_pgd prior to each call.
> """
>
> How exactly this will turn out for arm64 (and ARM) is still under
> discussion, though. My position is that if you are going to switch
> pgd's anyway, why not just use the id mapping? And even if you feel it
> is mandatory to install a virtual address mapping into UEFI (which I
> think is /not/ the case), you could install an id mapping as well,
> which means all the related machinery still gets invoked.
> The alternative to using a TTBR0 mapping would be to reserve a slice
> of kernel virtual memory so that the Runtime Services are guaranteed
> to live at the same virtual address after a kexec, ideally the same
> region on 4k and 64k pages ...
>
> We are planning to discuss this further at Linaro Connect next month.
Ok, thanks for the update. I'll hold off on this until you've discussed it
some more.
Cheers,
Will
next prev parent reply other threads:[~2014-08-06 16:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-31 14:11 [RFC PATCH] arm64/efi: use id mapping for Runtime Services Ard Biesheuvel
2014-07-31 15:02 ` Mark Salter
2014-07-31 18:37 ` Ard Biesheuvel
2014-08-06 14:36 ` Will Deacon
2014-08-06 15:15 ` Ard Biesheuvel
2014-08-06 16:32 ` Will Deacon [this message]
2014-09-10 13:44 ` Grant Likely
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=20140806163238.GA25953@arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).