From patchwork Wed Dec 19 15:56:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 154275 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5092593ljp; Wed, 19 Dec 2018 07:56:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/UvMt+vCdwTOoUcW1gKpZXxEMYUjuSBKzy4S8a6GISIzQRAV+r9MJ3BUIwOrIegng22yPas X-Received: by 2002:a17:902:3124:: with SMTP id w33mr20979842plb.241.1545234976435; Wed, 19 Dec 2018 07:56:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545234976; cv=none; d=google.com; s=arc-20160816; b=KQbBnRvvCXLu2hwNcu/oM7FDHARZWmTRbB/Vj3vXj2hZVaPb7UyvIKsMEW5sYognI3 CoGqPXfwL49u43mTGGvfMGR4quadoiLeWIAB8TEPcYQyAsT75WGKHm3lvEndIAiTE7vf XFxef00rxwKAbJbaoBRfW/FOb18AEjDt8bjo+HVYmJwcbn7S80hXmAf2zEfYM52qWbqo xqqb0zlpwXcmHlY0U9muawSFdSG+GG6WZsuT1aQcAHxYCeA/y+5nWQMuJau+hFCjA23y pF09k8jF9ma/ack3E0osH5Zv2iYqyXZZhan4HRTX0XgAEaCtbQdgJxPxTLQ1YQP/OcPR DTNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=DbuGim+ABcHe3ukx/WPst/MPrkNNJq4Lb7zm3rOUm74=; b=kmcNdWnPxb7BLGu97WmJ1sxJzwaT1JQVV6FbwtLM8Ji8fxNM8zli0zM0eN8UsYkdCZ 1H5pNZ3b9qpqA8VfOJo/tKdp5SabM3cQ19ahSI8ltXgPZVNZgfVyD+1C1J1rqBlk/N+E m8LYAhmQsyr+YIT2SEuDWy4NW0NOPDegZfJJ1lgxcdJqeuTenM1gTBj06M9pkOtrPdaM HKvXPKQqg3hiOC8l0ZuC25f9P532/S/4TtEzcXiDeuUXSNM0PETE4id9lVjiEIK4RaBH kJBR9ULkDNObaIYRLx4O+6jx7WdoccNUd6q/hzHPim1YncF7vCKiIEETFdqKx8FXveXM Bluw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v141si17900747pfc.260.2018.12.19.07.56.16; Wed, 19 Dec 2018 07:56:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730469AbeLSP4P (ORCPT + 1 other); Wed, 19 Dec 2018 10:56:15 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:16163 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729512AbeLSP4A (ORCPT ); Wed, 19 Dec 2018 10:56:00 -0500 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 2C78079033B1E; Wed, 19 Dec 2018 23:55:51 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.408.0; Wed, 19 Dec 2018 23:55:46 +0800 From: John Garry To: , CC: , , , Luo Jiaxing , John Garry Subject: [PATCH 8/8] scsi: hisi_sas: Add debugfs IOST file and add file operations Date: Wed, 19 Dec 2018 23:56:46 +0800 Message-ID: <1545235006-151716-9-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1545235006-151716-1-git-send-email-john.garry@huawei.com> References: <1545235006-151716-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Luo Jiaxing This patch create debugfs file for IOST and add file operations. Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 45a0be2..3d24366 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -2630,6 +2630,24 @@ static int hisi_sas_debugfs_port_open(struct inode *inode, struct file *filp) .owner = THIS_MODULE, }; +static int hisi_sas_show_row_64(struct seq_file *s, int index, + int sz, u64 *ptr) +{ + int i; + + /* completion header size not fixed per HW version */ + seq_printf(s, "index %04d:\n\t", index); + for (i = 1; i <= sz / 8; i++, ptr++) { + seq_printf(s, " 0x%016llx", le64_to_cpu(*ptr)); + if (!(i % 2)) + seq_puts(s, "\n\t"); + } + + seq_puts(s, "\n"); + + return 0; +} + static int hisi_sas_show_row_32(struct seq_file *s, int index, int sz, u32 *ptr) { @@ -2722,6 +2740,35 @@ static int hisi_sas_debugfs_dq_open(struct inode *inode, struct file *filp) .owner = THIS_MODULE, }; +static int hisi_sas_debugfs_iost_show(struct seq_file *s, void *p) +{ + struct hisi_hba *hisi_hba = s->private; + struct hisi_sas_iost *debugfs_iost = hisi_hba->debugfs_iost; + int i, ret, max_command_entries = hisi_hba->hw->max_command_entries; + + for (i = 0; i < max_command_entries; i++, debugfs_iost++) { + ret = hisi_sas_show_row_64(s, i, sizeof(*debugfs_iost), + (u64 *)debugfs_iost); + if (ret) + return ret; + } + + return 0; +} + +static int hisi_sas_debugfs_iost_open(struct inode *inode, struct file *filp) +{ + return single_open(filp, hisi_sas_debugfs_iost_show, inode->i_private); +} + +static const struct file_operations hisi_sas_debugfs_iost_fops = { + .open = hisi_sas_debugfs_iost_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, + .owner = THIS_MODULE, +}; + static void hisi_sas_debugfs_create_files(struct hisi_hba *hisi_hba) { struct dentry *dump_dentry; @@ -2783,6 +2830,10 @@ static void hisi_sas_debugfs_create_files(struct hisi_hba *hisi_hba) goto fail; } + if (!debugfs_create_file("iost", 0400, dump_dentry, hisi_hba, + &hisi_sas_debugfs_iost_fops)) + goto fail; + return; fail: debugfs_remove_recursive(hisi_hba->debugfs_dir);