Skip to content

Commit 0e5f0d8

Browse files
rth7680Michael Tokarev
authored andcommitted
target/arm: Fix sve_access_check for SME
Do not assume SME implies SVE. Ensure that the non-streaming check is present along the SME path, since it is not implied by sme_*_enabled_check. Cc: [email protected] Reviewed-by: Peter Maydell <[email protected]> Signed-off-by: Richard Henderson <[email protected]> Message-id: [email protected] Signed-off-by: Peter Maydell <[email protected]> (cherry picked from commit b4b2e070f41dd8774a70c6186141678558d79a38) Signed-off-by: Michael Tokarev <[email protected]>
1 parent 83b48a5 commit 0e5f0d8

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

target/arm/tcg/translate-a64.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,11 +1392,8 @@ static bool fp_access_check_only(DisasContext *s)
13921392
return true;
13931393
}
13941394

1395-
static bool fp_access_check(DisasContext *s)
1395+
static bool nonstreaming_check(DisasContext *s)
13961396
{
1397-
if (!fp_access_check_only(s)) {
1398-
return false;
1399-
}
14001397
if (s->sme_trap_nonstreaming && s->is_nonstreaming) {
14011398
gen_exception_insn(s, 0, EXCP_UDEF,
14021399
syn_smetrap(SME_ET_Streaming, false));
@@ -1405,6 +1402,11 @@ static bool fp_access_check(DisasContext *s)
14051402
return true;
14061403
}
14071404

1405+
static bool fp_access_check(DisasContext *s)
1406+
{
1407+
return fp_access_check_only(s) && nonstreaming_check(s);
1408+
}
1409+
14081410
/*
14091411
* Return <0 for non-supported element sizes, with MO_16 controlled by
14101412
* FEAT_FP16; return 0 for fp disabled; otherwise return >0 for success.
@@ -1455,14 +1457,24 @@ static int fp_access_check_vector_hsd(DisasContext *s, bool is_q, MemOp esz)
14551457
*/
14561458
bool sve_access_check(DisasContext *s)
14571459
{
1458-
if (s->pstate_sm || !dc_isar_feature(aa64_sve, s)) {
1460+
if (dc_isar_feature(aa64_sme, s)) {
14591461
bool ret;
14601462

1461-
assert(dc_isar_feature(aa64_sme, s));
1462-
ret = sme_sm_enabled_check(s);
1463+
if (s->pstate_sm) {
1464+
ret = sme_enabled_check(s);
1465+
} else if (dc_isar_feature(aa64_sve, s)) {
1466+
goto continue_sve;
1467+
} else {
1468+
ret = sme_sm_enabled_check(s);
1469+
}
1470+
if (ret) {
1471+
ret = nonstreaming_check(s);
1472+
}
14631473
s->sve_access_checked = (ret ? 1 : -1);
14641474
return ret;
14651475
}
1476+
1477+
continue_sve:
14661478
if (s->sve_excp_el) {
14671479
/* Assert that we only raise one exception per instruction. */
14681480
assert(!s->sve_access_checked);

0 commit comments

Comments
 (0)