public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Christoph Schlameuss" <schlameuss@linux.ibm.com>
To: "Claudio Imbrenda" <imbrenda@linux.ibm.com>
Cc: <kvm@vger.kernel.org>, <linux-s390@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Shuah Khan" <shuah@kernel.org>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Janosch Frank" <frankja@linux.ibm.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Nina Schoetterl-Glausch" <nsg@linux.ibm.com>
Subject: Re: [PATCH v2 2/3] selftests: kvm: s390: Add uc_skey VM test case
Date: Thu, 12 Sep 2024 16:29:25 +0200	[thread overview]
Message-ID: <D44DL9UL4Q2T.3JHP2BM3APY6A@linux.ibm.com> (raw)
In-Reply-To: <20240912101523.5ee9ca54@p-imbrenda>

On Thu Sep 12, 2024 at 10:15 AM CEST, Claudio Imbrenda wrote:
> On Mon,  2 Sep 2024 13:50:01 +0200
> Christoph Schlameuss <schlameuss@linux.ibm.com> wrote:
>
> > Add a test case manipulating s390 storage keys from within the ucontrol
> > VM.
> > 
> > Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
> > ---
> >  .../selftests/kvm/s390x/ucontrol_test.c       | 89 ++++++++++++++++++-
> >  1 file changed, 88 insertions(+), 1 deletion(-)

[...]

> > +TEST_F(uc_kvm, uc_skey)
> > +{
> > +	u64 test_vaddr = VM_MEM_SIZE - (SZ_1M / 2);
> > +	struct kvm_sync_regs *sync_regs = &self->run->s.regs;
> > +	struct kvm_run *run = self->run;
> > +	u8 skeyvalue = 0x34;
> > +
> > +	/* copy test_skey_asm to code_hva / code_gpa */
> > +	TH_LOG("copy code %p to vm mapped memory %p / %p",
> > +	       &test_skey_asm, (void *)self->code_hva, (void *)self->code_gpa);
> > +	memcpy((void *)self->code_hva, &test_skey_asm, PAGE_SIZE);
> > +
> > +	/* set register content for test_skey_asm to access not mapped memory */
> > +	sync_regs->gprs[1] = skeyvalue;
> > +	sync_regs->gprs[5] = self->base_gpa;
> > +	sync_regs->gprs[6] = test_vaddr;
> > +	run->kvm_dirty_regs |= KVM_SYNC_GPRS;
> > +
> > +	/* DAT disabled + 64 bit mode */
> > +	run->psw_mask = 0x0000000180000000ULL;
> > +	run->psw_addr = self->code_gpa;
> > +
> > +	ASSERT_EQ(0, uc_run_once(self));
> > +	ASSERT_EQ(false, uc_handle_exit(self));
>
> this should be true, since KSS will be triggered
>

Good find.
Yes, as this is the assertion does actually fail here.
Will fix that in the next version.

> > +	ASSERT_EQ(1, sync_regs->gprs[0]);
> > +
> > +	/* ISKE */
> > +	ASSERT_EQ(0, uc_run_once(self));
> > +	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);

[...]


  reply	other threads:[~2024-09-12 14:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-02 11:49 [PATCH v2 0/3] selftests: kvm: s390: Add ucontrol memory selftests Christoph Schlameuss
2024-09-02 11:50 ` [PATCH v2 1/3] selftests: kvm: s390: Add uc_map_unmap VM test case Christoph Schlameuss
2024-09-12  8:14   ` Claudio Imbrenda
2024-09-02 11:50 ` [PATCH v2 2/3] selftests: kvm: s390: Add uc_skey " Christoph Schlameuss
2024-09-12  8:15   ` Claudio Imbrenda
2024-09-12 14:29     ` Christoph Schlameuss [this message]
2024-09-02 11:50 ` [PATCH v2 3/3] selftests: kvm: s390: Verify reject memory region operations for ucontrol VMs 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=D44DL9UL4Q2T.3JHP2BM3APY6A@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=nsg@linux.ibm.com \
    --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