2 * Adjunct processor (AP) interfaces
4 * Copyright IBM Corp. 2017
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.
10 * Author(s): Tony Krowiak <akrowia@linux.vnet.ibm.com>
11 * Martin Schwidefsky <schwidefsky@de.ibm.com>
12 * Harald Freudenberger <freude@de.ibm.com>
15 #ifndef _ASM_S390_AP_H_
16 #define _ASM_S390_AP_H_
19 * The ap_qid_t identifier of an ap queue.
20 * If the AP facilities test (APFT) facility is available,
21 * card and queue index are 8 bit values, otherwise
22 * card index is 6 bit and queue index a 4 bit value.
24 typedef unsigned int ap_qid_t
;
26 #define AP_MKQID(_card, _queue) (((_card) & 63) << 8 | ((_queue) & 255))
27 #define AP_QID_CARD(_qid) (((_qid) >> 8) & 63)
28 #define AP_QID_QUEUE(_qid) ((_qid) & 255)
31 * struct ap_queue_status - Holds the AP queue status.
32 * @queue_empty: Shows if queue is empty
33 * @replies_waiting: Waiting replies
34 * @queue_full: Is 1 if the queue is full
35 * @irq_enabled: Shows if interrupts are enabled for the AP
36 * @response_code: Holds the 8 bit response code
38 * The ap queue status word is returned by all three AP functions
39 * (PQAP, NQAP and DQAP). There's a set of flags in the first
40 * byte, followed by a 1 byte response code.
42 struct ap_queue_status
{
43 unsigned int queue_empty
: 1;
44 unsigned int replies_waiting
: 1;
45 unsigned int queue_full
: 1;
46 unsigned int _pad1
: 4;
47 unsigned int irq_enabled
: 1;
48 unsigned int response_code
: 8;
49 unsigned int _pad2
: 16;
53 * ap_test_queue(): Test adjunct processor queue.
54 * @qid: The AP queue number
55 * @tbit: Test facilities bit
56 * @info: Pointer to queue descriptor
58 * Returns AP queue status structure.
60 struct ap_queue_status
ap_test_queue(ap_qid_t qid
,
64 struct ap_config_info
{
65 unsigned int apsc
: 1; /* S bit */
66 unsigned int apxa
: 1; /* N bit */
67 unsigned int qact
: 1; /* C bit */
68 unsigned int rc8a
: 1; /* R bit */
69 unsigned char _reserved1
: 4;
70 unsigned char _reserved2
[3];
71 unsigned char Na
; /* max # of APs - 1 */
72 unsigned char Nd
; /* max # of Domains - 1 */
73 unsigned char _reserved3
[10];
74 unsigned int apm
[8]; /* AP ID mask */
75 unsigned int aqm
[8]; /* AP queue mask */
76 unsigned int adm
[8]; /* AP domain mask */
77 unsigned char _reserved4
[16];
81 * ap_query_configuration(): Fetch cryptographic config info
83 * Returns the ap configuration info fetched via PQAP(QCI).
84 * On success 0 is returned, on failure a negative errno
85 * is returned, e.g. if the PQAP(QCI) instruction is not
86 * available, the return value will be -EOPNOTSUPP.
88 int ap_query_configuration(struct ap_config_info
*info
);
91 * struct ap_qirq_ctrl - convenient struct for easy invocation
92 * of the ap_queue_irq_ctrl() function. This struct is passed
93 * as GR1 parameter to the PQAP(AQIC) instruction. For details
94 * please see the AR documentation.
97 unsigned int _res1
: 8;
98 unsigned int zone
: 8; /* zone info */
99 unsigned int ir
: 1; /* ir flag: enable (1) or disable (0) irq */
100 unsigned int _res2
: 4;
101 unsigned int gisc
: 3; /* guest isc field */
102 unsigned int _res3
: 6;
103 unsigned int gf
: 2; /* gisa format */
104 unsigned int _res4
: 1;
105 unsigned int gisa
: 27; /* gisa origin */
106 unsigned int _res5
: 1;
107 unsigned int isc
: 3; /* irq sub class */
111 * ap_queue_irq_ctrl(): Control interruption on a AP queue.
112 * @qid: The AP queue number
113 * @qirqctrl: struct ap_qirq_ctrl, see above
114 * @ind: The notification indicator byte
116 * Returns AP queue status.
118 * Control interruption on the given AP queue.
119 * Just a simple wrapper function for the low level PQAP(AQIC)
120 * instruction available for other kernel modules.
122 struct ap_queue_status
ap_queue_irq_ctrl(ap_qid_t qid
,
123 struct ap_qirq_ctrl qirqctrl
,
126 #endif /* _ASM_S390_AP_H_ */