* [net-2.6 PATCH 1/3] NET/e1000: Fix powering off during shutdown
@ 2009-04-16 3:43 Jeff Kirsher
2009-04-16 3:43 ` [net-2.6 PATCH 2/3] NET/e1000e: " Jeff Kirsher
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jeff Kirsher @ 2009-04-16 3:43 UTC (permalink / raw)
To: davem; +Cc: netdev, gospo, Rafael J. Wysocki, Jeff Kirsher
From: Rafael J. Wysocki <rjw@sisk.pl>
Impact: Fix
Prevent e1000 from putting the adapter into D3 during shutdown except when
we're going to power off the system, since doing that may generally cause
problems with kexec to happen (such problems were observed for igb and
forcedeth). For this purpose seperate e1000_shutdown() from e1000_suspend()
and use the appropriate PCI PM callbacks in both of them.
Signed-off-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/e1000/e1000_main.c | 46 +++++++++++++++++++++++++++++-----------
1 files changed, 33 insertions(+), 13 deletions(-)
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 4cd8b25..ef12931 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -156,8 +156,8 @@ static void e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid);
static void e1000_restore_vlan(struct e1000_adapter *adapter);
-static int e1000_suspend(struct pci_dev *pdev, pm_message_t state);
#ifdef CONFIG_PM
+static int e1000_suspend(struct pci_dev *pdev, pm_message_t state);
static int e1000_resume(struct pci_dev *pdev);
#endif
static void e1000_shutdown(struct pci_dev *pdev);
@@ -4601,7 +4601,7 @@ int e1000_set_spd_dplx(struct e1000_adapter *adapter, u16 spddplx)
return 0;
}
-static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
+static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct e1000_adapter *adapter = netdev_priv(netdev);
@@ -4664,22 +4664,18 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
ew32(WUC, E1000_WUC_PME_EN);
ew32(WUFC, wufc);
- pci_enable_wake(pdev, PCI_D3hot, 1);
- pci_enable_wake(pdev, PCI_D3cold, 1);
} else {
ew32(WUC, 0);
ew32(WUFC, 0);
- pci_enable_wake(pdev, PCI_D3hot, 0);
- pci_enable_wake(pdev, PCI_D3cold, 0);
}
e1000_release_manageability(adapter);
+ *enable_wake = !!wufc;
+
/* make sure adapter isn't asleep if manageability is enabled */
- if (adapter->en_mng_pt) {
- pci_enable_wake(pdev, PCI_D3hot, 1);
- pci_enable_wake(pdev, PCI_D3cold, 1);
- }
+ if (adapter->en_mng_pt)
+ *enable_wake = true;
if (hw->phy_type == e1000_phy_igp_3)
e1000_phy_powerdown_workaround(hw);
@@ -4693,12 +4689,29 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
pci_disable_device(pdev);
- pci_set_power_state(pdev, pci_choose_state(pdev, state));
-
return 0;
}
#ifdef CONFIG_PM
+static int e1000_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+ int retval;
+ bool wake;
+
+ retval = __e1000_shutdown(pdev, &wake);
+ 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;
+}
+
static int e1000_resume(struct pci_dev *pdev)
{
struct net_device *netdev = pci_get_drvdata(pdev);
@@ -4753,7 +4766,14 @@ static int e1000_resume(struct pci_dev *pdev)
static void e1000_shutdown(struct pci_dev *pdev)
{
- e1000_suspend(pdev, PMSG_SUSPEND);
+ bool wake;
+
+ __e1000_shutdown(pdev, &wake);
+
+ if (system_state == SYSTEM_POWER_OFF) {
+ pci_wake_from_d3(pdev, wake);
+ pci_set_power_state(pdev, PCI_D3hot);
+ }
}
#ifdef CONFIG_NET_POLL_CONTROLLER
^ permalink raw reply related [flat|nested] 6+ messages in thread* [net-2.6 PATCH 2/3] NET/e1000e: Fix powering off during shutdown 2009-04-16 3:43 [net-2.6 PATCH 1/3] NET/e1000: Fix powering off during shutdown Jeff Kirsher @ 2009-04-16 3:43 ` Jeff Kirsher 2009-04-16 9:16 ` David Miller 2009-04-16 3:44 ` [net-2.6 PATCH 3/3] NET/ixgbe: " Jeff Kirsher 2009-04-16 9:16 ` [net-2.6 PATCH 1/3] NET/e1000: " David Miller 2 siblings, 1 reply; 6+ messages in thread From: Jeff Kirsher @ 2009-04-16 3:43 UTC (permalink / raw) To: davem; +Cc: netdev, gospo, Rafael J. Wysocki, Jeff Kirsher From: Rafael J. Wysocki <rjw@sisk.pl> Impact: Fix Prevent e1000e from putting the adapter into D3 during shutdown except when we're going to power off the system, since doing that may generally cause problems with kexec to happen (such problems were observed for igb and forcedeth). For this purpose seperate e1000e_shutdown() from e1000e_suspend() and use the appropriate PCI PM callbacks in both of them. Signed-off-by: "Rafael J. Wysocki" <rjw@sisk.pl> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> --- drivers/net/e1000e/netdev.c | 59 +++++++++++++++++++++++++++++++++---------- 1 files changed, 45 insertions(+), 14 deletions(-) diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 3b0f087..1693ed1 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c @@ -4346,7 +4346,7 @@ static int e1000_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) } } -static int e1000_suspend(struct pci_dev *pdev, pm_message_t state) +static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake) { struct net_device *netdev = pci_get_drvdata(pdev); struct e1000_adapter *adapter = netdev_priv(netdev); @@ -4409,20 +4409,16 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state) ew32(WUC, E1000_WUC_PME_EN); ew32(WUFC, wufc); - pci_enable_wake(pdev, PCI_D3hot, 1); - pci_enable_wake(pdev, PCI_D3cold, 1); } else { ew32(WUC, 0); ew32(WUFC, 0); - pci_enable_wake(pdev, PCI_D3hot, 0); - pci_enable_wake(pdev, PCI_D3cold, 0); } + *enable_wake = !!wufc; + /* make sure adapter isn't asleep if manageability is enabled */ - if (adapter->flags & FLAG_MNG_PT_ENABLED) { - pci_enable_wake(pdev, PCI_D3hot, 1); - pci_enable_wake(pdev, PCI_D3cold, 1); - } + if (adapter->flags & FLAG_MNG_PT_ENABLED) + *enable_wake = true; if (adapter->hw.phy.type == e1000_phy_igp_3) e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw); @@ -4435,6 +4431,26 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state) pci_disable_device(pdev); + return 0; +} + +static void e1000_power_off(struct pci_dev *pdev, bool sleep, bool wake) +{ + if (sleep && wake) { + pci_prepare_to_sleep(pdev); + return; + } + + pci_wake_from_d3(pdev, wake); + pci_set_power_state(pdev, PCI_D3hot); +} + +static void e1000_complete_shutdown(struct pci_dev *pdev, bool sleep, + bool wake) +{ + struct net_device *netdev = pci_get_drvdata(pdev); + struct e1000_adapter *adapter = netdev_priv(netdev); + /* * The pci-e switch on some quad port adapters will report a * correctable error when the MAC transitions from D0 to D3. To @@ -4450,14 +4466,12 @@ static int e1000_suspend(struct pci_dev *pdev, pm_message_t state) pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, (devctl & ~PCI_EXP_DEVCTL_CERE)); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); + e1000_power_off(pdev, sleep, wake); pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, devctl); } else { - pci_set_power_state(pdev, pci_choose_state(pdev, state)); + e1000_power_off(pdev, sleep, wake); } - - return 0; } static void e1000e_disable_l1aspm(struct pci_dev *pdev) @@ -4486,6 +4500,18 @@ static void e1000e_disable_l1aspm(struct pci_dev *pdev) } #ifdef CONFIG_PM +static int e1000_suspend(struct pci_dev *pdev, pm_message_t state) +{ + int retval; + bool wake; + + retval = __e1000_shutdown(pdev, &wake); + if (!retval) + e1000_complete_shutdown(pdev, true, wake); + + return retval; +} + static int e1000_resume(struct pci_dev *pdev) { struct net_device *netdev = pci_get_drvdata(pdev); @@ -4549,7 +4575,12 @@ static int e1000_resume(struct pci_dev *pdev) static void e1000_shutdown(struct pci_dev *pdev) { - e1000_suspend(pdev, PMSG_SUSPEND); + bool wake = false; + + __e1000_shutdown(pdev, &wake); + + if (system_state == SYSTEM_POWER_OFF) + e1000_complete_shutdown(pdev, false, wake); } #ifdef CONFIG_NET_POLL_CONTROLLER ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [net-2.6 PATCH 2/3] NET/e1000e: Fix powering off during shutdown 2009-04-16 3:43 ` [net-2.6 PATCH 2/3] NET/e1000e: " Jeff Kirsher @ 2009-04-16 9:16 ` David Miller 0 siblings, 0 replies; 6+ messages in thread From: David Miller @ 2009-04-16 9:16 UTC (permalink / raw) To: jeffrey.t.kirsher; +Cc: netdev, gospo, rjw From: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Date: Wed, 15 Apr 2009 20:43:43 -0700 > Prevent e1000e from putting the adapter into D3 during shutdown except when > we're going to power off the system, since doing that may generally cause > problems with kexec to happen (such problems were observed for igb and > forcedeth). For this purpose seperate e1000e_shutdown() from e1000e_suspend() > and use the appropriate PCI PM callbacks in both of them. > > Signed-off-by: "Rafael J. Wysocki" <rjw@sisk.pl> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Applied. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [net-2.6 PATCH 3/3] NET/ixgbe: Fix powering off during shutdown 2009-04-16 3:43 [net-2.6 PATCH 1/3] NET/e1000: Fix powering off during shutdown Jeff Kirsher 2009-04-16 3:43 ` [net-2.6 PATCH 2/3] NET/e1000e: " Jeff Kirsher @ 2009-04-16 3:44 ` Jeff Kirsher 2009-04-16 9:16 ` David Miller 2009-04-16 9:16 ` [net-2.6 PATCH 1/3] NET/e1000: " David Miller 2 siblings, 1 reply; 6+ messages in thread From: Jeff Kirsher @ 2009-04-16 3:44 UTC (permalink / raw) To: davem; +Cc: netdev, gospo, Rafael J. Wysocki, Jeff Kirsher From: Rafael J. Wysocki <rjw@sisk.pl> Impact: Fix Prevent ixgbe from putting the adapter into D3 during shutdown except when we're going to power off the system, since doing that may generally cause problems with kexec to happen (such problems were observed for igb and forcedeth). For this purpose seperate ixgbe_shutdown() from ixgbe_suspend() and use the appropriate PCI PM callbacks in both of them. Signed-off-by: "Rafael J. Wysocki" <rjw@sisk.pl> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> --- drivers/net/ixgbe/ixgbe_main.c | 36 ++++++++++++++++++++++++++++++++---- 1 files changed, 32 insertions(+), 4 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 11fd153..febde45 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c @@ -3612,9 +3612,9 @@ static int ixgbe_resume(struct pci_dev *pdev) return 0; } - #endif /* CONFIG_PM */ -static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) + +static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) { struct net_device *netdev = pci_get_drvdata(pdev); struct ixgbe_adapter *adapter = netdev_priv(netdev); @@ -3673,18 +3673,46 @@ static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) pci_enable_wake(pdev, PCI_D3cold, 0); } + *enable_wake = !!wufc; + ixgbe_release_hw_control(adapter); pci_disable_device(pdev); - pci_set_power_state(pdev, pci_choose_state(pdev, state)); + return 0; +} + +#ifdef CONFIG_PM +static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) +{ + int retval; + bool wake; + + retval = __ixgbe_shutdown(pdev, &wake); + 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; } +#endif /* CONFIG_PM */ static void ixgbe_shutdown(struct pci_dev *pdev) { - ixgbe_suspend(pdev, PMSG_SUSPEND); + bool wake; + + __ixgbe_shutdown(pdev, &wake); + + if (system_state == SYSTEM_POWER_OFF) { + pci_wake_from_d3(pdev, wake); + pci_set_power_state(pdev, PCI_D3hot); + } } /** ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [net-2.6 PATCH 3/3] NET/ixgbe: Fix powering off during shutdown 2009-04-16 3:44 ` [net-2.6 PATCH 3/3] NET/ixgbe: " Jeff Kirsher @ 2009-04-16 9:16 ` David Miller 0 siblings, 0 replies; 6+ messages in thread From: David Miller @ 2009-04-16 9:16 UTC (permalink / raw) To: jeffrey.t.kirsher; +Cc: netdev, gospo, rjw From: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Date: Wed, 15 Apr 2009 20:44:01 -0700 > Prevent ixgbe from putting the adapter into D3 during shutdown except when > we're going to power off the system, since doing that may generally cause > problems with kexec to happen (such problems were observed for igb and > forcedeth). For this purpose seperate ixgbe_shutdown() from ixgbe_suspend() > and use the appropriate PCI PM callbacks in both of them. > > Signed-off-by: "Rafael J. Wysocki" <rjw@sisk.pl> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Applied. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [net-2.6 PATCH 1/3] NET/e1000: Fix powering off during shutdown 2009-04-16 3:43 [net-2.6 PATCH 1/3] NET/e1000: Fix powering off during shutdown Jeff Kirsher 2009-04-16 3:43 ` [net-2.6 PATCH 2/3] NET/e1000e: " Jeff Kirsher 2009-04-16 3:44 ` [net-2.6 PATCH 3/3] NET/ixgbe: " Jeff Kirsher @ 2009-04-16 9:16 ` David Miller 2 siblings, 0 replies; 6+ messages in thread From: David Miller @ 2009-04-16 9:16 UTC (permalink / raw) To: jeffrey.t.kirsher; +Cc: netdev, gospo, rjw From: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Date: Wed, 15 Apr 2009 20:43:24 -0700 > Prevent e1000 from putting the adapter into D3 during shutdown except when > we're going to power off the system, since doing that may generally cause > problems with kexec to happen (such problems were observed for igb and > forcedeth). For this purpose seperate e1000_shutdown() from e1000_suspend() > and use the appropriate PCI PM callbacks in both of them. > > Signed-off-by: "Rafael J. Wysocki" <rjw@sisk.pl> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Applied. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-04-16 9:16 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-04-16 3:43 [net-2.6 PATCH 1/3] NET/e1000: Fix powering off during shutdown Jeff Kirsher 2009-04-16 3:43 ` [net-2.6 PATCH 2/3] NET/e1000e: " Jeff Kirsher 2009-04-16 9:16 ` David Miller 2009-04-16 3:44 ` [net-2.6 PATCH 3/3] NET/ixgbe: " Jeff Kirsher 2009-04-16 9:16 ` David Miller 2009-04-16 9:16 ` [net-2.6 PATCH 1/3] NET/e1000: " David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).