@@ -439,10 +439,17 @@ static bool check_ptrace_values_sve(pid_t child, struct test_config *config)
439439 pass = false;
440440 }
441441
442- if (sve -> size != SVE_PT_SIZE (vq , sve -> flags )) {
443- ksft_print_msg ("Mismatch in SVE header size: %d != %lu\n" ,
444- sve -> size , SVE_PT_SIZE (vq , sve -> flags ));
445- pass = false;
442+ if (svcr_in & SVCR_SM ) {
443+ if (sve -> size != sizeof (sve )) {
444+ ksft_print_msg ("NT_ARM_SVE reports data with PSTATE.SM\n" );
445+ pass = false;
446+ }
447+ } else {
448+ if (sve -> size != SVE_PT_SIZE (vq , sve -> flags )) {
449+ ksft_print_msg ("Mismatch in SVE header size: %d != %lu\n" ,
450+ sve -> size , SVE_PT_SIZE (vq , sve -> flags ));
451+ pass = false;
452+ }
446453 }
447454
448455 /* The registers might be in completely different formats! */
@@ -515,10 +522,17 @@ static bool check_ptrace_values_ssve(pid_t child, struct test_config *config)
515522 pass = false;
516523 }
517524
518- if (sve -> size != SVE_PT_SIZE (vq , sve -> flags )) {
519- ksft_print_msg ("Mismatch in SSVE header size: %d != %lu\n" ,
520- sve -> size , SVE_PT_SIZE (vq , sve -> flags ));
521- pass = false;
525+ if (!(svcr_in & SVCR_SM )) {
526+ if (sve -> size != sizeof (sve )) {
527+ ksft_print_msg ("NT_ARM_SSVE reports data without PSTATE.SM\n" );
528+ pass = false;
529+ }
530+ } else {
531+ if (sve -> size != SVE_PT_SIZE (vq , sve -> flags )) {
532+ ksft_print_msg ("Mismatch in SSVE header size: %d != %lu\n" ,
533+ sve -> size , SVE_PT_SIZE (vq , sve -> flags ));
534+ pass = false;
535+ }
522536 }
523537
524538 /* The registers might be in completely different formats! */
@@ -891,18 +905,11 @@ static void set_initial_values(struct test_config *config)
891905{
892906 int vq = __sve_vq_from_vl (vl_in (config ));
893907 int sme_vq = __sve_vq_from_vl (config -> sme_vl_in );
894- bool sm_change ;
895908
896909 svcr_in = config -> svcr_in ;
897910 svcr_expected = config -> svcr_expected ;
898911 svcr_out = 0 ;
899912
900- if (sme_supported () &&
901- (svcr_in & SVCR_SM ) != (svcr_expected & SVCR_SM ))
902- sm_change = true;
903- else
904- sm_change = false;
905-
906913 fill_random (& v_in , sizeof (v_in ));
907914 memcpy (v_expected , v_in , sizeof (v_in ));
908915 memset (v_out , 0 , sizeof (v_out ));
@@ -953,12 +960,7 @@ static void set_initial_values(struct test_config *config)
953960 if (fpmr_supported ()) {
954961 fill_random (& fpmr_in , sizeof (fpmr_in ));
955962 fpmr_in &= FPMR_SAFE_BITS ;
956-
957- /* Entering or exiting streaming mode clears FPMR */
958- if (sm_change )
959- fpmr_expected = 0 ;
960- else
961- fpmr_expected = fpmr_in ;
963+ fpmr_expected = fpmr_in ;
962964 } else {
963965 fpmr_in = 0 ;
964966 fpmr_expected = 0 ;
@@ -1195,18 +1197,8 @@ static void sve_write(pid_t child, struct test_config *config)
11951197
11961198static bool za_write_supported (struct test_config * config )
11971199{
1198- if (config -> sme_vl_in != config -> sme_vl_expected ) {
1199- /* Changing the SME VL exits streaming mode. */
1200- if (config -> svcr_expected & SVCR_SM ) {
1201- return false;
1202- }
1203- } else {
1204- /* Otherwise we can't change streaming mode */
1205- if ((config -> svcr_in & SVCR_SM ) !=
1206- (config -> svcr_expected & SVCR_SM )) {
1207- return false;
1208- }
1209- }
1200+ if ((config -> svcr_in & SVCR_SM ) != (config -> svcr_expected & SVCR_SM ))
1201+ return false;
12101202
12111203 return true;
12121204}
@@ -1224,10 +1216,8 @@ static void za_write_expected(struct test_config *config)
12241216 memset (zt_expected , 0 , sizeof (zt_expected ));
12251217 }
12261218
1227- /* Changing the SME VL flushes ZT, SVE state and exits SM */
1219+ /* Changing the SME VL flushes ZT, SVE state */
12281220 if (config -> sme_vl_in != config -> sme_vl_expected ) {
1229- svcr_expected &= ~SVCR_SM ;
1230-
12311221 sve_vq = __sve_vq_from_vl (vl_expected (config ));
12321222 memset (z_expected , 0 , __SVE_ZREGS_SIZE (sve_vq ));
12331223 memset (p_expected , 0 , __SVE_PREGS_SIZE (sve_vq ));
0 commit comments