Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp917223pxb; Wed, 1 Sep 2021 12:37:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqnk3lrUfQWpT6z5K2YE3ano/tcrpgT1kq8WkO0wWk+/LYDww2gm/wful/ZDdD7PzI8QrC X-Received: by 2002:a17:907:3e03:: with SMTP id hp3mr1221436ejc.183.1630525070648; Wed, 01 Sep 2021 12:37:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630525070; cv=none; d=google.com; s=arc-20160816; b=wHVaEK34E5MYsCdcKpfhaJgavoVFu6bt+3DJ6uN+aZNOPDEOyPRlzn8A2WuqNxqbtj kDAxzipe+a9EZyGqWqL70wk8OGT0tEyopXfiZTcio84ab386/0sGOQUQyUia6H+x8nFF vuMt8fVMn+kksuJ/mCz/uI2TdbRncGd8AAlC9Ry9ay6mDELsFry3PEozo+lm+zqjbbQk 58/o7v4NChTtu461I6BH0B/d8wivLO8MCOzkhHF42TihTkb7fDS/kcEG+SqW24xjuKHa CiGmHUZYgG9vH1mpXOT7T+0HoHJ7oT6IHP8QqUglDtnHTH8o9HJDdRbV6srExCyLD3vx 09Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LneVWK1agL7U0uOpX73aBljXZrR1mBP4YOkKskZZdhg=; b=tUB04X5rh8Te/nQmT6WTT5bKJVcF0QPZyJ1lINPuuGKyxb2YRYNR6lI/qT82uDXcq8 +7fCzr3BSEaMqnBuMJERvKftNWgDSathY1S3L3zIbxnMIj9J/Ey7g+wyVR4Pau827n7l 1cr+ncF8K6rIUXGrqbgy5yRF70qb7sAhOhezG9+DIwM54zxnyufyUZ+kSyzcT8muTiE7 lSXa1E6z8jiqt5Rqvv/UnSLw+X9CG8NHzwcaLlVmhVHyRRDAtzESH+mNqhh4g8tQ7P5N nVFU9aPnkemfyUekkJR0PdVNEsPw3NPJ1Se/YtabhFOXuDcH+aNGunJt6lsSjuzCSBAv o0eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qUvEBpoX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m16si651026ejl.46.2021.09.01.12.37.24; Wed, 01 Sep 2021 12:37:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qUvEBpoX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344573AbhIAMmu (ORCPT + 99 others); Wed, 1 Sep 2021 08:42:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:40946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344604AbhIAMjn (ORCPT ); Wed, 1 Sep 2021 08:39:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2D1E46101B; Wed, 1 Sep 2021 12:35:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630499730; bh=poimH6i1NbijenaKXDUyGwQ5qb1RuQqXKvjO4tJGAwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qUvEBpoXwNvLRSe8Vx3gTA1ONK2sa4KNdPW0XA6c6PBhUBvFf6rXL8enJ59CYWZLR W0nQKdLdYel6EvDRmJEK/UY+o45yRgcjwQIfDiblkr9XppncMi++kVExgTNyrT6MGk 6biyZ7c1Lekyf5oMJxrnir1vCsdRNhWVWpEfmETE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yee Li , Sasha Neftin , Dvora Fuxbrumer , Tony Nguyen , Sasha Levin Subject: [PATCH 5.10 030/103] e1000e: Fix the max snoop/no-snoop latency for 10M Date: Wed, 1 Sep 2021 14:27:40 +0200 Message-Id: <20210901122301.564180487@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210901122300.503008474@linuxfoundation.org> References: <20210901122300.503008474@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sasha Neftin [ Upstream commit 44a13a5d99c71bf9e1676d9e51679daf4d7b3d73 ] We should decode the latency and the max_latency before directly compare. The latency should be presented as lat_enc = scale x value: lat_enc_d = (lat_enc & 0x0x3ff) x (1U << (5*((max_ltr_enc & 0x1c00) >> 10))) Fixes: cf8fb73c23aa ("e1000e: add support for LTR on I217/I218") Suggested-by: Yee Li Signed-off-by: Sasha Neftin Tested-by: Dvora Fuxbrumer Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/e1000e/ich8lan.c | 14 +++++++++++++- drivers/net/ethernet/intel/e1000e/ich8lan.h | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index 6fb46682b058..5f0f1bd522f0 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c @@ -1006,6 +1006,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) { u32 reg = link << (E1000_LTRV_REQ_SHIFT + E1000_LTRV_NOSNOOP_SHIFT) | link << E1000_LTRV_REQ_SHIFT | E1000_LTRV_SEND; + u16 max_ltr_enc_d = 0; /* maximum LTR decoded by platform */ + u16 lat_enc_d = 0; /* latency decoded */ u16 lat_enc = 0; /* latency encoded */ if (link) { @@ -1059,7 +1061,17 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) E1000_PCI_LTR_CAP_LPT + 2, &max_nosnoop); max_ltr_enc = max_t(u16, max_snoop, max_nosnoop); - if (lat_enc > max_ltr_enc) + lat_enc_d = (lat_enc & E1000_LTRV_VALUE_MASK) * + (1U << (E1000_LTRV_SCALE_FACTOR * + ((lat_enc & E1000_LTRV_SCALE_MASK) + >> E1000_LTRV_SCALE_SHIFT))); + + max_ltr_enc_d = (max_ltr_enc & E1000_LTRV_VALUE_MASK) * + (1U << (E1000_LTRV_SCALE_FACTOR * + ((max_ltr_enc & E1000_LTRV_SCALE_MASK) + >> E1000_LTRV_SCALE_SHIFT))); + + if (lat_enc_d > max_ltr_enc_d) lat_enc = max_ltr_enc; } diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.h b/drivers/net/ethernet/intel/e1000e/ich8lan.h index 1502895eb45d..e757896287eb 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.h +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.h @@ -274,8 +274,11 @@ /* Latency Tolerance Reporting */ #define E1000_LTRV 0x000F8 +#define E1000_LTRV_VALUE_MASK 0x000003FF #define E1000_LTRV_SCALE_MAX 5 #define E1000_LTRV_SCALE_FACTOR 5 +#define E1000_LTRV_SCALE_SHIFT 10 +#define E1000_LTRV_SCALE_MASK 0x00001C00 #define E1000_LTRV_REQ_SHIFT 15 #define E1000_LTRV_NOSNOOP_SHIFT 16 #define E1000_LTRV_SEND (1 << 30) -- 2.30.2