All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Pierre Morel <pmorel@linux.ibm.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	frankja@linux.ibm.com, david@redhat.com, thuth@redhat.com
Subject: Re: [kvm-unit-tests PATCH v6 09/10] s390x: css: ssch/tsch with sense and interrupt
Date: Thu, 14 May 2020 14:24:11 +0200	[thread overview]
Message-ID: <20200514142411.6e369fe4.cohuck@redhat.com> (raw)
In-Reply-To: <1587725152-25569-10-git-send-email-pmorel@linux.ibm.com>

On Fri, 24 Apr 2020 12:45:51 +0200
Pierre Morel <pmorel@linux.ibm.com> wrote:

> We add a new css_lib file to contain the I/O function we may

s/function/functions/

> share with different tests.
> First function is the subchannel_enable() function.
> 
> When a channel is enabled we can start a SENSE_ID command using
> the SSCH instruction to recognize the control unit and device.
> 
> This tests the success of SSCH, the I/O interruption and the TSCH
> instructions.
> 
> The test expects a device with a control unit type of 0xC0CA as the
> first subchannel of the CSS.
> 
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
>  lib/s390x/asm/arch_def.h |   1 +
>  lib/s390x/css.h          |  20 ++++++
>  lib/s390x/css_lib.c      |  55 +++++++++++++++
>  s390x/Makefile           |   1 +
>  s390x/css.c              | 149 +++++++++++++++++++++++++++++++++++++++
>  5 files changed, 226 insertions(+)
>  create mode 100644 lib/s390x/css_lib.c
> 

(...)

> +static void irq_io(void)
> +{
> +	int ret = 0;
> +	char *flags;
> +	int sid;
> +
> +	report_prefix_push("Interrupt");
> +	/* Lowlevel set the SID as interrupt parameter. */
> +	if (lowcore->io_int_param != test_device_sid) {
> +		report(0,
> +		       "Bad io_int_param: %x expected %x",
> +		       lowcore->io_int_param, test_device_sid);
> +		goto pop;
> +	}
> +	report_prefix_pop();
> +
> +	report_prefix_push("tsch");
> +	sid = lowcore->subsys_id_word;
> +	ret = tsch(sid, &irb);
> +	switch (ret) {
> +	case 1:
> +		dump_irb(&irb);
> +		flags = dump_scsw_flags(irb.scsw.ctrl);
> +		report(0,
> +		       "I/O interrupt, but sch not status pending: %s", flags);

"...but tsch reporting sch as not status pending" ?

A buggy implementation might give the wrong cc for tsch, but still
indicate status pending in the control block.

> +		break;
> +	case 2:
> +		report(0, "TSCH returns unexpected CC 2");
> +		break;
> +	case 3:
> +		report(0, "Subchannel %08x not operational", sid);

"tsch reporting subchannel %08x as not operational" ?

> +		break;
> +	case 0:
> +		/* Stay humble on success */
> +		break;
> +	}
> +pop:
> +	report_prefix_pop();
> +	lowcore->io_old_psw.mask &= ~PSW_MASK_WAIT;
> +}

(...)

> +/*
> + * test_sense
> + * Pre-requisits:
> + * - We need the QEMU PONG device as the first recognized
> + *   device by the enumeration.
> + * - ./s390x-run s390x/css.elf -device ccw-pong,cu_type=0xc0ca
> + */
> +static void test_sense(void)
> +{
> +	int ret;
> +
> +	if (!test_device_sid) {
> +		report_skip("No device");
> +		return;
> +	}
> +
> +	ret = enable_subchannel(test_device_sid);
> +	if (ret < 0) {
> +		report(0,
> +		       "Could not enable the subchannel: %08x",
> +		       test_device_sid);
> +		return;
> +	}
> +
> +	ret = register_io_int_func(irq_io);
> +	if (ret) {
> +		report(0, "Could not register IRQ handler");
> +		goto unreg_cb;
> +	}
> +
> +	lowcore->io_int_param = 0;
> +
> +	ret = start_subchannel(CCW_CMD_SENSE_ID, &senseid, sizeof(senseid));

You're always send the full (extended) sense id block. What if the the
machine you're running on doesn't support extended sense id? Would the
SLI ccw flag help?

> +	if (!ret) {
> +		report(0, "start_senseid failed");

"ssch failed for SENSE ID on sch <sch>" ?

> +		goto unreg_cb;
> +	}
> +
> +	wfi(PSW_MASK_IO);
> +
> +	if (lowcore->io_int_param != test_device_sid) {
> +		report(0,
> +		       "No interrupts. io_int_param: expect 0x%08x, got 0x%08x",
> +		       test_device_sid, lowcore->io_int_param);

Doesn't irq_io() already moan here?

> +		goto unreg_cb;
> +	}
> +
> +	report_info("reserved %02x cu_type %04x cu_model %02x dev_type %04x dev_model %02x",
> +		    senseid.reserved, senseid.cu_type, senseid.cu_model,
> +		    senseid.dev_type, senseid.dev_model);
> +
> +	if (senseid.cu_type == PONG_CU)
> +		report(1, "cu_type: expect 0x%04x got 0x%04x",
> +		       PONG_CU_TYPE, senseid.cu_type);
> +	else
> +		report(0, "cu_type: expect 0x%04x got 0x%04x",
> +		       PONG_CU_TYPE, senseid.cu_type);
> +
> +unreg_cb:
> +	unregister_io_int_func(irq_io);
> +}
> +

  reply	other threads:[~2020-05-14 12:24 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 10:45 [kvm-unit-tests PATCH v6 00/10] s390x: Testing the Channel Subsystem I/O Pierre Morel
2020-04-24 10:45 ` [kvm-unit-tests PATCH v6 01/10] s390x: saving regs for interrupts Pierre Morel
2020-04-27  8:59   ` David Hildenbrand
2020-04-27 10:50     ` Pierre Morel
2020-04-24 10:45 ` [kvm-unit-tests PATCH v6 02/10] s390x: Use PSW bits definitions in cstart Pierre Morel
2020-04-27  9:01   ` David Hildenbrand
2020-04-28  8:10     ` Pierre Morel
2020-04-24 10:45 ` [kvm-unit-tests PATCH v6 03/10] s390x: Move control register bit definitions and add AFP to them Pierre Morel
2020-04-24 10:45 ` [kvm-unit-tests PATCH v6 04/10] s390x: interrupt registration Pierre Morel
2020-05-14 11:58   ` Cornelia Huck
2020-05-15  6:57     ` Pierre Morel
2020-05-15  7:57       ` David Hildenbrand
2020-04-24 10:45 ` [kvm-unit-tests PATCH v6 05/10] s390x: Library resources for CSS tests Pierre Morel
2020-05-14 12:03   ` Cornelia Huck
2020-05-15  7:02     ` Pierre Morel
2020-05-15  7:11       ` Cornelia Huck
2020-05-15  7:14         ` Pierre Morel
2020-04-24 10:45 ` [kvm-unit-tests PATCH v6 06/10] s390x: css: stsch, enumeration test Pierre Morel
2020-04-27 13:06   ` Janosch Frank
2020-04-28  8:17     ` Pierre Morel
2020-05-14 12:05   ` Cornelia Huck
2020-05-15  7:05     ` Pierre Morel
2020-04-24 10:45 ` [kvm-unit-tests PATCH v6 07/10] s390x: css: msch, enable test Pierre Morel
2020-04-27 13:11   ` Janosch Frank
2020-04-28  8:27     ` Pierre Morel
2020-05-14 12:08       ` Cornelia Huck
2020-05-15  7:11         ` Pierre Morel
2020-05-15  8:25           ` Cornelia Huck
2020-05-15  8:53             ` Janosch Frank
2020-05-15 11:34               ` Pierre Morel
2020-04-24 10:45 ` [kvm-unit-tests PATCH v6 08/10] s390x: define wfi: wait for interrupt Pierre Morel
2020-04-27 12:59   ` Janosch Frank
2020-04-28  8:44     ` Pierre Morel
2020-04-28  9:20       ` Janosch Frank
2020-04-28  9:27         ` Pierre Morel
2020-04-24 10:45 ` [kvm-unit-tests PATCH v6 09/10] s390x: css: ssch/tsch with sense and interrupt Pierre Morel
2020-05-14 12:24   ` Cornelia Huck [this message]
2020-05-15  7:37     ` Pierre Morel
2020-04-24 10:45 ` [kvm-unit-tests PATCH v6 10/10] s390x: css: ping pong Pierre Morel
2020-04-27 13:14   ` Janosch Frank
2020-04-28  8:50     ` 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=20200514142411.6e369fe4.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@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.