[kvm-unit-tests PATCH 2/8] lib: s390x: Add 0x3d, 0x3e and 0x3f PGM constants

Janosch Frank
2021-08-13T07:37:39Z

For UV and format 4 SIE tests we need to handle the following PGM exceptions:
0x3d Secure Storage Access (non-secure CPU accesses secure storage)
0x3e Non-Secure Storage Access (secure CPU accesses non-secure storage)
0x3f Mapping of secure guest is wrong

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
lib/s390x/asm/arch_def.h | 3 +++
lib/s390x/interrupt.c | 3 +++
2 files changed, 6 insertions(+)

diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
index 15cf7d48..4ca02c1d 100644
--- a/lib/s390x/asm/arch_def.h
+++ b/lib/s390x/asm/arch_def.h
@@ -177,6 +177,9 @@ _Static_assert(sizeof(struct lowcore) == 0x1900, "Lowcore size");
#define PGM_INT_CODE_REGION_FIRST_TRANS 0x39
#define PGM_INT_CODE_REGION_SECOND_TRANS 0x3a
#define PGM_INT_CODE_REGION_THIRD_TRANS 0x3b
+#define PGM_INT_CODE_SECURE_STOR_ACCESS 0x3d
+#define PGM_INT_CODE_NON_SECURE_STOR_ACCESS 0x3e
+#define PGM_INT_CODE_SECURE_STOR_VIOLATION 0x3f
#define PGM_INT_CODE_MONITOR_EVENT 0x40
#define PGM_INT_CODE_PER 0x80
#define PGM_INT_CODE_CRYPTO_OPERATION 0x119
diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c
index 785b7355..01ded49d 100644
--- a/lib/s390x/interrupt.c
+++ b/lib/s390x/interrupt.c
@@ -115,6 +115,9 @@ static void fixup_pgm_int(struct stack_frame_int *stack)
case PGM_INT_CODE_REGION_THIRD_TRANS:
case PGM_INT_CODE_PER:
case PGM_INT_CODE_CRYPTO_OPERATION:
+ case PGM_INT_CODE_SECURE_STOR_ACCESS:
+ case PGM_INT_CODE_NON_SECURE_STOR_ACCESS:
+ case PGM_INT_CODE_SECURE_STOR_VIOLATION:
/* The interrupt was nullified, the old PSW points at the
* responsible instruction. Forward the PSW so we don't loop.
*/
--
2.30.2