On 27.03.2018 15:02, Thomas Huth wrote: > On 27.03.2018 13:55, Janosch Frank wrote: >> Short test of the vector, vector enhancement 1 and vector bcd >> facility. >> >> Signed-off-by: Janosch Frank <frankja@xxxxxxxxxxxxxxxxxx> >> --- >> lib/s390x/asm/arch_def.h | 18 +++++++ >> s390x/Makefile | 1 + >> s390x/unittests.cfg | 3 ++ >> s390x/vector.c | 134 +++++++++++++++++++++++++++++++++++++++++++++++ >> 4 files changed, 156 insertions(+) >> create mode 100644 s390x/vector.c >> >> diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h >> index b67afac..99abe18 100644 >> --- a/lib/s390x/asm/arch_def.h >> +++ b/lib/s390x/asm/arch_def.h >> @@ -183,6 +183,24 @@ static inline uint64_t stctg(int cr) >> return value; >> } >> >> +static inline void ctl_set_bit(int cr, unsigned int bit) >> +{ >> + uint64_t reg; >> + >> + reg = stctg(cr); >> + reg |= 1UL << bit; >> + lctlg(cr, reg); >> +} >> + >> +static inline void ctl_clear_bit(int cr, unsigned int bit) >> +{ >> + uint64_t reg; >> + >> + reg = stctg(cr); >> + reg &= ~(1UL << bit); >> + lctlg(cr, reg); >> +} >> + >> static inline uint64_t extract_psw_mask(void) >> { >> uint32_t mask_upper = 0, mask_lower = 0; >> diff --git a/s390x/Makefile b/s390x/Makefile >> index d80ca96..7188daa 100644 >> --- a/s390x/Makefile >> +++ b/s390x/Makefile >> @@ -7,6 +7,7 @@ tests += $(TEST_DIR)/skey.elf >> tests += $(TEST_DIR)/diag10.elf >> tests += $(TEST_DIR)/pfmf.elf >> tests += $(TEST_DIR)/cmm.elf >> +tests += $(TEST_DIR)/vector.elf >> >> all: directories test_cases >> >> diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg >> index 63135d5..3943861 100644 >> --- a/s390x/unittests.cfg >> +++ b/s390x/unittests.cfg >> @@ -49,3 +49,6 @@ file = pfmf.elf >> >> [cmm] >> file = cmm.elf >> + >> +[vector] >> +file = vector.elf >> diff --git a/s390x/vector.c b/s390x/vector.c >> new file mode 100644 >> index 0000000..42550d7 >> --- /dev/null >> +++ b/s390x/vector.c >> @@ -0,0 +1,134 @@ > [...] >> +/* z14 vector extension test */ >> +static void test_ext1_nand(void) >> +{ >> + bool has_vext = test_facility(134); >> + static struct prm { >> + __uint128_t a,b,c; >> + } prm __attribute__((aligned(16))); >> + >> + report_xfail("Vector extensions 1 available", !has_vext, has_vext); >> + if (!has_vext) >> + return; >> + >> + memset(&prm.a, 0xff, 16); >> + prm.b = prm.a; > > The other functions now pre-initialize prm.c, too, so I think we should > do that here, too? Maybe simply replace the above two lines with: > > memset(&prm, 0xff, sizeof(prm)); > > ? > > (In case that's the only problem in this series, I could also do that > while picking up the patches if you agree, so you don't have to respin > just because of this) Feel free to do that > >> + asm volatile(" .machine z13\n" >> + " vl 0, %[v1]\n" >> + " vl 1, %[v2]\n" >> + " .byte 0xe7, 0x20, 0x10, 0x00, 0x00, 0x6e\n" /* vnn */ >> + " vst 2, %[v3]\n" >> + : [v3] "=Q" (prm.c) >> + : [v1] "Q" (prm.a), [v2] "Q" (prm.b) >> + : "v0", "v1", "v2", "memory"); >> + report("nand ff", !prm.c); >> +} > > Thomas >
Attachment:
signature.asc
Description: OpenPGP digital signature