Re: [kvm-unit-tests PATCH v1 1/2] lib: s390x: introduce check_pgm_int_code_xfail()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 12 May 2022 16:01:06 +0200
Nico Boehr <nrb@xxxxxxxxxxxxx> wrote:

> Right now, it is not very convenient to have expected failures when checking for
> program interrupts. Let's introduce check_pgm_int_code_xfail() with an API
> similar to report_xfail() to make the programmer's life easier.
> 
> With this, we can express check_pgm_int_code() as a special case of
> check_pgm_int_code_xfail() with xfail = false.
> 
> Signed-off-by: Nico Boehr <nrb@xxxxxxxxxxxxx>
> ---
>  lib/s390x/asm/interrupt.h | 1 +
>  lib/s390x/interrupt.c     | 9 +++++++--
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h
> index d9ab0bd781c9..88731da9e341 100644
> --- a/lib/s390x/asm/interrupt.h
> +++ b/lib/s390x/asm/interrupt.h
> @@ -46,6 +46,7 @@ void handle_svc_int(void);
>  void expect_pgm_int(void);
>  void expect_ext_int(void);
>  uint16_t clear_pgm_int(void);
> +void check_pgm_int_code_xfail(bool xfail, uint16_t code);
>  void check_pgm_int_code(uint16_t code);

... here ^ (see below)

>  
>  /* Activate low-address protection */
> diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
> index 27d3b767210f..b61f7d588550 100644
> --- a/lib/s390x/interrupt.c
> +++ b/lib/s390x/interrupt.c
> @@ -47,14 +47,19 @@ uint16_t clear_pgm_int(void)
>  	return code;
>  }
>  
> -void check_pgm_int_code(uint16_t code)
> +void check_pgm_int_code_xfail(bool xfail, uint16_t code)
>  {
>  	mb();
> -	report(code == lc->pgm_int_code,
> +	report_xfail(xfail, code == lc->pgm_int_code,
>  	       "Program interrupt: expected(%d) == received(%d)", code,
>  	       lc->pgm_int_code);
>  }
>  
> +void check_pgm_int_code(uint16_t code)
> +{
> +	check_pgm_int_code_xfail(false, code);
> +}
> +

... maybe at this point make it a macroid (static inline function)
directly in the .h ?

>  void register_pgm_cleanup_func(void (*f)(void))
>  {
>  	pgm_cleanup_func = f;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux