[kvm-unit-tests PATCH v1 1/4] lib: s390x: add cleanup function for external interrupts

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

 



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@xxxxxxxxxxxxx>
---
 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




[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