From patchwork Fri Dec 22 13:38:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 10130501 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 1A9D260318 for ; Fri, 22 Dec 2017 13:39:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C03E299A9 for ; Fri, 22 Dec 2017 13:39:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00DB22A046; Fri, 22 Dec 2017 13:39:26 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED 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 66C70299A9 for ; Fri, 22 Dec 2017 13:39:26 +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=B9jsbmLSxe/kiet/Q/qelmpONEzCrvnxpyu6csC6a2I=; b=oSyrICufjVrDDB IXSgqjFitAuJbipaYqdkKN8YKSptkvt6TTWFoIWOkTvN/8Q9b/6VHV7IHgoasTRXUc8BijrOexSY2 ShBcqWyPgqFNqzXKaXEhFBHv44xdcBx8oDy1aUwgQ0ytIGBnXX5sF4XW3wckk+sLLqyT6Eu/Vhcn4 cLRf9v316Hca3aBuhYzi2UAAA1TaxL/p7LkyZDsRlrtDOjqqjv576E5QH64HTR8i9bo4FIK8BnJsH IqZDQ1/xMe4dHD55x6F0u7wz7g3Qr6dtxP/Wc9e9F4/GPOkC8WlHbLNFK1jw4qE4xvUfzSbAMaaRH 6o1wzLeei1mscMeUU4Pw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eSNXk-0002Hx-E5; Fri, 22 Dec 2017 13:39:20 +0000 Received: from alexa-out.qualcomm.com ([129.46.98.28]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eSNXc-000285-61 for ath10k@lists.infradead.org; Fri, 22 Dec 2017 13:39:17 +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=1513949952; x=1545485952; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6WV5ZBmqaFBfCnFQ31RHdOMgpZP19TCSxE+vuccgGPQ=; b=Z4oD1jzy1M8XhuczeO5pKSoXoe1MIN9XLM/objkU6NnWMUdqZLC/3FLq ic8Ltt4yClGN1V3+oFYKIxxvW5nkuimVCJ46zY7xI3ZBnBNY4fqHPghKM 9w463DCXaew2//yMyvH5m12pctR2a4vbq3DSeAps7kC01tNPMYf9YJ+NB E=; Received: from ironmsg02-r-new.qualcomm.com (HELO ironmsg02-R.qualcomm.com) ([10.53.140.106]) by alexa-out.qualcomm.com with ESMTP; 22 Dec 2017 05:39:12 -0800 X-IronPort-AV: E=McAfee;i="5900,7806,8752"; a="1092177930" X-MGA-submission: =?us-ascii?q?MDFxcU0eHuWYxeEmLJV8mn6x3kKmL+AJCHZSM9?= =?us-ascii?q?HXR6xsPv1CKMEaQ2Htz2v5bT3rEKz2UDqgpaOC1qmvIzmlpGypuTv0lw?= =?us-ascii?q?q6N6AXisbZHGoyWkKXz2zPt3AtBXPqdx5Snd0PvUiERkiRTYl0P2ES1H?= =?us-ascii?q?f2?= Received: from nasanexm03b.na.qualcomm.com ([10.85.0.98]) by ironmsg02-R.qualcomm.com with ESMTP/TLS/AES256-SHA; 22 Dec 2017 05:39:11 -0800 Received: from euamsexm01a.eu.qualcomm.com (10.251.127.40) by nasanexm03b.na.qualcomm.com (10.85.0.98) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Fri, 22 Dec 2017 05:39:10 -0800 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.1293.2; Fri, 22 Dec 2017 14:39:04 +0100 Subject: [PATCH v2 3/6] ath10k: detach coredump.c from debug.c From: Kalle Valo To: Date: Fri, 22 Dec 2017 15:38:59 +0200 Message-ID: <151394993871.9382.1431672643745493472.stgit@potku.adurom.net> In-Reply-To: <151394982311.9382.1300230032038350642.stgit@potku.adurom.net> References: <151394982311.9382.1300230032038350642.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: NASANEXM01F.na.qualcomm.com (10.85.0.32) 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-20171222_053912_647330_E57292B6 X-CRM114-Status: GOOD ( 13.08 ) 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 | 11 ++++-- drivers/net/wireless/ath/ath10k/coredump.c | 51 +++++++++------------------- drivers/net/wireless/ath/ath10k/coredump.h | 11 ++++++ drivers/net/wireless/ath/ath10k/debug.c | 7 ---- 6 files changed, 45 insertions(+), 47 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/Makefile b/drivers/net/wireless/ath/ath10k/Makefile index 4e6a396827ee..6739ac26fd29 100644 --- a/drivers/net/wireless/ath/ath10k/Makefile +++ b/drivers/net/wireless/ath/ath10k/Makefile @@ -21,7 +21,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 8d36bfcfcf01..c42e74e03ba5 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -2676,12 +2676,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: @@ -2703,6 +2710,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 398cd3c57139..5e7705f59962 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -458,8 +458,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 timespec64 timestamp; __le32 registers[REG_DUMP_COUNT_QCA988X]; @@ -489,8 +487,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 { @@ -961,6 +957,13 @@ struct ath10k { #endif u32 pktlog_filter; + +#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 51b86878e733..968ab2f74d83 100644 --- a/drivers/net/wireless/ath/ath10k/coredump.c +++ b/drivers/net/wireless/ath/ath10k/coredump.c @@ -21,15 +21,12 @@ #include "debug.h" -#ifdef CONFIG_DEV_COREDUMP - 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); ktime_get_real_ts64(&crash_data->timestamp); @@ -37,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; @@ -64,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)); @@ -122,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; @@ -132,34 +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); + dev_coredumpv(ar->dev, dump, le32_to_cpu(dump->len), GFP_KERNEL); - if (!dump_ptr) - return -ENOMEM; - - 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; } -#endif /* CONFIG_DEV_COREDUMP */ +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 f8e44882439a..48788c851217 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;