Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2574568yba; Mon, 6 May 2019 08:12:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0uLkGPWX9lm46i0zl7FSwRV3ceWu4wYv27t2fJGUZgBm4/BeIaaYsAir/RZKKxbF1pvKG X-Received: by 2002:a62:5994:: with SMTP id k20mr33645391pfj.150.1557155554076; Mon, 06 May 2019 08:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557155554; cv=none; d=google.com; s=arc-20160816; b=y9h0C5atpXgKnh26AUofTnfGKsuHuum2dOuN021zmraQIrlR7GtSkieHNUNQNMFa4F e1A1JE+FL4C76dEsaWHG+/VtnpQIQ3gP66CZpG2hM6DzjxeeUqaRqJ2MKvBTV17qnMlp VpfLr8AceV03k52z2E/Uj5HQBmcFJs4+LcwG66tQSFnjc/7PZwzetNzFAINxpOjFj7AX 4IO8EbRNemdhpSriqkb0qHcs6Q7A4Ht1UaFh23SNGvXrXadTbkthQVQxLPnDqV9dWQ+G yBq1y/PbDvtr2dSO/LhWjjGMTFyGt4a2FWDw/VFYKU1G7UckkBZo8+Cn44gTg0zZr/zV plMQ== 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=tn7ZkPiGIZUUskKi9eEmbMeY81n7ggMK9rovjetmdwE=; b=pt1JUYAybtBx5IWK9uB1izJzF//WVLqobyRKYb1fodyz6rhFtDMDy0lsbq2CLlBlAI KW7dm908faT91wpr0Eoyg2qiv5j8zjoleykiVtLgvkbpXCjegnpUy5E6fbn8luoKp5k8 uTNTYKoOa4meapclKlHWpzv89Nn8oe7eZC/KSXxyPYY+eEwgEjvNEvapzYDn4gdhM/Sh lHEsV7kqdt4/eQC4kllPRJ7VGfrL8bC3PH+1juKE7lQQBwlHOkI62/l7GHL+MC4kE3pc WfurmtmDgDW3sOwLO6JDpnGY8rwbaTqGfXjpY/YUa8QYjIuoPFA+Nys0bUugboVvOgkP bUwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TZIGyKds; 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 e34si8088248pge.252.2019.05.06.08.12.16; Mon, 06 May 2019 08:12:34 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=TZIGyKds; 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 S1726870AbfEFOfL (ORCPT + 99 others); Mon, 6 May 2019 10:35:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:55096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726861AbfEFOfK (ORCPT ); Mon, 6 May 2019 10:35:10 -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 6907C21019; Mon, 6 May 2019 14:35:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153308; bh=fOnT34oNrHlV4KUDqVYLAxQ0jQLiGfUnymj9BUE/VQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TZIGyKdsmyhIObRiaIBMdPIwPKVSwwgp241Sbd9qFxevAmo4rXU46I3D4cKI82IuP DTWtTn85mJMbXYPJtA0/Q8dyA9PzKuxAoSF1anSdFXNlgQe9Miu+6nyvmw+PvQcWaF BsV7BiqmRGf9twUjhePDFYWp4+2udgKx/+ZTGtFQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arvind Sankar , Kai-Heng Feng , Aaron Brown , Jeff Kirsher , "Sasha Levin (Microsoft)" Subject: [PATCH 5.0 040/122] igb: Fix WARN_ONCE on runtime suspend Date: Mon, 6 May 2019 16:31:38 +0200 Message-Id: <20190506143058.511439350@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@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 [ Upstream commit dabb8338be533c18f50255cf39ff4f66d4dabdbe ] The runtime_suspend device callbacks are not supposed to save configuration state or change the power state. Commit fb29f76cc566 ("igb: Fix an issue that PME is not enabled during runtime suspend") changed the driver to not save configuration state during runtime suspend, however the driver callback still put the device into a low-power state. This causes a warning in the pci pm core and results in pci_pm_runtime_suspend not calling pci_save_state or pci_finish_runtime_suspend. Fix this by not changing the power state either, leaving that to pci pm core, and make the same change for suspend callback as well. Also move a couple of defines into the appropriate header file instead of inline in the .c file. Fixes: fb29f76cc566 ("igb: Fix an issue that PME is not enabled during runtime suspend") Signed-off-by: Arvind Sankar Reviewed-by: Kai-Heng Feng Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin (Microsoft) --- .../net/ethernet/intel/igb/e1000_defines.h | 2 + drivers/net/ethernet/intel/igb/igb_main.c | 57 +++---------------- 2 files changed, 10 insertions(+), 49 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h index 01fcfc6f3415..d2e2c50ce257 100644 --- a/drivers/net/ethernet/intel/igb/e1000_defines.h +++ b/drivers/net/ethernet/intel/igb/e1000_defines.h @@ -194,6 +194,8 @@ /* enable link status from external LINK_0 and LINK_1 pins */ #define E1000_CTRL_SWDPIN0 0x00040000 /* SWDPIN 0 value */ #define E1000_CTRL_SWDPIN1 0x00080000 /* SWDPIN 1 value */ +#define E1000_CTRL_ADVD3WUC 0x00100000 /* D3 WUC */ +#define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 /* PHY PM enable */ #define E1000_CTRL_SDP0_DIR 0x00400000 /* SDP0 Data direction */ #define E1000_CTRL_SDP1_DIR 0x00800000 /* SDP1 Data direction */ #define E1000_CTRL_RST 0x04000000 /* Global reset */ diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 7137e7f9c7f3..21ccadb720d1 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -8755,9 +8755,7 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, struct e1000_hw *hw = &adapter->hw; u32 ctrl, rctl, status; u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol; -#ifdef CONFIG_PM - int retval = 0; -#endif + bool wake; rtnl_lock(); netif_device_detach(netdev); @@ -8770,14 +8768,6 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, igb_clear_interrupt_scheme(adapter); rtnl_unlock(); -#ifdef CONFIG_PM - if (!runtime) { - retval = pci_save_state(pdev); - if (retval) - return retval; - } -#endif - status = rd32(E1000_STATUS); if (status & E1000_STATUS_LU) wufc &= ~E1000_WUFC_LNKC; @@ -8794,10 +8784,6 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, } ctrl = rd32(E1000_CTRL); - /* advertise wake from D3Cold */ - #define E1000_CTRL_ADVD3WUC 0x00100000 - /* phy power management enable */ - #define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000 ctrl |= E1000_CTRL_ADVD3WUC; wr32(E1000_CTRL, ctrl); @@ -8811,12 +8797,15 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake, wr32(E1000_WUFC, 0); } - *enable_wake = wufc || adapter->en_mng_pt; - if (!*enable_wake) + wake = wufc || adapter->en_mng_pt; + if (!wake) igb_power_down_link(adapter); else igb_power_up_link(adapter); + if (enable_wake) + *enable_wake = wake; + /* Release control of h/w to f/w. If f/w is AMT enabled, this * would have already happened in close and is redundant. */ @@ -8859,22 +8848,7 @@ static void igb_deliver_wake_packet(struct net_device *netdev) static int __maybe_unused igb_suspend(struct device *dev) { - int retval; - bool wake; - struct pci_dev *pdev = to_pci_dev(dev); - - retval = __igb_shutdown(pdev, &wake, 0); - if (retval) - return retval; - - if (wake) { - pci_prepare_to_sleep(pdev); - } else { - pci_wake_from_d3(pdev, false); - pci_set_power_state(pdev, PCI_D3hot); - } - - return 0; + return __igb_shutdown(to_pci_dev(dev), NULL, 0); } static int __maybe_unused igb_resume(struct device *dev) @@ -8945,22 +8919,7 @@ static int __maybe_unused igb_runtime_idle(struct device *dev) static int __maybe_unused igb_runtime_suspend(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - int retval; - bool wake; - - retval = __igb_shutdown(pdev, &wake, 1); - if (retval) - return retval; - - if (wake) { - pci_prepare_to_sleep(pdev); - } else { - pci_wake_from_d3(pdev, false); - pci_set_power_state(pdev, PCI_D3hot); - } - - return 0; + return __igb_shutdown(to_pci_dev(dev), NULL, 1); } static int __maybe_unused igb_runtime_resume(struct device *dev) -- 2.20.1