Linux KVM/arm64 development list
 help / color / mirror / Atom feed
From: Nadav Amit <nadav.amit@gmail.com>
To: Andrew Jones <andrew.jones@linux.dev>
Cc: kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu,
	kvm@vger.kernel.org, Nadav Amit <namit@vmware.com>
Subject: [kvm-unit-tests PATCH 1/2] arm64: set sctlr_el1.SPAN
Date: Sat, 17 Jun 2023 01:31:37 +0000	[thread overview]
Message-ID: <20230617013138.1823-2-namit@vmware.com> (raw)
In-Reply-To: <20230617013138.1823-1-namit@vmware.com>

From: Nadav Amit <namit@vmware.com>

Do not assume PAN is not supported or that sctlr_el1.SPAN is already set.

Without setting sctlr_el1.SPAN, tests crash when they access the memory
after an exception.

Signed-off-by: Nadav Amit <namit@vmware.com>
---
 arm/cstart64.S         | 1 +
 lib/arm64/asm/sysreg.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arm/cstart64.S b/arm/cstart64.S
index 61e27d3..d4cee6f 100644
--- a/arm/cstart64.S
+++ b/arm/cstart64.S
@@ -245,6 +245,7 @@ asm_mmu_enable:
 	orr	x1, x1, SCTLR_EL1_C
 	orr	x1, x1, SCTLR_EL1_I
 	orr	x1, x1, SCTLR_EL1_M
+	orr	x1, x1, SCTLR_EL1_SPAN
 	msr	sctlr_el1, x1
 	isb
 
diff --git a/lib/arm64/asm/sysreg.h b/lib/arm64/asm/sysreg.h
index 18c4ed3..b9868ff 100644
--- a/lib/arm64/asm/sysreg.h
+++ b/lib/arm64/asm/sysreg.h
@@ -81,6 +81,7 @@ asm(
 
 /* System Control Register (SCTLR_EL1) bits */
 #define SCTLR_EL1_EE	(1 << 25)
+#define SCTLR_EL1_SPAN	(1 << 23)
 #define SCTLR_EL1_WXN	(1 << 19)
 #define SCTLR_EL1_I	(1 << 12)
 #define SCTLR_EL1_SA0	(1 << 4)
-- 
2.34.1


  reply	other threads:[~2023-06-17  1:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-17  1:31 [kvm-unit-tests PATCH 0/2] arm64: fix paging issues Nadav Amit
2023-06-17  1:31 ` Nadav Amit [this message]
2023-06-25 19:44   ` [kvm-unit-tests PATCH 1/2] arm64: set sctlr_el1.SPAN Nadav Amit
2023-07-07 18:26   ` Nadav Amit
2023-07-14 10:31   ` Alexandru Elisei
2023-07-14 11:29     ` Shaoqin Huang
2023-07-14 18:42       ` Nadav Amit
2023-07-17  6:50         ` Andrew Jones
2023-07-17  6:52           ` Andrew Jones
2023-07-17  8:53             ` Nikos Nikoleris
2023-07-17 17:05               ` Nadav Amit
2023-07-18  8:44                 ` Alexandru Elisei
2023-07-19  5:42                   ` Nadav Amit
2023-06-17  1:31 ` [kvm-unit-tests PATCH 2/2] arm64: ensure tlbi is safe Nadav Amit
2023-07-14 10:55   ` Alexandru Elisei
2023-07-14 17:20     ` Nadav Amit

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=20230617013138.1823-2-namit@vmware.com \
    --to=nadav.amit@gmail.com \
    --cc=andrew.jones@linux.dev \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=kvmarm@lists.linux.dev \
    --cc=namit@vmware.com \
    /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