Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: linux-arm-kernel@lists.infradead.org
Cc: mark.rutland@arm.com, steve.capper@arm.com,
	catalin.marinas@arm.com, linux-kernel@vger.kernel.org,
	broonie@kernel.org, shan.gavin@gmail.com, will@kernel.org
Subject: [PATCH] arm64/kernel: Fix range on invalidating dcache for boot page tables
Date: Fri, 24 Apr 2020 15:02:30 +1000	[thread overview]
Message-ID: <20200424050230.16720-1-gshan@redhat.com> (raw)

The MMU is disabled when __create_page_tables() is called. The data
cache corresponding to these two page tables, which are tracked by
@idmap_pg_dir and @init_pg_dir, is invalidated after the page tables
are populated. However, the wrong or inappropriate size have been used
and more data cache are invalidated than it need.

This fixes the issue by invalidating the data cache for these two
page tables separately as they aren't necessarily physically adjacent.

Signed-off-by: Gavin Shan <gshan@redhat.com>
---
 arch/arm64/kernel/head.S | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 57a91032b4c2..66947873c9e7 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -398,6 +398,10 @@ SYM_FUNC_START_LOCAL(__create_page_tables)
 	 * tables again to remove any speculatively loaded cache lines.
 	 */
 	adrp	x0, idmap_pg_dir
+	mov	x1, #IDMAP_DIR_SIZE
+	dmb	sy
+	bl	__inval_dcache_area
+	adrp	x0, init_pg_dir
 	adrp	x1, init_pg_end
 	sub	x1, x1, x0
 	dmb	sy
-- 
2.23.0


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

             reply	other threads:[~2020-04-24  5:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24  5:02 Gavin Shan [this message]
2020-04-24 10:01 ` [PATCH] arm64/kernel: Fix range on invalidating dcache for boot page tables Mark Rutland
2020-04-27 23:53   ` Gavin Shan

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=20200424050230.16720-1-gshan@redhat.com \
    --to=gshan@redhat.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=shan.gavin@gmail.com \
    --cc=steve.capper@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox