Received: by 10.223.185.116 with SMTP id b49csp970836wrg; Wed, 21 Feb 2018 09:52:43 -0800 (PST) X-Google-Smtp-Source: AH8x2279F5YQPQTMN5Q6QNbvatdZgPPD4VEkgHiQPgMTwrOsLeucvFKJXrELUq+74eja/xQgrS18 X-Received: by 2002:a17:902:3a1:: with SMTP id d30-v6mr3779868pld.409.1519235563174; Wed, 21 Feb 2018 09:52:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519235563; cv=none; d=google.com; s=arc-20160816; b=ohtJwuolQJ/HCwNG7bGrO3EODjm364xKXzLLtrZruHS5k2mlihUY74fr5hA6s5lt16 8onCldIGcjEv/tALLrRPTs0cBfCp3qcC9Cf6IkY7uvsBznCmhfm03LCJY/NNxIwzLRNn AvYKxq2ECIrMFfs+z84/MvijZ6UH3uBK18NMlbxs4TOdbxNgUxH0bPelaC4Fmucn9NXp tkgfcJvR49bhaBAFQ5Vyf2Q2EY9R4gNzv+lSkLky3Kr1ykuuyHpIU2QGR3D5fQ4hUVw0 FHCWLW3G9Ja1zt4fIFig5xMQwOGLtm0vJxp16mm+ejrNLRyvynG59F/KGbCUMGQQcCiG sQ3g== 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=MtiZxpLZQQt6+hCoQSG42T+zp24/GKcKqzcQ8R4RmYY=; b=j6/UqXBdcZMS1m9LyWhdRqMCHEoCet7MQ5nwQIhXSkaY+DwHT6M4HGj8WOqEO6oCel amJScWUJ9ykbwOND/y/Tf+p9L8csD6AsfqMfmUo2ucustPliCi2jtq3fLe6eU1tl9giZ HGWlnSGGSAnjukHYNOqJeJ2J2uZeJY8PwV2RGb9VbVdz3jDdyTgul0RloLD1e1QwF7U4 yhD+t/lOBoMnZJ8hpo2wEGQCp4pmdxUa9KHQDPS6aNXgjTsd3EHqvLEsnHLCl/wPR1X/ I1UmTSotL3Ff4rEW01yUrljiBcvtJbnadn5jAm/so5FNVpqMbDTgZJC4uavLF6wqqnKv omVA== 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 b128si74603pgc.323.2018.02.21.09.52.29; Wed, 21 Feb 2018 09:52:43 -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 S934110AbeBUMyp (ORCPT + 99 others); Wed, 21 Feb 2018 07:54:45 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34144 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932466AbeBUMyh (ORCPT ); Wed, 21 Feb 2018 07:54:37 -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 7F4AD1147; Wed, 21 Feb 2018 12:54:36 +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.9 16/77] rtlwifi: rtl8821ae: Fix connection lost problem correctly Date: Wed, 21 Feb 2018 13:48:25 +0100 Message-Id: <20180221124432.867563876@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180221124432.172390020@linuxfoundation.org> References: <20180221124432.172390020@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.9-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 @@ -1128,7 +1128,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; } @@ -1170,7 +1170,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