Re: [PATCH v3 06/10] selftests: kvm: s390: Add VM run test case

Christoph Schlameuss
2024-08-01T07:05:36Z

On Wed, 31 Jul 2024 16:37:19 +0200
Janosch Frank <frankja@linux.ibm.com> wrote:

> On 7/30/24 9:24 AM, Christoph Schlameuss wrote:
> > Add test case running code interacting with registers within a
> > ucontrol VM.
> >
> > * Add uc_gprs test case
> >
> > The test uses the same VM setup using the fixture and debug macros
> > introduced in earlier patches in this series.
> >
> > Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
> > ---
> > .../selftests/kvm/s390x/ucontrol_test.c | 126 ++++++++++++++++++
> > 1 file changed, 126 insertions(+)
> >
> > diff --git a/tools/testing/selftests/kvm/s390x/ucontrol_test.c b/tools/testing/selftests/kvm/s390x/ucontrol_test.c
> > index 029233374465..817b1e08559c 100644
> > --- a/tools/testing/selftests/kvm/s390x/ucontrol_test.c
> > +++ b/tools/testing/selftests/kvm/s390x/ucontrol_test.c
> > @@ -41,6 +41,23 @@ void require_ucontrol_admin(void)
> > TEST_REQUIRE(kvm_has_cap(KVM_CAP_S390_UCONTROL));
> > }
> [...]
> > +/* verify SIEIC exit
> > + * * reset stop requests
> > + * * fail on codes not expected in the test cases
> > + */
> > +static bool uc_handle_sieic(FIXTURE_DATA(uc_kvm) * self)
> > +{
> > + struct kvm_s390_sie_block *sie_block = self->sie_block;
> > + struct kvm_run *run = self->run;
> > +
> > + /* check SIE interception code */
> > + pr_info("sieic: 0x%2x 0x%4x 0x%4x\n",
>
> I don't think there should be a space before the 4:
> sieic: 0x 4 0x8300 0x440000
>
> We can automatically add in the missing 0
> 0x%02x
>

At some point I considered that easier to read without the leading
zeroes, but even that is not even true for me any more. I will change
that to "sieic: 0x%.2x 0x%.4x 0x%.4x\n".

> > + run->s390_sieic.icptcode,
> > + run->s390_sieic.ipa,
> > + run->s390_sieic.ipb);
> > + switch (run->s390_sieic.icptcode) {
> > + case ICPT_STOP:
> > + /* stopped via sie V P --> ignore */
> > + /* reset stop request */
> > + sie_block->cpuflags = sie_block->cpuflags & ~CPUSTAT_STOP_INT;
> > + pr_info("sie V P - cleared %.4x\n", sie_block->cpuflags);
> > + break;
>
> With the added code that removes the P bit this shouldn't be called
> anymore, no?
>

Yes, you are right this is no longer needed. And I will remove it.

> > + case ICPT_INST:
> > + /* end execution in caller on intercepted instruction */
> > + return false;
> > + default:
> > + TEST_FAIL("UNEXPECTED SIEIC CODE %d", run->s390_sieic.icptcode);
> > + }
> > + return true;
> > +}
>