]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
s390/zcrypt: add debug possibility for CCA and EP11 messages
authorHarald Freudenberger <freude@linux.ibm.com>
Fri, 9 Feb 2024 15:20:21 +0000 (16:20 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Fri, 16 Feb 2024 13:30:13 +0000 (14:30 +0100)
This patch introduces dynamic debug hexdump invocation
possibilities to be able to:
- dump an CCA or EP11 CPRB request as early as possible
  when received via ioctl from userspace but after the
  ap message has been collected together.
- dump an CCA or EP11 CPRB reply short before it is
  transferred via ioctl into userspace.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
drivers/s390/crypto/zcrypt_api.c

index 00e7e05a289c696ffef9ea41f1237e26bf9e010e..e8742757085b21c2af7d0c34f1173f3d06adbde6 100644 (file)
@@ -866,6 +866,8 @@ static long _zcrypt_send_cprb(bool userspace, struct ap_perms *perms,
        rc = prep_cca_ap_msg(userspace, xcrb, &ap_msg, &func_code, &domain);
        if (rc)
                goto out;
+       print_hex_dump_debug("ccareq: ", DUMP_PREFIX_ADDRESS, 16, 1,
+                            ap_msg.msg, ap_msg.len, false);
 
        tdom = *domain;
        if (perms != &ap_perms && tdom < AP_DOMAINS) {
@@ -953,6 +955,10 @@ static long _zcrypt_send_cprb(bool userspace, struct ap_perms *perms,
                *domain = AP_QID_QUEUE(qid);
 
        rc = pref_zq->ops->send_cprb(userspace, pref_zq, xcrb, &ap_msg);
+       if (!rc) {
+               print_hex_dump_debug("ccarpl: ", DUMP_PREFIX_ADDRESS, 16, 1,
+                                    ap_msg.msg, ap_msg.len, false);
+       }
 
        spin_lock(&zcrypt_list_lock);
        zcrypt_drop_queue(pref_zc, pref_zq, mod, wgt);
@@ -1046,6 +1052,8 @@ static long _zcrypt_send_ep11_cprb(bool userspace, struct ap_perms *perms,
        rc = prep_ep11_ap_msg(userspace, xcrb, &ap_msg, &func_code, &domain);
        if (rc)
                goto out_free;
+       print_hex_dump_debug("ep11req: ", DUMP_PREFIX_ADDRESS, 16, 1,
+                            ap_msg.msg, ap_msg.len, false);
 
        if (perms != &ap_perms && domain < AUTOSEL_DOM) {
                if (ap_msg.flags & AP_MSG_FLAG_ADMIN) {
@@ -1130,6 +1138,10 @@ static long _zcrypt_send_ep11_cprb(bool userspace, struct ap_perms *perms,
 
        qid = pref_zq->queue->qid;
        rc = pref_zq->ops->send_ep11_cprb(userspace, pref_zq, xcrb, &ap_msg);
+       if (!rc) {
+               print_hex_dump_debug("ep11rpl: ", DUMP_PREFIX_ADDRESS, 16, 1,
+                                    ap_msg.msg, ap_msg.len, false);
+       }
 
        spin_lock(&zcrypt_list_lock);
        zcrypt_drop_queue(pref_zc, pref_zq, mod, wgt);