kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: Pierre Morel <pmorel@linux.ibm.com>, kvm@vger.kernel.org
Cc: david@redhat.com, thuth@redhat.com, cohuck@redhat.com,
	imbrenda@linux.ibm.com
Subject: Re: [kvm-unit-tests PATCH v1 4/6] s390x: lib: css: add expectations to wait for interrupt
Date: Fri, 19 Mar 2021 10:09:42 +0100	[thread overview]
Message-ID: <c9a38bd8-f091-d3e4-dea5-0ffd9f1cdf12@linux.ibm.com> (raw)
In-Reply-To: <1616073988-10381-5-git-send-email-pmorel@linux.ibm.com>

On 3/18/21 2:26 PM, Pierre Morel wrote:
> When waiting for an interrupt we may need to check the cause of
> the interrupt depending on the test case.
> 
> Let's provide the tests the possibility to check if the last valid
> IRQ received is for the expected instruction.

s/instruction/command/?

We're checking for some value in an IO structure, right?
Instruction makes me expect an actual processor instruction.

Is there another word that can be used to describe what we're checking
here? If yes please also add it to the "pending" variable. "pending_fc"
or "pending_scsw_fc" for example.

> 
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
>  lib/s390x/css.h     |  2 +-
>  lib/s390x/css_lib.c | 11 ++++++++++-
>  s390x/css.c         |  4 ++--
>  3 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/s390x/css.h b/lib/s390x/css.h
> index 65fc335..add3b4e 100644
> --- a/lib/s390x/css.h
> +++ b/lib/s390x/css.h
> @@ -316,7 +316,7 @@ void css_irq_io(void);
>  int css_residual_count(unsigned int schid);
>  
>  void enable_io_isc(uint8_t isc);
> -int wait_and_check_io_completion(int schid);
> +int wait_and_check_io_completion(int schid, uint32_t pending);
>  
>  /*
>   * CHSC definitions
> diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c
> index 211c73c..4cdd7ad 100644
> --- a/lib/s390x/css_lib.c
> +++ b/lib/s390x/css_lib.c
> @@ -537,7 +537,7 @@ struct ccw1 *ccw_alloc(int code, void *data, int count, unsigned char flags)
>   * completion.
>   * Only report failures.
>   */
> -int wait_and_check_io_completion(int schid)
> +int wait_and_check_io_completion(int schid, uint32_t pending)
>  {
>  	int ret = 0;
>  	struct irq_entry *irq = NULL;
> @@ -569,6 +569,15 @@ int wait_and_check_io_completion(int schid)
>  		goto end;
>  	}
>  
> +	if (pending) {
> +		if (!(pending & irq->irb.scsw.ctrl)) {
> +			report_info("%08x : %s", schid, dump_scsw_flags(irq->irb.scsw.ctrl));
> +			report_info("expect   : %s", dump_scsw_flags(pending));
> +			ret = -1;
> +			goto end;
> +		}
> +	}
> +
>  	/* clear and halt pending are valid even without secondary or primary status */
>  	if (irq->irb.scsw.ctrl & (SCSW_FC_CLEAR | SCSW_FC_HALT)) {
>  		ret = 0;
> diff --git a/s390x/css.c b/s390x/css.c
> index c340c53..a6a9773 100644
> --- a/s390x/css.c
> +++ b/s390x/css.c
> @@ -94,7 +94,7 @@ static void test_sense(void)
>  		goto error;
>  	}
>  
> -	if (wait_and_check_io_completion(test_device_sid) < 0)
> +	if (wait_and_check_io_completion(test_device_sid, SCSW_FC_START) < 0)
>  		goto error;
>  
>  	/* Test transfer completion */
> @@ -137,7 +137,7 @@ static void sense_id(void)
>  {
>  	assert(!start_ccw1_chain(test_device_sid, ccw));
>  
> -	assert(wait_and_check_io_completion(test_device_sid) >= 0);
> +	assert(wait_and_check_io_completion(test_device_sid, SCSW_FC_START) >= 0);
>  }
>  
>  static void css_init(void)
> 


  reply	other threads:[~2021-03-19  9:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-18 13:26 [kvm-unit-tests PATCH v1 0/6] Testing SSCH, CSCH and HSCH for errors Pierre Morel
2021-03-18 13:26 ` [kvm-unit-tests PATCH v1 1/6] s390x: lib: css: disabling a subchannel Pierre Morel
2021-03-19  9:02   ` Janosch Frank
2021-03-19  9:11     ` Pierre Morel
2021-03-19 10:03   ` Cornelia Huck
2021-03-19 10:11     ` Pierre Morel
2021-03-19 15:29     ` Pierre Morel
2021-03-18 13:26 ` [kvm-unit-tests PATCH v1 2/6] s390x: lib: css: SCSW bit definitions Pierre Morel
2021-03-19 10:16   ` Cornelia Huck
2021-03-19 15:30     ` Pierre Morel
2021-03-18 13:26 ` [kvm-unit-tests PATCH v1 3/6] s390x: lib: css: upgrading IRQ handling Pierre Morel
2021-03-18 14:22   ` Pierre Morel
2021-03-19 11:01   ` Cornelia Huck
2021-03-19 15:55     ` Pierre Morel
2021-03-19 16:09       ` Cornelia Huck
2021-03-19 16:34         ` Pierre Morel
2021-03-18 13:26 ` [kvm-unit-tests PATCH v1 4/6] s390x: lib: css: add expectations to wait for interrupt Pierre Morel
2021-03-19  9:09   ` Janosch Frank [this message]
2021-03-19  9:50     ` Pierre Morel
2021-03-19 11:23       ` Cornelia Huck
2021-03-19 16:18         ` Pierre Morel
2021-03-18 13:26 ` [kvm-unit-tests PATCH v1 5/6] s390x: css: testing ssch error response Pierre Morel
2021-03-19  9:18   ` Janosch Frank
2021-03-19 10:02     ` Pierre Morel
2021-03-18 13:26 ` [kvm-unit-tests PATCH v1 6/6] s390x: css: testing clear and halt subchannel Pierre Morel

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=c9a38bd8-f091-d3e4-dea5-0ffd9f1cdf12@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=pmorel@linux.ibm.com \
    --cc=thuth@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).