aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/uapi
diff options
context:
space:
mode:
authorHarald Freudenberger <freude@linux.vnet.ibm.com>2018-04-09 10:18:37 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2018-04-11 04:36:27 -0400
commitaf4a72276d49da117dbc99799afee740a26f8f10 (patch)
treebf702e269fde807e249f60346abc6b1a685ba419 /arch/s390/include/uapi
parent71cbbff8c4fd1467b59b8c15a06093ac03cd11c7 (diff)
s390/zcrypt: Support up to 256 crypto adapters.
There was an artificial restriction on the card/adapter id to only 6 bits but all the AP commands do support adapter ids with 8 bit. This patch removes this restriction to 64 adapters and now up to 256 adapter can get addressed. Some of the ioctl calls work on the max number of cards possible (which was 64). These ioctls are now deprecated but still supported. All the defines, structs and ioctl interface declarations have been kept for compabibility. There are now new ioctls (and defines for these) with an additional '2' appended which provide the extended versions with 256 cards supported. Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include/uapi')
-rw-r--r--arch/s390/include/uapi/asm/zcrypt.h124
1 files changed, 78 insertions, 46 deletions
diff --git a/arch/s390/include/uapi/asm/zcrypt.h b/arch/s390/include/uapi/asm/zcrypt.h
index 2e061b664b5c..b62e0614e440 100644
--- a/arch/s390/include/uapi/asm/zcrypt.h
+++ b/arch/s390/include/uapi/asm/zcrypt.h
@@ -203,9 +203,9 @@ struct ep11_urb {
203} __attribute__((packed)); 203} __attribute__((packed));
204 204
205/** 205/**
206 * struct zcrypt_device_status 206 * struct zcrypt_device_status_ext
207 * @hwtype: raw hardware type 207 * @hwtype: raw hardware type
208 * @qid: 6 bit device index, 8 bit domain 208 * @qid: 8 bit device index, 8 bit domain
209 * @functions: AP device function bit field 'abcdef' 209 * @functions: AP device function bit field 'abcdef'
210 * a, b, c = reserved 210 * a, b, c = reserved
211 * d = CCA coprocessor 211 * d = CCA coprocessor
@@ -214,28 +214,23 @@ struct ep11_urb {
214 * @online online status 214 * @online online status
215 * @reserved reserved 215 * @reserved reserved
216 */ 216 */
217struct zcrypt_device_status { 217struct zcrypt_device_status_ext {
218 unsigned int hwtype:8; 218 unsigned int hwtype:8;
219 unsigned int qid:14; 219 unsigned int qid:16;
220 unsigned int online:1; 220 unsigned int online:1;
221 unsigned int functions:6; 221 unsigned int functions:6;
222 unsigned int reserved:3; 222 unsigned int reserved:1;
223}; 223};
224 224
225#define MAX_ZDEV_CARDIDS 64 225#define MAX_ZDEV_CARDIDS_EXT 256
226#define MAX_ZDEV_DOMAINS 256 226#define MAX_ZDEV_DOMAINS_EXT 256
227 227
228/** 228/* Maximum number of zcrypt devices */
229 * Maximum number of zcrypt devices 229#define MAX_ZDEV_ENTRIES_EXT (MAX_ZDEV_CARDIDS_EXT * MAX_ZDEV_DOMAINS_EXT)
230 */
231#define MAX_ZDEV_ENTRIES (MAX_ZDEV_CARDIDS * MAX_ZDEV_DOMAINS)
232 230
233/** 231/* Device matrix of all zcrypt devices */
234 * zcrypt_device_matrix 232struct zcrypt_device_matrix_ext {
235 * Device matrix of all zcrypt devices 233 struct zcrypt_device_status_ext device[MAX_ZDEV_ENTRIES_EXT];
236 */
237struct zcrypt_device_matrix {
238 struct zcrypt_device_status device[MAX_ZDEV_ENTRIES];
239}; 234};
240 235
241#define AUTOSELECT ((unsigned int)0xFFFFFFFF) 236#define AUTOSELECT ((unsigned int)0xFFFFFFFF)
@@ -270,39 +265,35 @@ struct zcrypt_device_matrix {
270 * ZSENDEP11CPRB 265 * ZSENDEP11CPRB
271 * Send an arbitrary EP11 CPRB to an EP11 coprocessor crypto card. 266 * Send an arbitrary EP11 CPRB to an EP11 coprocessor crypto card.
272 * 267 *
273 * Z90STAT_STATUS_MASK 268 * ZCRYPT_DEVICE_STATUS
274 * Return an 64 element array of unsigned chars for the status of 269 * The given struct zcrypt_device_matrix_ext is updated with
275 * all devices. 270 * status information for each currently known apqn.
271 *
272 * ZCRYPT_STATUS_MASK
273 * Return an MAX_ZDEV_CARDIDS_EXT element array of unsigned chars for the
274 * status of all devices.
276 * 0x01: PCICA 275 * 0x01: PCICA
277 * 0x02: PCICC 276 * 0x02: PCICC
278 * 0x03: PCIXCC_MCL2 277 * 0x03: PCIXCC_MCL2
279 * 0x04: PCIXCC_MCL3 278 * 0x04: PCIXCC_MCL3
280 * 0x05: CEX2C 279 * 0x05: CEX2C
281 * 0x06: CEX2A 280 * 0x06: CEX2A
282 * 0x0d: device is disabled via the proc filesystem 281 * 0x07: CEX3C
283 * 282 * 0x08: CEX3A
284 * Z90STAT_QDEPTH_MASK 283 * 0x0a: CEX4
285 * Return an 64 element array of unsigned chars for the queue 284 * 0x0b: CEX5
286 * depth of all devices. 285 * 0x0c: CEX6
287 * 286 * 0x0d: device is disabled
288 * Z90STAT_PERDEV_REQCNT
289 * Return an 64 element array of unsigned integers for the number
290 * of successfully completed requests per device since the device
291 * was detected and made available.
292 *
293 * Z90STAT_REQUESTQ_COUNT
294 * Return an integer count of the number of entries waiting to be
295 * sent to a device.
296 * 287 *
297 * Z90STAT_PENDINGQ_COUNT 288 * ZCRYPT_QDEPTH_MASK
298 * Return an integer count of the number of entries sent to all 289 * Return an MAX_ZDEV_CARDIDS_EXT element array of unsigned chars for the
299 * devices awaiting the reply. 290 * queue depth of all devices.
300 * 291 *
301 * Z90STAT_TOTALOPEN_COUNT 292 * ZCRYPT_PERDEV_REQCNT
302 * Return an integer count of the number of open file handles. 293 * Return an MAX_ZDEV_CARDIDS_EXT element array of unsigned integers for
294 * the number of successfully completed requests per device since the
295 * device was detected and made available.
303 * 296 *
304 * Z90STAT_DOMAIN_INDEX
305 * Return the integer value of the Cryptographic Domain.
306 */ 297 */
307 298
308/** 299/**
@@ -312,15 +303,56 @@ struct zcrypt_device_matrix {
312#define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x06, 0) 303#define ICARSACRT _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x06, 0)
313#define ZSECSENDCPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x81, 0) 304#define ZSECSENDCPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x81, 0)
314#define ZSENDEP11CPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x04, 0) 305#define ZSENDEP11CPRB _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x04, 0)
315#define ZDEVICESTATUS _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x4f, 0)
316 306
317/* Status ioctl calls */ 307#define ZCRYPT_DEVICE_STATUS _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x5f, 0)
308#define ZCRYPT_STATUS_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x58, char[MAX_ZDEV_CARDIDS_EXT])
309#define ZCRYPT_QDEPTH_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x59, char[MAX_ZDEV_CARDIDS_EXT])
310#define ZCRYPT_PERDEV_REQCNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x5a, int[MAX_ZDEV_CARDIDS_EXT])
311
312/*
313 * Only deprecated defines, structs and ioctls below this line.
314 */
315
316/* Deprecated: use MAX_ZDEV_CARDIDS_EXT */
317#define MAX_ZDEV_CARDIDS 64
318/* Deprecated: use MAX_ZDEV_DOMAINS_EXT */
319#define MAX_ZDEV_DOMAINS 256
320
321/* Deprecated: use MAX_ZDEV_ENTRIES_EXT */
322#define MAX_ZDEV_ENTRIES (MAX_ZDEV_CARDIDS * MAX_ZDEV_DOMAINS)
323
324/* Deprecated: use struct zcrypt_device_status_ext */
325struct zcrypt_device_status {
326 unsigned int hwtype:8;
327 unsigned int qid:14;
328 unsigned int online:1;
329 unsigned int functions:6;
330 unsigned int reserved:3;
331};
332
333/* Deprecated: use struct zcrypt_device_matrix_ext */
334struct zcrypt_device_matrix {
335 struct zcrypt_device_status device[MAX_ZDEV_ENTRIES];
336};
337
338/* Deprecated: use ZCRYPT_DEVICE_STATUS */
339#define ZDEVICESTATUS _IOC(_IOC_READ|_IOC_WRITE, ZCRYPT_IOCTL_MAGIC, 0x4f, 0)
340/* Deprecated: use ZCRYPT_STATUS_MASK */
341#define Z90STAT_STATUS_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x48, char[64])
342/* Deprecated: use ZCRYPT_QDEPTH_MASK */
343#define Z90STAT_QDEPTH_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x49, char[64])
344/* Deprecated: use ZCRYPT_PERDEV_REQCNT */
345#define Z90STAT_PERDEV_REQCNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4a, int[64])
346
347/* Deprecated: use sysfs to query these values */
318#define Z90STAT_REQUESTQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x44, int) 348#define Z90STAT_REQUESTQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x44, int)
319#define Z90STAT_PENDINGQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x45, int) 349#define Z90STAT_PENDINGQ_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x45, int)
320#define Z90STAT_TOTALOPEN_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x46, int) 350#define Z90STAT_TOTALOPEN_COUNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x46, int)
321#define Z90STAT_DOMAIN_INDEX _IOR(ZCRYPT_IOCTL_MAGIC, 0x47, int) 351#define Z90STAT_DOMAIN_INDEX _IOR(ZCRYPT_IOCTL_MAGIC, 0x47, int)
322#define Z90STAT_STATUS_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x48, char[64]) 352
323#define Z90STAT_QDEPTH_MASK _IOR(ZCRYPT_IOCTL_MAGIC, 0x49, char[64]) 353/*
324#define Z90STAT_PERDEV_REQCNT _IOR(ZCRYPT_IOCTL_MAGIC, 0x4a, int[64]) 354 * The ioctl number ranges 0x40 - 0x42 and 0x4b - 0x4e had been used in the
355 * past, don't assign new ioctls for these.
356 */
325 357
326#endif /* __ASM_S390_ZCRYPT_H */ 358#endif /* __ASM_S390_ZCRYPT_H */