From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] ARM64: mmuinfo: comment the if clauses decoding PAR_ELx
Date: Wed, 9 Oct 2024 07:57:30 +0200 [thread overview]
Message-ID: <20241009055731.4115395-1-a.fatoum@pengutronix.de> (raw)
From: Ahmad Fatoum <a.fatoum@barebox.org>
The encoding in the PAR_ELx register is a bit tricky, so add some
comments for each if-clause to make the code easier to read.
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
arch/arm/cpu/mmuinfo_64.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/arm/cpu/mmuinfo_64.c b/arch/arm/cpu/mmuinfo_64.c
index de4945f43e8e..0c5cf3e65cb7 100644
--- a/arch/arm/cpu/mmuinfo_64.c
+++ b/arch/arm/cpu/mmuinfo_64.c
@@ -133,7 +133,7 @@ static void decode_par(unsigned long par)
{
u8 devmem_attr = BITS(63, 56, par);
- if (par & 1) {
+ if (par & 1) { /* Faulting */
printf(" Translation aborted [9:8]: because of a fault in the %s%s\n",
stage_fault[BITS(9, 9, par)],
BITS(8, 8, par) ? " during a stage 1 translation table walk" : "");
@@ -141,30 +141,30 @@ static void decode_par(unsigned long par)
decode_fault_status(BITS(6, 1, par)),
decode_fault_status_level(BITS(6, 1, par)));
printf(" Failure [0]: 0x1\n");
- } else {
- if ((devmem_attr & 0xf0) && (devmem_attr & 0x0f)) {
+ } else { /* Successful */
+ if ((devmem_attr & 0xf0) && (devmem_attr & 0x0f)) { /* Normal Memory */
printf(" Outer mem. attr. [63:60]: 0x%02lx (%s)\n", BITS(63, 60, par),
cache_attr[BITS(63, 60, par)]);
printf(" Inner mem. attr. [59:56]: 0x%02lx (%s)\n", BITS(59, 56, par),
cache_attr[BITS(59, 56, par)]);
- } else if ((devmem_attr & 0b11110010) == 0) {
+ } else if ((devmem_attr & 0b11110010) == 0) { /* Device Memory */
printf(" Memory attr. [63:56]: 0x%02x (%s)\n",
devmem_attr, decode_devmem_attr(devmem_attr));
if (devmem_attr & 1)
printf(" (XS == 0 if FEAT_XS implemented)\n");
- } else if (devmem_attr == 0b01000000) {
+ } else if (devmem_attr == 0b01000000) { /* FEAT_XS-specific */
printf(" Outer mem. attr. [63:56]: 0x%02lx (%s)\n", BITS(63, 56, par),
"Non-Cacheable");
printf(" Inner mem. attr. [63:56]: 0x%02lx (%s)\n", BITS(63, 56, par),
"Non-Cacheable");
printf(" (XS == 0 if FEAT_XS implemented)\n");
- } else if (devmem_attr == 0b10100000) {
+ } else if (devmem_attr == 0b10100000) { /* FEAT_XS-specific */
printf(" Outer mem. attr. [63:56]: 0x%02lx (%s)\n", BITS(63, 56, par),
"Write-Through, No Write-Allocate");
printf(" Inner mem. attr. [63:56]: 0x%02lx (%s)\n", BITS(63, 56, par),
"Write-Through");
printf(" (XS == 0 if FEAT_XS implemented)\n");
- } else if (devmem_attr == 0b11110000) {
+ } else if (devmem_attr == 0b11110000) { /* FEAT_MTE2-specific */
printf(" Outer mem. attr. [63:56]: 0x%02lx (%s)\n", BITS(63, 56, par),
"Write-Back");
printf(" Inner mem. attr. [63:56]: 0x%02lx (%s)\n", BITS(63, 56, par),
--
2.39.5
next reply other threads:[~2024-10-09 5:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 5:57 Ahmad Fatoum [this message]
2024-10-09 5:57 ` [PATCH 2/2] ARM64: asm: mark assembly entry points as functions Ahmad Fatoum
2024-10-14 12:49 ` [PATCH 1/2] ARM64: mmuinfo: comment the if clauses decoding PAR_ELx Sascha Hauer
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=20241009055731.4115395-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@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