From: "Leif Lindholm" <quic_llindhol@quicinc.com>
To: "Marvin Häuser" <mhaeuser@posteo.de>
Cc: <devel@edk2.groups.io>,
Ard Biesheuvel <ardb+tianocore@kernel.org>,
Sami Mujawar <sami.mujawar@arm.com>,
Vitaly Cheptsov <vit9696@protonmail.com>
Subject: Re: [PATCH 2/2] ArmPkg/ArmMmuLib: Fix ArmReplaceLiveTranslationEntry() alignment
Date: Mon, 17 Apr 2023 20:53:40 +0100 [thread overview]
Message-ID: <ZD2jxJBGKouXe8ig@qc-i7.hemma.eciton.net> (raw)
In-Reply-To: <20230417180916.95237-2-mhaeuser@posteo.de>
On Mon, Apr 17, 2023 at 18:09:16 +0000, Marvin Häuser wrote:
> As the ASM_FUNC() macro performs a section switch, the preceding
> .balign directive applies the alignment constraint to the current
> location in the previous section. As the linker may not merge the
> sections in-order, ArmReplaceLiveTranslationEntry() may be left
> unaligned.
>
> Replace the explicit invocation of .balign with the ASM_FUNC_ALIGN()
> macro, which guarantees the alignment constraint is applied correctly.
>
> Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Assuming we reach consensus on the preceding patch, this one is a no
brainer:
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
> ---
> ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
> index e936a5be4e11..7627aeb95464 100644
> --- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
> +++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
> @@ -69,17 +69,16 @@
> .L2_\@:
> .endm
>
> - // Align this routine to a log2 upper bound of its size, so that it is
> - // guaranteed not to cross a page or block boundary.
> - .balign 0x200
> -
> //VOID
> //ArmReplaceLiveTranslationEntry (
> // IN UINT64 *Entry,
> // IN UINT64 Value,
> // IN UINT64 Address
> // )
> -ASM_FUNC(ArmReplaceLiveTranslationEntry)
> +//
> +// Align this routine to a log2 upper bound of its size, so that it is
> +// guaranteed not to cross a page or block boundary.
> +ASM_FUNC_ALIGN(ArmReplaceLiveTranslationEntry, 0x200)
>
> // disable interrupts
> mrs x4, daif
> --
> 2.40.0
>
next prev parent reply other threads:[~2023-04-17 19:53 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-17 18:09 [PATCH 1/2] ArmPkg/AsmMacroIoLibV8: Introduce ASM_FUNC_ALIGN() Marvin Häuser
2023-04-17 18:09 ` [PATCH 2/2] ArmPkg/ArmMmuLib: Fix ArmReplaceLiveTranslationEntry() alignment Marvin Häuser
2023-04-17 19:53 ` Leif Lindholm [this message]
2023-04-17 19:52 ` [PATCH 1/2] ArmPkg/AsmMacroIoLibV8: Introduce ASM_FUNC_ALIGN() Leif Lindholm
2023-04-17 21:18 ` Ard Biesheuvel
2023-04-18 6:40 ` Marvin Häuser
2023-04-18 8:10 ` Ard Biesheuvel
2023-04-18 8:18 ` Marvin Häuser
2023-04-18 8:59 ` Ard Biesheuvel
2023-04-19 17:13 ` Marvin Häuser
2023-04-19 17:40 ` [edk2-devel] " Ard Biesheuvel
2023-04-19 17:45 ` Marvin Häuser
2023-04-19 18:03 ` Ard Biesheuvel
2023-04-19 18:25 ` Marvin Häuser
2023-04-19 18:26 ` Ard Biesheuvel
2023-04-19 18:31 ` Marvin Häuser
2023-04-19 19:48 ` Ard Biesheuvel
2023-04-19 20:10 ` Marvin Häuser
2023-04-19 21:42 ` Marvin Häuser
2023-04-19 21:55 ` Ard Biesheuvel
2023-04-19 22:15 ` Marvin Häuser
2023-04-19 22:27 ` Pedro Falcato
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-list 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=ZD2jxJBGKouXe8ig@qc-i7.hemma.eciton.net \
--to=devel@edk2.groups.io \
/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