@@ -219,6 +219,7 @@ static void guest_code(void)
219
219
GUEST_REG_SYNC (SYS_ID_AA64MMFR1_EL1 );
220
220
GUEST_REG_SYNC (SYS_ID_AA64MMFR2_EL1 );
221
221
GUEST_REG_SYNC (SYS_ID_AA64ZFR0_EL1 );
222
+ GUEST_REG_SYNC (SYS_CTR_EL0 );
222
223
223
224
GUEST_DONE ();
224
225
}
@@ -490,11 +491,25 @@ static void test_clidr(struct kvm_vcpu *vcpu)
490
491
test_reg_vals [encoding_to_range_idx (SYS_CLIDR_EL1 )] = clidr ;
491
492
}
492
493
494
+ static void test_ctr (struct kvm_vcpu * vcpu )
495
+ {
496
+ u64 ctr ;
497
+
498
+ vcpu_get_reg (vcpu , KVM_ARM64_SYS_REG (SYS_CTR_EL0 ), & ctr );
499
+ ctr &= ~CTR_EL0_DIC_MASK ;
500
+ if (ctr & CTR_EL0_IminLine_MASK )
501
+ ctr -- ;
502
+
503
+ vcpu_set_reg (vcpu , KVM_ARM64_SYS_REG (SYS_CTR_EL0 ), ctr );
504
+ test_reg_vals [encoding_to_range_idx (SYS_CTR_EL0 )] = ctr ;
505
+ }
506
+
493
507
static void test_vcpu_ftr_id_regs (struct kvm_vcpu * vcpu )
494
508
{
495
509
u64 val ;
496
510
497
511
test_clidr (vcpu );
512
+ test_ctr (vcpu );
498
513
499
514
vcpu_get_reg (vcpu , KVM_ARM64_SYS_REG (SYS_MPIDR_EL1 ), & val );
500
515
val ++ ;
@@ -525,6 +540,7 @@ static void test_reset_preserves_id_regs(struct kvm_vcpu *vcpu)
525
540
test_assert_id_reg_unchanged (vcpu , test_regs [i ].reg );
526
541
527
542
test_assert_id_reg_unchanged (vcpu , SYS_CLIDR_EL1 );
543
+ test_assert_id_reg_unchanged (vcpu , SYS_CTR_EL0 );
528
544
529
545
ksft_test_result_pass ("%s\n" , __func__ );
530
546
}
0 commit comments