Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3038349ybe; Sun, 8 Sep 2019 05:58:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8f+dlh19qbqqIqUtr5RwsQFlKUeeNzbhh60eh+KYD5cWU3nJhmG7PWth6gJ35V1Er/4RO X-Received: by 2002:a17:906:c401:: with SMTP id u1mr15460223ejz.254.1567947494804; Sun, 08 Sep 2019 05:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567947494; cv=none; d=google.com; s=arc-20160816; b=K6turQ+Bv7eeN2e5QsrKzs9wJ2MakzmdrlIKIdnLXrTvIp4bYwhIDA+m2B104Uneym w0+tD9LozfrjZ3h7zlu2WSvUMIDoqs0vPUnlGnG3YotpAJsoo4YPMYB/EQEKJ61/3K1g dUz/dlGS+T8/befeHn+PXvHF+TKIAQ6GMe/W5Zay2VWo0ojDSztgLKxKssQGvZPFBsU9 Gg7eGQt4hyt5dhnYY1BjEsVHQPcXCPEVLAZOp2Y40NA754f/LEcFPruxLvssvL5RKhVv Vqv7IFfdNb2yQ8bOggVAUoJ2dVuMIPBGZLYsJEQFghn4DZ/wVYGbDM6i3lI+Ou9v034J KCNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=FegHyyrWtiY6JYh5ksltt3lg4+C3B8qFcBtXVJ8yKyQ=; b=fK6hSy3jaAtx9T/LqJHoa+vgEGlhSK1av0zTzoaDx+NzwAJjHmKr3nyVVuaAaOGwTg PzeOLxky7Wv2b5F61BCUg3J1OX0L0/KVb8iOu11kSBNYR4/TLP2izq6eclES5doJ7eOM tnpvhjm3LqW4Z6VZPTNVhtUZL/OCbe8SFiXoMrQJIVth3iWNpBJHli76f4OeGoO06SL+ m5jrPtB5YC3EtQSIz4m6q2v3yQM/FfHJbrJVqfCiJkZJYL7lkU4zMMD9F/C1Xu5PYe4E oS2lhFI/v5u8QCCpgR8drTUMKvh0YlZoe7kuySgrsQmpcpGEq1VSJLbG95wnfmPF4e1x F8fw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-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 s30si6718593edb.377.2019.09.08.05.57.50; Sun, 08 Sep 2019 05:58:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-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-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727383AbfIHIjO (ORCPT + 99 others); Sun, 8 Sep 2019 04:39:14 -0400 Received: from alexa-out-ams-02.qualcomm.com ([185.23.61.163]:7549 "EHLO alexa-out-ams-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbfIHIjN (ORCPT ); Sun, 8 Sep 2019 04:39:13 -0400 Received: from ironmsg03-ams.qualcomm.com ([10.251.56.4]) by alexa-out-ams-02.qualcomm.com with ESMTP; 08 Sep 2019 10:33:04 +0200 Received: from lx-merez1.mea.qualcomm.com ([10.18.173.103]) by ironmsg03-ams.qualcomm.com with ESMTP; 08 Sep 2019 10:33:00 +0200 From: Maya Erez To: Kalle Valo Cc: Dedy Lansky , linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com, Maya Erez Subject: [PATCH 03/11] wil6210: add debugfs to show PMC ring content Date: Sun, 8 Sep 2019 11:32:47 +0300 Message-Id: <1567931575-27984-4-git-send-email-merez@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1567931575-27984-1-git-send-email-merez@codeaurora.org> References: <1567931575-27984-1-git-send-email-merez@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Dedy Lansky PMC is a hardware debug mechanism which allows capturing real time debug data and stream it to host memory. The driver allocates memory buffers and set them inside PMC ring of descriptors. Add pmcring debugfs that application can use to read the binary content of descriptors inside the PMC ring (cat pmcring). Signed-off-by: Dedy Lansky Signed-off-by: Maya Erez --- drivers/net/wireless/ath/wil6210/debugfs.c | 13 +++++++++++++ drivers/net/wireless/ath/wil6210/pmc.c | 26 ++++++++++++++++++++++++++ drivers/net/wireless/ath/wil6210/pmc.h | 1 + 3 files changed, 40 insertions(+) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index fd3b2b3..50dc30e 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -959,6 +959,18 @@ static ssize_t wil_read_pmccfg(struct file *file, char __user *user_buf, .llseek = wil_pmc_llseek, }; +static int wil_pmcring_seq_open(struct inode *inode, struct file *file) +{ + return single_open(file, wil_pmcring_read, inode->i_private); +} + +static const struct file_operations fops_pmcring = { + .open = wil_pmcring_seq_open, + .release = single_release, + .read = seq_read, + .llseek = seq_lseek, +}; + /*---tx_mgmt---*/ /* Write mgmt frame to this file to send it */ static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf, @@ -2371,6 +2383,7 @@ static void wil6210_debugfs_init_blobs(struct wil6210_priv *wil, {"back", 0644, &fops_back}, {"pmccfg", 0644, &fops_pmccfg}, {"pmcdata", 0444, &fops_pmcdata}, + {"pmcring", 0444, &fops_pmcring}, {"temp", 0444, &temp_fops}, {"freq", 0444, &freq_fops}, {"link", 0444, &link_fops}, diff --git a/drivers/net/wireless/ath/wil6210/pmc.c b/drivers/net/wireless/ath/wil6210/pmc.c index c49f798..4b7ac14 100644 --- a/drivers/net/wireless/ath/wil6210/pmc.c +++ b/drivers/net/wireless/ath/wil6210/pmc.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "wmi.h" #include "wil6210.h" #include "txrx.h" @@ -431,3 +432,28 @@ loff_t wil_pmc_llseek(struct file *filp, loff_t off, int whence) return newpos; } + +int wil_pmcring_read(struct seq_file *s, void *data) +{ + struct wil6210_priv *wil = s->private; + struct pmc_ctx *pmc = &wil->pmc; + size_t pmc_ring_size = + sizeof(struct vring_rx_desc) * pmc->num_descriptors; + + mutex_lock(&pmc->lock); + + if (!wil_is_pmc_allocated(pmc)) { + wil_err(wil, "error, pmc is not allocated!\n"); + pmc->last_cmd_status = -EPERM; + mutex_unlock(&pmc->lock); + return -EPERM; + } + + wil_dbg_misc(wil, "pmcring_read: size %zu\n", pmc_ring_size); + + seq_write(s, pmc->pring_va, pmc_ring_size); + + mutex_unlock(&pmc->lock); + + return 0; +} diff --git a/drivers/net/wireless/ath/wil6210/pmc.h b/drivers/net/wireless/ath/wil6210/pmc.h index bebc8d5..92b8c4d 100644 --- a/drivers/net/wireless/ath/wil6210/pmc.h +++ b/drivers/net/wireless/ath/wil6210/pmc.h @@ -25,3 +25,4 @@ void wil_pmc_alloc(struct wil6210_priv *wil, int wil_pmc_last_cmd_status(struct wil6210_priv *wil); ssize_t wil_pmc_read(struct file *, char __user *, size_t, loff_t *); loff_t wil_pmc_llseek(struct file *filp, loff_t off, int whence); +int wil_pmcring_read(struct seq_file *s, void *data); -- 1.9.1