From patchwork Tue Aug 15 08:23:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 9901253 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D1D6560244 for ; Tue, 15 Aug 2017 08:23:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0A0F287F0 for ; Tue, 15 Aug 2017 08:23:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5768287FF; Tue, 15 Aug 2017 08:23:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3CD7E287F0 for ; Tue, 15 Aug 2017 08:23:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:To:From:Subject:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XH7yb/2eOOa4k64akD4s1kyP+7K3C2YvAjSEA2Lu1Rw=; b=LEBrnmoIhLTJ6A FhfzY3Qi763wpqBM4s4yYj/fCvMbNNAS4e2PqSsGIcutpM9SEcc5UZfj4KIymDB1BUU+rM9HJBIAp bckOvUtCC1dNfr9fQkhmfaRQUS67yX4gEFocFE8mahFer7QA4aJIe48hXBp9CuKh756ZriWpSsIYF 7FTMeTilSvZPw02y3LPz9/JMIC4g0HO5FYF5FoMgdJdJ8MCfXuL4NlFJVzPwUpsVDAtJ87LaWCdDC TBL5ouKq9/SdlxHcRtBm/r7w5ZqyubOVyyP8lERs4Lm6Myb4Kj6RH9reEPfUSYnLoHWWzuzalUVba yfGbxeDUfvy9kfWopZsw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dhX8g-0001Wm-Q5; Tue, 15 Aug 2017 08:23:50 +0000 Received: from alexa-out.qualcomm.com ([129.46.98.28] helo=alexa-out-lv-02.qualcomm.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dhX8c-0001EG-B9 for ath10k@lists.infradead.org; Tue, 15 Aug 2017 08:23:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1502785426; x=1534321426; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3CFugq/OGBLP1SaMz4xmQnUJqMapjy1Ri6FWNBuInro=; b=WE0nKbZW0v8/1TdYG1heyz0LlYVQBgk4FwJpOZvfp7ZBP8UnPrbPohZw AZdLPdw5Qo142eJ+eDCUighXIQx5QntPHvdBlpNd0yDuWbW8mTiFjcNYO W4j+ckUVfOUOqG/L7OviqHGNJg79Ih/zSJJtptj9Q4/zuiOCcd/1Gn323 o=; X-IronPort-AV: E=Sophos;i="5.41,377,1498546800"; d="scan'208";a="3240862" Received: from ironmsg02-r-new.qualcomm.com (HELO ironmsg02-R.qualcomm.com) ([10.53.140.106]) by alexa-out-lv-02.qualcomm.com with ESMTP; 15 Aug 2017 01:23:29 -0700 X-IronPort-AV: E=McAfee;i="5900,7806,8622"; a="1016282343" X-MGA-submission: =?us-ascii?q?MDF2jYrCIEEHzffxMI2ev6aR6D7+cBQIYwyePl?= =?us-ascii?q?dFthfNU4vt9v1tyTDyToa+Maeas4ah/q0fUco/KzkhAb6fNL/tAXF3fs?= =?us-ascii?q?yfY7xK2PBqa13xKuCWHTVc38qWtTnljFyqAOTfHpTJ2XOjQyxIPa6LG/?= =?us-ascii?q?uD?= Received: from nasanexm02e.na.qualcomm.com ([10.85.0.86]) by ironmsg02-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 15 Aug 2017 01:23:28 -0700 Received: from euamsexm01a.eu.qualcomm.com (10.251.127.40) by nasanexm02e.na.qualcomm.com (10.85.0.86) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Tue, 15 Aug 2017 01:23:27 -0700 Received: from potku.adurom.net (10.80.80.8) by euamsexm01a.eu.qualcomm.com (10.251.127.40) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Tue, 15 Aug 2017 10:23:23 +0200 Subject: [PATCH 3/6] ath10k: detach coredump.c from debug.c From: Kalle Valo To: Date: Tue, 15 Aug 2017 11:23:17 +0300 Message-ID: <150278539688.22482.3577133520037595343.stgit@potku.adurom.net> In-Reply-To: <150278532045.22482.14490702801292107536.stgit@potku.adurom.net> References: <150278532045.22482.14490702801292107536.stgit@potku.adurom.net> User-Agent: StGit/0.17.1-17-ge4e0 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01B.na.qualcomm.com (10.85.0.82) To euamsexm01a.eu.qualcomm.com (10.251.127.40) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170815_012346_520385_DB5DBDF6 X-CRM114-Status: GOOD ( 12.98 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now coredump is totally separate from debug.c and doesn't depend on CONFIG_ATH10K_DEBUGFS anymore, only on CONFIG_DEV_COREDUMP. Also remove leftovers from the removed debugfs file support. Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/ath10k/Makefile | 2 + drivers/net/wireless/ath/ath10k/core.c | 10 +++++- drivers/net/wireless/ath/ath10k/core.h | 10 +++--- drivers/net/wireless/ath/ath10k/coredump.c | 49 ++++++++++------------------ drivers/net/wireless/ath/ath10k/coredump.h | 11 ++++++ drivers/net/wireless/ath/ath10k/debug.c | 7 ---- 6 files changed, 45 insertions(+), 44 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/Makefile b/drivers/net/wireless/ath/ath10k/Makefile index 769478b567a2..80f5556c4a68 100644 --- a/drivers/net/wireless/ath/ath10k/Makefile +++ b/drivers/net/wireless/ath/ath10k/Makefile @@ -20,7 +20,7 @@ ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o ath10k_core-$(CONFIG_THERMAL) += thermal.o ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o ath10k_core-$(CONFIG_PM) += wow.o -ath10k_core-$(CONFIG_ATH10K_DEBUGFS) += coredump.o +ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o obj-$(CONFIG_ATH10K_PCI) += ath10k_pci.o ath10k_pci-y += pci.o \ diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index caecfca4a38a..7b465973d2ca 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -2584,12 +2584,19 @@ struct ath10k *ath10k_core_create(size_t priv_size, struct device *dev, init_dummy_netdev(&ar->napi_dev); - ret = ath10k_debug_create(ar); + ret = ath10k_coredump_create(ar); if (ret) goto err_free_aux_wq; + ret = ath10k_debug_create(ar); + if (ret) + goto err_free_coredump; + return ar; +err_free_coredump: + ath10k_coredump_destroy(ar); + err_free_aux_wq: destroy_workqueue(ar->workqueue_aux); err_free_wq: @@ -2611,6 +2618,7 @@ void ath10k_core_destroy(struct ath10k *ar) destroy_workqueue(ar->workqueue_aux); ath10k_debug_destroy(ar); + ath10k_coredump_destroy(ar); ath10k_htt_tx_destroy(&ar->htt); ath10k_wmi_free_host_mem(ar); ath10k_mac_destroy(ar); diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 949ebb3e967b..06f85ae752fe 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -460,8 +460,6 @@ struct ath10k_ce_crash_hdr { /* used for crash-dump storage, protected by data-lock */ struct ath10k_fw_crash_data { - bool crashed_since_read; - guid_t guid; struct timespec timestamp; __le32 registers[REG_DUMP_COUNT_QCA988X]; @@ -492,8 +490,6 @@ struct ath10k_debug { u32 reg_addr; u32 nf_cal_period; void *cal_data; - - struct ath10k_fw_crash_data *fw_crash_data; }; enum ath10k_state { @@ -960,6 +956,12 @@ struct ath10k { } spectral; #endif +#ifdef CONFIG_DEV_COREDUMP + struct { + struct ath10k_fw_crash_data *fw_crash_data; + } coredump; +#endif + struct { /* protected by conf_mutex */ struct ath10k_fw_components utf_mode_fw; diff --git a/drivers/net/wireless/ath/ath10k/coredump.c b/drivers/net/wireless/ath/ath10k/coredump.c index b4631e573851..512d44fa5848 100644 --- a/drivers/net/wireless/ath/ath10k/coredump.c +++ b/drivers/net/wireless/ath/ath10k/coredump.c @@ -23,11 +23,10 @@ struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar) { - struct ath10k_fw_crash_data *crash_data = ar->debug.fw_crash_data; + struct ath10k_fw_crash_data *crash_data = ar->coredump.fw_crash_data; lockdep_assert_held(&ar->data_lock); - crash_data->crashed_since_read = true; guid_gen(&crash_data->guid); getnstimeofday(&crash_data->timestamp); @@ -35,10 +34,9 @@ struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar) } EXPORT_SYMBOL(ath10k_coredump_new); -static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar, - bool mark_read) +static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar) { - struct ath10k_fw_crash_data *crash_data = ar->debug.fw_crash_data; + struct ath10k_fw_crash_data *crash_data = ar->coredump.fw_crash_data; struct ath10k_ce_crash_hdr *ce_hdr; struct ath10k_dump_file_data *dump_data; struct ath10k_tlv_dump_data *dump_tlv; @@ -62,12 +60,6 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar, spin_lock_bh(&ar->data_lock); - if (!crash_data->crashed_since_read) { - spin_unlock_bh(&ar->data_lock); - vfree(buf); - return NULL; - } - dump_data = (struct ath10k_dump_file_data *)(buf); strlcpy(dump_data->df_magic, "ATH10K-FW-DUMP", sizeof(dump_data->df_magic)); @@ -120,8 +112,6 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar, sofar += sizeof(*dump_tlv) + sizeof(*ce_hdr) + CE_COUNT * sizeof(ce_hdr->entries[0]); - ar->debug.fw_crash_data->crashed_since_read = !mark_read; - spin_unlock_bh(&ar->data_lock); return dump_data; @@ -130,32 +120,29 @@ static struct ath10k_dump_file_data *ath10k_coredump_build(struct ath10k *ar, int ath10k_coredump_submit(struct ath10k *ar) { struct ath10k_dump_file_data *dump; - void *dump_ptr; - u32 dump_len; - /* To keep the dump file available also for debugfs don't mark the - * file read, only debugfs should do that. - */ - dump = ath10k_coredump_build(ar, false); + dump = ath10k_coredump_build(ar); if (!dump) { ath10k_warn(ar, "no crash dump data found for devcoredump"); return -ENODATA; } - /* Make a copy of the dump file for dev_coredumpv() as during the - * transition period we need to own the original file. Once - * fw_crash_dump debugfs file is removed no need to have a copy - * anymore. - */ - dump_len = le32_to_cpu(dump->len); - dump_ptr = vzalloc(dump_len); - - if (!dump_ptr) - return -ENOMEM; + dev_coredumpv(ar->dev, dump, le32_to_cpu(dump->len), GFP_KERNEL); - memcpy(dump_ptr, dump, dump_len); + return 0; +} - dev_coredumpv(ar->dev, dump_ptr, dump_len, GFP_KERNEL); +int ath10k_coredump_create(struct ath10k *ar) +{ + ar->coredump.fw_crash_data = vzalloc(sizeof(*ar->coredump.fw_crash_data)); + if (!ar->coredump.fw_crash_data) + return -ENOMEM; return 0; } + +void ath10k_coredump_destroy(struct ath10k *ar) +{ + vfree(ar->coredump.fw_crash_data); + ar->coredump.fw_crash_data = NULL; +} diff --git a/drivers/net/wireless/ath/ath10k/coredump.h b/drivers/net/wireless/ath/ath10k/coredump.h index 2d2f45b5aa37..2d33075f081a 100644 --- a/drivers/net/wireless/ath/ath10k/coredump.h +++ b/drivers/net/wireless/ath/ath10k/coredump.h @@ -103,6 +103,8 @@ struct ath10k_dump_file_data { int ath10k_coredump_submit(struct ath10k *ar); struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar); +int ath10k_coredump_create(struct ath10k *ar); +void ath10k_coredump_destroy(struct ath10k *ar); #else /* CONFIG_DEV_COREDUMP */ @@ -116,6 +118,15 @@ static inline struct ath10k_fw_crash_data *ath10k_coredump_new(struct ath10k *ar return NULL; } +static inline int ath10k_coredump_create(struct ath10k *ar) +{ + return 0; +} + +static inline void ath10k_coredump_destroy(struct ath10k *ar) +{ +} + #endif /* CONFIG_DEV_COREDUMP */ #endif /* _COREDUMP_H_ */ diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c index 28f96359ee73..eed4e9cc47ef 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -2137,10 +2137,6 @@ static const struct file_operations fops_fw_checksums = { int ath10k_debug_create(struct ath10k *ar) { - ar->debug.fw_crash_data = vzalloc(sizeof(*ar->debug.fw_crash_data)); - if (!ar->debug.fw_crash_data) - return -ENOMEM; - ar->debug.cal_data = vzalloc(ATH10K_DEBUG_CAL_DATA_LEN); if (!ar->debug.cal_data) return -ENOMEM; @@ -2155,9 +2151,6 @@ int ath10k_debug_create(struct ath10k *ar) void ath10k_debug_destroy(struct ath10k *ar) { - vfree(ar->debug.fw_crash_data); - ar->debug.fw_crash_data = NULL; - vfree(ar->debug.cal_data); ar->debug.cal_data = NULL;