All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: mark.rutland@arm.com, catalin.marinas@arm.com, will@kernel.org,
	Anshuman Khandual <anshuman.khandual@arm.com>
Subject: [PATCH 5/6] arm64: head: clarify `map_memory`
Date: Wed, 18 May 2022 08:47:24 +0530	[thread overview]
Message-ID: <20220518031725.3128044-6-anshuman.khandual@arm.com> (raw)
In-Reply-To: <20220518031725.3128044-1-anshuman.khandual@arm.com>

From: Mark Rutland <mark.rutland@arm.com>

In the `map_memory` macro we repurpose the `count` temporary register to
hold the physical address `phys` aligned downwards to
SWAPPER_BLOCK_SIZE. Due to the subtle usage of `count` elsewhere, this
is a little confusing, and is also unnecessary as we can safely corrupt
`phys`, which is not used after `map_memory` completes.

This patch makes `map_memory` manipulate `phys` in-place, and updates
the documentation to mention that it corrupts `phys`.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/arm64/kernel/head.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 01739f5ec3de..107275e06212 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -225,7 +225,7 @@ SYM_CODE_END(preserve_boot_args)
  *
  * Temporaries:	istart, iend, tmp, count, sv - these need to be different registers
  * Preserves:	vstart, flags
- * Corrupts:	tbl, rtbl, vend, istart, iend, tmp, count, sv
+ * Corrupts:	tbl, rtbl, vend, phys, istart, iend, tmp, count, sv
  */
 	.macro map_memory, tbl, rtbl, vstart, vend, flags, phys, pgds, istart, iend, tmp, count, sv
 	sub \vend, \vend, #1
@@ -251,8 +251,8 @@ SYM_CODE_END(preserve_boot_args)
 #endif
 
 	compute_indices \vstart, \vend, #SWAPPER_BLOCK_SHIFT, #PTRS_PER_PTE, \istart, \iend, \count, \tmp
-	bic \count, \phys, #SWAPPER_BLOCK_SIZE - 1
-	populate_entries \tbl, \count, \istart, \iend, \flags, #SWAPPER_BLOCK_SIZE, \tmp
+	bic \phys, \phys, #SWAPPER_BLOCK_SIZE - 1
+	populate_entries \tbl, \phys, \istart, \iend, \flags, #SWAPPER_BLOCK_SIZE, \tmp
 	.endm
 
 /*
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-05-18  3:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18  3:17 [PATCH 0/6] arm64/head: Cleanups for __create_page_tables() Anshuman Khandual
2022-05-18  3:17 ` [PATCH 1/6] arm64: don't override idmap t0sz Anshuman Khandual
2022-05-18  6:41   ` Ard Biesheuvel
2022-05-18  3:17 ` [PATCH 2/6] arm64: head: remove __PHYS_OFFSET Anshuman Khandual
2022-05-18  6:45   ` Ard Biesheuvel
2022-05-18  3:17 ` [PATCH 3/6] arm64: head: clarify `populate_entries` Anshuman Khandual
2022-05-18  3:17 ` [PATCH 4/6] arm64: head: clarify `compute_indices` Anshuman Khandual
2022-05-18  6:47   ` Ard Biesheuvel
2022-05-18  3:17 ` Anshuman Khandual [this message]
2022-05-18  3:17 ` [PATCH 6/6] arm64: head: clarify commentary for __create_page_tables Anshuman Khandual
2022-05-18  6:52 ` [PATCH 0/6] arm64/head: Cleanups for __create_page_tables() Ard Biesheuvel
2022-05-18  9:35   ` Anshuman Khandual
2022-06-27 10:17     ` Will Deacon
2022-06-28  4:47       ` Anshuman Khandual

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=20220518031725.3128044-6-anshuman.khandual@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=will@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.