[kvm-unit-tests PATCH v1 2/3] s390x: check for specific program interrupt

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

 



We already have check_pgm_int_code to check and report if a specific
program interrupt has occourred, but this approach has some issues.

In order to specify which test is being run, it was needed to push and
pop a prefix for each test, which is not nice to read both in the code
and in the output.

Another issue is that sometimes the condition to test for might require
other checks in addition to the interrupt.

The simple function added in this patch tests if the program intteruupt
received is the one expected.

Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
---
 lib/s390x/asm/interrupt.h | 1 +
 lib/s390x/interrupt.c     | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h
index 1a2e2cd8..a33437b1 100644
--- a/lib/s390x/asm/interrupt.h
+++ b/lib/s390x/asm/interrupt.h
@@ -23,6 +23,7 @@ void expect_pgm_int(void);
 void expect_ext_int(void);
 uint16_t clear_pgm_int(void);
 void check_pgm_int_code(uint16_t code);
+int is_pgm(int expected);
 
 /* Activate low-address protection */
 static inline void low_prot_enable(void)
diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
index 59e01b1a..6f660285 100644
--- a/lib/s390x/interrupt.c
+++ b/lib/s390x/interrupt.c
@@ -51,6 +51,12 @@ void check_pgm_int_code(uint16_t code)
 	       lc->pgm_int_code);
 }
 
+int is_pgm(int expected)
+{
+	mb();
+	return expected == lc->pgm_int_code;
+}
+
 void register_pgm_cleanup_func(void (*f)(void))
 {
 	pgm_cleanup_func = f;
-- 
2.26.2




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux