From patchwork Thu Dec 18 08:10:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emmanuel Grumbach X-Patchwork-Id: 5511461 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 732EFBEEA8 for ; Thu, 18 Dec 2014 08:11:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF8A4209EA for ; Thu, 18 Dec 2014 08:11:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D2327209DE for ; Thu, 18 Dec 2014 08:11:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752309AbaLRIL2 (ORCPT ); Thu, 18 Dec 2014 03:11:28 -0500 Received: from mail-wi0-f176.google.com ([209.85.212.176]:34198 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751965AbaLRIL0 (ORCPT ); Thu, 18 Dec 2014 03:11:26 -0500 Received: by mail-wi0-f176.google.com with SMTP id ex7so844701wid.15 for ; Thu, 18 Dec 2014 00:11:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Wgii5rbzEDQ+JkXYn0JtRJ+GdaLvTYjq4UKRxfvm7gc=; b=Iv2FlI1Ij7xe0SJ1bF6Vk6/DnIRDBBZ3/MHEEBZaXD4961VzfCUN2hFQ8CTx35iz+e AMmJ5JEi1IQrupc5zeuG9OsSzUkyFgLzJqCdAUtA6vVsR7LMc4PG9xIOHHEN5BQP0hhy 9tl9nCoNoBFMHUbVxc7srI2Iau7RqOKbiRJGVomoeuxhu/l/g0IrrR+9UT5Rs0nTAPE6 fUPcMlF/zVR7JToripiesfggS3Tk4jVUuENAEWP6SzRXYusEFbbT7dggkdIdxgKpU1lG Us9lDi5wWpkHp/qb1IMeVt1yxNFqZYO/5Le4u4JX+b09ZmsNKjW8w8wBfuHtEvFp92Mx 6qjg== X-Received: by 10.194.2.141 with SMTP id 13mr1716768wju.9.1418890285723; Thu, 18 Dec 2014 00:11:25 -0800 (PST) Received: from localhost.localdomain (93-172-128-38.bb.netvision.net.il. [93.172.128.38]) by mx.google.com with ESMTPSA id j2sm7968614wjs.28.2014.12.18.00.11.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Dec 2014 00:11:25 -0800 (PST) From: Emmanuel Grumbach To: linux-wireless@vger.kernel.org Cc: Liad Kaufman , Emmanuel Grumbach Subject: [PATCH 5/5] iwlwifi: pcie: limit fw chunk sizes given to fh Date: Thu, 18 Dec 2014 10:10:01 +0200 Message-Id: <1418890201-15177-5-git-send-email-egrumbach@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <0BA3FCBA62E2DC44AF3030971E174FB31B5CD8C0@hasmsx107.ger.corp.intel.com> References: <0BA3FCBA62E2DC44AF3030971E174FB31B5CD8C0@hasmsx107.ger.corp.intel.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Liad Kaufman New FW has chunks that are larger than the size limit of the FH's DMA. To make sure we don't crash it - actively limit the max size of each chunk. Signed-off-by: Liad Kaufman Reviewed-by: Johannes Berg Signed-off-by: Emmanuel Grumbach --- drivers/net/wireless/iwlwifi/iwl-fh.h | 1 + drivers/net/wireless/iwlwifi/pcie/trans.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h index 9564ae1..1f7f15e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fh.h +++ b/drivers/net/wireless/iwlwifi/iwl-fh.h @@ -310,6 +310,7 @@ static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) #define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) #define FH_MEM_TFDIB_REG1_ADDR_BITSHIFT 28 +#define FH_MEM_TB_MAX_LENGTH (0x00020000) /* TFDB Area - TFDs buffer table */ #define FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK (0xFFFFFFFF) diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index d151af3..523fe0c 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c @@ -614,7 +614,7 @@ static int iwl_pcie_load_section(struct iwl_trans *trans, u8 section_num, { u8 *v_addr; dma_addr_t p_addr; - u32 offset, chunk_sz = section->len; + u32 offset, chunk_sz = min_t(u32, FH_MEM_TB_MAX_LENGTH, section->len); int ret = 0; IWL_DEBUG_FW(trans, "[%d] uCode section being loaded...\n",