From: Will Deacon <will.deacon@arm.com>
To: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Catalin Marinas <Catalin.Marinas@arm.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"patches@linaro.org" <patches@linaro.org>,
"linaro-kernel@lists.linaro.org" <linaro-kernel@lists.linaro.org>,
John Stultz <john.stultz@linaro.org>,
Sumit Semwal <sumit.semwal@linaro.org>,
Christoffer Dall <christoffer.dall@linaro.org>,
Marc Zyngier <Marc.Zyngier@arm.com>,
Andre Przywara <Andre.Przywara@arm.com>
Subject: Re: [PATCH v2 1/5] arm64: alternative: Provide if/else/endif assembler macros
Date: Mon, 20 Jul 2015 18:12:42 +0100 [thread overview]
Message-ID: <20150720171242.GP9908@arm.com> (raw)
In-Reply-To: <1437405004-1296-2-git-send-email-daniel.thompson@linaro.org>
Hi Daniel,
Couple of really small comments.
On Mon, Jul 20, 2015 at 04:10:00PM +0100, Daniel Thompson wrote:
> The existing alternative_insn macro has some limitations that make it
> hard to work with. In particular the fact it takes instructions from it
> own macro arguments means it doesn't play very nicely with C pre-processor
> macros because the macro arguments look like a string to the C
> pre-processor. Workarounds are (probably) possible but things start to
> look ugly.
>
> Introduce an alternative set of macros that allows instructions to be
> presented to the assembler as normal and switch everything over to the
> new macros.
>
> Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
> ---
> arch/arm64/include/asm/alternative.h | 40 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
> diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h
> index c385a0c4057f..31b19ad18f7e 100644
> --- a/arch/arm64/include/asm/alternative.h
> +++ b/arch/arm64/include/asm/alternative.h
> @@ -77,6 +77,46 @@ void free_alternatives_memory(void);
> .org . - (662b-661b) + (664b-663b)
> .endm
>
> +/*
> + * Begin an alternative code sequence.
> + *
> + * The code that follows this marco will be assembled and linked as
> + * normal. There are no restrictions on this code.
s/marco/macro/
> + */
> +.macro alternative_if_not cap
> + .pushsection .altinstructions, "a"
> + altinstruction_entry 661f, 663f, \cap, 662f-661f, 664f-663f
> + .popsection
> +661:
> +.endm
> +
> +/*
> + * Provide the alternative code sequence.
> + *
> + * The code that follows this macro is assembled into a special
> + * section to be used for dynamic patching. Code that follows this
> + * macro must:
> + *
> + * 1. Be exactly the same length (in bytes) as the default code
> + * sequence.
> + *
> + * 2. Not jump to local labels defined outside of the alternative
> + * sequence.
Actually, we fix up the branch target during patching. What you can't do
is jump into *another* alternative sequence.
Will
next prev parent reply other threads:[~2015-07-20 17:12 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-10 13:48 [PATCH] arm64: alternative: Provide if/else/endif assembler macros Daniel Thompson
2015-07-16 18:19 ` Will Deacon
2015-07-17 10:42 ` Daniel Thompson
2015-07-20 15:09 ` [PATCH v2 0/5] " Daniel Thompson
2015-07-20 15:10 ` [PATCH v2 1/5] " Daniel Thompson
2015-07-20 17:12 ` Will Deacon [this message]
2015-07-22 11:08 ` Daniel Thompson
2015-07-20 15:10 ` [PATCH v2 2/5] arm64: mm: Adopt new alternative " Daniel Thompson
2015-07-20 15:10 ` [PATCH v2 3/5] arm64: kernel: " Daniel Thompson
2015-07-20 15:10 ` [PATCH v2 4/5] arm64: kvm: " Daniel Thompson
2015-07-20 15:10 ` [PATCH v2 5/5] arm64: alternative: Remove alternative_insn macro Daniel Thompson
2015-07-22 11:21 ` [PATCH v3 0/5] arm64: alternative: Provide if/else/endif assembler macros Daniel Thompson
2015-07-22 11:21 ` [PATCH v3 1/5] " Daniel Thompson
2015-07-22 11:21 ` [PATCH v3 2/5] arm64: mm: Adopt new alternative " Daniel Thompson
2015-07-22 11:21 ` [PATCH v3 3/5] arm64: kernel: " Daniel Thompson
2015-07-22 11:21 ` [PATCH v3 4/5] arm64: kvm: " Daniel Thompson
2015-07-22 15:17 ` Will Deacon
2015-07-22 15:55 ` Marc Zyngier
2015-07-22 11:21 ` [PATCH v3 5/5] arm64: alternative: Remove alternative_insn macro Daniel Thompson
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=20150720171242.GP9908@arm.com \
--to=will.deacon@arm.com \
--cc=Andre.Przywara@arm.com \
--cc=Catalin.Marinas@arm.com \
--cc=Marc.Zyngier@arm.com \
--cc=christoffer.dall@linaro.org \
--cc=daniel.thompson@linaro.org \
--cc=john.stultz@linaro.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@linaro.org \
--cc=sumit.semwal@linaro.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).