Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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/*
13 * vaddress union in order to easily decode a virtual address into its
14 * region first index, region second index etc. parts.
15 */
16union vaddress {
17 unsigned long addr;
18 struct {
19 unsigned long rfx : 11;
20 unsigned long rsx : 11;
21 unsigned long rtx : 11;
22 unsigned long sx : 11;
23 unsigned long px : 8;
24 unsigned long bx : 12;
25 };
26 struct {
27 unsigned long rfx01 : 2;
28 unsigned long : 9;
29 unsigned long rsx01 : 2;
30 unsigned long : 9;
31 unsigned long rtx01 : 2;
32 unsigned long : 9;
33 unsigned long sx01 : 2;
34 unsigned long : 29;
35 };
36};
37
38union asce {
39 unsigned long val;
40 struct {
41 unsigned long rsto: 52;/* Region- or Segment-Table Origin */
42 unsigned long : 2;
43 unsigned long g : 1; /* Subspace Group control */
44 unsigned long p : 1; /* Private Space control */
45 unsigned long s : 1; /* Storage-Alteration-Event control */
46 unsigned long x : 1; /* Space-Switch-Event control */
47 unsigned long r : 1; /* Real-Space control */
48 unsigned long : 1;
49 unsigned long dt : 2; /* Designation-Type control */
50 unsigned long tl : 2; /* Region- or Segment-Table Length */
51 };
52};
53
54enum {
55 ASCE_TYPE_SEGMENT = 0,
56 ASCE_TYPE_REGION3 = 1,
57 ASCE_TYPE_REGION2 = 2,
58 ASCE_TYPE_REGION1 = 3
59};
60
61union region1_table_entry {
62 unsigned long val;
63 struct {
64 unsigned long rto: 52;/* Region-Table Origin */
65 unsigned long : 2;
66 unsigned long p : 1; /* DAT-Protection Bit */
67 unsigned long : 1;
68 unsigned long tf : 2; /* Region-Second-Table Offset */
69 unsigned long i : 1; /* Region-Invalid Bit */
70 unsigned long : 1;
71 unsigned long tt : 2; /* Table-Type Bits */
72 unsigned long tl : 2; /* Region-Second-Table Length */
73 };
74};
75
76union region2_table_entry {
77 unsigned long val;
78 struct {
79 unsigned long rto: 52;/* Region-Table Origin */
80 unsigned long : 2;
81 unsigned long p : 1; /* DAT-Protection Bit */
82 unsigned long : 1;
83 unsigned long tf : 2; /* Region-Third-Table Offset */
84 unsigned long i : 1; /* Region-Invalid Bit */
85 unsigned long : 1;
86 unsigned long tt : 2; /* Table-Type Bits */
87 unsigned long tl : 2; /* Region-Third-Table Length */
88 };
89};
90
91struct region3_table_entry_fc0 {
92 unsigned long sto: 52;/* Segment-Table Origin */
93 unsigned long : 1;
94 unsigned long fc : 1; /* Format-Control */
95 unsigned long p : 1; /* DAT-Protection Bit */
96 unsigned long : 1;
97 unsigned long tf : 2; /* Segment-Table Offset */
98 unsigned long i : 1; /* Region-Invalid Bit */
99 unsigned long cr : 1; /* Common-Region Bit */
100 unsigned long tt : 2; /* Table-Type Bits */
101 unsigned long tl : 2; /* Segment-Table Length */
102};
103
104struct region3_table_entry_fc1 {
105 unsigned long rfaa: 33;/* Region-Frame Absolute Address */
106 unsigned long : 14;
107 unsigned long av : 1; /* ACCF-Validity Control */
108 unsigned long acc : 4; /* Access-Control Bits */
109 unsigned long f : 1; /* Fetch-Protection Bit */
110 unsigned long fc : 1; /* Format-Control */
111 unsigned long p : 1; /* DAT-Protection Bit */
112 unsigned long iep : 1; /* Instruction-Execution-Protection */
113 unsigned long : 2;
114 unsigned long i : 1; /* Region-Invalid Bit */
115 unsigned long cr : 1; /* Common-Region Bit */
116 unsigned long tt : 2; /* Table-Type Bits */
117 unsigned long : 2;
118};
119
120union region3_table_entry {
121 unsigned long val;
122 struct region3_table_entry_fc0 fc0;
123 struct region3_table_entry_fc1 fc1;
124 struct {
125 unsigned long : 53;
126 unsigned long fc: 1; /* Format-Control */
127 unsigned long p : 1; /* DAT-Protection Bit */
128 unsigned long : 3;
129 unsigned long i : 1; /* Region-Invalid Bit */
130 unsigned long cr: 1; /* Common-Region Bit */
131 unsigned long tt: 2; /* Table-Type Bits */
132 unsigned long : 2;
133 };
134};
135
136struct segment_table_entry_fc0 {
137 unsigned long pto: 53;/* Page-Table Origin */
138 unsigned long fc : 1; /* Format-Control */
139 unsigned long p : 1; /* DAT-Protection Bit */
140 unsigned long : 3;
141 unsigned long i : 1; /* Segment-Invalid Bit */
142 unsigned long cs : 1; /* Common-Segment Bit */
143 unsigned long tt : 2; /* Table-Type Bits */
144 unsigned long : 2;
145};
146
147struct segment_table_entry_fc1 {
148 unsigned long sfaa: 44;/* Segment-Frame Absolute Address */
149 unsigned long : 3;
150 unsigned long av : 1; /* ACCF-Validity Control */
151 unsigned long acc : 4; /* Access-Control Bits */
152 unsigned long f : 1; /* Fetch-Protection Bit */
153 unsigned long fc : 1; /* Format-Control */
154 unsigned long p : 1; /* DAT-Protection Bit */
155 unsigned long iep : 1; /* Instruction-Execution-Protection */
156 unsigned long : 2;
157 unsigned long i : 1; /* Segment-Invalid Bit */
158 unsigned long cs : 1; /* Common-Segment Bit */
159 unsigned long tt : 2; /* Table-Type Bits */
160 unsigned long : 2;
161};
162
163union segment_table_entry {
164 unsigned long val;
165 struct segment_table_entry_fc0 fc0;
166 struct segment_table_entry_fc1 fc1;
167 struct {
168 unsigned long : 53;
169 unsigned long fc: 1; /* Format-Control */
170 unsigned long p : 1; /* DAT-Protection Bit */
171 unsigned long : 3;
172 unsigned long i : 1; /* Segment-Invalid Bit */
173 unsigned long cs: 1; /* Common-Segment Bit */
174 unsigned long tt: 2; /* Table-Type Bits */
175 unsigned long : 2;
176 };
177};
178
179union page_table_entry {
180 unsigned long val;
181 struct {
182 unsigned long pfra: 52;/* Page-Frame Real Address */
183 unsigned long z : 1; /* Zero Bit */
184 unsigned long i : 1; /* Page-Invalid Bit */
185 unsigned long p : 1; /* DAT-Protection Bit */
186 unsigned long iep : 1; /* Instruction-Execution-Protection */
187 unsigned long : 8;
188 };
189};
190
191enum {
192 TABLE_TYPE_SEGMENT = 0,
193 TABLE_TYPE_REGION3 = 1,
194 TABLE_TYPE_REGION2 = 2,
195 TABLE_TYPE_REGION1 = 3
196};
197
198#endif /* _S390_DAT_BITS_H */