1*5399e34bSNico Boehr /* SPDX-License-Identifier: GPL-2.0-only */ 2*5399e34bSNico Boehr /* 3*5399e34bSNico Boehr * Guarded storage related definitions 4*5399e34bSNico Boehr * 5*5399e34bSNico Boehr * Copyright 2018 IBM Corp. 6*5399e34bSNico Boehr * 7*5399e34bSNico Boehr * Authors: 8*5399e34bSNico Boehr * Martin Schwidefsky <schwidefsky@de.ibm.com> 9*5399e34bSNico Boehr * Janosch Frank <frankja@linux.ibm.com> 10*5399e34bSNico Boehr */ 11*5399e34bSNico Boehr #include <stdint.h> 12*5399e34bSNico Boehr 13*5399e34bSNico Boehr #ifndef _S390X_GS_H_ 14*5399e34bSNico Boehr #define _S390X_GS_H_ 15*5399e34bSNico Boehr 16*5399e34bSNico Boehr struct gs_cb { 17*5399e34bSNico Boehr uint64_t reserved; 18*5399e34bSNico Boehr uint64_t gsd; 19*5399e34bSNico Boehr uint64_t gssm; 20*5399e34bSNico Boehr uint64_t gs_epl_a; 21*5399e34bSNico Boehr }; 22*5399e34bSNico Boehr 23*5399e34bSNico Boehr struct gs_epl { 24*5399e34bSNico Boehr uint8_t pad1; 25*5399e34bSNico Boehr union { 26*5399e34bSNico Boehr uint8_t gs_eam; 27*5399e34bSNico Boehr struct { 28*5399e34bSNico Boehr uint8_t : 6; 29*5399e34bSNico Boehr uint8_t e : 1; 30*5399e34bSNico Boehr uint8_t b : 1; 31*5399e34bSNico Boehr }; 32*5399e34bSNico Boehr }; 33*5399e34bSNico Boehr union { 34*5399e34bSNico Boehr uint8_t gs_eci; 35*5399e34bSNico Boehr struct { 36*5399e34bSNico Boehr uint8_t tx : 1; 37*5399e34bSNico Boehr uint8_t cx : 1; 38*5399e34bSNico Boehr uint8_t : 5; 39*5399e34bSNico Boehr uint8_t in : 1; 40*5399e34bSNico Boehr }; 41*5399e34bSNico Boehr }; 42*5399e34bSNico Boehr union { 43*5399e34bSNico Boehr uint8_t gs_eai; 44*5399e34bSNico Boehr struct { 45*5399e34bSNico Boehr uint8_t : 1; 46*5399e34bSNico Boehr uint8_t t : 1; 47*5399e34bSNico Boehr uint8_t as : 2; 48*5399e34bSNico Boehr uint8_t ar : 4; 49*5399e34bSNico Boehr }; 50*5399e34bSNico Boehr }; 51*5399e34bSNico Boehr uint32_t pad2; 52*5399e34bSNico Boehr uint64_t gs_eha; 53*5399e34bSNico Boehr uint64_t gs_eia; 54*5399e34bSNico Boehr uint64_t gs_eoa; 55*5399e34bSNico Boehr uint64_t gs_eir; 56*5399e34bSNico Boehr uint64_t gs_era; 57*5399e34bSNico Boehr }; 58*5399e34bSNico Boehr load_gs_cb(struct gs_cb * gs_cb)59*5399e34bSNico Boehrstatic inline void load_gs_cb(struct gs_cb *gs_cb) 60*5399e34bSNico Boehr { 61*5399e34bSNico Boehr asm volatile(".insn rxy,0xe3000000004d,0,%0" : : "Q" (*gs_cb)); 62*5399e34bSNico Boehr } 63*5399e34bSNico Boehr store_gs_cb(struct gs_cb * gs_cb)64*5399e34bSNico Boehrstatic inline void store_gs_cb(struct gs_cb *gs_cb) 65*5399e34bSNico Boehr { 66*5399e34bSNico Boehr asm volatile(".insn rxy,0xe30000000049,0,%0" : : "Q" (*gs_cb)); 67*5399e34bSNico Boehr } 68*5399e34bSNico Boehr 69*5399e34bSNico Boehr #endif 70