@@ -49,6 +49,19 @@ struct ap_queue_status {
49
49
unsigned int _pad2 : 16 ;
50
50
};
51
51
52
+ /*
53
+ * AP queue status reg union to access the reg1
54
+ * register with the lower 32 bits comprising the
55
+ * ap queue status.
56
+ */
57
+ union ap_queue_status_reg {
58
+ unsigned long value ;
59
+ struct {
60
+ u32 _pad ;
61
+ struct ap_queue_status status ;
62
+ };
63
+ };
64
+
52
65
/**
53
66
* ap_intructions_available() - Test if AP instructions are available.
54
67
*
@@ -82,7 +95,7 @@ static inline bool ap_instructions_available(void)
82
95
*/
83
96
static inline struct ap_queue_status ap_tapq (ap_qid_t qid , unsigned long * info )
84
97
{
85
- struct ap_queue_status reg1 ;
98
+ union ap_queue_status_reg reg1 ;
86
99
unsigned long reg2 ;
87
100
88
101
asm volatile (
@@ -91,12 +104,12 @@ static inline struct ap_queue_status ap_tapq(ap_qid_t qid, unsigned long *info)
91
104
" .insn rre,0xb2af0000,0,0\n" /* PQAP(TAPQ) */
92
105
" lgr %[reg1],1\n" /* gr1 (status) into reg1 */
93
106
" lgr %[reg2],2\n" /* gr2 into reg2 */
94
- : [reg1 ] "=&d" (reg1 ), [reg2 ] "=&d" (reg2 )
107
+ : [reg1 ] "=&d" (reg1 . value ), [reg2 ] "=&d" (reg2 )
95
108
: [qid ] "d" (qid )
96
109
: "cc" , "0" , "1" , "2" );
97
110
if (info )
98
111
* info = reg2 ;
99
- return reg1 ;
112
+ return reg1 . status ;
100
113
}
101
114
102
115
/**
@@ -125,16 +138,16 @@ static inline struct ap_queue_status ap_test_queue(ap_qid_t qid,
125
138
static inline struct ap_queue_status ap_rapq (ap_qid_t qid )
126
139
{
127
140
unsigned long reg0 = qid | (1UL << 24 ); /* fc 1UL is RAPQ */
128
- struct ap_queue_status reg1 ;
141
+ union ap_queue_status_reg reg1 ;
129
142
130
143
asm volatile (
131
144
" lgr 0,%[reg0]\n" /* qid arg into gr0 */
132
145
" .insn rre,0xb2af0000,0,0\n" /* PQAP(RAPQ) */
133
146
" lgr %[reg1],1\n" /* gr1 (status) into reg1 */
134
- : [reg1 ] "=&d" (reg1 )
147
+ : [reg1 ] "=&d" (reg1 . value )
135
148
: [reg0 ] "d" (reg0 )
136
149
: "cc" , "0" , "1" );
137
- return reg1 ;
150
+ return reg1 . status ;
138
151
}
139
152
140
153
/**
@@ -146,16 +159,16 @@ static inline struct ap_queue_status ap_rapq(ap_qid_t qid)
146
159
static inline struct ap_queue_status ap_zapq (ap_qid_t qid )
147
160
{
148
161
unsigned long reg0 = qid | (2UL << 24 ); /* fc 2UL is ZAPQ */
149
- struct ap_queue_status reg1 ;
162
+ union ap_queue_status_reg reg1 ;
150
163
151
164
asm volatile (
152
165
" lgr 0,%[reg0]\n" /* qid arg into gr0 */
153
166
" .insn rre,0xb2af0000,0,0\n" /* PQAP(ZAPQ) */
154
167
" lgr %[reg1],1\n" /* gr1 (status) into reg1 */
155
- : [reg1 ] "=&d" (reg1 )
168
+ : [reg1 ] "=&d" (reg1 . value )
156
169
: [reg0 ] "d" (reg0 )
157
170
: "cc" , "0" , "1" );
158
- return reg1 ;
171
+ return reg1 . status ;
159
172
}
160
173
161
174
/**
@@ -209,18 +222,21 @@ static inline int ap_qci(struct ap_config_info *config)
209
222
* parameter to the PQAP(AQIC) instruction. For details please
210
223
* see the AR documentation.
211
224
*/
212
- struct ap_qirq_ctrl {
213
- unsigned int _res1 : 8 ;
214
- unsigned int zone : 8 ; /* zone info */
215
- unsigned int ir : 1 ; /* ir flag: enable (1) or disable (0) irq */
216
- unsigned int _res2 : 4 ;
217
- unsigned int gisc : 3 ; /* guest isc field */
218
- unsigned int _res3 : 6 ;
219
- unsigned int gf : 2 ; /* gisa format */
220
- unsigned int _res4 : 1 ;
221
- unsigned int gisa : 27 ; /* gisa origin */
222
- unsigned int _res5 : 1 ;
223
- unsigned int isc : 3 ; /* irq sub class */
225
+ union ap_qirq_ctrl {
226
+ unsigned long value ;
227
+ struct {
228
+ unsigned int : 8 ;
229
+ unsigned int zone : 8 ; /* zone info */
230
+ unsigned int ir : 1 ; /* ir flag: enable (1) or disable (0) irq */
231
+ unsigned int : 4 ;
232
+ unsigned int gisc : 3 ; /* guest isc field */
233
+ unsigned int : 6 ;
234
+ unsigned int gf : 2 ; /* gisa format */
235
+ unsigned int : 1 ;
236
+ unsigned int gisa : 27 ; /* gisa origin */
237
+ unsigned int : 1 ;
238
+ unsigned int isc : 3 ; /* irq sub class */
239
+ };
224
240
};
225
241
226
242
/**
@@ -232,29 +248,22 @@ struct ap_qirq_ctrl {
232
248
* Returns AP queue status.
233
249
*/
234
250
static inline struct ap_queue_status ap_aqic (ap_qid_t qid ,
235
- struct ap_qirq_ctrl qirqctrl ,
251
+ union ap_qirq_ctrl qirqctrl ,
236
252
phys_addr_t pa_ind )
237
253
{
238
254
unsigned long reg0 = qid | (3UL << 24 ); /* fc 3UL is AQIC */
239
- union {
240
- unsigned long value ;
241
- struct ap_qirq_ctrl qirqctrl ;
242
- struct {
243
- u32 _pad ;
244
- struct ap_queue_status status ;
245
- };
246
- } reg1 ;
255
+ union ap_queue_status_reg reg1 ;
247
256
unsigned long reg2 = pa_ind ;
248
257
249
- reg1 .qirqctrl = qirqctrl ;
258
+ reg1 .value = qirqctrl . value ;
250
259
251
260
asm volatile (
252
261
" lgr 0,%[reg0]\n" /* qid param into gr0 */
253
262
" lgr 1,%[reg1]\n" /* irq ctrl into gr1 */
254
263
" lgr 2,%[reg2]\n" /* ni addr into gr2 */
255
264
" .insn rre,0xb2af0000,0,0\n" /* PQAP(AQIC) */
256
265
" lgr %[reg1],1\n" /* gr1 (status) into reg1 */
257
- : [reg1 ] "+&d" (reg1 )
266
+ : [reg1 ] "+&d" (reg1 . value )
258
267
: [reg0 ] "d" (reg0 ), [reg2 ] "d" (reg2 )
259
268
: "cc" , "memory" , "0" , "1" , "2" );
260
269
@@ -291,13 +300,7 @@ static inline struct ap_queue_status ap_qact(ap_qid_t qid, int ifbit,
291
300
union ap_qact_ap_info * apinfo )
292
301
{
293
302
unsigned long reg0 = qid | (5UL << 24 ) | ((ifbit & 0x01 ) << 22 );
294
- union {
295
- unsigned long value ;
296
- struct {
297
- u32 _pad ;
298
- struct ap_queue_status status ;
299
- };
300
- } reg1 ;
303
+ union ap_queue_status_reg reg1 ;
301
304
unsigned long reg2 ;
302
305
303
306
reg1 .value = apinfo -> val ;
@@ -308,7 +311,7 @@ static inline struct ap_queue_status ap_qact(ap_qid_t qid, int ifbit,
308
311
" .insn rre,0xb2af0000,0,0\n" /* PQAP(QACT) */
309
312
" lgr %[reg1],1\n" /* gr1 (status) into reg1 */
310
313
" lgr %[reg2],2\n" /* qact out info into reg2 */
311
- : [reg1 ] "+&d" (reg1 ), [reg2 ] "=&d" (reg2 )
314
+ : [reg1 ] "+&d" (reg1 . value ), [reg2 ] "=&d" (reg2 )
312
315
: [reg0 ] "d" (reg0 )
313
316
: "cc" , "0" , "1" , "2" );
314
317
apinfo -> val = reg2 ;
@@ -333,7 +336,7 @@ static inline struct ap_queue_status ap_nqap(ap_qid_t qid,
333
336
{
334
337
unsigned long reg0 = qid | 0x40000000UL ; /* 0x4... is last msg part */
335
338
union register_pair nqap_r1 , nqap_r2 ;
336
- struct ap_queue_status reg1 ;
339
+ union ap_queue_status_reg reg1 ;
337
340
338
341
nqap_r1 .even = (unsigned int )(psmid >> 32 );
339
342
nqap_r1 .odd = psmid & 0xffffffff ;
@@ -345,11 +348,11 @@ static inline struct ap_queue_status ap_nqap(ap_qid_t qid,
345
348
"0: .insn rre,0xb2ad0000,%[nqap_r1],%[nqap_r2]\n"
346
349
" brc 2,0b\n" /* handle partial completion */
347
350
" lgr %[reg1],1\n" /* gr1 (status) into reg1 */
348
- : [reg0 ] "+&d" (reg0 ), [reg1 ] "=&d" (reg1 ),
351
+ : [reg0 ] "+&d" (reg0 ), [reg1 ] "=&d" (reg1 . value ),
349
352
[nqap_r2 ] "+&d" (nqap_r2 .pair )
350
353
: [nqap_r1 ] "d" (nqap_r1 .pair )
351
354
: "cc" , "memory" , "0" , "1" );
352
- return reg1 ;
355
+ return reg1 . status ;
353
356
}
354
357
355
358
/**
@@ -389,7 +392,7 @@ static inline struct ap_queue_status ap_dqap(ap_qid_t qid,
389
392
unsigned long * resgr0 )
390
393
{
391
394
unsigned long reg0 = resgr0 && * resgr0 ? * resgr0 : qid | 0x80000000UL ;
392
- struct ap_queue_status reg1 ;
395
+ union ap_queue_status_reg reg1 ;
393
396
unsigned long reg2 ;
394
397
union register_pair rp1 , rp2 ;
395
398
@@ -408,8 +411,9 @@ static inline struct ap_queue_status ap_dqap(ap_qid_t qid,
408
411
"2: lgr %[reg0],0\n" /* gr0 (qid + info) into reg0 */
409
412
" lgr %[reg1],1\n" /* gr1 (status) into reg1 */
410
413
" lgr %[reg2],2\n" /* gr2 (res length) into reg2 */
411
- : [reg0 ] "+&d" (reg0 ), [reg1 ] "=&d" (reg1 ), [reg2 ] "=&d" (reg2 ),
412
- [rp1 ] "+&d" (rp1 .pair ), [rp2 ] "+&d" (rp2 .pair )
414
+ : [reg0 ] "+&d" (reg0 ), [reg1 ] "=&d" (reg1 .value ),
415
+ [reg2 ] "=&d" (reg2 ), [rp1 ] "+&d" (rp1 .pair ),
416
+ [rp2 ] "+&d" (rp2 .pair )
413
417
:
414
418
: "cc" , "memory" , "0" , "1" , "2" );
415
419
@@ -421,7 +425,7 @@ static inline struct ap_queue_status ap_dqap(ap_qid_t qid,
421
425
* Signal the caller that this dqap is only partially received
422
426
* with a special status response code 0xFF and *resgr0 updated
423
427
*/
424
- reg1 .response_code = 0xFF ;
428
+ reg1 .status . response_code = 0xFF ;
425
429
if (resgr0 )
426
430
* resgr0 = reg0 ;
427
431
} else {
@@ -430,7 +434,7 @@ static inline struct ap_queue_status ap_dqap(ap_qid_t qid,
430
434
* resgr0 = 0 ;
431
435
}
432
436
433
- return reg1 ;
437
+ return reg1 . status ;
434
438
}
435
439
436
440
/*
0 commit comments