From: Andre Przywara <andre.przywara@arm.com>
To: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>,
Heinrich Schuchardt <heinrich.schuchardt@canonical.com>,
Alison Wang <alison.wang@nxp.com>,
Michael Walle <michael@walle.cc>, Nishanth Menon <nm@ti.com>,
Priyanka Singh <priyanka.singh@nxp.com>,
Peter Hoyes <Peter.Hoyes@arm.com>,
Marek Vasut <marek.vasut+renesas@gmail.com>,
u-boot@lists.denx.de
Subject: [PATCH 5/6] armv8: Simplify switch_el macro
Date: Sun, 9 Jan 2022 17:30:08 +0000 [thread overview]
Message-ID: <20220109173009.25522-6-andre.przywara@arm.com> (raw)
In-Reply-To: <20220109173009.25522-1-andre.przywara@arm.com>
The switch_el macro is a neat contraption to handle cases where we need
different code depending on the current exception level, but its
implementation was longer than needed.
Simplify it by doing just one comparison, then using the different
condition codes to branch to the desired target. PState.CurrentEL just
holds two bits, and since we don't care about EL0, we can use >, =, < to
select EL3, EL2 and EL1, respectively.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
arch/arm/include/asm/macro.h | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/arm/include/asm/macro.h b/arch/arm/include/asm/macro.h
index ec0171e0e6c..acd519020d7 100644
--- a/arch/arm/include/asm/macro.h
+++ b/arch/arm/include/asm/macro.h
@@ -69,12 +69,10 @@ lr .req x30
*/
.macro switch_el, xreg, el3_label, el2_label, el1_label
mrs \xreg, CurrentEL
- cmp \xreg, 0xc
- b.eq \el3_label
- cmp \xreg, 0x8
+ cmp \xreg, #0x8
+ b.gt \el3_label
b.eq \el2_label
- cmp \xreg, 0x4
- b.eq \el1_label
+ b.lt \el1_label
.endm
/*
--
2.17.6
next prev parent reply other threads:[~2022-01-09 17:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-09 17:30 [PATCH 0/6] armv8: fixes and cleanups Andre Przywara
2022-01-09 17:30 ` [PATCH 1/6] cmd: exception: arm64: fix undefined, add faults Andre Przywara
2022-01-09 18:43 ` Heinrich Schuchardt
2022-01-09 19:08 ` Heinrich Schuchardt
2022-01-09 21:31 ` Andre Przywara
2022-01-09 22:19 ` Heinrich Schuchardt
2022-01-09 22:35 ` Andre Przywara
2022-01-09 22:47 ` Mark Kettenis
2022-01-09 23:19 ` Andre Przywara
2022-01-09 23:23 ` Heinrich Schuchardt
2022-01-09 23:49 ` Andre Przywara
2022-01-10 22:37 ` Mark Kettenis
2022-01-11 10:28 ` Andre Przywara
2022-01-09 17:30 ` [PATCH 2/6] armv8: Always unmask SErrors Andre Przywara
2022-01-09 17:30 ` [PATCH 3/6] armv8: Force SP_ELx stack pointer usage Andre Przywara
2022-01-09 17:30 ` [PATCH 4/6] arm: Clean up asm/io.h Andre Przywara
2022-01-09 21:39 ` Andre Przywara
2022-01-13 6:44 ` Leo Liang
2022-01-09 17:30 ` Andre Przywara [this message]
2022-01-09 17:30 ` [PATCH 6/6] armv8: Fix and simplify branch_if_master/branch_if_slave Andre Przywara
2022-01-09 19:14 ` [PATCH 0/6] armv8: fixes and cleanups Michael Walle
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=20220109173009.25522-6-andre.przywara@arm.com \
--to=andre.przywara@arm.com \
--cc=Peter.Hoyes@arm.com \
--cc=alison.wang@nxp.com \
--cc=heinrich.schuchardt@canonical.com \
--cc=marek.vasut+renesas@gmail.com \
--cc=michael@walle.cc \
--cc=nm@ti.com \
--cc=priyanka.singh@nxp.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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