public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Schlameuss <schlameuss@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Shuah Khan <shuah@kernel.org>,
	linux-s390@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [PATCH v1 5/6] selftests: kvm: s390: Streamline uc_skey test to issue iske after sske
Date: Mon,  9 Dec 2024 12:07:16 +0100	[thread overview]
Message-ID: <20241209110717.77279-6-schlameuss@linux.ibm.com> (raw)
In-Reply-To: <20241209110717.77279-1-schlameuss@linux.ibm.com>

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.

Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
---
 .../selftests/kvm/s390x/ucontrol_test.c       | 22 +++++--------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/tools/testing/selftests/kvm/s390x/ucontrol_test.c b/tools/testing/selftests/kvm/s390x/ucontrol_test.c
index d3a5dbfabade..755cd31e6387 100644
--- a/tools/testing/selftests/kvm/s390x/ucontrol_test.c
+++ b/tools/testing/selftests/kvm/s390x/ucontrol_test.c
@@ -88,10 +88,6 @@ asm("test_skey_asm:\n"
 	"	ahi	%r0,1\n"
 	"	st	%r1,0(%r5,%r6)\n"
 
-	"	iske	%r1,%r6\n"
-	"	ahi	%r0,1\n"
-	"	diag	0,0,0x44\n"
-
 	"	sske	%r1,%r6\n"
 	"	xgr	%r1,%r1\n"
 	"	iske	%r1,%r6\n"
@@ -593,7 +589,9 @@ TEST_F(uc_kvm, uc_skey)
 	ASSERT_EQ(true, uc_handle_exit(self));
 	ASSERT_EQ(1, sync_regs->gprs[0]);
 
-	/* ISKE */
+	/* SSKE + ISKE */
+	sync_regs->gprs[1] = skeyvalue;
+	run->kvm_dirty_regs |= KVM_SYNC_GPRS;
 	ASSERT_EQ(0, uc_run_once(self));
 
 	/*
@@ -607,19 +605,9 @@ TEST_F(uc_kvm, uc_skey)
 	TEST_ASSERT_EQ(ICPT_INST, sie_block->icptcode);
 	TEST_REQUIRE(sie_block->ipa != 0xb229);
 
-	/* ISKE contd. */
+	/* SSKE + ISKE contd. */
 	ASSERT_EQ(false, uc_handle_exit(self));
 	ASSERT_EQ(2, sync_regs->gprs[0]);
-	/* assert initial skey (ACC = 0, R & C = 1) */
-	ASSERT_EQ(0x06, sync_regs->gprs[1]);
-	uc_assert_diag44(self);
-
-	/* SSKE + ISKE */
-	sync_regs->gprs[1] = skeyvalue;
-	run->kvm_dirty_regs |= KVM_SYNC_GPRS;
-	ASSERT_EQ(0, uc_run_once(self));
-	ASSERT_EQ(false, uc_handle_exit(self));
-	ASSERT_EQ(3, sync_regs->gprs[0]);
 	ASSERT_EQ(skeyvalue, sync_regs->gprs[1]);
 	uc_assert_diag44(self);
 
@@ -628,7 +616,7 @@ TEST_F(uc_kvm, uc_skey)
 	run->kvm_dirty_regs |= KVM_SYNC_GPRS;
 	ASSERT_EQ(0, uc_run_once(self));
 	ASSERT_EQ(false, uc_handle_exit(self));
-	ASSERT_EQ(4, sync_regs->gprs[0]);
+	ASSERT_EQ(3, sync_regs->gprs[0]);
 	/* assert R reset but rest of skey unchanged */
 	ASSERT_EQ(skeyvalue & 0xfa, sync_regs->gprs[1]);
 	ASSERT_EQ(0, sync_regs->gprs[1] & 0x04);
-- 
2.47.1


  parent reply	other threads:[~2024-12-09 11:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09 11:07 [PATCH v1 0/6] selftests: kvm: s390: Reject invalid ioctls on ucontrol VMs Christoph Schlameuss
2024-12-09 11:07 ` [PATCH v1 1/6] kvm: s390: Reject setting flic pfault attributes " Christoph Schlameuss
2024-12-09 11:36   ` Janosch Frank
2024-12-09 11:40   ` Janosch Frank
2024-12-09 15:23   ` Christoph Schlameuss
2024-12-09 11:07 ` [PATCH v1 2/6] selftests: kvm: s390: Add ucontrol flic attr selftests Christoph Schlameuss
2024-12-09 18:14   ` Claudio Imbrenda
2024-12-10  9:34     ` Christoph Schlameuss
2024-12-09 11:07 ` [PATCH v1 3/6] kvm: s390: Reject KVM_SET_GSI_ROUTING on ucontrol VMs Christoph Schlameuss
2024-12-09 15:23   ` Christoph Schlameuss
2024-12-09 11:07 ` [PATCH v1 4/6] selftests: kvm: s390: Add ucontrol gis routing test Christoph Schlameuss
2024-12-09 11:07 ` Christoph Schlameuss [this message]
2024-12-09 15:23   ` [PATCH v1 5/6] selftests: kvm: s390: Streamline uc_skey test to issue iske after sske Christoph Schlameuss
2024-12-09 11:07 ` [PATCH v1 6/6] selftests: kvm: s390: Add has device attr check to uc_attr_mem_limit selftest Christoph Schlameuss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241209110717.77279-6-schlameuss@linux.ibm.com \
    --to=schlameuss@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox