s390x: two small fixes
cover s390x: two small fixes
Two minor things. Make sure we only have one store when testing for an addressing exception and use the same invalid opcode as QEMU actually does.
David Hildenbrand (2):
s390x: use instruction 0x0000 to test for operation exceptions
s390x: use inline assembly to test for addressing exceptions
s390x/selftest.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.9.4
PATCH 1/2 s390x: use instruction 0x0000 to test for operation exceptions
QEMU uses 0x0000 for KVM, not 0x0001. Doesn't really matter (both are invalid), but now it matches the comment.
--- s390x/selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/selftest.c +1 -1
@@ -29,7 +29,7 @@ static void test_fp(void)static void test_pgm_int (void ) {expect_pgm_int (); - asmvolatile (" .insn e,0x0001" );/* used for SW breakpoints in QEMU */ + asmvolatile (" .insn e,0x0000" );/* used for SW breakpoints in QEMU */ check_pgm_int_code (PGM_INT_CODE_OPERATION );expect_pgm_int ();
Signature · 1 line
2.9.4
PATCH 2/2 s390x: use inline assembly to test for addressing exceptions
In reply to David HildenbrandGCC is free to generate multiple stores instead of just one (e.g. observed by switching to -O0), making the test fail.
Make sure we really only have one store.
--- s390x/selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/selftest.c +1 -1
@@ -33,7 +33,7 @@ static void test_pgm_int(void)check_pgm_int_code (PGM_INT_CODE_OPERATION );expect_pgm_int (); - *((unsigned int *)-1 ) =1 ; + asmvolatile (" stg %0,0(%0)\n" : :"r" (-1 ));check_pgm_int_code (PGM_INT_CODE_ADDRESSING ); }
Signature · 1 line
2.9.4
Re: [kvm-unit-tests PATCH v1 1/2] s390x: use instruction 0x0000 to test for operation exceptions
In reply to David HildenbrandQuoted 14 lines · David Hildenbrand
QEMU uses
0x0000for KVM, not0x0001. Doesn't really matter (both are invalid), but now it matches the comment.Signed-off-by David Hildenbrand <[email protected]>--- s390x/selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)s390x/selftest.c +0
-0
s390x/selftest.c static void test_fp(void) · line 35
Quoted 8 lines
s390x/selftest.c +1
-1@@ -29,7 +29,7 @@ static void test_fp(void)static void test_pgm_int (void ) {expect_pgm_int (); - asmvolatile (" .insn e,0x0001" );/* used for SW breakpoints in QEMU */ + asmvolatile (" .insn e,0x0000" );/* used for SW breakpoints in QEMU */ check_pgm_int_code (PGM_INT_CODE_OPERATION );expect_pgm_int ();
Re: [kvm-unit-tests PATCH v1 2/2] s390x: use inline assembly to test for addressing exceptions
In reply to David HildenbrandQuoted 15 lines · David Hildenbrand
GCC is free to generate multiple stores instead of just one (e.g. observed by switching to -O0), making the test fail.
Make sure we really only have one store.
Signed-off-by David Hildenbrand <[email protected]>--- s390x/selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)s390x/selftest.c +0
-0
s390x/selftest.c static void test_pgm_int(void) · line 38
Quoted 7 lines
s390x/selftest.c +1
-1@@ -33,7 +33,7 @@ static void test_pgm_int(void)check_pgm_int_code (PGM_INT_CODE_OPERATION );expect_pgm_int (); - *((unsigned int *)-1 ) =1 ; + asmvolatile (" stg %0,0(%0)\n" : :"r" (-1 ));check_pgm_int_code (PGM_INT_CODE_ADDRESSING ); }
I guess using a volatile pointer would work, too? Anyway, the inline assembly looks certainly also fine here, so:
Paolo Bonzini
maintainerRe: [kvm-unit-tests PATCH v1 2/2] s390x: use inline assembly to test for addressing exceptions
Quoted 1 line · Thomas Huth
Reviewed-by Thomas Huth <[email protected]>
Thanks David and Thomas, queued.