xref: /linux/arch/s390/include/asm/dat-bits.h (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * DAT table and related structures
4  *
5  * Copyright IBM Corp. 2024
6  *
7  */
8 
9 #ifndef _S390_DAT_BITS_H
10 #define _S390_DAT_BITS_H
11 
12 union asce {
13 	unsigned long val;
14 	struct {
15 		unsigned long rsto: 52;/* Region- or Segment-Table Origin */
16 		unsigned long	  : 2;
17 		unsigned long g   : 1; /* Subspace Group control */
18 		unsigned long p   : 1; /* Private Space control */
19 		unsigned long s   : 1; /* Storage-Alteration-Event control */
20 		unsigned long x   : 1; /* Space-Switch-Event control */
21 		unsigned long r   : 1; /* Real-Space control */
22 		unsigned long	  : 1;
23 		unsigned long dt  : 2; /* Designation-Type control */
24 		unsigned long tl  : 2; /* Region- or Segment-Table Length */
25 	};
26 };
27 
28 enum {
29 	ASCE_TYPE_SEGMENT = 0,
30 	ASCE_TYPE_REGION3 = 1,
31 	ASCE_TYPE_REGION2 = 2,
32 	ASCE_TYPE_REGION1 = 3
33 };
34 
35 union region1_table_entry {
36 	unsigned long val;
37 	struct {
38 		unsigned long rto: 52;/* Region-Table Origin */
39 		unsigned long	 : 2;
40 		unsigned long p  : 1; /* DAT-Protection Bit */
41 		unsigned long	 : 1;
42 		unsigned long tf : 2; /* Region-Second-Table Offset */
43 		unsigned long i  : 1; /* Region-Invalid Bit */
44 		unsigned long	 : 1;
45 		unsigned long tt : 2; /* Table-Type Bits */
46 		unsigned long tl : 2; /* Region-Second-Table Length */
47 	};
48 };
49 
50 union region2_table_entry {
51 	unsigned long val;
52 	struct {
53 		unsigned long rto: 52;/* Region-Table Origin */
54 		unsigned long	 : 2;
55 		unsigned long p  : 1; /* DAT-Protection Bit */
56 		unsigned long	 : 1;
57 		unsigned long tf : 2; /* Region-Third-Table Offset */
58 		unsigned long i  : 1; /* Region-Invalid Bit */
59 		unsigned long	 : 1;
60 		unsigned long tt : 2; /* Table-Type Bits */
61 		unsigned long tl : 2; /* Region-Third-Table Length */
62 	};
63 };
64 
65 struct region3_table_entry_fc0 {
66 	unsigned long sto: 52;/* Segment-Table Origin */
67 	unsigned long	 : 1;
68 	unsigned long fc : 1; /* Format-Control */
69 	unsigned long p  : 1; /* DAT-Protection Bit */
70 	unsigned long	 : 1;
71 	unsigned long tf : 2; /* Segment-Table Offset */
72 	unsigned long i  : 1; /* Region-Invalid Bit */
73 	unsigned long cr : 1; /* Common-Region Bit */
74 	unsigned long tt : 2; /* Table-Type Bits */
75 	unsigned long tl : 2; /* Segment-Table Length */
76 };
77 
78 struct region3_table_entry_fc1 {
79 	unsigned long rfaa: 33;/* Region-Frame Absolute Address */
80 	unsigned long	  : 14;
81 	unsigned long av  : 1; /* ACCF-Validity Control */
82 	unsigned long acc : 4; /* Access-Control Bits */
83 	unsigned long f   : 1; /* Fetch-Protection Bit */
84 	unsigned long fc  : 1; /* Format-Control */
85 	unsigned long p   : 1; /* DAT-Protection Bit */
86 	unsigned long iep : 1; /* Instruction-Execution-Protection */
87 	unsigned long	  : 2;
88 	unsigned long i   : 1; /* Region-Invalid Bit */
89 	unsigned long cr  : 1; /* Common-Region Bit */
90 	unsigned long tt  : 2; /* Table-Type Bits */
91 	unsigned long	  : 2;
92 };
93 
94 union region3_table_entry {
95 	unsigned long val;
96 	struct region3_table_entry_fc0 fc0;
97 	struct region3_table_entry_fc1 fc1;
98 	struct {
99 		unsigned long	: 53;
100 		unsigned long fc: 1; /* Format-Control */
101 		unsigned long	: 4;
102 		unsigned long i : 1; /* Region-Invalid Bit */
103 		unsigned long cr: 1; /* Common-Region Bit */
104 		unsigned long tt: 2; /* Table-Type Bits */
105 		unsigned long	: 2;
106 	};
107 };
108 
109 struct segment_table_entry_fc0 {
110 	unsigned long pto: 53;/* Page-Table Origin */
111 	unsigned long fc : 1; /* Format-Control */
112 	unsigned long p  : 1; /* DAT-Protection Bit */
113 	unsigned long	 : 3;
114 	unsigned long i  : 1; /* Segment-Invalid Bit */
115 	unsigned long cs : 1; /* Common-Segment Bit */
116 	unsigned long tt : 2; /* Table-Type Bits */
117 	unsigned long	 : 2;
118 };
119 
120 struct segment_table_entry_fc1 {
121 	unsigned long sfaa: 44;/* Segment-Frame Absolute Address */
122 	unsigned long	  : 3;
123 	unsigned long av  : 1; /* ACCF-Validity Control */
124 	unsigned long acc : 4; /* Access-Control Bits */
125 	unsigned long f   : 1; /* Fetch-Protection Bit */
126 	unsigned long fc  : 1; /* Format-Control */
127 	unsigned long p   : 1; /* DAT-Protection Bit */
128 	unsigned long iep : 1; /* Instruction-Execution-Protection */
129 	unsigned long	  : 2;
130 	unsigned long i   : 1; /* Segment-Invalid Bit */
131 	unsigned long cs  : 1; /* Common-Segment Bit */
132 	unsigned long tt  : 2; /* Table-Type Bits */
133 	unsigned long	  : 2;
134 };
135 
136 union segment_table_entry {
137 	unsigned long val;
138 	struct segment_table_entry_fc0 fc0;
139 	struct segment_table_entry_fc1 fc1;
140 	struct {
141 		unsigned long	: 53;
142 		unsigned long fc: 1; /* Format-Control */
143 		unsigned long	: 4;
144 		unsigned long i : 1; /* Segment-Invalid Bit */
145 		unsigned long cs: 1; /* Common-Segment Bit */
146 		unsigned long tt: 2; /* Table-Type Bits */
147 		unsigned long	: 2;
148 	};
149 };
150 
151 union page_table_entry {
152 	unsigned long val;
153 	struct {
154 		unsigned long pfra: 52;/* Page-Frame Real Address */
155 		unsigned long z   : 1; /* Zero Bit */
156 		unsigned long i   : 1; /* Page-Invalid Bit */
157 		unsigned long p   : 1; /* DAT-Protection Bit */
158 		unsigned long iep : 1; /* Instruction-Execution-Protection */
159 		unsigned long	  : 8;
160 	};
161 };
162 
163 enum {
164 	TABLE_TYPE_SEGMENT = 0,
165 	TABLE_TYPE_REGION3 = 1,
166 	TABLE_TYPE_REGION2 = 2,
167 	TABLE_TYPE_REGION1 = 3
168 };
169 
170 #endif /* _S390_DAT_BITS_H */
171