From patchwork Wed Dec 19 15:56:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 154273 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5092433ljp; Wed, 19 Dec 2018 07:56:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/WH+v7aQDCvItdd4yg1REC4JGKNjT9h6z8v32VP8p5EV43ECgW9qjPhN61oY+RgbCSafUXs X-Received: by 2002:a63:5026:: with SMTP id e38mr19922619pgb.123.1545234967151; Wed, 19 Dec 2018 07:56:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545234967; cv=none; d=google.com; s=arc-20160816; b=UQVBvOwOBtRwQxjr/qkpv6YfLUQbDeOzhlp0TqQaDz4VjqZ3+QfuKD/TULl5PVJY9I SuiX6yldcJiUVhX/Kwv8LQ9VoOkygYq2YWoPs19s7xtiad6FWH80Em+1Adw1oOLI53Tz 3K3EeHee32vrj9hn3kbSNmwtuBedRALfO0Tq7yPAcPCVvmt1PM8/NyFtf87bMPOF/xsr CI5E072OzDHMZtFlFa+ckriNsI2YI5gpjAWBQ17/dIxHw4iMlblntXeKnEimjp1r599p MSWvHUOXTp+XBnw4+/WwksRkpHNGi1d1XPrR26SAfTn13ncf3jSarSwyFHDEvu1qBQOW 89MQ== 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=iBmwnKCzSJLktJaTtbcfGb63RArBr1NDxQ67d06couE=; b=oOIdvYoj9gvTVInC501fsuLEfjQDYaSAubaLLQ+RtyPmT7AAp4tT022bqbrE8NM3oL vT13/Ieq+72QcYVyIJNlrnGbh/u2kUeO7Ey4rVL2kgGm2glqOXP01hObul/vMCYMMuas 795bQ6Jf+zak5RejowX+0qax4eOaflCBLqTTdlSwtw1h25S3iI/2TzyxOSExiArga9u9 KZQIXcaUIdsRW6qYvZx+FXmrU7enVtKlnqGSZFD1jevtvQ14B+uZb2sLHWUvmhjt/XB2 mDzqF5noiyWlCVJhPO4/cuB7woIztSKFG4FEWc/mgzWceXot2r6e/z65pnxn6m6rsnbp Us7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 x23si11750288pgj.247.2018.12.19.07.56.06; Wed, 19 Dec 2018 07:56:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730448AbeLSP4E (ORCPT + 31 others); Wed, 19 Dec 2018 10:56:04 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:16164 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730420AbeLSP4A (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 31813130E497F; 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 7/8] scsi: hisi_sas: Add debugfs DQ file and add file operations Date: Wed, 19 Dec 2018 23:56:45 +0800 Message-ID: <1545235006-151716-8-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luo Jiaxing This patch create debugfs file for DQ and add file operations Signed-off-by: Luo Jiaxing Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 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 ce0a9dc..45a0be2 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -2685,6 +2685,43 @@ static int hisi_sas_debugfs_cq_open(struct inode *inode, struct file *filp) .owner = THIS_MODULE, }; +static int hisi_sas_dq_show_slot(struct seq_file *s, int slot, void *dq_ptr) +{ + struct hisi_sas_dq *dq = dq_ptr; + struct hisi_hba *hisi_hba = dq->hisi_hba; + void *cmd_queue = hisi_hba->debugfs_cmd_hdr[dq->id]; + void *cmd_hdr = cmd_queue + + hisi_hba->hw->complete_hdr_size * slot; + + return hisi_sas_show_row_32(s, slot, sizeof(struct hisi_sas_cmd_hdr), + cmd_hdr); +} + +static int hisi_sas_debugfs_dq_show(struct seq_file *s, void *p) +{ + int slot, ret; + + for (slot = 0; slot < HISI_SAS_QUEUE_SLOTS; slot++) { + ret = hisi_sas_dq_show_slot(s, slot, s->private); + if (ret) + return ret; + } + return 0; +} + +static int hisi_sas_debugfs_dq_open(struct inode *inode, struct file *filp) +{ + return single_open(filp, hisi_sas_debugfs_dq_show, inode->i_private); +} + +static const struct file_operations hisi_sas_debugfs_dq_fops = { + .open = hisi_sas_debugfs_dq_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; @@ -2692,6 +2729,7 @@ static void hisi_sas_debugfs_create_files(struct hisi_hba *hisi_hba) char name[256]; int p; int c; + int d; /* Create dump dir inside device dir */ dump_dentry = debugfs_create_dir("dump", hisi_hba->debugfs_dir); @@ -2731,6 +2769,20 @@ static void hisi_sas_debugfs_create_files(struct hisi_hba *hisi_hba) goto fail; } + /* Create DQ dir and files */ + dentry = debugfs_create_dir("dq", dump_dentry); + if (!dentry) + goto fail; + + for (d = 0; d < hisi_hba->queue_count; d++) { + snprintf(name, 256, "%d", d); + + if (!debugfs_create_file(name, 0400, dentry, + &hisi_hba->dq[d], + &hisi_sas_debugfs_dq_fops)) + goto fail; + } + return; fail: debugfs_remove_recursive(hisi_hba->debugfs_dir);