diff mbox series

[kvm-unit-tests,v3,14/16] s390x: css: issuing SSCH when the channel is status pending

Message ID 1617694853-6881-15-git-send-email-pmorel@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: Testing SSCH, CSCH and HSCH for errors | expand

Commit Message

Pierre Morel April 6, 2021, 7:40 a.m. UTC
We await CC=1 when we issue a SSCH on a channel with status pending.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
 lib/s390x/css.h |  2 ++
 s390x/css.c     | 10 ++++++++++
 2 files changed, 12 insertions(+)

Comments

Cornelia Huck April 6, 2021, 3:34 p.m. UTC | #1
On Tue,  6 Apr 2021 09:40:51 +0200
Pierre Morel <pmorel@linux.ibm.com> wrote:

> We await CC=1 when we issue a SSCH on a channel with status pending.
> 
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
>  lib/s390x/css.h |  2 ++
>  s390x/css.c     | 10 ++++++++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/lib/s390x/css.h b/lib/s390x/css.h
> index 08b2974..3eb6957 100644
> --- a/lib/s390x/css.h
> +++ b/lib/s390x/css.h
> @@ -90,6 +90,8 @@ struct scsw {
>  #define SCSW_ESW_FORMAT		0x04000000
>  #define SCSW_SUSPEND_CTRL	0x08000000
>  #define SCSW_KEY		0xf0000000
> +#define SCSW_SSCH_COMPLETED	(SCSW_CCW_FORMAT | SCSW_FC_START | SCSW_SC_PENDING | SCSW_SC_SECONDARY | \
> +				 SCSW_SC_PRIMARY)
>  	uint32_t ctrl;
>  	uint32_t ccw_addr;
>  #define SCSW_DEVS_DEV_END	0x04
> diff --git a/s390x/css.c b/s390x/css.c
> index f8c6688..52264f2 100644
> --- a/s390x/css.c
> +++ b/s390x/css.c
> @@ -258,6 +258,15 @@ static void ssch_orb_fcx(void)
>  	orb->ctrl = tmp;
>  }
>  
> +static void ssch_status_pending(void)
> +{
> +	assert(ssch(test_device_sid, orb) == 0);
> +	report(ssch(test_device_sid, orb) == 1, "CC = 1");

I don't think that's correct in the general case (although it will work
for QEMU).

The PoP has a note about some models discarding the status pending, if
we have secondary status only (although I don't think that would happen
with this sequence.) You might also end up with cc 2 here, I think. In
theory, you could also get a cc 3 on real hardware, but that would be a
real edge case, and subsequent tests would fail anyway.

> +	/* now we clear the status */
> +	assert(tsch(test_device_sid, &irb) == 0);
> +	check_io_completion(test_device_sid, SCSW_SSCH_COMPLETED);
> +}
> +
>  static struct tests ssh_tests[] = {
>  	{ "privilege", ssch_privilege },
>  	{ "orb cpa zero", ssch_orb_cpa_zero },
> @@ -269,6 +278,7 @@ static struct tests ssh_tests[] = {
>  	{ "ORB reserved CTRL bits", ssch_orb_ctrl },
>  	{ "ORB extensions", ssch_orb_extension},
>  	{ "FC extensions", ssch_orb_fcx},
> +	{ "status pending before ssch", ssch_status_pending},
>  	{ NULL, NULL }
>  };
>
Pierre Morel April 7, 2021, 10:46 a.m. UTC | #2
On 4/6/21 5:34 PM, Cornelia Huck wrote:
> On Tue,  6 Apr 2021 09:40:51 +0200
> Pierre Morel <pmorel@linux.ibm.com> wrote:
> 
>> We await CC=1 when we issue a SSCH on a channel with status pending.
>>
>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
>> ---
>>   lib/s390x/css.h |  2 ++
>>   s390x/css.c     | 10 ++++++++++
>>   2 files changed, 12 insertions(+)
>>
>> diff --git a/lib/s390x/css.h b/lib/s390x/css.h
>> index 08b2974..3eb6957 100644
>> --- a/lib/s390x/css.h
>> +++ b/lib/s390x/css.h
>> @@ -90,6 +90,8 @@ struct scsw {
>>   #define SCSW_ESW_FORMAT		0x04000000
>>   #define SCSW_SUSPEND_CTRL	0x08000000
>>   #define SCSW_KEY		0xf0000000
>> +#define SCSW_SSCH_COMPLETED	(SCSW_CCW_FORMAT | SCSW_FC_START | SCSW_SC_PENDING | SCSW_SC_SECONDARY | \
>> +				 SCSW_SC_PRIMARY)
>>   	uint32_t ctrl;
>>   	uint32_t ccw_addr;
>>   #define SCSW_DEVS_DEV_END	0x04
>> diff --git a/s390x/css.c b/s390x/css.c
>> index f8c6688..52264f2 100644
>> --- a/s390x/css.c
>> +++ b/s390x/css.c
>> @@ -258,6 +258,15 @@ static void ssch_orb_fcx(void)
>>   	orb->ctrl = tmp;
>>   }
>>   
>> +static void ssch_status_pending(void)
>> +{
>> +	assert(ssch(test_device_sid, orb) == 0);
>> +	report(ssch(test_device_sid, orb) == 1, "CC = 1");
> 
> I don't think that's correct in the general case (although it will work
> for QEMU).
> 
> The PoP has a note about some models discarding the status pending, if
> we have secondary status only (although I don't think that would happen
> with this sequence.) You might also end up with cc 2 here, I think. In
> theory, you could also get a cc 3 on real hardware, but that would be a
> real edge case, and subsequent tests would fail anyway.


OK, yes and it could also fail if we introduce asynchronousity in QEMU 
CCW too.
So I let fall all tests about starting a second instruction before 
testing the sub channel.
I have more in csch and hsch...

> 
>> +	/* now we clear the status */
>> +	assert(tsch(test_device_sid, &irb) == 0);
>> +	check_io_completion(test_device_sid, SCSW_SSCH_COMPLETED);
>> +}
>> +
>>   static struct tests ssh_tests[] = {
>>   	{ "privilege", ssch_privilege },
>>   	{ "orb cpa zero", ssch_orb_cpa_zero },
>> @@ -269,6 +278,7 @@ static struct tests ssh_tests[] = {
>>   	{ "ORB reserved CTRL bits", ssch_orb_ctrl },
>>   	{ "ORB extensions", ssch_orb_extension},
>>   	{ "FC extensions", ssch_orb_fcx},
>> +	{ "status pending before ssch", ssch_status_pending},
>>   	{ NULL, NULL }
>>   };
>>   
>
diff mbox series

Patch

diff --git a/lib/s390x/css.h b/lib/s390x/css.h
index 08b2974..3eb6957 100644
--- a/lib/s390x/css.h
+++ b/lib/s390x/css.h
@@ -90,6 +90,8 @@  struct scsw {
 #define SCSW_ESW_FORMAT		0x04000000
 #define SCSW_SUSPEND_CTRL	0x08000000
 #define SCSW_KEY		0xf0000000
+#define SCSW_SSCH_COMPLETED	(SCSW_CCW_FORMAT | SCSW_FC_START | SCSW_SC_PENDING | SCSW_SC_SECONDARY | \
+				 SCSW_SC_PRIMARY)
 	uint32_t ctrl;
 	uint32_t ccw_addr;
 #define SCSW_DEVS_DEV_END	0x04
diff --git a/s390x/css.c b/s390x/css.c
index f8c6688..52264f2 100644
--- a/s390x/css.c
+++ b/s390x/css.c
@@ -258,6 +258,15 @@  static void ssch_orb_fcx(void)
 	orb->ctrl = tmp;
 }
 
+static void ssch_status_pending(void)
+{
+	assert(ssch(test_device_sid, orb) == 0);
+	report(ssch(test_device_sid, orb) == 1, "CC = 1");
+	/* now we clear the status */
+	assert(tsch(test_device_sid, &irb) == 0);
+	check_io_completion(test_device_sid, SCSW_SSCH_COMPLETED);
+}
+
 static struct tests ssh_tests[] = {
 	{ "privilege", ssch_privilege },
 	{ "orb cpa zero", ssch_orb_cpa_zero },
@@ -269,6 +278,7 @@  static struct tests ssh_tests[] = {
 	{ "ORB reserved CTRL bits", ssch_orb_ctrl },
 	{ "ORB extensions", ssch_orb_extension},
 	{ "FC extensions", ssch_orb_fcx},
+	{ "status pending before ssch", ssch_status_pending},
 	{ NULL, NULL }
 };