diff mbox series

[kvm-unit-tests,GIT,PULL,1/4] lib: s390x: add PSW and PSW_WITH_CUR_MASK macros

Message ID 20230105121538.52008-2-imbrenda@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: storage key and CMM concurrent tests | expand

Commit Message

Claudio Imbrenda Jan. 5, 2023, 12:15 p.m. UTC
Since a lot of code starts new CPUs using the current PSW mask, add two
macros to streamline the creation of generic PSWs and PSWs with the
current program mask.

Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20221130154038.70492-2-imbrenda@linux.ibm.com
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Message-Id: <20221130154038.70492-2-imbrenda@linux.ibm.com>
---
 lib/s390x/asm/arch_def.h | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
index 783a7eaa..bb26e008 100644
--- a/lib/s390x/asm/arch_def.h
+++ b/lib/s390x/asm/arch_def.h
@@ -41,6 +41,8 @@  struct psw {
 	uint64_t	addr;
 };
 
+#define PSW(m, a) ((struct psw){ .mask = (m), .addr = (uint64_t)(a) })
+
 struct short_psw {
 	uint32_t	mask;
 	uint32_t	addr;
@@ -321,6 +323,8 @@  static inline uint64_t extract_psw_mask(void)
 	return (uint64_t) mask_upper << 32 | mask_lower;
 }
 
+#define PSW_WITH_CUR_MASK(addr) PSW(extract_psw_mask(), (addr))
+
 static inline void load_psw_mask(uint64_t mask)
 {
 	struct psw psw = {