mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] fixup! ARM64: mmu: fix mmu_early_enable VA->PA mapping
Date: Mon, 18 Dec 2023 13:42:16 +0100	[thread overview]
Message-ID: <20231218124216.2872831-1-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <PR3P195MB055567DB185710A642B12808C390A@PR3P195MB0555.EURP195.PROD.OUTLOOK.COM>

Fix warnings and reformat:

  - fix whitespaces in accordance with kernel coding style
  - mark locally-used function static to fix warning
  - remove cast to fix -Wint-conversion warning
  - Use C-style comments as used elsewhere

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/cpu/mmu_64.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index e855ae4fa7d4..a392789ab696 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -294,12 +294,13 @@ void dma_flush_range(void *ptr, size_t size)
 	v8_flush_dcache_range(start, end);
 }
 
-void init_range(void *virt_addr, size_t size)
+static void init_range(void *virt_addr, size_t size)
 {
 	uint64_t *ttb = get_ttb();
 	uint64_t addr = (uint64_t)virt_addr;
-	while(size) {
-		early_remap_range((void *)addr, L0_XLAT_SIZE, MAP_UNCACHED);
+
+	while (size) {
+		early_remap_range(addr, L0_XLAT_SIZE, MAP_UNCACHED);
 		split_block(ttb,0);
 		size -= L0_XLAT_SIZE;
 		addr += L0_XLAT_SIZE;
@@ -324,9 +325,10 @@ void mmu_early_enable(unsigned long membase, unsigned long memsize)
 
 	memset((void *)ttb, 0, GRANULE_SIZE);
 
-	// Assume maximum BITS_PER_PA set to 40 bits.
-	// Set 1:1 mapping of VA->PA. So to cover the full 1TB range we need 2 tables.
-	init_range(0, 2*L0_XLAT_SIZE);
+	/* Assuming maximum BITS_PER_PA set to 40 bits, set 1:1 mapping
+	 * of VA->PA. To cover the full 1TiB range we need 2 tables.
+	 */
+	init_range(0, 2 * L0_XLAT_SIZE);
 	early_remap_range(membase, memsize - OPTEE_SIZE, MAP_CACHED);
 	early_remap_range(membase + memsize - OPTEE_SIZE, OPTEE_SIZE, MAP_FAULT);
 	early_remap_range(PAGE_ALIGN_DOWN((uintptr_t)_stext), PAGE_ALIGN(_etext - _stext), MAP_CACHED);
-- 
2.39.2




  reply	other threads:[~2023-12-18 12:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18 12:05 [PATCH] " Lior Weintraub
2023-12-18 12:42 ` Ahmad Fatoum [this message]
2023-12-18 12:43 ` Ahmad Fatoum
2023-12-18 14:00   ` Lior Weintraub

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=20231218124216.2872831-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