From patchwork Tue Jun 14 06:17:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 9175029 X-Patchwork-Delegate: kvalo@adurom.com 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 40D1F60772 for ; Tue, 14 Jun 2016 06:18:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 307D7200F5 for ; Tue, 14 Jun 2016 06:18:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22E1A2818B; Tue, 14 Jun 2016 06:18:57 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AD41F200F5 for ; Tue, 14 Jun 2016 06:18:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bChgR-0000pM-U2; Tue, 14 Jun 2016 06:18:43 +0000 Received: from wolverine01.qualcomm.com ([199.106.114.254]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bChgP-0000lm-Dn for ath10k@lists.infradead.org; Tue, 14 Jun 2016 06:18:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1465885121; x=1497421121; h=from:to:cc:subject:date:message-id:mime-version; bh=h0BMLLkCQ/kB/Ym9FWO65nWg5ym/nQh5Cjbo9kjJg6Q=; b=HEnJ6bK/YcXlFw8vVCzvjaXa4fV7TNPtOfedZmVk8mnvQvI3DsAQsrmJ qGJesIGF/p0bMgyr4DON5OL211RH1hlCaawEJlIts53CLilkeQC53Nt9q St9hKunw6sBiYqGEW7IDGxfAbsBqLhXTVUEJDYkM+M5j3MXv4vWG42b+8 M=; X-IronPort-AV: E=Sophos;i="5.26,470,1459839600"; d="scan'208";a="200320579" Received: from unknown (HELO Ironmsg04-R.qualcomm.com) ([10.53.140.108]) by wolverine01.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Jun 2016 23:18:19 -0700 X-IronPort-AV: E=McAfee;i="5700,7163,8195"; a="1215686929" Received: from nasanexm02c.na.qualcomm.com ([10.85.0.43]) by Ironmsg04-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 13 Jun 2016 23:18:18 -0700 Received: from aphydexm01b.ap.qualcomm.com (10.252.127.11) by NASANEXM02C.na.qualcomm.com (10.85.0.43) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Mon, 13 Jun 2016 23:18:17 -0700 Received: from qcmail1.qualcomm.com (10.80.80.8) by aphydexm01b.ap.qualcomm.com (10.252.127.11) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Tue, 14 Jun 2016 11:48:07 +0530 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Tue, 14 Jun 2016 11:47:59 +0530 From: Rajkumar Manoharan To: Subject: [PATCH] ath10k: fix system hang at qca99x0 probe on x86 platform Date: Tue, 14 Jun 2016 11:47:28 +0530 Message-ID: <20160614061728.570-1-rmanohar@qti.qualcomm.com> X-Mailer: git-send-email 2.8.3 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01E.na.qualcomm.com (10.85.0.31) To aphydexm01b.ap.qualcomm.com (10.252.127.11) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160613_231841_560667_6579AADA X-CRM114-Status: UNSURE ( 9.48 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: greearb@candelatech.com, linux-wireless@vger.kernel.org, Rajkumar Manoharan , rmanohar@codeaurora.org, Felix Fietkau Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP commit b057886524be ("ath10k: do not use coherent memory for allocated device memory chunks") replaced coherent memory allocation for memory chunks to fix low memory platforms. Unfortunately this is causing system freeze on x86 platform while bringing up qca99x0 device. The system hangs while DMA mapping bigger memory chunks (689816/865444 bytes). Fix this by limiting maximum memory chunk size to 256 KiB per request. Cc: Felix Fietkau Fixes: b057886524be ("ath10k: do not use coherent memory for allocated device memory chunks") Signed-off-by: Rajkumar Manoharan --- drivers/net/wireless/ath/ath10k/wmi.c | 6 ++++++ drivers/net/wireless/ath/ath10k/wmi.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 6279ab4a760e..7c15f65fe5ed 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -4411,6 +4411,12 @@ static int ath10k_wmi_alloc_chunk(struct ath10k *ar, u32 req_id, if (!pool_size) return -EINVAL; + if (pool_size > WMI_MAX_MEM_CHUNK_SIZE) { + num_units = WMI_MAX_MEM_CHUNK_SIZE / + round_up(unit_len, 4); + pool_size = num_units * round_up(unit_len, 4); + } + vaddr = kzalloc(pool_size, GFP_KERNEL | __GFP_NOWARN); if (!vaddr) num_units /= 2; diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 90f594e89f94..dea1f235a54d 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -6184,6 +6184,7 @@ struct wmi_roam_ev { #define ATH10K_DEFAULT_ATIM 0 #define WMI_MAX_MEM_REQS 16 +#define WMI_MAX_MEM_CHUNK_SIZE (256 * 1024) /* 256 KB */ struct wmi_scan_ev_arg { __le32 event_type; /* %WMI_SCAN_EVENT_ */