summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Carstens <hca@linux.ibm.com>2022-03-06 10:59:05 +0100
committerVasily Gorbik <gor@linux.ibm.com>2022-03-08 00:33:01 +0100
commit998e78004fe4dd9219b039efe763e19d10d9a6f9 (patch)
treeccc4df0bba7f90956a4996b112b4bd5b0a8ffae7
parent52b739e2780c7a15e5be06f1691d92ba5f962f79 (diff)
s390/traps: get rid of magic cast for per code
Add a proper union in lowcore to reflect architecture and get rid of a "magic" cast in order to read the full per code. Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
-rw-r--r--arch/s390/include/asm/lowcore.h9
-rw-r--r--arch/s390/kernel/traps.c2
2 files changed, 8 insertions, 3 deletions
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h
index 28a2c6ba795e..9829d6b44a20 100644
--- a/arch/s390/include/asm/lowcore.h
+++ b/arch/s390/include/asm/lowcore.h
@@ -43,8 +43,13 @@ struct lowcore {
};
__u32 data_exc_code; /* 0x0090 */
__u16 mon_class_num; /* 0x0094 */
- __u8 per_code; /* 0x0096 */
- __u8 per_atmid; /* 0x0097 */
+ union {
+ struct {
+ __u8 per_code; /* 0x0096 */
+ __u8 per_atmid; /* 0x0097 */
+ };
+ __u16 per_code_combined;
+ };
__u64 per_address; /* 0x0098 */
__u8 exc_access_id; /* 0x00a0 */
__u8 per_access_id; /* 0x00a1 */
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index a3c94dfcbe16..674c65019434 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -322,7 +322,7 @@ void noinstr __do_pgm_check(struct pt_regs *regs)
set_thread_flag(TIF_PER_TRAP);
ev->address = S390_lowcore.per_address;
- ev->cause = *(u16 *)&S390_lowcore.per_code;
+ ev->cause = S390_lowcore.per_code_combined;
ev->paid = S390_lowcore.per_access_id;
} else {
/* PER event in kernel is kprobes */