Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/zcrypt: Rework debug feature invocations.

Rework the debug feature calls and initialization. There
are now two debug feature entries used by the zcrypt code.
The first is 'ap' with all the AP bus related stuff and the
second is 'zcrypt' with all the zcrypt and devices and
driver related entries. However, there isn't much traffic on
both debug features. The ap bus code emits only some debug
info and for zcrypt devices on appearance and disappearance
there is an entry written.

The new dbf invocations use the sprintf buffer layout,
whereas the old implementation used the ascii dbf buffer.
There are now 5*8=40 bytes used for each entry, resulting in
5 parameters per call. As the sprintf buffer needs a format
string the first parameter provides this and so up to 4 more
parameters can be used. Alltogehter the new layout should be
much more human readable for customers and test.

Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Harald Freudenberger and committed by
Martin Schwidefsky
cccd85bf bf9f3119

+188 -141
+40
drivers/s390/crypto/ap_bus.c
··· 47 47 #include <asm/facility.h> 48 48 #include <linux/crypto.h> 49 49 #include <linux/mod_devicetable.h> 50 + #include <linux/debugfs.h> 50 51 51 52 #include "ap_bus.h" 52 53 #include "ap_asm.h" 54 + #include "ap_debug.h" 53 55 54 56 /* 55 57 * Module description. ··· 82 80 83 81 static struct ap_config_info *ap_configuration; 84 82 static bool initialised; 83 + 84 + /* 85 + * AP bus related debug feature things. 86 + */ 87 + static struct dentry *ap_dbf_root; 88 + debug_info_t *ap_dbf_info; 85 89 86 90 /* 87 91 * Workqueue timer for bus rescan. ··· 576 568 577 569 static void ap_bus_suspend(void) 578 570 { 571 + AP_DBF(DBF_DEBUG, "ap_bus_suspend running\n"); 572 + 579 573 ap_suspend_flag = 1; 580 574 /* 581 575 * Disable scanning for devices, thus we do not want to scan ··· 612 602 static void ap_bus_resume(void) 613 603 { 614 604 int rc; 605 + 606 + AP_DBF(DBF_DEBUG, "ap_bus_resume running\n"); 615 607 616 608 /* remove all queue devices */ 617 609 bus_for_each_dev(&ap_bus_type, NULL, NULL, ··· 754 742 spin_lock_bh(&ap_domain_lock); 755 743 ap_domain_index = domain; 756 744 spin_unlock_bh(&ap_domain_lock); 745 + 746 + AP_DBF(DBF_DEBUG, "store new default domain=%d\n", domain); 747 + 757 748 return count; 758 749 } 759 750 ··· 979 964 unsigned int functions = 0; 980 965 int rc, id, dom, borked, domains; 981 966 967 + AP_DBF(DBF_DEBUG, "ap_scan_bus running\n"); 968 + 982 969 ap_query_configuration(); 983 970 if (ap_select_domain() != 0) 984 971 goto out; ··· 1146 1129 .fn = ap_reset_all, 1147 1130 }; 1148 1131 1132 + int __init ap_debug_init(void) 1133 + { 1134 + ap_dbf_root = debugfs_create_dir("ap", NULL); 1135 + ap_dbf_info = debug_register("ap", 1, 1, 1136 + DBF_MAX_SPRINTF_ARGS * sizeof(long)); 1137 + debug_register_view(ap_dbf_info, &debug_sprintf_view); 1138 + debug_set_level(ap_dbf_info, DBF_ERR); 1139 + 1140 + return 0; 1141 + } 1142 + 1143 + void ap_debug_exit(void) 1144 + { 1145 + debugfs_remove(ap_dbf_root); 1146 + debug_unregister(ap_dbf_info); 1147 + } 1148 + 1149 1149 /** 1150 1150 * ap_module_init(): The module initialization code. 1151 1151 * ··· 1172 1138 { 1173 1139 int max_domain_id; 1174 1140 int rc, i; 1141 + 1142 + rc = ap_debug_init(); 1143 + if (rc) 1144 + return rc; 1175 1145 1176 1146 if (ap_instructions_available() != 0) { 1177 1147 pr_warn("The hardware system does not support AP instructions\n"); ··· 1304 1266 unregister_reset_call(&ap_reset_call); 1305 1267 if (ap_using_interrupts()) 1306 1268 unregister_adapter_interrupt(&ap_airq); 1269 + 1270 + ap_debug_exit(); 1307 1271 } 1308 1272 1309 1273 module_init(ap_module_init);
+28
drivers/s390/crypto/ap_debug.h
··· 1 + /* 2 + * Copyright IBM Corp. 2016 3 + * Author(s): Harald Freudenberger <freude@de.ibm.com> 4 + */ 5 + #ifndef AP_DEBUG_H 6 + #define AP_DEBUG_H 7 + 8 + #include <asm/debug.h> 9 + 10 + #define DBF_ERR 3 /* error conditions */ 11 + #define DBF_WARN 4 /* warning conditions */ 12 + #define DBF_INFO 5 /* informational */ 13 + #define DBF_DEBUG 6 /* for debugging only */ 14 + 15 + #define RC2ERR(rc) ((rc) ? DBF_ERR : DBF_INFO) 16 + #define RC2WARN(rc) ((rc) ? DBF_WARN : DBF_INFO) 17 + 18 + #define DBF_MAX_SPRINTF_ARGS 5 19 + 20 + #define AP_DBF(...) \ 21 + debug_sprintf_event(ap_dbf_info, ##__VA_ARGS__) 22 + 23 + extern debug_info_t *ap_dbf_info; 24 + 25 + int ap_debug_init(void); 26 + void ap_debug_exit(void); 27 + 28 + #endif /* AP_DEBUG_H */
+14 -24
drivers/s390/crypto/zcrypt_api.c
··· 41 41 #include <linux/debugfs.h> 42 42 #include <asm/debug.h> 43 43 44 - #include "zcrypt_debug.h" 45 44 #include "zcrypt_api.h" 45 + #include "zcrypt_debug.h" 46 46 47 47 #include "zcrypt_msgtype6.h" 48 48 #include "zcrypt_msgtype50.h" ··· 71 71 72 72 static LIST_HEAD(zcrypt_ops_list); 73 73 74 - static struct dentry *debugfs_root; 75 - debug_info_t *zcrypt_dbf_common; 76 - debug_info_t *zcrypt_dbf_devices; 77 - debug_info_t *zcrypt_dbf_cards; 74 + /* Zcrypt related debug feature stuff. */ 75 + static struct dentry *zcrypt_dbf_root; 76 + debug_info_t *zcrypt_dbf_info; 78 77 79 78 /** 80 79 * Process a rescan of the transport layer. ··· 86 87 atomic_set(&zcrypt_rescan_req, 0); 87 88 atomic_inc(&zcrypt_rescan_count); 88 89 ap_bus_force_rescan(); 89 - ZCRYPT_DBF_COMMON(DBF_INFO, "rescan%07d", 90 - atomic_inc_return(&zcrypt_rescan_count)); 90 + ZCRYPT_DBF(DBF_INFO, "rescan count=%07d", 91 + atomic_inc_return(&zcrypt_rescan_count)); 91 92 return 1; 92 93 } 93 94 return 0; ··· 1362 1363 1363 1364 int __init zcrypt_debug_init(void) 1364 1365 { 1365 - debugfs_root = debugfs_create_dir("zcrypt", NULL); 1366 - 1367 - zcrypt_dbf_common = debug_register("zcrypt_common", 1, 1, 16); 1368 - debug_register_view(zcrypt_dbf_common, &debug_hex_ascii_view); 1369 - debug_set_level(zcrypt_dbf_common, DBF_ERR); 1370 - 1371 - zcrypt_dbf_devices = debug_register("zcrypt_devices", 1, 1, 16); 1372 - debug_register_view(zcrypt_dbf_devices, &debug_hex_ascii_view); 1373 - debug_set_level(zcrypt_dbf_devices, DBF_ERR); 1374 - 1375 - zcrypt_dbf_cards = debug_register("zcrypt_cards", 1, 1, 16); 1376 - debug_register_view(zcrypt_dbf_cards, &debug_hex_ascii_view); 1377 - debug_set_level(zcrypt_dbf_cards, DBF_ERR); 1366 + zcrypt_dbf_root = debugfs_create_dir("zcrypt", NULL); 1367 + zcrypt_dbf_info = debug_register("zcrypt", 1, 1, 1368 + DBF_MAX_SPRINTF_ARGS * sizeof(long)); 1369 + debug_register_view(zcrypt_dbf_info, &debug_sprintf_view); 1370 + debug_set_level(zcrypt_dbf_info, DBF_ERR); 1378 1371 1379 1372 return 0; 1380 1373 } 1381 1374 1382 1375 void zcrypt_debug_exit(void) 1383 1376 { 1384 - debugfs_remove(debugfs_root); 1385 - debug_unregister(zcrypt_dbf_common); 1386 - debug_unregister(zcrypt_dbf_devices); 1377 + debugfs_remove(zcrypt_dbf_root); 1378 + debug_unregister(zcrypt_dbf_info); 1387 1379 } 1388 1380 1389 1381 /** ··· 1424 1434 { 1425 1435 remove_proc_entry("driver/z90crypt", NULL); 1426 1436 misc_deregister(&zcrypt_misc_device); 1427 - zcrypt_debug_exit(); 1428 1437 zcrypt_msgtype6_exit(); 1429 1438 zcrypt_msgtype50_exit(); 1439 + zcrypt_debug_exit(); 1430 1440 } 1431 1441 1432 1442 module_init(zcrypt_api_init);
-8
drivers/s390/crypto/zcrypt_api.h
··· 132 132 atomic_t load; /* Utilization of the crypto device */ 133 133 134 134 int request_count; /* # current requests. */ 135 - 136 - debug_info_t *dbf_area; /* debugging */ 137 135 }; 138 136 139 137 struct zcrypt_queue { ··· 147 149 int request_count; /* # current requests. */ 148 150 149 151 struct ap_message reply; /* Per-device reply structure. */ 150 - 151 - debug_info_t *dbf_area; /* debugging */ 152 152 }; 153 153 154 154 /* transport layer rescanning */ ··· 155 159 extern spinlock_t zcrypt_list_lock; 156 160 extern int zcrypt_device_count; 157 161 extern struct list_head zcrypt_card_list; 158 - 159 - extern debug_info_t *zcrypt_dbf_common; 160 - extern debug_info_t *zcrypt_dbf_devices; 161 - extern debug_info_t *zcrypt_dbf_cards; 162 162 163 163 #define for_each_zcrypt_card(_zc) \ 164 164 list_for_each_entry(_zc, &zcrypt_card_list, list)
+8 -2
drivers/s390/crypto/zcrypt_card.c
··· 79 79 80 80 zc->online = online; 81 81 id = zc->card->id; 82 - ZCRYPT_DBF_DEV(DBF_INFO, zc, "card%02xo%dman", id, online); 82 + 83 + ZCRYPT_DBF(DBF_INFO, "card=%02x online=%d\n", id, online); 84 + 83 85 spin_lock(&zcrypt_list_lock); 84 86 list_for_each_entry(zq, &zc->zqueues, list) 85 87 zcrypt_queue_force_online(zq, online); ··· 111 109 return NULL; 112 110 INIT_LIST_HEAD(&zc->list); 113 111 INIT_LIST_HEAD(&zc->zqueues); 114 - zc->dbf_area = zcrypt_dbf_cards; 115 112 kref_init(&zc->refcount); 116 113 return zc; 117 114 } ··· 161 160 spin_unlock(&zcrypt_list_lock); 162 161 163 162 zc->online = 1; 163 + 164 + ZCRYPT_DBF(DBF_INFO, "card=%02x register online=1\n", zc->card->id); 165 + 164 166 return rc; 165 167 } 166 168 EXPORT_SYMBOL(zcrypt_card_register); ··· 176 172 */ 177 173 void zcrypt_card_unregister(struct zcrypt_card *zc) 178 174 { 175 + ZCRYPT_DBF(DBF_INFO, "card=%02x unregister\n", zc->card->id); 176 + 179 177 spin_lock(&zcrypt_list_lock); 180 178 list_del_init(&zc->list); 181 179 spin_unlock(&zcrypt_list_lock);
+11 -35
drivers/s390/crypto/zcrypt_debug.h
··· 1 1 /* 2 - * Copyright IBM Corp. 2012 2 + * Copyright IBM Corp. 2016 3 3 * Author(s): Holger Dengler (hd@linux.vnet.ibm.com) 4 + * Harald Freudenberger <freude@de.ibm.com> 4 5 */ 5 6 #ifndef ZCRYPT_DEBUG_H 6 7 #define ZCRYPT_DEBUG_H 7 8 8 9 #include <asm/debug.h> 9 - #include "zcrypt_api.h" 10 10 11 - /* that gives us 15 characters in the text event views */ 12 - #define ZCRYPT_DBF_LEN 16 11 + #define DBF_ERR 3 /* error conditions */ 12 + #define DBF_WARN 4 /* warning conditions */ 13 + #define DBF_INFO 5 /* informational */ 14 + #define DBF_DEBUG 6 /* for debugging only */ 13 15 14 - #define DBF_ERR 3 /* error conditions */ 15 - #define DBF_WARN 4 /* warning conditions */ 16 - #define DBF_INFO 6 /* informational */ 17 - 16 + #define RC2ERR(rc) ((rc) ? DBF_ERR : DBF_INFO) 18 17 #define RC2WARN(rc) ((rc) ? DBF_WARN : DBF_INFO) 19 18 20 - #define ZCRYPT_DBF_COMMON(level, text...) \ 21 - do { \ 22 - if (debug_level_enabled(zcrypt_dbf_common, level)) { \ 23 - char debug_buffer[ZCRYPT_DBF_LEN]; \ 24 - snprintf(debug_buffer, ZCRYPT_DBF_LEN, text); \ 25 - debug_text_event(zcrypt_dbf_common, level, \ 26 - debug_buffer); \ 27 - } \ 28 - } while (0) 19 + #define DBF_MAX_SPRINTF_ARGS 5 29 20 30 - #define ZCRYPT_DBF_DEVICES(level, text...) \ 31 - do { \ 32 - if (debug_level_enabled(zcrypt_dbf_devices, level)) { \ 33 - char debug_buffer[ZCRYPT_DBF_LEN]; \ 34 - snprintf(debug_buffer, ZCRYPT_DBF_LEN, text); \ 35 - debug_text_event(zcrypt_dbf_devices, level, \ 36 - debug_buffer); \ 37 - } \ 38 - } while (0) 21 + #define ZCRYPT_DBF(...) \ 22 + debug_sprintf_event(zcrypt_dbf_info, ##__VA_ARGS__) 39 23 40 - #define ZCRYPT_DBF_DEV(level, device, text...) \ 41 - do { \ 42 - if (debug_level_enabled(device->dbf_area, level)) { \ 43 - char debug_buffer[ZCRYPT_DBF_LEN]; \ 44 - snprintf(debug_buffer, ZCRYPT_DBF_LEN, text); \ 45 - debug_text_event(device->dbf_area, level, \ 46 - debug_buffer); \ 47 - } \ 48 - } while (0) 24 + extern debug_info_t *zcrypt_dbf_info; 49 25 50 26 int zcrypt_debug_init(void); 51 27 void zcrypt_debug_exit(void);
+17 -18
drivers/s390/crypto/zcrypt_error.h
··· 93 93 struct ap_message *reply) 94 94 { 95 95 struct error_hdr *ehdr = reply->message; 96 + int card = AP_QID_CARD(zq->queue->qid); 97 + int queue = AP_QID_QUEUE(zq->queue->qid); 96 98 97 99 switch (ehdr->reply_code) { 98 100 case REP82_ERROR_OPERAND_INVALID: ··· 107 105 // REP88_ERROR_OPERAND // '84' CEX2A 108 106 // REP88_ERROR_OPERAND_EVEN_MOD // '85' CEX2A 109 107 /* Invalid input data. */ 108 + ZCRYPT_DBF(DBF_WARN, 109 + "device=%02x.%04x reply=0x%02x => rc=EINVAL\n", 110 + card, queue, ehdr->reply_code); 110 111 return -EINVAL; 111 112 case REP82_ERROR_MESSAGE_TYPE: 112 113 // REP88_ERROR_MESSAGE_TYPE // '20' CEX2A ··· 121 116 atomic_set(&zcrypt_rescan_req, 1); 122 117 zq->online = 0; 123 118 pr_err("Cryptographic device %02x.%04x failed and was set offline\n", 124 - AP_QID_CARD(zq->queue->qid), 125 - AP_QID_QUEUE(zq->queue->qid)); 126 - ZCRYPT_DBF_DEV(DBF_ERR, zq, "dev%02x%04xo%drc%d", 127 - AP_QID_CARD(zq->queue->qid), 128 - AP_QID_QUEUE(zq->queue->qid), zq->online, 129 - ehdr->reply_code); 119 + card, queue); 120 + ZCRYPT_DBF(DBF_ERR, 121 + "device=%02x.%04x reply=0x%02x => online=0 rc=EAGAIN\n", 122 + card, queue, ehdr->reply_code); 130 123 return -EAGAIN; 131 124 case REP82_ERROR_TRANSPORT_FAIL: 132 125 case REP82_ERROR_MACHINE_FAILURE: ··· 133 130 atomic_set(&zcrypt_rescan_req, 1); 134 131 zq->online = 0; 135 132 pr_err("Cryptographic device %02x.%04x failed and was set offline\n", 136 - AP_QID_CARD(zq->queue->qid), 137 - AP_QID_QUEUE(zq->queue->qid)); 138 - ZCRYPT_DBF_DEV(DBF_ERR, zq, "dev%02x%04xo%drc%d", 139 - AP_QID_CARD(zq->queue->qid), 140 - AP_QID_QUEUE(zq->queue->qid), zq->online, 141 - ehdr->reply_code); 133 + card, queue); 134 + ZCRYPT_DBF(DBF_ERR, 135 + "device=%02x.%04x reply=0x%02x => online=0 rc=EAGAIN\n", 136 + card, queue, ehdr->reply_code); 142 137 return -EAGAIN; 143 138 default: 144 139 zq->online = 0; 145 140 pr_err("Cryptographic device %02x.%04x failed and was set offline\n", 146 - AP_QID_CARD(zq->queue->qid), 147 - AP_QID_QUEUE(zq->queue->qid)); 148 - ZCRYPT_DBF_DEV(DBF_ERR, zq, "dev%02x%04xo%drc%d", 149 - AP_QID_CARD(zq->queue->qid), 150 - AP_QID_QUEUE(zq->queue->qid), zq->online, 151 - ehdr->reply_code); 141 + card, queue); 142 + ZCRYPT_DBF(DBF_ERR, 143 + "device=%02x.%04x reply=0x%02x => online=0 rc=EAGAIN\n", 144 + card, queue, ehdr->reply_code); 152 145 return -EAGAIN; /* repeat the request on a different device. */ 153 146 } 154 147 }
+13 -10
drivers/s390/crypto/zcrypt_msgtype50.c
··· 367 367 pr_err("Cryptographic device %02x.%04x failed and was set offline\n", 368 368 AP_QID_CARD(zq->queue->qid), 369 369 AP_QID_QUEUE(zq->queue->qid)); 370 - ZCRYPT_DBF_DEV(DBF_ERR, zq, "dev%02x%04xo%drc%d", 371 - AP_QID_CARD(zq->queue->qid), 372 - AP_QID_QUEUE(zq->queue->qid), 373 - zq->online, t80h->code); 374 - 370 + ZCRYPT_DBF(DBF_ERR, 371 + "device=%02x.%04x code=0x%02x => online=0 rc=EAGAIN\n", 372 + AP_QID_CARD(zq->queue->qid), 373 + AP_QID_QUEUE(zq->queue->qid), 374 + t80h->code); 375 375 return -EAGAIN; /* repeat the request on a different device. */ 376 376 } 377 377 if (zq->zcard->user_space_type == ZCRYPT_CEX2A) ··· 390 390 unsigned int outputdatalength) 391 391 { 392 392 /* Response type byte is the second byte in the response. */ 393 - switch (((unsigned char *) reply->message)[1]) { 393 + unsigned char rtype = ((unsigned char *) reply->message)[1]; 394 + 395 + switch (rtype) { 394 396 case TYPE82_RSP_CODE: 395 397 case TYPE88_RSP_CODE: 396 398 return convert_error(zq, reply); ··· 404 402 pr_err("Cryptographic device %02x.%04x failed and was set offline\n", 405 403 AP_QID_CARD(zq->queue->qid), 406 404 AP_QID_QUEUE(zq->queue->qid)); 407 - ZCRYPT_DBF_DEV(DBF_ERR, zq, "dev%02x%04xo%dfail", 408 - AP_QID_CARD(zq->queue->qid), 409 - AP_QID_QUEUE(zq->queue->qid), 410 - zq->online); 405 + ZCRYPT_DBF(DBF_ERR, 406 + "device=%02x.%04x rtype=0x%02x => online=0 rc=EAGAIN\n", 407 + AP_QID_CARD(zq->queue->qid), 408 + AP_QID_QUEUE(zq->queue->qid), 409 + (unsigned int) rtype); 411 410 return -EAGAIN; /* repeat the request on a different device. */ 412 411 } 413 412 }
+44 -36
drivers/s390/crypto/zcrypt_msgtype6.c
··· 638 638 service_rc = msg->cprbx.ccp_rtcode; 639 639 if (unlikely(service_rc != 0)) { 640 640 service_rs = msg->cprbx.ccp_rscode; 641 - if (service_rc == 8 && service_rs == 66) 641 + if ((service_rc == 8 && service_rs == 66) || 642 + (service_rc == 8 && service_rs == 65) || 643 + (service_rc == 8 && service_rs == 72) || 644 + (service_rc == 8 && service_rs == 770) || 645 + (service_rc == 12 && service_rs == 769)) { 646 + ZCRYPT_DBF(DBF_DEBUG, 647 + "device=%02x.%04x rc/rs=%d/%d => rc=EINVAL\n", 648 + AP_QID_CARD(zq->queue->qid), 649 + AP_QID_QUEUE(zq->queue->qid), 650 + (int) service_rc, (int) service_rs); 642 651 return -EINVAL; 643 - if (service_rc == 8 && service_rs == 65) 644 - return -EINVAL; 645 - if (service_rc == 8 && service_rs == 770) 646 - return -EINVAL; 652 + } 647 653 if (service_rc == 8 && service_rs == 783) { 648 654 zq->zcard->min_mod_size = 649 655 PCIXCC_MIN_MOD_SIZE_OLD; 656 + ZCRYPT_DBF(DBF_DEBUG, 657 + "device=%02x.%04x rc/rs=%d/%d => rc=EAGAIN\n", 658 + AP_QID_CARD(zq->queue->qid), 659 + AP_QID_QUEUE(zq->queue->qid), 660 + (int) service_rc, (int) service_rs); 650 661 return -EAGAIN; 651 662 } 652 - if (service_rc == 12 && service_rs == 769) 653 - return -EINVAL; 654 - if (service_rc == 8 && service_rs == 72) 655 - return -EINVAL; 656 663 zq->online = 0; 657 664 pr_err("Cryptographic device %02x.%04x failed and was set offline\n", 658 665 AP_QID_CARD(zq->queue->qid), 659 666 AP_QID_QUEUE(zq->queue->qid)); 660 - ZCRYPT_DBF_DEV(DBF_ERR, zq, "dev%02x%04xo%drc%d", 661 - AP_QID_CARD(zq->queue->qid), 662 - AP_QID_QUEUE(zq->queue->qid), 663 - zq->online, 664 - msg->hdr.reply_code); 667 + ZCRYPT_DBF(DBF_ERR, 668 + "device=%02x.%04x rc/rs=%d/%d => online=0 rc=EAGAIN\n", 669 + AP_QID_CARD(zq->queue->qid), 670 + AP_QID_QUEUE(zq->queue->qid), 671 + (int) service_rc, (int) service_rs); 665 672 return -EAGAIN; /* repeat the request on a different device. */ 666 673 } 667 674 data = msg->text; ··· 783 776 { 784 777 struct type86x_reply *msg = reply->message; 785 778 786 - /* Response type byte is the second byte in the response. */ 787 - switch (((unsigned char *) reply->message)[1]) { 779 + switch (msg->hdr.type) { 788 780 case TYPE82_RSP_CODE: 789 781 case TYPE88_RSP_CODE: 790 782 return convert_error(zq, reply); ··· 809 803 pr_err("Cryptographic device %02x.%04x failed and was set offline\n", 810 804 AP_QID_CARD(zq->queue->qid), 811 805 AP_QID_QUEUE(zq->queue->qid)); 812 - ZCRYPT_DBF_DEV(DBF_ERR, zq, "dev%02x%04xo%dfail", 813 - AP_QID_CARD(zq->queue->qid), 814 - AP_QID_QUEUE(zq->queue->qid), 815 - zq->online); 806 + ZCRYPT_DBF(DBF_ERR, 807 + "device=%02x.%04x rtype=0x%02x => online=0 rc=EAGAIN\n", 808 + AP_QID_CARD(zq->queue->qid), 809 + AP_QID_QUEUE(zq->queue->qid), 810 + (int) msg->hdr.type); 816 811 return -EAGAIN; /* repeat the request on a different device. */ 817 812 } 818 813 } ··· 824 817 { 825 818 struct type86x_reply *msg = reply->message; 826 819 827 - /* Response type byte is the second byte in the response. */ 828 - switch (((unsigned char *) reply->message)[1]) { 820 + switch (msg->hdr.type) { 829 821 case TYPE82_RSP_CODE: 830 822 case TYPE88_RSP_CODE: 831 823 xcRB->status = 0x0008044DL; /* HDD_InvalidParm */ ··· 844 838 pr_err("Cryptographic device %02x.%04x failed and was set offline\n", 845 839 AP_QID_CARD(zq->queue->qid), 846 840 AP_QID_QUEUE(zq->queue->qid)); 847 - ZCRYPT_DBF_DEV(DBF_ERR, zq, "dev%02x%04xo%dfail", 848 - AP_QID_CARD(zq->queue->qid), 849 - AP_QID_QUEUE(zq->queue->qid), 850 - zq->online); 841 + ZCRYPT_DBF(DBF_ERR, 842 + "device=%02x.%04x rtype=0x%02x => online=0 rc=EAGAIN\n", 843 + AP_QID_CARD(zq->queue->qid), 844 + AP_QID_QUEUE(zq->queue->qid), 845 + (int) msg->hdr.type); 851 846 return -EAGAIN; /* repeat the request on a different device. */ 852 847 } 853 848 } ··· 858 851 { 859 852 struct type86_ep11_reply *msg = reply->message; 860 853 861 - /* Response type byte is the second byte in the response. */ 862 - switch (((unsigned char *)reply->message)[1]) { 854 + switch (msg->hdr.type) { 863 855 case TYPE82_RSP_CODE: 864 856 case TYPE87_RSP_CODE: 865 857 return convert_error(zq, reply); ··· 873 867 pr_err("Cryptographic device %02x.%04x failed and was set offline\n", 874 868 AP_QID_CARD(zq->queue->qid), 875 869 AP_QID_QUEUE(zq->queue->qid)); 876 - ZCRYPT_DBF_DEV(DBF_ERR, zq, "dev%02x%04xo%dfail", 877 - AP_QID_CARD(zq->queue->qid), 878 - AP_QID_QUEUE(zq->queue->qid), 879 - zq->online); 870 + ZCRYPT_DBF(DBF_ERR, 871 + "device=%02x.%04x rtype=0x%02x => online=0 rc=EAGAIN\n", 872 + AP_QID_CARD(zq->queue->qid), 873 + AP_QID_QUEUE(zq->queue->qid), 874 + (int) msg->hdr.type); 880 875 return -EAGAIN; /* repeat the request on a different device. */ 881 876 } 882 877 } ··· 904 897 pr_err("Cryptographic device %02x.%04x failed and was set offline\n", 905 898 AP_QID_CARD(zq->queue->qid), 906 899 AP_QID_QUEUE(zq->queue->qid)); 907 - ZCRYPT_DBF_DEV(DBF_ERR, zq, "dev%02x%04xo%dfail", 908 - AP_QID_CARD(zq->queue->qid), 909 - AP_QID_QUEUE(zq->queue->qid), 910 - zq->online); 900 + ZCRYPT_DBF(DBF_ERR, 901 + "device=%02x.%04x rtype=0x%02x => online=0 rc=EAGAIN\n", 902 + AP_QID_CARD(zq->queue->qid), 903 + AP_QID_QUEUE(zq->queue->qid), 904 + (int) msg->hdr.type); 911 905 return -EAGAIN; /* repeat the request on a different device. */ 912 906 } 913 907 }
+13 -8
drivers/s390/crypto/zcrypt_queue.c
··· 70 70 if (online && !zc->online) 71 71 return -EINVAL; 72 72 zq->online = online; 73 - ZCRYPT_DBF_DEV(DBF_INFO, zq, "dev%02x%04xo%dman", 74 - AP_QID_CARD(zq->queue->qid), 75 - AP_QID_QUEUE(zq->queue->qid), online); 73 + 74 + ZCRYPT_DBF(DBF_INFO, "queue=%02x.%04x online=%d\n", 75 + AP_QID_CARD(zq->queue->qid), 76 + AP_QID_QUEUE(zq->queue->qid), 77 + online); 78 + 76 79 if (!online) 77 80 ap_flush_queue(zq->queue); 78 81 return count; ··· 112 109 goto out_free; 113 110 zq->reply.length = max_response_size; 114 111 INIT_LIST_HEAD(&zq->list); 115 - zq->dbf_area = zcrypt_dbf_devices; 116 112 kref_init(&zq->refcount); 117 113 return zq; 118 114 ··· 163 161 zcrypt_card_get(zc); 164 162 zq->zcard = zc; 165 163 zq->online = 1; /* New devices are online by default. */ 166 - ZCRYPT_DBF_DEV(DBF_INFO, zq, "dev%02x%04xo%dreg", 167 - AP_QID_CARD(zq->queue->qid), 168 - AP_QID_QUEUE(zq->queue->qid), 169 - zq->online); 164 + 165 + ZCRYPT_DBF(DBF_INFO, "queue=%02x.%04x register online=1\n", 166 + AP_QID_CARD(zq->queue->qid), AP_QID_QUEUE(zq->queue->qid)); 167 + 170 168 list_add_tail(&zq->list, &zc->zqueues); 171 169 zcrypt_device_count++; 172 170 spin_unlock(&zcrypt_list_lock); ··· 206 204 void zcrypt_queue_unregister(struct zcrypt_queue *zq) 207 205 { 208 206 struct zcrypt_card *zc; 207 + 208 + ZCRYPT_DBF(DBF_INFO, "queue=%02x.%04x unregister\n", 209 + AP_QID_CARD(zq->queue->qid), AP_QID_QUEUE(zq->queue->qid)); 209 210 210 211 zc = zq->zcard; 211 212 spin_lock(&zcrypt_list_lock);