Message ID | 20200717145813.62573-3-frankja@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | PV tests part 1 | expand |
On Fri, 17 Jul 2020 10:58:12 -0400 Janosch Frank <frankja@linux.ibm.com> wrote: > If a exception new psw mask contains a key a specification exception > instead of a special operation exception is presented. Let's test > that. > > Also let's add the test to unittests.cfg so it is run more often. > > Signed-off-by: Janosch Frank <frankja@linux.ibm.com> > --- > s390x/skrf.c | 81 > +++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | > 4 +++ 2 files changed, 85 insertions(+) > > diff --git a/s390x/skrf.c b/s390x/skrf.c > index 9cae589..9733412 100644 > --- a/s390x/skrf.c > +++ b/s390x/skrf.c > @@ -15,6 +15,8 @@ > #include <asm/page.h> > #include <asm/facility.h> > #include <asm/mem.h> > +#include <asm/sigp.h> > +#include <smp.h> > > static uint8_t pagebuf[PAGE_SIZE * 2] > __attribute__((aligned(PAGE_SIZE * 2))); > @@ -106,6 +108,84 @@ static void test_tprot(void) > report_prefix_pop(); > } > > +#include <asm-generic/barrier.h> > +static int testflag = 0; > + > +static void wait_for_flag(void) > +{ > + while (!testflag) > + mb(); > +} > + > +static void set_flag(int val) > +{ > + mb(); > + testflag = val; > + mb(); > +} > + > +static void ecall_cleanup(void) > +{ > + struct lowcore *lc = (void *)0x0; > + > + lc->ext_new_psw.mask = 0x0000000180000000UL; > + lc->sw_int_crs[0] = 0x0000000000040000; > + > + /* > + * PGM old contains the ext new PSW, we need to clean it up, > + * so we don't get a special oepration exception on the lpswe > + * of pgm old. > + */ > + lc->pgm_old_psw.mask = 0x0000000180000000UL; > + lc->pgm_old_psw.addr = (unsigned long)wait_for_flag; > + > + check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); > + set_flag(1); > +} > + > +/* Set a key into the external new psw mask and open external call > masks */ +static void ecall_setup(void) > +{ > + struct lowcore *lc = (void *)0x0; > + uint64_t mask; > + > + register_pgm_int_func(ecall_cleanup); > + expect_pgm_int(); > + /* Put a skey into the ext new psw */ > + lc->ext_new_psw.mask = 0x00F0000180000000UL; > + /* Open up ext masks */ > + ctl_set_bit(0, 13); > + mask = extract_psw_mask(); > + mask |= PSW_MASK_EXT; > + load_psw_mask(mask); > + /* Tell cpu 0 that we're ready */ > + set_flag(1); > +} > + > +static void test_exception_ext_new(void) > +{ > + struct psw psw = { > + .mask = extract_psw_mask(), > + .addr = (unsigned long)ecall_setup > + }; > + > + report_prefix_push("exception external new"); > + if (smp_query_num_cpus() < 2) { > + report_skip("Need second cpu for exception external > new test."); > + report_prefix_pop(); > + return; > + } > + > + smp_cpu_setup(1, psw); > + wait_for_flag(); > + set_flag(0); > + > + sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); > + wait_for_flag(); > + smp_cpu_stop(1); > + report_prefix_pop(); > +} > + > int main(void) > { > report_prefix_push("skrf"); > @@ -121,6 +201,7 @@ int main(void) > test_mvcos(); > test_spka(); > test_tprot(); > + test_exception_ext_new(); > > done: > report_prefix_pop(); > diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg > index 0f156af..b35269b 100644 > --- a/s390x/unittests.cfg > +++ b/s390x/unittests.cfg > @@ -88,3 +88,7 @@ extra_params = -m 3G > [css] > file = css.elf > extra_params = -device virtio-net-ccw > + > +[skrf] > +file = skrf.elf > +smp = 2 Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
On 17/07/2020 16.58, Janosch Frank wrote: > If a exception new psw mask contains a key a specification exception > instead of a special operation exception is presented. I have troubles parsing that sentence... could you write that differently? (and: "s/a exception/an exception/") > Let's test > that. > > Also let's add the test to unittests.cfg so it is run more often. > > Signed-off-by: Janosch Frank <frankja@linux.ibm.com> > --- > s390x/skrf.c | 81 +++++++++++++++++++++++++++++++++++++++++++++ > s390x/unittests.cfg | 4 +++ > 2 files changed, 85 insertions(+) > > diff --git a/s390x/skrf.c b/s390x/skrf.c > index 9cae589..9733412 100644 > --- a/s390x/skrf.c > +++ b/s390x/skrf.c > @@ -15,6 +15,8 @@ > #include <asm/page.h> > #include <asm/facility.h> > #include <asm/mem.h> > +#include <asm/sigp.h> > +#include <smp.h> > > static uint8_t pagebuf[PAGE_SIZE * 2] __attribute__((aligned(PAGE_SIZE * 2))); > > @@ -106,6 +108,84 @@ static void test_tprot(void) > report_prefix_pop(); > } > > +#include <asm-generic/barrier.h> Can we keep the #includes at the top of the file, please? > +static int testflag = 0; > + > +static void wait_for_flag(void) > +{ > + while (!testflag) > + mb(); > +} > + > +static void set_flag(int val) > +{ > + mb(); > + testflag = val; > + mb(); > +} > + > +static void ecall_cleanup(void) > +{ > + struct lowcore *lc = (void *)0x0; > + > + lc->ext_new_psw.mask = 0x0000000180000000UL; Don't we have defines for the PSW values yet? > + lc->sw_int_crs[0] = 0x0000000000040000; > + > + /* > + * PGM old contains the ext new PSW, we need to clean it up, > + * so we don't get a special oepration exception on the lpswe operation > + * of pgm old. > + */ > + lc->pgm_old_psw.mask = 0x0000000180000000UL; > + lc->pgm_old_psw.addr = (unsigned long)wait_for_flag; > + > + check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); > + set_flag(1); > +} Thomas
On 7/21/20 9:28 AM, Thomas Huth wrote: > On 17/07/2020 16.58, Janosch Frank wrote: >> If a exception new psw mask contains a key a specification exception >> instead of a special operation exception is presented. > > I have troubles parsing that sentence... could you write that differently? > (and: "s/a exception/an exception/") How about: When an exception psw new with a storage key in its mask is loaded from lowcore a specification exception is raised instead of the special operation exception that is normally presented when skrf is active. > >> Let's test >> that. >> >> Also let's add the test to unittests.cfg so it is run more often. >> >> Signed-off-by: Janosch Frank <frankja@linux.ibm.com> >> --- >> s390x/skrf.c | 81 +++++++++++++++++++++++++++++++++++++++++++++ >> s390x/unittests.cfg | 4 +++ >> 2 files changed, 85 insertions(+) >> >> diff --git a/s390x/skrf.c b/s390x/skrf.c >> index 9cae589..9733412 100644 >> --- a/s390x/skrf.c >> +++ b/s390x/skrf.c >> @@ -15,6 +15,8 @@ >> #include <asm/page.h> >> #include <asm/facility.h> >> #include <asm/mem.h> >> +#include <asm/sigp.h> >> +#include <smp.h> >> >> static uint8_t pagebuf[PAGE_SIZE * 2] __attribute__((aligned(PAGE_SIZE * 2))); >> >> @@ -106,6 +108,84 @@ static void test_tprot(void) >> report_prefix_pop(); >> } >> >> +#include <asm-generic/barrier.h> > > Can we keep the #includes at the top of the file, please? Yes > >> +static int testflag = 0; >> + >> +static void wait_for_flag(void) >> +{ >> + while (!testflag) >> + mb(); >> +} >> + >> +static void set_flag(int val) >> +{ >> + mb(); >> + testflag = val; >> + mb(); >> +} >> + >> +static void ecall_cleanup(void) >> +{ >> + struct lowcore *lc = (void *)0x0; >> + >> + lc->ext_new_psw.mask = 0x0000000180000000UL; > > Don't we have defines for the PSW values yet? Pierre dropped that patch because of your old binutils version... > >> + lc->sw_int_crs[0] = 0x0000000000040000; >> + >> + /* >> + * PGM old contains the ext new PSW, we need to clean it up, >> + * so we don't get a special oepration exception on the lpswe > > operation fixed > >> + * of pgm old. >> + */ >> + lc->pgm_old_psw.mask = 0x0000000180000000UL; >> + lc->pgm_old_psw.addr = (unsigned long)wait_for_flag; >> + >> + check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); >> + set_flag(1); >> +} > > Thomas >
On 21/07/2020 10.52, Janosch Frank wrote: > On 7/21/20 9:28 AM, Thomas Huth wrote: >> On 17/07/2020 16.58, Janosch Frank wrote: >>> If a exception new psw mask contains a key a specification exception >>> instead of a special operation exception is presented. >> >> I have troubles parsing that sentence... could you write that differently? >> (and: "s/a exception/an exception/") > > How about: > > When an exception psw new with a storage key in its mask is loaded from > lowcore a specification exception is raised instead of the special > operation exception that is normally presented when skrf is active. Still a huge beast of a sentence. Could you maybe make two sentences out of it? For example: " ... is raised. This differs from the normal case where ..." ? Thomas
On 7/21/20 4:28 PM, Thomas Huth wrote: > On 21/07/2020 10.52, Janosch Frank wrote: >> On 7/21/20 9:28 AM, Thomas Huth wrote: >>> On 17/07/2020 16.58, Janosch Frank wrote: >>>> If a exception new psw mask contains a key a specification exception >>>> instead of a special operation exception is presented. >>> >>> I have troubles parsing that sentence... could you write that differently? >>> (and: "s/a exception/an exception/") >> >> How about: >> >> When an exception psw new with a storage key in its mask is loaded from >> lowcore a specification exception is raised instead of the special >> operation exception that is normally presented when skrf is active. > > Still a huge beast of a sentence. Could you maybe make two sentences out > of it? For example: > > " ... is raised. This differs from the normal case where ..." When an exception psw new with a storage key in its mask is loaded from lowcore a specification exception is raised. This behavior differs from the one that is presented when trying to execute skey related instructions which will raise special operation exceptions. > > ? > > Thomas >
On Tue, 21 Jul 2020 17:03:10 +0200 Janosch Frank <frankja@linux.ibm.com> wrote: > On 7/21/20 4:28 PM, Thomas Huth wrote: > > On 21/07/2020 10.52, Janosch Frank wrote: > >> On 7/21/20 9:28 AM, Thomas Huth wrote: > >>> On 17/07/2020 16.58, Janosch Frank wrote: > >>>> If a exception new psw mask contains a key a specification exception > >>>> instead of a special operation exception is presented. > >>> > >>> I have troubles parsing that sentence... could you write that differently? > >>> (and: "s/a exception/an exception/") > >> > >> How about: > >> > >> When an exception psw new with a storage key in its mask is loaded from > >> lowcore a specification exception is raised instead of the special > >> operation exception that is normally presented when skrf is active. > > > > Still a huge beast of a sentence. Could you maybe make two sentences out > > of it? For example: > > > > " ... is raised. This differs from the normal case where ..." > > When an exception psw new with a storage key in its mask is loaded from > lowcore a specification exception is raised. This behavior differs from > the one that is presented when trying to execute skey related > instructions which will raise special operation exceptions. s/psw new/new psw/ ? (And probably a comma after 'lowcore'.) "This differs from the behaviour when trying to execute skey related instructions, which will result in special operation exceptions." ?
On 7/23/20 2:10 PM, Cornelia Huck wrote: > On Tue, 21 Jul 2020 17:03:10 +0200 > Janosch Frank <frankja@linux.ibm.com> wrote: > >> On 7/21/20 4:28 PM, Thomas Huth wrote: >>> On 21/07/2020 10.52, Janosch Frank wrote: >>>> On 7/21/20 9:28 AM, Thomas Huth wrote: >>>>> On 17/07/2020 16.58, Janosch Frank wrote: >>>>>> If a exception new psw mask contains a key a specification exception >>>>>> instead of a special operation exception is presented. >>>>> >>>>> I have troubles parsing that sentence... could you write that differently? >>>>> (and: "s/a exception/an exception/") >>>> >>>> How about: >>>> >>>> When an exception psw new with a storage key in its mask is loaded from >>>> lowcore a specification exception is raised instead of the special >>>> operation exception that is normally presented when skrf is active. >>> >>> Still a huge beast of a sentence. Could you maybe make two sentences out >>> of it? For example: >>> >>> " ... is raised. This differs from the normal case where ..." >> >> When an exception psw new with a storage key in its mask is loaded from >> lowcore a specification exception is raised. This behavior differs from >> the one that is presented when trying to execute skey related >> instructions which will raise special operation exceptions. > > s/psw new/new psw/ ? Yeah that would align the naming with the pop one. > > (And probably a comma after 'lowcore'.) > > "This differs from the behaviour when trying to execute skey related > instructions, which will result in special operation exceptions." > > ? Sure
diff --git a/s390x/skrf.c b/s390x/skrf.c index 9cae589..9733412 100644 --- a/s390x/skrf.c +++ b/s390x/skrf.c @@ -15,6 +15,8 @@ #include <asm/page.h> #include <asm/facility.h> #include <asm/mem.h> +#include <asm/sigp.h> +#include <smp.h> static uint8_t pagebuf[PAGE_SIZE * 2] __attribute__((aligned(PAGE_SIZE * 2))); @@ -106,6 +108,84 @@ static void test_tprot(void) report_prefix_pop(); } +#include <asm-generic/barrier.h> +static int testflag = 0; + +static void wait_for_flag(void) +{ + while (!testflag) + mb(); +} + +static void set_flag(int val) +{ + mb(); + testflag = val; + mb(); +} + +static void ecall_cleanup(void) +{ + struct lowcore *lc = (void *)0x0; + + lc->ext_new_psw.mask = 0x0000000180000000UL; + lc->sw_int_crs[0] = 0x0000000000040000; + + /* + * PGM old contains the ext new PSW, we need to clean it up, + * so we don't get a special oepration exception on the lpswe + * of pgm old. + */ + lc->pgm_old_psw.mask = 0x0000000180000000UL; + lc->pgm_old_psw.addr = (unsigned long)wait_for_flag; + + check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); + set_flag(1); +} + +/* Set a key into the external new psw mask and open external call masks */ +static void ecall_setup(void) +{ + struct lowcore *lc = (void *)0x0; + uint64_t mask; + + register_pgm_int_func(ecall_cleanup); + expect_pgm_int(); + /* Put a skey into the ext new psw */ + lc->ext_new_psw.mask = 0x00F0000180000000UL; + /* Open up ext masks */ + ctl_set_bit(0, 13); + mask = extract_psw_mask(); + mask |= PSW_MASK_EXT; + load_psw_mask(mask); + /* Tell cpu 0 that we're ready */ + set_flag(1); +} + +static void test_exception_ext_new(void) +{ + struct psw psw = { + .mask = extract_psw_mask(), + .addr = (unsigned long)ecall_setup + }; + + report_prefix_push("exception external new"); + if (smp_query_num_cpus() < 2) { + report_skip("Need second cpu for exception external new test."); + report_prefix_pop(); + return; + } + + smp_cpu_setup(1, psw); + wait_for_flag(); + set_flag(0); + + sigp(1, SIGP_EXTERNAL_CALL, 0, NULL); + wait_for_flag(); + smp_cpu_stop(1); + report_prefix_pop(); +} + int main(void) { report_prefix_push("skrf"); @@ -121,6 +201,7 @@ int main(void) test_mvcos(); test_spka(); test_tprot(); + test_exception_ext_new(); done: report_prefix_pop(); diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index 0f156af..b35269b 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -88,3 +88,7 @@ extra_params = -m 3G [css] file = css.elf extra_params = -device virtio-net-ccw + +[skrf] +file = skrf.elf +smp = 2
If a exception new psw mask contains a key a specification exception instead of a special operation exception is presented. Let's test that. Also let's add the test to unittests.cfg so it is run more often. Signed-off-by: Janosch Frank <frankja@linux.ibm.com> --- s390x/skrf.c | 81 +++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 4 +++ 2 files changed, 85 insertions(+)