s390x: SCLP Unit test
v6 cover s390x: SCLP Unit test
This patchset contains some minor cleanup, some preparatory work and then the SCLP unit test itself.
The unit test checks 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
v5 -> v6
* fixed a bug in test_addressing
* improved comments in test_sccb_prefix
* replaced all inline assembly usages of spx and stpx with the wrappers
* added one more wrapper for test_one_sccb for read-only tests v4 -> v5
* updated usage of report()
* added SPX and STPX wrappers to the library
* improved readability
* addressed some more comments
v3 -> v4
* export sclp_setup_int instead of copying it
* add more comments
* rename some more variables to improve readability
* improve the prefix test
* improved the invalid address test
* addressed further comments received during review
v2 -> v3
* generally improved the naming of variables
* added and fixed comments
* renamed test_one_run to test_one_simple
* added some const where needed
* addresed many more small comments received during review v1 -> v2
* fix many small issues that came up during the first round of reviews
* add comments to each function
* use a static buffer for the SCCP template when used
Claudio Imbrenda (4):
s390x: export sclp_setup_int
s390x: sclp: add service call instruction wrapper
s390x: lib: add SPX and STPX instruction wrapper
s390x: SCLP unit test
s390x/Makefile | 1 + lib/s390x/asm/arch_def.h | 23 ++ lib/s390x/sclp.h | 1 + lib/s390x/sclp.c | 9 +- s390x/intercept.c | 33 ++- s390x/sclp.c | 472 +++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 8 + 7 files changed, 520 insertions(+), 27 deletions(-) create mode 100644 s390x/sclp.c
Signature · 1 line
2.24.1
PATCH v6 1/4 s390x: export sclp_setup_int
Export sclp_setup_int() so that it can be used in tests.
Needed for an upcoming unit test.
--- lib/s390x/sclp.h | 1 + lib/s390x/sclp.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
lib/s390x/sclp.h +1 -0
@@ -265,6 +265,7 @@ typedef struct ReadEventData { } __attribute__((packed)) ReadEventData;extern char _sccb[]; +void sclp_setup_int (void );void sclp_handle_ext (void );void sclp_wait_busy (void );void sclp_mark_busy (void );
lib/s390x/sclp.c +1 -1
@@ -45,7 +45,7 @@ static void mem_init(phys_addr_t mem_end)page_alloc_ops_enable (); } -static void sclp_setup_int (void ) +void sclp_setup_int (void ) {uint64_t mask;
Signature · 1 line
2.24.1
PATCH v6 2/4 s390x: sclp: add service call instruction wrapper
In reply to Claudio ImbrendaAdd a wrapper for the service call instruction, and use it for SCLP interactions instead of using inline assembly everywhere.
--- lib/s390x/asm/arch_def.h | 13 +++++++++++++ lib/s390x/sclp.c | 7 +------ 2 files changed, 14 insertions(+), 6 deletions(-)
lib/s390x/asm/arch_def.h +13 -0
@@ -271,4 +271,17 @@ static inline int stsi(void *addr, int fc, int sel1, int sel2) return cc; } +static inline int servc (uint32_t command,unsigned long sccb) +{ +int cc; + + asmvolatile ( +" .insn rre,0xb2200000,%1,%2\n" /* servc %1,%2 */ +" ipm %0\n" +" srl %0,28" + :"=&d" (cc) :"d" (command),"a" (sccb) + :"cc" ,"memory" ); +return cc; +} +#endif
lib/s390x/sclp.c +1 -6
@@ -116,12 +116,7 @@ int sclp_service_call(unsigned int command, void *sccb)int cc;sclp_setup_int (); - asmvolatile ( -" .insn rre,0xb2200000,%1,%2\n" /* servc %1,%2 */ -" ipm %0\n" -" srl %0,28" - :"=&d" (cc) :"d" (command),"a" (__pa (sccb)) - :"cc" ,"memory" ); + cc =servc (command,__pa (sccb));sclp_wait_busy ();if (cc ==3 )return -1 ;
Signature · 1 line
2.24.1
PATCH v6 3/4 s390x: lib: add SPX and STPX instruction wrapper
In reply to Claudio ImbrendaAdd a wrapper for the SET PREFIX and STORE PREFIX instructions, and use it instead of using inline assembly everywhere.
--- lib/s390x/asm/arch_def.h | 10 ++++++++++ s390x/intercept.c | 33 +++++++++++++-------------------- 2 files changed, 23 insertions(+), 20 deletions(-)
lib/s390x/asm/arch_def.h +10 -0
@@ -284,4 +284,14 @@ static inline int servc(uint32_t command, unsigned long sccb) return cc; } +static inline void spx (uint32_t *new_prefix) +{ + asmvolatile ("spx %0" : :"Q" (*new_prefix) :"memory" ); +} + +static inline void stpx (uint32_t *current_prefix) +{ + asmvolatile ("stpx %0" :"=Q" (*current_prefix)); +} +#endif
s390x/intercept.c +13 -20
@@ -26,27 +26,24 @@ static void test_stpx(void)uint32_t new_prefix = (uint32_t )(intptr_t )pagebuf;/* Can we successfully change the prefix? */ - asmvolatile ( -" stpx %0\n" -" spx %2\n" -" stpx %1\n" -" spx %0\n" - :"+Q" (old_prefix),"+Q" (tst_prefix) - :"Q" (new_prefix)); +stpx (&old_prefix); +spx (&new_prefix); +stpx (&tst_prefix); +spx (&old_prefix);report (old_prefix ==0 && tst_prefix == new_prefix,"store prefix" );expect_pgm_int ();low_prot_enable (); - asmvolatile (" stpx 0(%0) " : :"r" (8 )); +stpx ((void *)8L );low_prot_disable ();check_pgm_int_code (PGM_INT_CODE_PROTECTION );expect_pgm_int (); - asmvolatile (" stpx 0(%0) " : :"r" (1 )); +stpx ((void *)1L );check_pgm_int_code (PGM_INT_CODE_SPECIFICATION );expect_pgm_int (); - asmvolatile (" stpx 0(%0) " : :"r" (-8L )); +stpx ((void *)-8L );check_pgm_int_code (PGM_INT_CODE_ADDRESSING ); }
@@ -63,22 +60,18 @@ static void test_spx(void)* some facility bits there ... at least some of them should be * set in our buffer afterwards. */ - asmvolatile ( -" stpx %0\n" -" spx %1\n" -" stfl 0\n" -" spx %0\n" - :"+Q" (old_prefix) - :"Q" (new_prefix) - :"memory" ); +stpx (&old_prefix); +spx (&new_prefix); + asmvolatile (" stfl 0" : : :"memory" ); +spx (&old_prefix);report (pagebuf[GEN_LC_STFL ] !=0 ,"stfl to new prefix" );expect_pgm_int (); - asmvolatile (" spx 0(%0) " : :"r" (1 )); +spx ((void *)1L );check_pgm_int_code (PGM_INT_CODE_SPECIFICATION );expect_pgm_int (); - asmvolatile (" spx 0(%0) " : :"r" (-8L )); +spx ((void *)-8L );check_pgm_int_code (PGM_INT_CODE_ADDRESSING ); }
Signature · 1 line
2.24.1
Re: [kvm-unit-tests PATCH v6 3/4] s390x: lib: add SPX and STPX instruction wrapper
Quoted 14 lines · Claudio Imbrenda
Add a wrapper for the SET PREFIX and STORE PREFIX instructions, and use it instead of using inline assembly everywhere.
Signed-off-by Claudio Imbrenda <[email protected]>--- lib/s390x/asm/arch_def.h | 10 ++++++++++ s390x/intercept.c | 33 +++++++++++++-------------------- 2 files changed, 23 insertions(+), 20 deletions(-)lib/s390x/asm/arch_def.h +0
-0
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 287
Quoted 4 lines
lib/s390x/asm/arch_def.h +1
-0@@ -284,4 +284,14 @@ static inline int servc(uint32_t command, unsigned long sccb)return cc; } +static inline void spx (uint32_t *new_prefix)
Looking at this a second time ... why is new_prefix a pointer? A normal value should be sufficient here, shouldn't it?
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 296
Quoted 9 lines
lib/s390x/asm/arch_def.h +9
-0+{ + asmvolatile ("spx %0" : :"Q" (*new_prefix) :"memory" ); +} + +static inline void stpx (uint32_t *current_prefix) +{ + asmvolatile ("stpx %0" :"=Q" (*current_prefix)); +} +
Thomas
Re: [kvm-unit-tests PATCH v6 3/4] s390x: lib: add SPX and STPX instruction wrapper
Quoted 18 lines · On Thu, 9 Jan 2020 17:43:55 +0100 Thomas Huth <[email protected]> wrote:
Quoted 17 lines · Claudio Imbrenda
Add a wrapper for the SET PREFIX and STORE PREFIX instructions, and use it instead of using inline assembly everywhere.
Signed-off-by Claudio Imbrenda <[email protected]>--- lib/s390x/asm/arch_def.h | 10 ++++++++++ s390x/intercept.c | 33 +++++++++++++-------------------- 2 files changed, 23 insertions(+), 20 deletions(-)lib/s390x/asm/arch_def.h +0
-0@@ -284,4 +284,14 @@ static inline int servc(uint32_t command, unsigned long sccb) return cc; }
Quoted 4 lines
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 287
Quoted 1 line
lib/s390x/asm/arch_def.h +1
-0+static inline void spx (uint32_t *new_prefix)Looking at this a second time ... why is
new_prefixa pointer? A normal value should be sufficient here, shouldn't it?
no. if you look at the code in the same patch, intercept.c at some points needs to pass "wrong" pointers to spx and stpx in order to test them, so this needs to be a pointer
the instructions themselves expect pointers (base register + offset)
Quoted 12 lines
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 296
Quoted 9 lines
lib/s390x/asm/arch_def.h +9
-0+{ + asmvolatile ("spx %0" : :"Q" (*new_prefix) :"memory" ); +} + +static inline void stpx (uint32_t *current_prefix) +{ + asmvolatile ("stpx %0" :"=Q" (*current_prefix)); +} +Thomas
Thomas Huth
Reviewed-byRe: [kvm-unit-tests PATCH v6 3/4] s390x: lib: add SPX and STPX instruction wrapper
Quoted 26 lines · Claudio Imbrenda
Quoted 18 lines · On Thu, 9 Jan 2020 17:43:55 +0100 Thomas Huth <[email protected]> wrote:
Quoted 17 lines · Claudio Imbrenda
Add a wrapper for the SET PREFIX and STORE PREFIX instructions, and use it instead of using inline assembly everywhere.
Signed-off-by Claudio Imbrenda <[email protected]>--- lib/s390x/asm/arch_def.h | 10 ++++++++++ s390x/intercept.c | 33 +++++++++++++-------------------- 2 files changed, 23 insertions(+), 20 deletions(-)lib/s390x/asm/arch_def.h +0
-0@@ -284,4 +284,14 @@ static inline int servc(uint32_t command, unsigned long sccb) return cc; }Quoted 4 lines
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 287
Quoted 1 line
lib/s390x/asm/arch_def.h +1
-0+static inline void spx (uint32_t *new_prefix)Looking at this a second time ... why is
new_prefixa pointer? A normal value should be sufficient here, shouldn't it?
Quoted 5 lines
no. if you look at the code in the same patch,
intercept.cat some points needs to pass "wrong" pointers to spx and stpx in order to test them, so this needs to be a pointerthe instructions themselves expect pointers (base register + offset)
Ah, you're right, that "Q" constraint always confuses me... I guess you could do it without pointers when using the "r" constraint, but it's likely better to do it the same way as stpx, so your patch should be fine.
Quoted 9 lines
Quoted 9 lines
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 296
Quoted 9 lines
lib/s390x/asm/arch_def.h +9
-0+{ + asmvolatile ("spx %0" : :"Q" (*new_prefix) :"memory" ); +} + +static inline void stpx (uint32_t *current_prefix) +{ + asmvolatile ("stpx %0" :"=Q" (*current_prefix)); +} +
Re: [kvm-unit-tests PATCH v6 3/4] s390x: lib: add SPX and STPX instruction wrapper
Quoted 31 lines · Thomas Huth
Quoted 30 lines · Claudio Imbrenda
Quoted 18 lines · On Thu, 9 Jan 2020 17:43:55 +0100 Thomas Huth <[email protected]> wrote:
Quoted 17 lines · Claudio Imbrenda
Add a wrapper for the SET PREFIX and STORE PREFIX instructions, and use it instead of using inline assembly everywhere.
Signed-off-by Claudio Imbrenda <[email protected]>--- lib/s390x/asm/arch_def.h | 10 ++++++++++ s390x/intercept.c | 33 +++++++++++++-------------------- 2 files changed, 23 insertions(+), 20 deletions(-)lib/s390x/asm/arch_def.h +0
-0@@ -284,4 +284,14 @@ static inline int servc(uint32_t command, unsigned long sccb) return cc; }Quoted 4 lines
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 287
Quoted 1 line
lib/s390x/asm/arch_def.h +1
-0+static inline void spx (uint32_t *new_prefix)Looking at this a second time ... why is
new_prefixa pointer? A normal value should be sufficient here, shouldn't it?no. if you look at the code in the same patch,
intercept.cat some points needs to pass "wrong" pointers to spx and stpx in order to test them, so this needs to be a pointer
Quoted 5 lines
Quoted 1 line
the instructions themselves expect pointers (base register + offset)
Ah, you're right, that "Q" constraint always confuses me... I guess you could do it without pointers when using the "r" constraint, but it's likely better to do it the same way as stpx, so your patch should be fine.
Honestly, I'd rather have stpx return a u32 than passing a ptr. That's how the kernel does it and is in-line with epswe/lpswe and sctlg/lctlg which are already in the library.
Also, if possible names like set_prefix and store_prefix (or better get_prefix) prefix would make it much more readable.
Quoted 13 lines
Quoted 10 lines
Quoted 10 lines
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 296
Quoted 10 lines
lib/s390x/asm/arch_def.h +9
-0+{ + asmvolatile ("spx %0" : :"Q" (*new_prefix) :"memory" ); +} + +static inline void stpx (uint32_t *current_prefix) +{ + asmvolatile ("stpx %0" :"=Q" (*current_prefix)); +} +Reviewed-by Thomas Huth <[email protected]>
Re: [kvm-unit-tests PATCH v6 3/4] s390x: lib: add SPX and STPX instruction wrapper
Quoted 35 lines · On Thu, 9 Jan 2020 18:05:42 +0100 Janosch Frank <[email protected]> wrote:
Quoted 34 lines · Thomas Huth
Quoted 32 lines · Claudio Imbrenda
Quoted 18 lines · On Thu, 9 Jan 2020 17:43:55 +0100 Thomas Huth <[email protected]> wrote:
Quoted 17 lines · Claudio Imbrenda
Add a wrapper for the SET PREFIX and STORE PREFIX instructions, and use it instead of using inline assembly everywhere.
Signed-off-by Claudio Imbrenda <[email protected]>--- lib/s390x/asm/arch_def.h | 10 ++++++++++ s390x/intercept.c | 33 +++++++++++++-------------------- 2 files changed, 23 insertions(+), 20 deletions(-)lib/s390x/asm/arch_def.h +0
-0@@ -284,4 +284,14 @@ static inline int servc(uint32_t command, unsigned long sccb) return cc; }Quoted 4 lines
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 287
Quoted 1 line
lib/s390x/asm/arch_def.h +1
-0+static inline void spx (uint32_t *new_prefix)Looking at this a second time ... why is
new_prefixa pointer? A normal value should be sufficient here, shouldn't it?no. if you look at the code in the same patch,
intercept.cat some points needs to pass "wrong" pointers to spx and stpx in order to test them, so this needs to be a pointerthe instructions themselves expect pointers (base register + offset)
Quoted 6 lines
Quoted 4 lines
Ah, you're right, that "Q" constraint always confuses me... I guess you could do it without pointers when using the "r" constraint, but it's likely better to do it the same way as stpx, so your patch should be fine.
Honestly, I'd rather have stpx return a u32 than passing a ptr.
that's what I had done initially, but it doesn't work, see above for the reasons why we need a pointer
Quoted 2 lines
That's how the kernel does it and is in-line with epswe/lpswe and sctlg/lctlg which are already in the library.
the kernel does not need to test wrong addresses.
I could have spx accept an int and stpx return an int, but then intercept.c would still need some inline assembly for SPX and STPX
Quoted 2 lines
Also, if possible names like
set_prefixandstore_prefix(or betterget_prefix) prefix would make it much more readable.
this can be done, but that's not how all the other wrappers are
Quoted 15 lines
Quoted 13 lines
Quoted 10 lines
Quoted 10 lines
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 296
Quoted 10 lines
lib/s390x/asm/arch_def.h +9
-0+{ + asmvolatile ("spx %0" : :"Q" (*new_prefix) :"memory" ); +} + +static inline void stpx (uint32_t *current_prefix) +{ + asmvolatile ("stpx %0" :"=Q" (*current_prefix)); +} +Reviewed-by Thomas Huth <[email protected]>
Re: [kvm-unit-tests PATCH v6 3/4] s390x: lib: add SPX and STPX instruction wrapper
Quoted 43 lines · Claudio Imbrenda
Quoted 40 lines · On Thu, 9 Jan 2020 18:05:42 +0100 Janosch Frank <[email protected]> wrote:
Quoted 38 lines · Thomas Huth
Quoted 26 lines · Claudio Imbrenda
Quoted 18 lines · On Thu, 9 Jan 2020 17:43:55 +0100 Thomas Huth <[email protected]> wrote:
Quoted 17 lines · Claudio Imbrenda
Add a wrapper for the SET PREFIX and STORE PREFIX instructions, and use it instead of using inline assembly everywhere.
Signed-off-by Claudio Imbrenda <[email protected]>--- lib/s390x/asm/arch_def.h | 10 ++++++++++ s390x/intercept.c | 33 +++++++++++++-------------------- 2 files changed, 23 insertions(+), 20 deletions(-)lib/s390x/asm/arch_def.h +0
-0@@ -284,4 +284,14 @@ static inline int servc(uint32_t command, unsigned long sccb) return cc; }Quoted 4 lines
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 287
Quoted 1 line
lib/s390x/asm/arch_def.h +1
-0+static inline void spx (uint32_t *new_prefix)Looking at this a second time ... why is
new_prefixa pointer? A normal value should be sufficient here, shouldn't it?Quoted 6 lines
no. if you look at the code in the same patch,
intercept.cat some points needs to pass "wrong" pointers to spx and stpx in order to test them, so this needs to be a pointerthe instructions themselves expect pointers (base register + offset)
Ah, you're right, that "Q" constraint always confuses me... I guess you could do it without pointers when using the "r" constraint, but it's likely better to do it the same way as stpx, so your patch should be fine.
Quoted 4 lines
Quoted 1 line
Honestly, I'd rather have stpx return a u32 than passing a ptr.
that's what I had done initially, but it doesn't work, see above for the reasons why we need a pointer
I prefer having the "normal" usage in the library and the abnormal usage as inline assembly, that's most often why we use inline assembly anyway (apart from the lib). The library doesn't need to fit every use-case, but rather serve the most used things to increase development speed and readability.
Quoted 6 lines
Quoted 3 lines
That's how the kernel does it and is in-line with epswe/lpswe and sctlg/lctlg which are already in the library.
the kernel does not need to test wrong addresses.
Quoted 7 lines
I could have spx accept an int and stpx return an int, but then
intercept.cwould still need some inline assembly for SPX and STPXQuoted 2 lines
Also, if possible names like
set_prefixandstore_prefix(or betterget_prefix) prefix would make it much more readable.this can be done, but that's not how all the other wrappers are
Maybe it's just me, but I always confuse stpx with spx since the designers did not use lpx/stpx which is much more obvious.
Quoted 17 lines
Quoted 16 lines
Quoted 14 lines
Quoted 11 lines
Quoted 11 lines
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 296
Quoted 11 lines
lib/s390x/asm/arch_def.h +9
-0+{ + asmvolatile ("spx %0" : :"Q" (*new_prefix) :"memory" ); +} + +static inline void stpx (uint32_t *current_prefix) +{ + asmvolatile ("stpx %0" :"=Q" (*current_prefix)); +} +Reviewed-by Thomas Huth <[email protected]>
Re: [kvm-unit-tests PATCH v6 3/4] s390x: lib: add SPX and STPX instruction wrapper
In reply to Thomas HuthQuoted 31 lines · On Thu, 9 Jan 2020 17:58:11 +0100 Thomas Huth <[email protected]> wrote:
Quoted 30 lines · Claudio Imbrenda
Quoted 18 lines · On Thu, 9 Jan 2020 17:43:55 +0100 Thomas Huth <[email protected]> wrote:
Quoted 17 lines · Claudio Imbrenda
Add a wrapper for the SET PREFIX and STORE PREFIX instructions, and use it instead of using inline assembly everywhere.
Signed-off-by Claudio Imbrenda <[email protected]>--- lib/s390x/asm/arch_def.h | 10 ++++++++++ s390x/intercept.c | 33 +++++++++++++-------------------- 2 files changed, 23 insertions(+), 20 deletions(-)lib/s390x/asm/arch_def.h +0
-0@@ -284,4 +284,14 @@ static inline int servc(uint32_t command, unsigned long sccb) return cc; }Quoted 4 lines
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 287
Quoted 1 line
lib/s390x/asm/arch_def.h +1
-0+static inline void spx (uint32_t *new_prefix)Looking at this a second time ... why is
new_prefixa pointer? A normal value should be sufficient here, shouldn't it?no. if you look at the code in the same patch,
intercept.cat some points needs to pass "wrong" pointers to spx and stpx in order to test them, so this needs to be a pointer
Quoted 5 lines
Quoted 2 lines
the instructions themselves expect pointers (base register + offset)
Ah, you're right, that "Q" constraint always confuses me... I guess you could do it without pointers when using the "r" constraint, but
actually no :)
I think "r" allows for register 0, which is handled specially when used as base register, so we'd need at least "a".
but, by using Q, the compiler generates the "best" combination of opcodes, so for example spx((void *)1L) becomes simply "SPX 1" and so on
Quoted 15 lines
it's likely better to do it the same way as stpx, so your patch should be fine.
Quoted 9 lines
Quoted 9 lines
lib/s390x/asm/arch_def.h static inline int servc(uint32_t command, unsigned long sccb) · line 296
Quoted 9 lines
lib/s390x/asm/arch_def.h +9
-0+{ + asmvolatile ("spx %0" : :"Q" (*new_prefix) :"memory" ); +} + +static inline void stpx (uint32_t *current_prefix) +{ + asmvolatile ("stpx %0" :"=Q" (*current_prefix)); +} +Reviewed-by Thomas Huth <[email protected]>
PATCH v6 4/4 s390x: SCLP unit test
In reply to Claudio ImbrendaSCLP 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
--- s390x/Makefile | 1 + s390x/sclp.c | 472 ++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 8 + 3 files changed, 481 insertions(+) create mode 100644 s390x/sclp.c
s390x/Makefile +1 -0
@@ -16,6 +16,7 @@ tests += $(TEST_DIR)/diag288.elf tests += $(TEST_DIR)/stsi.elf tests += $(TEST_DIR)/skrf.elf tests += $(TEST_DIR)/smp.elf +tests += $(TEST_DIR)/sclp.elf tests_binary = $(patsubst %.elf,%.bin,$(tests)) all: directories test_cases test_cases_binary
s390x/sclp.c new file +472 -0
472 lines not on this page · raw message
s390x/unittests.cfg +8 -0
@@ -75,3 +75,11 @@ file = stsi.elf [smp] file = smp.elf extra_params =-smp 2 + +[sclp-1g] +file = sclp.elf +extra_params = -m 1G + +[sclp-3g] +file = sclp.elf +extra_params = -m 3G
Signature · 1 line
2.24.1
Re: [kvm-unit-tests PATCH v6 4/4] s390x: SCLP unit test
Quoted 15 lines · Claudio Imbrenda
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
Quoted 2 lines
Signed-off-by Claudio Imbrenda <[email protected]>Reviewed-by Thomas Huth <[email protected]>
I wonder how fast this will run under z/VM and if we need to increase the timeout.
Nicely done, one comment below.
Tested under LPAR, KVM and PV
Quoted 6 lines
--- s390x/Makefile | 1 + s390x/sclp.c | 472 ++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 8 + 3 files changed, 481 insertions(+) create mode 100644 s390x/sclp.c
[..]
Quoted 9 lines
s390x/sclp.c new file +9
-0+/** +* Test SCCBs that are not 64-bit aligned. +*/ +static void test_sccb_unaligned (void ) +{ +int offset; + +for (offset =1 ; offset <8 ; offset++) +if (!test_one_simple (valid_code, offset + pagebuf,8 ,8 ,PGM_BIT_SPEC ,0 ))
s390x/sclp.c line 156
Quoted 10 lines
s390x/sclp.c new file +10
-0+break ; +report (offset ==8 ,"SCCB unaligned" ); +} + +/** +* Test SCCBs whose address is in the lowcore or prefix area. +*/ +static void test_sccb_prefix (void ) +{ +uint8_t scratch[2 *PAGE_SIZE ];
LC_SIZE?
Can also be used in more places below.
Re: [kvm-unit-tests PATCH v6 4/4] s390x: SCLP unit test
Quoted 16 lines · On Thu, 9 Jan 2020 18:44:34 +0100 Janosch Frank <[email protected]> wrote:
Quoted 15 lines · Claudio Imbrenda
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
Quoted 5 lines
Quoted 2 lines
Signed-off-by Claudio Imbrenda <[email protected]>Reviewed-by Thomas Huth <[email protected]>I wonder how fast this will run under z/VM and if we need to increase the timeout.
I don't know, but it runs pretty fast even on z13
Quoted 3 lines
Nicely done, one comment below.
Acked-by Janosch Frank <[email protected]>
[...]
Quoted 2 lines
LC_SIZE?
Can also be used in more places below.
hmm yes I'll fix it