Received: by 10.223.185.116 with SMTP id b49csp924270wrg; Wed, 21 Feb 2018 09:06:25 -0800 (PST) X-Google-Smtp-Source: AH8x227A3fvgwNNNaiG+WXmgXEmmbqLtQrUg1xbwtKPmljVFKwF0qOPgwvEpVJPvWK/YLLws8XKJ X-Received: by 2002:a17:902:7b98:: with SMTP id w24-v6mr3757563pll.328.1519232785686; Wed, 21 Feb 2018 09:06:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519232785; cv=none; d=google.com; s=arc-20160816; b=egOZ+QDnunmxHVsS6LYzh/vWkmqoq9aQ0d1msVaK5DiTZweWS7PhUPfJwPWKgTazI0 pkoAMFra9gn6qvAJjpyGvg4qa03f3HKKWxNV+jW0NFU0OnVuviEnDMBEj1Uh2J/d1+AO DTUtAUo+rjvgUvZXy9PrtY2By2hQXGDuY9Y7UmA+0rwMMAvTXVph4tFxoSgOzHCfGRhq L6MRhRWj8lcLohUfZ3KAN34drGdkZJ7HYTMYb6TEcrF/UCGHrKIr8wYJc9FAHrxAHIWF IvDKGXKg6e/RgghwukCR7QvBUvNs60dVh48Kj4o0QuBqry2/X0o9ARn4dypRcrlo9xoA tAig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=nOCv7FM9fNQdDqeELq0L1sDpTnbUIQflkRN64t8x7k4=; b=Kyz9YYGIPQykzq3KTxyFtFSGGWbtpVfaPqF/zEcc4WcBP+eEEhpN7SeANSIzonD44J fUirickzHVCPU+KDS2oHDUHLW162yhAg1XA5ebOhyLiOv8j1QL6dqn32urclqiLpC2jd JMPIoLIjJZ3H3bfd2AwXR4PbkkWZ36jkOsOVcBlFNtJMFqcFygYZOclLZxpNlX39CFYQ kV4PtQ6lIRCmggJxjxHvemzEOV5sKruqHFxJYTSJDuDgw0z0HwXi0bLpoYrVWw9Urm0R n0Wp/dA3grwQbhkUJMW/bholmX9A+fIpWJ7t7nMtpq3wIvN9giYZCZ9PrWOgujS06tDu k+Kg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 8si294665pfk.60.2018.02.21.09.06.02; Wed, 21 Feb 2018 09:06:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933801AbeBUMpo (ORCPT + 99 others); Wed, 21 Feb 2018 07:45:44 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:59142 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933767AbeBUMpl (ORCPT ); Wed, 21 Feb 2018 07:45:41 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 097951230; Wed, 21 Feb 2018 12:45:40 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Larry Finger , Kalle Valo Subject: [PATCH 4.4 18/33] rtlwifi: rtl8821ae: Fix connection lost problem correctly Date: Wed, 21 Feb 2018 13:45:01 +0100 Message-Id: <20180221124410.563533089@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124409.564661689@linuxfoundation.org> References: <20180221124409.564661689@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Larry Finger commit c713fb071edc0efc01a955f65a006b0e1795d2eb upstream. There has been a coding error in rtl8821ae since it was first introduced, namely that an 8-bit register was read using a 16-bit read in _rtl8821ae_dbi_read(). This error was fixed with commit 40b368af4b75 ("rtlwifi: Fix alignment issues"); however, this change led to instability in the connection. To restore stability, this change was reverted in commit b8b8b16352cd ("rtlwifi: rtl8821ae: Fix connection lost problem"). Unfortunately, the unaligned access causes machine checks in ARM architecture, and we were finally forced to find the actual cause of the problem on x86 platforms. Following a suggestion from Pkshih , it was found that increasing the ASPM L1 latency from 0 to 7 fixed the instability. This parameter was varied to see if a smaller value would work; however, it appears that 7 is the safest value. A new symbol is defined for this quantity, thus it can be easily changed if necessary. Fixes: b8b8b16352cd ("rtlwifi: rtl8821ae: Fix connection lost problem") Cc: Stable # 4.14+ Fix-suggested-by: Pkshih Signed-off-by: Larry Finger Tested-by: James Cameron # x86_64 OLPC NL3 Signed-off-by: Kalle Valo Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c | 5 +++-- drivers/net/wireless/realtek/rtlwifi/wifi.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c @@ -1127,7 +1127,7 @@ static u8 _rtl8821ae_dbi_read(struct rtl } if (0 == tmp) { read_addr = REG_DBI_RDATA + addr % 4; - ret = rtl_read_word(rtlpriv, read_addr); + ret = rtl_read_byte(rtlpriv, read_addr); } return ret; } @@ -1169,7 +1169,8 @@ static void _rtl8821ae_enable_aspm_back_ } tmp = _rtl8821ae_dbi_read(rtlpriv, 0x70f); - _rtl8821ae_dbi_write(rtlpriv, 0x70f, tmp | BIT(7)); + _rtl8821ae_dbi_write(rtlpriv, 0x70f, tmp | BIT(7) | + ASPM_L1_LATENCY << 3); tmp = _rtl8821ae_dbi_read(rtlpriv, 0x719); _rtl8821ae_dbi_write(rtlpriv, 0x719, tmp | BIT(3) | BIT(4)); --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h @@ -99,6 +99,7 @@ #define RTL_USB_MAX_RX_COUNT 100 #define QBSS_LOAD_SIZE 5 #define MAX_WMMELE_LENGTH 64 +#define ASPM_L1_LATENCY 7 #define TOTAL_CAM_ENTRY 32