Skip to content

Commit 3223906

Browse files
schlacClaudio Imbrenda
authored andcommitted
KVM: s390: selftests: Streamline uc_skey test to issue iske after sske
In some rare situations a non default storage key is already set on the memory used by the test. Within normal VMs the key is reset / zapped when the memory is added to the VM. This is not the case for ucontrol VMs. With the initial iske check removed this test case can work in all situations. The function of the iske instruction is still validated by the remaining code. Fixes: 0185fbc ("KVM: s390: selftests: Add uc_skey VM test case") Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com> Link: https://lore.kernel.org/r/20250128131803.1047388-1-schlameuss@linux.ibm.com Message-ID: <20250128131803.1047388-1-schlameuss@linux.ibm.com> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
1 parent 84b7387 commit 3223906

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

tools/testing/selftests/kvm/s390/ucontrol_test.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ asm("test_skey_asm:\n"
8888
" ahi %r0,1\n"
8989
" st %r1,0(%r5,%r6)\n"
9090

91-
" iske %r1,%r6\n"
92-
" ahi %r0,1\n"
93-
" diag 0,0,0x44\n"
94-
9591
" sske %r1,%r6\n"
9692
" xgr %r1,%r1\n"
9793
" iske %r1,%r6\n"
@@ -600,7 +596,9 @@ TEST_F(uc_kvm, uc_skey)
600596
ASSERT_EQ(true, uc_handle_exit(self));
601597
ASSERT_EQ(1, sync_regs->gprs[0]);
602598

603-
/* ISKE */
599+
/* SSKE + ISKE */
600+
sync_regs->gprs[1] = skeyvalue;
601+
run->kvm_dirty_regs |= KVM_SYNC_GPRS;
604602
ASSERT_EQ(0, uc_run_once(self));
605603

606604
/*
@@ -612,21 +610,11 @@ TEST_F(uc_kvm, uc_skey)
612610
TEST_ASSERT_EQ(0, sie_block->ictl & (ICTL_ISKE | ICTL_SSKE | ICTL_RRBE));
613611
TEST_ASSERT_EQ(KVM_EXIT_S390_SIEIC, self->run->exit_reason);
614612
TEST_ASSERT_EQ(ICPT_INST, sie_block->icptcode);
615-
TEST_REQUIRE(sie_block->ipa != 0xb229);
613+
TEST_REQUIRE(sie_block->ipa != 0xb22b);
616614

617-
/* ISKE contd. */
615+
/* SSKE + ISKE contd. */
618616
ASSERT_EQ(false, uc_handle_exit(self));
619617
ASSERT_EQ(2, sync_regs->gprs[0]);
620-
/* assert initial skey (ACC = 0, R & C = 1) */
621-
ASSERT_EQ(0x06, sync_regs->gprs[1]);
622-
uc_assert_diag44(self);
623-
624-
/* SSKE + ISKE */
625-
sync_regs->gprs[1] = skeyvalue;
626-
run->kvm_dirty_regs |= KVM_SYNC_GPRS;
627-
ASSERT_EQ(0, uc_run_once(self));
628-
ASSERT_EQ(false, uc_handle_exit(self));
629-
ASSERT_EQ(3, sync_regs->gprs[0]);
630618
ASSERT_EQ(skeyvalue, sync_regs->gprs[1]);
631619
uc_assert_diag44(self);
632620

@@ -635,7 +623,7 @@ TEST_F(uc_kvm, uc_skey)
635623
run->kvm_dirty_regs |= KVM_SYNC_GPRS;
636624
ASSERT_EQ(0, uc_run_once(self));
637625
ASSERT_EQ(false, uc_handle_exit(self));
638-
ASSERT_EQ(4, sync_regs->gprs[0]);
626+
ASSERT_EQ(3, sync_regs->gprs[0]);
639627
/* assert R reset but rest of skey unchanged */
640628
ASSERT_EQ(skeyvalue & 0xfa, sync_regs->gprs[1]);
641629
ASSERT_EQ(0, sync_regs->gprs[1] & 0x04);

0 commit comments

Comments
 (0)