Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1393198pxv; Fri, 16 Jul 2021 08:22:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPPuKA+TiqeFICUSIdOWUwPbVNJYTQkaSerHTl22eyeQPu20rL75WhtWrMrzyf7WhdRyCV X-Received: by 2002:a17:906:354a:: with SMTP id s10mr12494624eja.9.1626448978332; Fri, 16 Jul 2021 08:22:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626448978; cv=none; d=google.com; s=arc-20160816; b=E3ePBKtV8Vt6T+wp1aRPS3Esl+oDvII3LHtkEOp4RcGQHMzUaU2slD46MUkV39fPLX TXoV3Yu3490nyuTu9iwUD7nvNiK2ymzul2JKz5rcTE0+ZxIpuIrsvp8WGY3ZCv5HY1y1 QmBzPNeEKLPf85NcUvrtJtBapWJtED6rDdPvgq3qvJiloQTMRxiCKmUyk5UYdD0ze7hX v8aO/dzut7TQbVK+xUht0QX9oAktRjD/0gY3oiQem8bEebYJAju6VHcaT+M+6AFO8SwN qoJKXNQwVcMWMDsQVV5s+ON8yDtM1gYxqUi+V6n4HhGHrtSwh36Z/NfCMBfI3BRMQNwX 8ksQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NaztiW8y0zbEM5BnHti1Gp6mOCctl7zpEXezAiyDpPc=; b=kOEB1vDqGH8U5KEGf5HS20HuYrunOwwvNP/hFOiLY01NJIDsQ7WC7Yhxp1o+cRc6Bs usExVBVMbBLqtyo6omGbz6V9ZBjfgkbTi1OSxpksEkPClCc/O+lMBYfuDXmgecG7XQ+M sWRjl6FMaXoRgky0yAvm7E1LklodKLggKQv6CxQV9QC3D/S5D3JzdAzYp2U1Tfo7GpSg mCbxja6JhJh7lhFuosvjyAEKd81/1uBhyAyqKW4RCpxHBBVsQ+axg6/VbkaVKFK5Dkfc 8URc6xLYlzqY/0hwrkEwghRq6PJgFdarjUQLeu+qsnCsye8lTD1xeIp3vPPTCOfWAFmA gkiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="fzu/Nx2U"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x9si11235068edr.149.2021.07.16.08.22.34; Fri, 16 Jul 2021 08:22:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="fzu/Nx2U"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240780AbhGPPWe (ORCPT + 99 others); Fri, 16 Jul 2021 11:22:34 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:28024 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240251AbhGPPWY (ORCPT ); Fri, 16 Jul 2021 11:22:24 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16GFJ3Bh108840; Fri, 16 Jul 2021 11:19:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=NaztiW8y0zbEM5BnHti1Gp6mOCctl7zpEXezAiyDpPc=; b=fzu/Nx2U9BMGyPnIa5m9PUkNRS/ptVWjxq96+EcYZyB+eB6n4SACTqPkEauTOUaAcatt JrecwOy38LkCjUxVdeaDX2FoWvAKBYJkML25P50wDnzfzYCqzW94NwyVRp3Fe4BmXnh/ Lc0KOfrhf7r4keDvHOuCiy+KUb8nb00SF93dJFFGqa4x6O3cVWl/UtbXUM43C2CENtmK +WUATWNidsajWk2Zxg6K+4ot4y/nQx+OFSNyoOcuDELXQbzYZZvHeq1ENm9R3u8JrNmb aK9lc9UDTPiWGDyNPlecXuBqhuKop7/bNCvYu3hfM4X4qIXa0vxQ4dvI3bKqYCtVr5hw 1A== Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 39tyncnbfr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jul 2021 11:19:07 -0400 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16GFGfJS023509; Fri, 16 Jul 2021 15:19:04 GMT Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by ppma02dal.us.ibm.com with ESMTP id 39qt3ewur7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 16 Jul 2021 15:19:04 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16GFJ3Gi10027486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 16 Jul 2021 15:19:03 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 32B5BC6059; Fri, 16 Jul 2021 15:19:03 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB58CC605D; Fri, 16 Jul 2021 15:19:02 +0000 (GMT) Received: from v0005c16.aus.stglabs.ibm.com (unknown [9.211.92.96]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 16 Jul 2021 15:19:02 +0000 (GMT) From: Eddie James To: linux-kernel@vger.kernel.org Cc: linux-hwmon@vger.kernel.org, linux-fsi@lists.ozlabs.org, linux@roeck-us.net, jdelvare@suse.com, jk@ozlabs.org, joel@jms.id.au, alistair@popple.id.au, openbmc@lists.ozlabs.org, Eddie James Subject: [PATCH 3/3] fsi: occ: Add dynamic debug to dump command and response Date: Fri, 16 Jul 2021 10:18:50 -0500 Message-Id: <20210716151850.28973-4-eajames@linux.ibm.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210716151850.28973-1-eajames@linux.ibm.com> References: <20210716151850.28973-1-eajames@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 3ZpwZuyjX5mctZig_Fom-bhIZ3K76wJ3 X-Proofpoint-ORIG-GUID: 3ZpwZuyjX5mctZig_Fom-bhIZ3K76wJ3 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-07-16_05:2021-07-16,2021-07-16 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 malwarescore=0 spamscore=0 priorityscore=1501 adultscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107160092 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the dynamic branching capability of the dynamic debug subsystem to dump the command and response with the correct OCC device name. Signed-off-by: Eddie James --- drivers/fsi/fsi-occ.c | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c index ecf738411fe2..641a6869b9df 100644 --- a/drivers/fsi/fsi-occ.c +++ b/drivers/fsi/fsi-occ.c @@ -21,6 +21,15 @@ #include #include +#if !defined(CONFIG_DYNAMIC_DEBUG_CORE) +#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) +#if defined(DEBUG) +#define DYNAMIC_DEBUG_BRANCH(descriptor) true +#else /* DEBUG */ +#define DYNAMIC_DEBUG_BRANCH(descriptor) false +#endif /* DEBUG */ +#endif /* CONFIG_DYNAMIC_DEBUG_CORE */ + #define OCC_SRAM_BYTES 4096 #define OCC_CMD_DATA_BYTES 4090 #define OCC_RESP_DATA_BYTES 4089 @@ -359,6 +368,20 @@ static int occ_putsram(struct occ *occ, const void *data, ssize_t len, byte_buf[len - 2] = checksum >> 8; byte_buf[len - 1] = checksum & 0xff; + { + DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_cmd, "OCC command"); + + if (DYNAMIC_DEBUG_BRANCH(ddm_occ_cmd)) { + char prefix[64]; + + snprintf(prefix, sizeof(prefix), "%s %s: cmd ", + dev_driver_string(occ->dev), + dev_name(occ->dev)); + print_hex_dump(KERN_DEBUG, prefix, DUMP_PREFIX_OFFSET, + 16, 4, byte_buf, len, false); + } + } + rc = sbefifo_submit(occ->sbefifo, buf, cmd_len, buf, &resp_len); if (rc) goto free; @@ -556,6 +579,27 @@ int fsi_occ_submit(struct device *dev, const void *request, size_t req_len, } *resp_len = resp_data_length + 7; + + { + DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_rsp, + "OCC response"); + DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_full_rsp, + "OCC full response"); + + if (DYNAMIC_DEBUG_BRANCH(ddm_occ_full_rsp) || + DYNAMIC_DEBUG_BRANCH(ddm_occ_rsp)) { + char prefix[64]; + size_t l = DYNAMIC_DEBUG_BRANCH(ddm_occ_full_rsp) ? + *resp_len : 16; + + snprintf(prefix, sizeof(prefix), "%s %s: rsp ", + dev_driver_string(occ->dev), + dev_name(occ->dev)); + print_hex_dump(KERN_DEBUG, prefix, DUMP_PREFIX_OFFSET, + 16, 4, resp, l, false); + } + } + rc = occ_verify_checksum(occ, resp, resp_data_length); done: -- 2.27.0