All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nico Boehr <nrb@linux.ibm.com>
To: kvm@vger.kernel.org, linux-s390@vger.kernel.org
Cc: frankja@linux.ibm.com, imbrenda@linux.ibm.com, thuth@redhat.com
Subject: [kvm-unit-tests PATCH v1 1/4] lib: s390x: add cleanup function for external interrupts
Date: Wed, 13 Jul 2022 13:36:18 +0200	[thread overview]
Message-ID: <20220713113621.14778-2-nrb@linux.ibm.com> (raw)
In-Reply-To: <20220713113621.14778-1-nrb@linux.ibm.com>

Upcoming changes require a way to clear the wait bit in the PSW when
returning from an interrupt handler.

Similar to pgm ints, add a way to register a cleanup function which runs
in the interrupt handler.

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 lib/s390x/asm/interrupt.h | 1 +
 lib/s390x/interrupt.c     | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h
index d9ab0bd781c9..e662f0f0a190 100644
--- a/lib/s390x/asm/interrupt.h
+++ b/lib/s390x/asm/interrupt.h
@@ -38,6 +38,7 @@ union teid {
 };
 
 void register_pgm_cleanup_func(void (*f)(void));
+void register_ext_cleanup_func(void (*f)(struct stack_frame_int *));
 void handle_pgm_int(struct stack_frame_int *stack);
 void handle_ext_int(struct stack_frame_int *stack);
 void handle_mcck_int(void);
diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
index 6da20c4494ad..bb12ddf2d734 100644
--- a/lib/s390x/interrupt.c
+++ b/lib/s390x/interrupt.c
@@ -18,6 +18,7 @@
 static bool pgm_int_expected;
 static bool ext_int_expected;
 static void (*pgm_cleanup_func)(void);
+static void (*ext_cleanup_func)(struct stack_frame_int *stack);
 
 void expect_pgm_int(void)
 {
@@ -197,6 +198,11 @@ void handle_pgm_int(struct stack_frame_int *stack)
 		fixup_pgm_int(stack);
 }
 
+void register_ext_cleanup_func(void (*f)(struct stack_frame_int *))
+{
+	ext_cleanup_func = f;
+}
+
 void handle_ext_int(struct stack_frame_int *stack)
 {
 	if (!ext_int_expected &&
@@ -215,6 +221,9 @@ void handle_ext_int(struct stack_frame_int *stack)
 
 	if (!(stack->crs[0] & CR0_EXTM_MASK))
 		lowcore.ext_old_psw.mask &= ~PSW_MASK_EXT;
+
+	if (ext_cleanup_func)
+		(*ext_cleanup_func)(stack);
 }
 
 void handle_mcck_int(void)
-- 
2.35.3


  reply	other threads:[~2022-07-13 11:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 11:36 [kvm-unit-tests PATCH v1 0/4] s390x: add tests for SIGP call orders in enabled wait Nico Boehr
2022-07-13 11:36 ` Nico Boehr [this message]
2022-07-13 11:36 ` [kvm-unit-tests PATCH v1 2/4] s390x: smp: move sigp calls with invalid cpu address to array Nico Boehr
2022-07-13 11:36 ` [kvm-unit-tests PATCH v1 3/4] s390x: smp: use an array for sigp calls Nico Boehr
2022-07-13 11:36 ` [kvm-unit-tests PATCH v1 4/4] s390x: smp: add tests for calls in wait state Nico Boehr

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=20220713113621.14778-2-nrb@linux.ibm.com \
    --to=nrb@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.