public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>, kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, david@redhat.com,
	borntraeger@de.ibm.com, frankja@linux.ibm.com
Subject: Re: [kvm-unit-tests PATCH v5 4/4] s390x: SCLP unit test
Date: Thu, 9 Jan 2020 13:42:34 +0100	[thread overview]
Message-ID: <2ca46041-2135-3847-4f22-e1cdebe01936@redhat.com> (raw)
In-Reply-To: <20200108161317.268928-5-imbrenda@linux.ibm.com>

On 08/01/2020 17.13, Claudio Imbrenda wrote:
> SCLP unit test. Testing the following:
> 
> * Correctly ignoring instruction bits that should be ignored
> * Privileged instruction check
> * Check for addressing exceptions
> * Specification exceptions:
>   - SCCB size less than 8
>   - SCCB unaligned
>   - SCCB overlaps prefix or lowcore
>   - SCCB address higher than 2GB
> * Return codes for
>   - Invalid command
>   - SCCB too short (but at least 8)
>   - SCCB page boundary violation
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  s390x/Makefile      |   1 +
>  s390x/sclp.c        | 462 ++++++++++++++++++++++++++++++++++++++++++++
>  s390x/unittests.cfg |   8 +
>  3 files changed, 471 insertions(+)
>  create mode 100644 s390x/sclp.c
[...]
> +/**
> + * Test SCCBs whose address is in the lowcore or prefix area.
> + */
> +static void test_sccb_prefix(void)
> +{
> +	uint8_t scratch[2 * PAGE_SIZE];
> +	uint32_t prefix, new_prefix;
> +	int offset;
> +
> +	/*
> +	 * copy the current lowcore to the future new location, otherwise we
> +	 * will not have a valid lowcore after setting the new prefix.
> +	 */
> +	memcpy(prefix_buf, 0, 2 * PAGE_SIZE);
> +	/* save the current prefix (it's probably going to be 0) */
> +	prefix = stpx();
> +	/*
> +	 * save the current content of absolute pages 0 and 1, so we can
> +	 * restore them after we trash them later on
> +	 */
> +	memcpy(scratch, (void *)(intptr_t)prefix, 2 * PAGE_SIZE);
> +	/* set the new prefix to prefix_buf */
> +	new_prefix = (uint32_t)(intptr_t)prefix_buf;
> +	spx(new_prefix);
> +
> +	/*
> +	 * testing with SCCB addresses in the lowcore; since we can't
> +	 * actually trash the lowcore (unsurprisingly, things break if we
> +	 * do), this will be a read-only test.
> +	 */
> +	for (offset = 0; offset < 2 * PAGE_SIZE; offset += 8)
> +		if (!test_one_sccb(valid_code, MKPTR(offset), 0, PGM_BIT_SPEC, 0))
> +			break;
> +	report(offset == 2 * PAGE_SIZE, "SCCB low pages");
> +
> +	/*
> +	 * this will trash the contents of the two pages at absolute
> +	 * address 0; we will need to restore them later.
> +	 */

I'm still a bit confused by this comment - will SCLP really trash the
contents here, or will there be a specification exception (since
PGM_BIT_SPEC is given below)? ... maybe you could clarify the comment in
case you respin again (or it could be fixed when picking up the patch)?

> +	for (offset = 0; offset < 2 * PAGE_SIZE; offset += 8)
> +		if (!test_one_simple(valid_code, MKPTR(new_prefix + offset), 8, 8, PGM_BIT_SPEC, 0))
> +			break;
> +	report(offset == 2 * PAGE_SIZE, "SCCB prefix pages");
> +
> +	/* restore the previous contents of absolute pages 0 and 1 */
> +	memcpy(prefix_buf, 0, 2 * PAGE_SIZE);
> +	/* restore the prefix to the original value */
> +	spx(prefix);
> +}

Remaining parts look ok to me now, so with the comment clarified:

Reviewed-by: Thomas Huth <thuth@redhat.com>

  reply	other threads:[~2020-01-09 12:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 16:13 [kvm-unit-tests PATCH v5 0/4] s390x: SCLP Unit test Claudio Imbrenda
2020-01-08 16:13 ` [kvm-unit-tests PATCH v5 1/4] s390x: export sclp_setup_int Claudio Imbrenda
2020-01-08 16:13 ` [kvm-unit-tests PATCH v5 2/4] s390x: sclp: add service call instruction wrapper Claudio Imbrenda
2020-01-08 16:13 ` [kvm-unit-tests PATCH v5 3/4] s390x: lib: add SPX and STPX " Claudio Imbrenda
2020-01-08 18:58   ` Thomas Huth
2020-01-09 11:36     ` Claudio Imbrenda
2020-01-09 12:55       ` Thomas Huth
2020-01-08 16:13 ` [kvm-unit-tests PATCH v5 4/4] s390x: SCLP unit test Claudio Imbrenda
2020-01-09 12:42   ` Thomas Huth [this message]
2020-01-09 13:29     ` Claudio Imbrenda

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=2ca46041-2135-3847-4f22-e1cdebe01936@redhat.com \
    --to=thuth@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.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