public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Janosch Frank <frankja@linux.ibm.com>, kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, thuth@redhat.com
Subject: Re: [kvm-unit-tests PATCH v3 5/6] s390x: Prepare for external calls
Date: Wed, 25 Sep 2019 10:50:25 +0200	[thread overview]
Message-ID: <caa7fb6d-5a8a-f9b5-dd83-fdfd7ec9cf8d@redhat.com> (raw)
In-Reply-To: <20190920080356.1948-6-frankja@linux.ibm.com>

On 20.09.19 10:03, Janosch Frank wrote:
> With SMP we also get new external interrupts like external call and
> emergency call. Let's make them known.
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> ---
>  lib/s390x/asm/arch_def.h  |  5 +++++
>  lib/s390x/asm/interrupt.h |  3 +++
>  lib/s390x/interrupt.c     | 23 +++++++++++++++++++----
>  3 files changed, 27 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
> index d5a7f51..96cca2e 100644
> --- a/lib/s390x/asm/arch_def.h
> +++ b/lib/s390x/asm/arch_def.h
> @@ -19,6 +19,11 @@ struct psw {
>  #define PSW_MASK_DAT			0x0400000000000000UL
>  #define PSW_MASK_PSTATE			0x0001000000000000UL
>  
> +#define CR0_EXTM_SCLP			0X0000000000000200UL
> +#define CR0_EXTM_EXTC			0X0000000000002000UL
> +#define CR0_EXTM_EMGC			0X0000000000004000UL
> +#define CR0_EXTM_MASK			0X0000000000006200UL
> +
>  struct lowcore {
>  	uint8_t		pad_0x0000[0x0080 - 0x0000];	/* 0x0000 */
>  	uint32_t	ext_int_param;			/* 0x0080 */
> diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h
> index f485e96..4cfade9 100644
> --- a/lib/s390x/asm/interrupt.h
> +++ b/lib/s390x/asm/interrupt.h
> @@ -11,6 +11,8 @@
>  #define _ASMS390X_IRQ_H_
>  #include <asm/arch_def.h>
>  
> +#define EXT_IRQ_EMERGENCY_SIG	0x1201
> +#define EXT_IRQ_EXTERNAL_CALL	0x1202
>  #define EXT_IRQ_SERVICE_SIG	0x2401
>  
>  void handle_pgm_int(void);
> @@ -19,6 +21,7 @@ void handle_mcck_int(void);
>  void handle_io_int(void);
>  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(uint16_t code);
>  
> diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
> index 7832711..5cade23 100644
> --- a/lib/s390x/interrupt.c
> +++ b/lib/s390x/interrupt.c
> @@ -15,6 +15,7 @@
>  #include <sclp.h>
>  
>  static bool pgm_int_expected;
> +static bool ext_int_expected;
>  static struct lowcore *lc;
>  
>  void expect_pgm_int(void)
> @@ -24,6 +25,13 @@ void expect_pgm_int(void)
>  	mb();
>  }
>  
> +void expect_ext_int(void)
> +{
> +	ext_int_expected = true;
> +	lc->ext_int_code = 0;
> +	mb();
> +}
> +
>  uint16_t clear_pgm_int(void)
>  {
>  	uint16_t code;
> @@ -108,15 +116,22 @@ void handle_pgm_int(void)
>  
>  void handle_ext_int(void)
>  {
> -	if (lc->ext_int_code != EXT_IRQ_SERVICE_SIG) {
> +	if (!ext_int_expected &&
> +	    lc->ext_int_code != EXT_IRQ_SERVICE_SIG) {
>  		report_abort("Unexpected external call interrupt: at %#lx",
>  			     lc->ext_old_psw.addr);
> -	} else {
> -		lc->ext_old_psw.mask &= ~PSW_MASK_EXT;
> +		return;
> +	}
> +
> +	if (lc->ext_int_code == EXT_IRQ_SERVICE_SIG) {
>  		lc->sw_int_cr0 &= ~(1UL << 9);
>  		sclp_handle_ext();
> -		lc->ext_int_code = 0;
> +	} else {
> +		ext_int_expected = false;
>  	}
> +
> +	if (!(lc->sw_int_cr0 & CR0_EXTM_MASK))
> +		lc->ext_old_psw.mask &= ~PSW_MASK_EXT;
>  }
>  
>  void handle_mcck_int(void)
> 

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David / dhildenb

  reply	other threads:[~2019-09-25  8:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20  8:03 [kvm-unit-tests PATCH v3 0/6] s390x: Add multiboot and smp Janosch Frank
2019-09-20  8:03 ` [kvm-unit-tests PATCH v3 1/6] s390x: Use interrupts in SCLP and add locking Janosch Frank
2019-09-20  8:12   ` David Hildenbrand
2019-09-20  8:03 ` [kvm-unit-tests PATCH v3 2/6] s390x: Add linemode console Janosch Frank
2019-09-20  8:03 ` [kvm-unit-tests PATCH v3 3/6] s390x: Add linemode buffer to fix newline on every print Janosch Frank
2019-09-20  8:24   ` David Hildenbrand
2019-09-20  8:31     ` Janosch Frank
2019-09-20 11:23     ` [kvm-unit-tests PATCH] " Janosch Frank
2019-09-20  8:03 ` [kvm-unit-tests PATCH v3 4/6] s390x: Add initial smp code Janosch Frank
2019-09-23 10:43   ` Thomas Huth
2019-09-23 14:15     ` [kvm-unit-tests PATCH] " Janosch Frank
2019-09-24 16:06       ` Thomas Huth
2019-09-20  8:03 ` [kvm-unit-tests PATCH v3 5/6] s390x: Prepare for external calls Janosch Frank
2019-09-25  8:50   ` David Hildenbrand [this message]
2019-09-20  8:03 ` [kvm-unit-tests PATCH v3 6/6] s390x: SMP test Janosch Frank
2019-09-25  8:49   ` Thomas Huth
2019-09-25 10:26     ` Janosch Frank
2019-09-25  9:03   ` David Hildenbrand
2019-09-25 10:24     ` Janosch Frank
2019-09-25 13:27   ` David Hildenbrand
2019-09-25 13:30     ` Thomas Huth
2019-09-25 13:32       ` David Hildenbrand
2019-09-25 13:35         ` David Hildenbrand
2019-09-25 13:39           ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=caa7fb6d-5a8a-f9b5-dd83-fdfd7ec9cf8d@redhat.com \
    --to=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox