[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 24/71] target/arm: Add ARM_CP_SME
From: |
Richard Henderson |
Subject: |
[PATCH 24/71] target/arm: Add ARM_CP_SME |
Date: |
Thu, 2 Jun 2022 14:48:06 -0700 |
This will be used for controlling access to SME cpregs.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/cpregs.h | 5 +++++
target/arm/translate-a64.c | 18 ++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h
index d9b678c2f1..d30758ee71 100644
--- a/target/arm/cpregs.h
+++ b/target/arm/cpregs.h
@@ -113,6 +113,11 @@ enum {
ARM_CP_EL3_NO_EL2_UNDEF = 1 << 16,
ARM_CP_EL3_NO_EL2_KEEP = 1 << 17,
ARM_CP_EL3_NO_EL2_C_NZ = 1 << 18,
+ /*
+ * Flag: Access check for this sysreg is constrained by the
+ * ARM pseudocode function CheckSMEAccess().
+ */
+ ARM_CP_SME = 1 << 19,
};
/*
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 8bbd1b7f07..f51d80d816 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -1186,6 +1186,22 @@ bool sve_access_check(DisasContext *s)
return fp_access_check(s);
}
+/*
+ * Check that SME access is enabled, raise an exception if not.
+ * Note that this function corresponds to CheckSMEAccess and is
+ * only used directly for cpregs.
+ */
+static bool sme_access_check(DisasContext *s)
+{
+ if (s->sme_excp_el) {
+ gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
+ syn_smetrap(SME_ET_AccessTrap, false),
+ s->sme_excp_el);
+ return false;
+ }
+ return true;
+}
+
/*
* This utility function is for doing register extension with an
* optional shift. You will likely want to pass a temporary for the
@@ -1958,6 +1974,8 @@ static void handle_sys(DisasContext *s, uint32_t insn,
bool isread,
return;
} else if ((ri->type & ARM_CP_SVE) && !sve_access_check(s)) {
return;
+ } else if ((ri->type & ARM_CP_SME) && !sme_access_check(s)) {
+ return;
}
if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) {
--
2.34.1
- Re: [PATCH 19/71] target/arm: Add isar_feature_aa64_sme, (continued)
- [PATCH 14/71] target/arm: Export sve contiguous ldst support functions, Richard Henderson, 2022/06/02
- [PATCH 21/71] target/arm: Implement TPIDR2_EL0, Richard Henderson, 2022/06/02
- [PATCH 23/71] target/arm: Add syn_smetrap, Richard Henderson, 2022/06/02
- [PATCH 25/71] target/arm: Add SVCR, Richard Henderson, 2022/06/02
- [PATCH 24/71] target/arm: Add ARM_CP_SME,
Richard Henderson <=
- [PATCH 27/71] target/arm: Add SMIDR_EL1, SMPRI_EL1, SMPRIMAP_EL2, Richard Henderson, 2022/06/02
- [PATCH 29/71] target/arm: Add the SME ZA storage to CPUARMState, Richard Henderson, 2022/06/02
- [PATCH 30/71] target/arm: Implement SMSTART, SMSTOP, Richard Henderson, 2022/06/02
- [PATCH 33/71] target/arm: Generalize cpu_arm_{get,set}_vq, Richard Henderson, 2022/06/02
- [PATCH 31/71] target/arm: Move error for sve%d property to arm_cpu_sve_finalize, Richard Henderson, 2022/06/02