Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1033753ybt; Fri, 19 Jun 2020 22:20:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeSa3JBPVRSPSzq/+839NMQMj6TwSvPK+Xv/hGl+a4rslYnYqZF/e1thtAVUOeE5WGwGsS X-Received: by 2002:a17:906:3456:: with SMTP id d22mr6543910ejb.358.1592630415810; Fri, 19 Jun 2020 22:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592630415; cv=none; d=google.com; s=arc-20160816; b=A9i2liRu77MePsyeClYmbQ96cUguxwM5p2757yS7XUMjntKYFqbfocSn6Ft0Pha07H oXJEnJ965JYtoIITsCsgUeWp7AgjlZBZu0sNfeUaqOPhf0UzDYo5BYmVONrWNctZ8JE/ NBE8hF68nWYXx+RQi+GeVbRY3FpMJqDS0GFBzQbFS9NWWhOZ18TNHU3TS2ZdZ5ig5gwb MOhYTlEO7/4T4h3snLDtUgIRE/p1oN5K/TxPhpaXz0HbIGzt4viBtsK/BWLNvGNBNMuL yNxJxvhLzh+IQrswdE+aB5mWYNqQYTZNiqQn2eNOfTG0+1FpfgzDWPORZpiMVpvQsKwn rqUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J5ScpbWsD7nE/QH50Rzi2+ul/6+pDxPNhMb9dUfgN8U=; b=paAZAtVuu+NKgO9jdFn4oCnXk6WUuxccUNILGHr8j2BZgl10ZltlWDh4ZAyNkvuUu1 FVPh+67l6gIAg4sGuMcfdMiG3GO5+Vv7EVRasBTQpLu4i6lm0ROGSV2358HP3LVAcwxK rWqU7YXsHp7lrdq+WpmFllVVQvrVZ7WFnRsHQ7TVNK+3isvhMBmL2SEEpFrExthhG+X9 7eh5pO/I+mzPwK7loUdXYtZZ8J8+t/0v+XR3kvwMW1GijuUZpXuMTusRUjLfREyDu36u TyUyA7yXjp4SnP2VurHfZWvEJ8eyJyhMBwBsvL0DqAPxOgu8BZXCf75+8NgCyPtojIn3 dixA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eXyeRbNO; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s9si5142892ejq.422.2020.06.19.22.19.52; Fri, 19 Jun 2020 22:20:15 -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=@kernel.org header.s=default header.b=eXyeRbNO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390546AbgFSQQW (ORCPT + 99 others); Fri, 19 Jun 2020 12:16:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:59906 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390958AbgFSPDG (ORCPT ); Fri, 19 Jun 2020 11:03:06 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 30E80206DB; Fri, 19 Jun 2020 15:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578985; bh=YTXT8grH/sr/BUaAj3D5RuOd32qqzSywBujC0D38cBs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eXyeRbNOChIFheUHs0JdvlBjthU16kY+m4pMaxYpBsxmBtLjKd4QFcLmGKCp4V4cP Orgo+qpIYB9f7tt6DF6IVm0eMOcyESbFiGT6Ce/YIM7AKje6Y7e3FxXqhoi9RVf+JI zHJXUPm874gPcz/qaZZ2NyKqqhHrwoywcqXs/8T0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Punit Agrawal , Alexander Duyck , Aaron Brown , Jeff Kirsher Subject: [PATCH 4.19 233/267] e1000e: Relax condition to trigger reset for ME workaround Date: Fri, 19 Jun 2020 16:33:38 +0200 Message-Id: <20200619141659.894856054@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Punit Agrawal commit d601afcae2febc49665008e9a79e701248d56c50 upstream. It's an error if the value of the RX/TX tail descriptor does not match what was written. The error condition is true regardless the duration of the interference from ME. But the driver only performs the reset if E1000_ICH_FWSM_PCIM2PCI_COUNT (2000) iterations of 50us delay have transpired. The extra condition can lead to inconsistency between the state of hardware as expected by the driver. Fix this by dropping the check for number of delay iterations. While at it, also make __ew32_prepare() static as it's not used anywhere else. CC: stable Signed-off-by: Punit Agrawal Reviewed-by: Alexander Duyck Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/e1000e/e1000.h | 1 - drivers/net/ethernet/intel/e1000e/netdev.c | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) --- a/drivers/net/ethernet/intel/e1000e/e1000.h +++ b/drivers/net/ethernet/intel/e1000e/e1000.h @@ -574,7 +574,6 @@ static inline u32 __er32(struct e1000_hw #define er32(reg) __er32(hw, E1000_##reg) -s32 __ew32_prepare(struct e1000_hw *hw); void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val); #define ew32(reg, val) __ew32(hw, E1000_##reg, (val)) --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -119,14 +119,12 @@ static const struct e1000_reg_info e1000 * has bit 24 set while ME is accessing MAC CSR registers, wait if it is set * and try again a number of times. **/ -s32 __ew32_prepare(struct e1000_hw *hw) +static void __ew32_prepare(struct e1000_hw *hw) { s32 i = E1000_ICH_FWSM_PCIM2PCI_COUNT; while ((er32(FWSM) & E1000_ICH_FWSM_PCIM2PCI) && --i) udelay(50); - - return i; } void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val) @@ -607,11 +605,11 @@ static void e1000e_update_rdt_wa(struct { struct e1000_adapter *adapter = rx_ring->adapter; struct e1000_hw *hw = &adapter->hw; - s32 ret_val = __ew32_prepare(hw); + __ew32_prepare(hw); writel(i, rx_ring->tail); - if (unlikely(!ret_val && (i != readl(rx_ring->tail)))) { + if (unlikely(i != readl(rx_ring->tail))) { u32 rctl = er32(RCTL); ew32(RCTL, rctl & ~E1000_RCTL_EN); @@ -624,11 +622,11 @@ static void e1000e_update_tdt_wa(struct { struct e1000_adapter *adapter = tx_ring->adapter; struct e1000_hw *hw = &adapter->hw; - s32 ret_val = __ew32_prepare(hw); + __ew32_prepare(hw); writel(i, tx_ring->tail); - if (unlikely(!ret_val && (i != readl(tx_ring->tail)))) { + if (unlikely(i != readl(tx_ring->tail))) { u32 tctl = er32(TCTL); ew32(TCTL, tctl & ~E1000_TCTL_EN);