All the mail mirrored from lore.kernel.org
 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 v6 2/6] s390x: css: simplifications of the tests
Date: Mon, 15 Mar 2021 11:48:51 +0100	[thread overview]
Message-ID: <2429a22a-a1f1-a995-0ca8-4f13373abb13@linux.ibm.com> (raw)
In-Reply-To: <1615545714-13747-3-git-send-email-pmorel@linux.ibm.com>

On 3/12/21 11:41 AM, Pierre Morel wrote:
> In order to ease the writing of tests based on:
> - interrupt
> - enabling a subchannel
> - using multiple I/O on a channel without disabling it
> 
> We do the following simplifications:
> - the I/O interrupt handler is registered on CSS initialization
> - We do not enable again a subchannel in senseid if it is already
>   enabled
> - we add a css_enabled() function to test if a subchannel is enabled
> 
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>

Acked-by: Janosch Frank <frankja@linux.ibm.com>

> ---
>  lib/s390x/css.h     |  1 +
>  lib/s390x/css_lib.c | 41 ++++++++++++++++++++++++++---------------
>  s390x/css.c         | 15 +++++----------
>  3 files changed, 32 insertions(+), 25 deletions(-)
> 
> diff --git a/lib/s390x/css.h b/lib/s390x/css.h
> index 3dc2f31..b9e4c08 100644
> --- a/lib/s390x/css.h
> +++ b/lib/s390x/css.h
> @@ -278,6 +278,7 @@ int css_enumerate(void);
>  
>  #define IO_SCH_ISC      3
>  int css_enable(int schid, int isc);
> +bool css_enabled(int schid);
>  
>  /* Library functions */
>  int start_ccw1_chain(unsigned int sid, struct ccw1 *ccw);
> diff --git a/lib/s390x/css_lib.c b/lib/s390x/css_lib.c
> index 3c1acbf..a97d61e 100644
> --- a/lib/s390x/css_lib.c
> +++ b/lib/s390x/css_lib.c
> @@ -161,6 +161,31 @@ out:
>  	return schid;
>  }
>  
> +/*
> + * css_enabled: report if the subchannel is enabled
> + * @schid: Subchannel Identifier
> + * Return value:
> + *   true if the subchannel is enabled
> + *   false otherwise
> + */
> +bool css_enabled(int schid)
> +{
> +	struct pmcw *pmcw = &schib.pmcw;
> +	int cc;
> +
> +	cc = stsch(schid, &schib);
> +	if (cc) {
> +		report_info("stsch: updating sch %08x failed with cc=%d",
> +			    schid, cc);
> +		return false;
> +	}
> +
> +	if (!(pmcw->flags & PMCW_ENABLE)) {
> +		report_info("stsch: sch %08x not enabled", schid);
> +		return false;
> +	}
> +	return true;
> +}
>  /*
>   * css_enable: enable the subchannel with the specified ISC
>   * @schid: Subchannel Identifier
> @@ -210,18 +235,8 @@ retry:
>  	/*
>  	 * Read the SCHIB again to verify the enablement
>  	 */
> -	cc = stsch(schid, &schib);
> -	if (cc) {
> -		report_info("stsch: updating sch %08x failed with cc=%d",
> -			    schid, cc);
> -		return cc;
> -	}
> -
> -	if ((pmcw->flags & flags) == flags) {
> -		report_info("stsch: sch %08x successfully modified after %d retries",
> -			    schid, retry_count);
> +	if (css_enabled(schid))
>  		return 0;
> -	}
>  
>  	if (retry_count++ < MAX_ENABLE_RETRIES) {
>  		mdelay(10); /* the hardware was not ready, give it some time */
> @@ -250,10 +265,6 @@ void css_irq_io(void)
>  		       lowcore_ptr->io_int_param, sid);
>  		goto pop;
>  	}
> -	report_info("subsys_id_word: %08x io_int_param %08x io_int_word %08x",
> -			lowcore_ptr->subsys_id_word,
> -			lowcore_ptr->io_int_param,
> -			lowcore_ptr->io_int_word);
>  	report_prefix_pop();
>  
>  	report_prefix_push("tsch");
> diff --git a/s390x/css.c b/s390x/css.c
> index 12036b3..a477833 100644
> --- a/s390x/css.c
> +++ b/s390x/css.c
> @@ -25,6 +25,7 @@ static unsigned long cu_type = DEFAULT_CU_TYPE;
>  
>  static int test_device_sid;
>  static struct senseid *senseid;
> +struct ccw1 *ccw;
>  
>  static void test_enumerate(void)
>  {
> @@ -58,7 +59,6 @@ static void test_enable(void)
>   */
>  static void test_sense(void)
>  {
> -	struct ccw1 *ccw;
>  	int ret;
>  	int len;
>  
> @@ -74,18 +74,12 @@ static void test_sense(void)
>  		return;
>  	}
>  
> -	ret = register_io_int_func(css_irq_io);
> -	if (ret) {
> -		report(0, "Could not register IRQ handler");
> -		return;
> -	}
> -
>  	lowcore_ptr->io_int_param = 0;
>  
>  	senseid = alloc_io_mem(sizeof(*senseid), 0);
>  	if (!senseid) {
>  		report(0, "Allocation of senseid");
> -		goto error_senseid;
> +		return;
>  	}
>  
>  	ccw = ccw_alloc(CCW_CMD_SENSE_ID, senseid, sizeof(*senseid), CCW_F_SLI);
> @@ -137,12 +131,13 @@ error:
>  	free_io_mem(ccw, sizeof(*ccw));
>  error_ccw:
>  	free_io_mem(senseid, sizeof(*senseid));
> -error_senseid:
> -	unregister_io_int_func(css_irq_io);
>  }
>  
>  static void css_init(void)
>  {
> +	assert(register_io_int_func(css_irq_io) == 0);
> +	lowcore_ptr->io_int_param = 0;
> +
>  	report(get_chsc_scsc(), "Store Channel Characteristics");
>  }
>  
> 


  reply	other threads:[~2021-03-15 10:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 10:41 [kvm-unit-tests PATCH v6 0/6] CSS Mesurement Block Pierre Morel
2021-03-12 10:41 ` [kvm-unit-tests PATCH v6 1/6] s390x: css: Store CSS Characteristics Pierre Morel
2021-03-12 10:41 ` [kvm-unit-tests PATCH v6 2/6] s390x: css: simplifications of the tests Pierre Morel
2021-03-15 10:48   ` Janosch Frank [this message]
2021-03-16 10:27     ` Pierre Morel
2021-03-12 10:41 ` [kvm-unit-tests PATCH v6 3/6] s390x: css: extending the subchannel modifying functions Pierre Morel
2021-03-15 10:50   ` Janosch Frank
2021-03-16 10:26     ` Pierre Morel
2021-03-12 10:41 ` [kvm-unit-tests PATCH v6 4/6] s390x: css: implementing Set CHannel Monitor Pierre Morel
2021-03-12 10:41 ` [kvm-unit-tests PATCH v6 5/6] s390x: css: testing measurement block format 0 Pierre Morel
2021-03-12 11:17   ` Cornelia Huck
2021-03-16 10:26     ` Pierre Morel
2021-03-15 10:53   ` Janosch Frank
2021-03-16 10:27     ` Pierre Morel
2021-03-12 10:41 ` [kvm-unit-tests PATCH v6 6/6] s390x: css: testing measurement block format 1 Pierre Morel
2021-03-12 11:18 ` [kvm-unit-tests PATCH v6 0/6] CSS Mesurement Block Cornelia Huck
2021-03-12 14:17   ` Janosch Frank
2021-03-16  9:39     ` 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=2429a22a-a1f1-a995-0ca8-4f13373abb13@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.