Received: by 10.223.185.116 with SMTP id b49csp733434wrg; Wed, 21 Feb 2018 06:07:26 -0800 (PST) X-Google-Smtp-Source: AH8x226y0Qd/3EfevdoaP6azfgzD4XLj0NIcKg23uv3noDLO7vCTJyxDV8ij3OtASJhBNTCyoCsl X-Received: by 2002:a17:902:5914:: with SMTP id o20-v6mr3258427pli.60.1519222046285; Wed, 21 Feb 2018 06:07:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519222046; cv=none; d=google.com; s=arc-20160816; b=L91/qBzqhAU/WK4zsh38bFZw7C0Xt8lazaIa9Ksob0G5jTnUx2VdBxFVZjBgwU4YtU RLGFdAvXt/dcmx1FivM4cK5yr0qPIvgpUR/tvmMSt0YfjGHV4cDr8dBfBvVEiNl57yPc iQdRo3P9DdPvqKwY/v/0mMfk+T6kTVG/4cmlvENiFVBJDrTD0imqi3PtOSXljbeBEHJ0 KndfwL5XsC873HUoRHy4jymGOuWKfe0uIOn5z+wk9phzNbEwb7WSHNNvpioKjqs3z0uQ xQUiw3wHL7lWC4aKjKLum0n0CHmoIPIejAUShCNmE9bCLinwncqWidp2uZB7/0fuSF+l j0kQ== 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=mUNvZcXNPL58RBNz3SdqGICaZ4ChcP+IjKZNx/7h/sw=; b=Oyz5wI7YNds4kQEcXq/ixUaLP4HZnIme2WNg8G0P2QwnnDYDkvkdaW0cIGNDcrfro9 2gp7l+brLcyu8e+zNNW2uqTRsYB3IWUPhDPYXH6o40YcRVVGCiQL1JKACHWokDEaKK4Z KtEZV9wSpZJ0mUAEdcVjRGlBYctmbR9pzggxMkW3Ire5IVhK9hd3FRV4RhyIeusUDT0E iRULPcEJitBdc/yGwndhUtwTsc/Q5lHHhC3SyBAyl4Q/ZZfjK2sCZ0xOVNu5kcAiyteG hUVFWKJZVo70+/mPY9d2dlVfKKX/24raQziCXKFDsdModGDDooGXfeODU2DErxrGpdZk 1c1g== 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 w10si12018327pgr.136.2018.02.21.06.07.01; Wed, 21 Feb 2018 06:07:26 -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 S935736AbeBUND0 (ORCPT + 99 others); Wed, 21 Feb 2018 08:03:26 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:39524 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933197AbeBUNDW (ORCPT ); Wed, 21 Feb 2018 08:03:22 -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 48E6810B2; Wed, 21 Feb 2018 13:03:21 +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.14 124/167] rtlwifi: rtl8821ae: Fix connection lost problem correctly Date: Wed, 21 Feb 2018 13:48:55 +0100 Message-Id: <20180221124531.333274857@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124524.639039577@linuxfoundation.org> References: <20180221124524.639039577@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.14-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 @@ -1122,7 +1122,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; } @@ -1164,7 +1164,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