Received: by 10.223.185.116 with SMTP id b49csp697802wrg; Wed, 21 Feb 2018 05:35:05 -0800 (PST) X-Google-Smtp-Source: AH8x22773meoBfAq2DubKZyfh78LCPt/qJ0n6pEgFzyjdb2FoixTmmNN/RTEDbRSzI8iSiwjyZLQ X-Received: by 2002:a17:902:654a:: with SMTP id d10-v6mr2518427pln.117.1519220105072; Wed, 21 Feb 2018 05:35:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519220105; cv=none; d=google.com; s=arc-20160816; b=P1almBbLlwJDrmtoAztsFASp1sZOrdhCojwjenVWNaSSN8Lqq1ghHYc1XOf1Etw1yd +ogtzwLutecbO4oO+P30Us/6UAa6lsqo4bgAPF+mm2N1IagmVyLVNN414CJ2HPnokEO6 mbsg8dxjb0i+NPfSYvk9dKUpOUdz90J2n/EejKh7wU2x5JgkT/w//wKr1KeVBDb35inJ m8ttw+DTk5jb1ObTzVhD4K104o2xit//cr8UMkzvbr5ivtDUUqPJFcqD2UaZZMqoIC1e WxHeaQhCZJCJ11wqcehntwYerjkYpdBH2uWjD41pvKG+Z/NLJXzIZ8a3dIioVNPQSibG kLXg== 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=NdzJwEZq5tbb2GGhsLJLdk7tBNMa8z0lmtzIKTUeE6Y=; b=xHHSuDMI27/y6Ey+pOVQZbDdDWSxVo/1oFyl9YgWLkSVCEj7iYL4czHu0FFcHijEB7 B+kDrkEePcFRSEKHm/+wfl52quzLrbsRxGb5z0PCINkm0VtKF+wKnadEU0PsjL3Mdn2e SW+zp9BBOAyeehn6Ws2ByK3IjXEbYKrQJFLGqEW/jfpjbNbaCTeUTV8D9LP2eHecp91Q OAewWpfYUiXBFmfOUfFFwQ9pOH2tpm89G78/lSVe4BiyumuUP91WN2D2n/YT7ev8r6me 81TO+QoubJ4szO645tmMd5I7YB6G/meVr00m2Obe4ICqkANnXIUyDZ4GXOmfMTsl8NoG xMqw== 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 x7si14080565pfb.298.2018.02.21.05.34.50; Wed, 21 Feb 2018 05:35:05 -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 S936408AbeBUNLc (ORCPT + 99 others); Wed, 21 Feb 2018 08:11:32 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44882 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753611AbeBUNL1 (ORCPT ); Wed, 21 Feb 2018 08:11:27 -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 8461C89C; Wed, 21 Feb 2018 13:11:26 +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.15 127/163] rtlwifi: rtl8821ae: Fix connection lost problem correctly Date: Wed, 21 Feb 2018 13:49:16 +0100 Message-Id: <20180221124537.155053230@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124529.931834518@linuxfoundation.org> References: <20180221124529.931834518@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.15-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 @@ -1123,7 +1123,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; } @@ -1165,7 +1165,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