mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Peter Wu <lekensteyn@gmail.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Bastien Traverse <bastien.traverse@gmail.com>,
	linux-kernel@vger.kernel.org, francis.moro@gmail.com,
	linux-pm@vger.kernel.org
Subject: Re: 3.12: ethernet controller missing after resuming from suspend to RAM
Date: Wed, 12 Feb 2014 00:58:07 +0100	[thread overview]
Message-ID: <1835578.EmLUpvTMQe@vostro.rjw.lan> (raw)
In-Reply-To: <8701691.z6Q6jDD18v@al>

On Tuesday, February 11, 2014 07:17:37 PM Peter Wu wrote:
> On Tuesday 11 February 2014 12:42:37 Mika Westerberg wrote:
> > On Mon, Feb 10, 2014 at 11:39:29PM +0100, Rafael J. Wysocki wrote:
> > > > _STA() returns 0x0A instead of 0x0F. Could there be something missing in
> > > > the ACPI hotplug code that overlooks this and removes the device on
> > > > resume?
> > > 
> > > That is possible.  Actually even quite likely, but let's wait for the
> > > response from Peter.
> > 
> > Here's a hack that should take the 0xa return value into consideration. It
> > turned out that this case is even mentioned in the ACPI spec.
> 
> Tested-by: Peter Wu <lekensteyn@gmail.com>
> 
> This works, the devices are not lost anymore after resume. dmesg
> mentions the 04:00.* devices at resume compared to the unpatched kernel:
> 
> [   42.650721] PM: Finishing wakeup.
> [   42.650768] acpiphp_glue: hotplug_event: Bus check notify on \_SB_.PCI0.RP03
> [   42.650772] acpiphp_glue: hotplug_event: re-enumerating slots under \_SB_.PCI0.RP03
> [   42.650874] iwlwifi 0000:05:00.0: no hotplug settings from platform
> [   42.650722] Restarting tasks ... done.
> [   42.650985] video LNXVIDEO:00: Restoring backlight state
> [   42.650988] video LNXVIDEO:01: Restoring backlight state
> [   43.124208] ACPI: \_SB_.AC__: ACPI_NOTIFY_BUS_CHECK event: unsupported
> [   43.128401] jme 0000:04:00.5: irq 50 for MSI/MSI-X
> [   43.153005] jme 0000:04:00.5 eth0: Link is down
> [   43.153030] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
> [   43.154364] iwlwifi 0000:05:00.0: L1 Enabled; Disabling L0S
> [   43.162307] iwlwifi 0000:05:00.0: Radio type=0x1-0x3-0x1
> [   43.276220] acpiphp_glue: hotplug_event: Bus check notify on \_SB_.PCI0.RP01
> [   43.276223] acpiphp_glue: hotplug_event: re-enumerating slots under \_SB_.PCI0.RP01
> [   43.276257] xhci_hcd 0000:02:00.0: no hotplug settings from platform
> [   43.276267] acpiphp_glue: hotplug_event: Bus check notify on \_SB_.PCI0.RP02
> [   43.276268] acpiphp_glue: hotplug_event: re-enumerating slots under \_SB_.PCI0.RP02
> [   43.276355] sdhci-pci 0000:04:00.0: no hotplug settings from platform
> [   43.276368] pci 0000:04:00.2: no hotplug settings from platform
> [   43.276381] jmb38x_ms 0000:04:00.3: no hotplug settings from platform
> [   43.276393] jme 0000:04:00.5: no hotplug settings from platform
> [   43.276398] acpiphp_glue: hotplug_event: Bus check notify on \_SB_.PCI0.RP03
> [   43.276399] acpiphp_glue: hotplug_event: re-enumerating slots under \_SB_.PCI0.RP03
> [   43.276491] iwlwifi 0000:05:00.0: no hotplug settings from platform
> [   43.277214] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
> 
> Rafael, do you want me to test the other patch as well?

No, thanks!

Mika, I'll add a changelog to your patch and queue it up as a fix for 3.14.

Thanks!


> > diff --git a/drivers/pci/hotplug/acpiphp_glue.c
> > b/drivers/pci/hotplug/acpiphp_glue.c index e2a783fdb98f..014381b42d86
> > 100644
> > --- a/drivers/pci/hotplug/acpiphp_glue.c
> > +++ b/drivers/pci/hotplug/acpiphp_glue.c
> > @@ -730,6 +730,17 @@ static unsigned int get_slot_status(struct acpiphp_slot
> > *slot) return (unsigned int)sta;
> >  }
> > 
> > +static inline bool device_sta_valid(unsigned long long sta)
> > +{
> > +	/*
> > +	 * ACPI spec says that _STA may return bit 0 clear with bit 8 set
> > +	 * if the device is valid but does not require device driver to be
> > +	 * loaded (chapter 6.3.7).
> > +	 */
> > +	unsigned mask = ACPI_STA_DEVICE_ENABLED | ACPI_STA_DEVICE_FUNCTIONING;
> > +	return (sta & mask) == mask;
> > +}
> > +
> >  /**
> >   * trim_stale_devices - remove PCI devices that are not responding.
> >   * @dev: PCI device to start walking the hierarchy from.
> > @@ -745,7 +756,7 @@ static void trim_stale_devices(struct pci_dev *dev)
> >  		unsigned long long sta;
> > 
> >  		status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
> > -		alive = (ACPI_SUCCESS(status) && sta == ACPI_STA_ALL)
> > +		alive = (ACPI_SUCCESS(status) && device_sta_valid(sta))
> > 
> >  			|| acpiphp_no_hotplug(handle);
> > 
> >  	}
> >  	if (!alive) {
> > @@ -792,7 +803,7 @@ static void acpiphp_check_bridge(struct acpiphp_bridge
> > *bridge) mutex_lock(&slot->crit_sect);
> >  		if (slot_no_hotplug(slot)) {
> >  			; /* do nothing */
> > -		} else if (get_slot_status(slot) == ACPI_STA_ALL) {
> > +		} else if (device_sta_valid(get_slot_status(slot))) {
> >  			/* remove stale devices if any */
> >  			list_for_each_entry_safe_reverse(dev, tmp,
> >  							 &bus->devices, bus_list)
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2014-02-11 23:43 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-05 23:42 Bastien Traverse
2014-02-06  7:38 ` Francis Moreau
2014-02-06 12:40   ` Rafael J. Wysocki
2014-02-06 13:33     ` Francis Moreau
2014-02-06 23:15     ` Bastien Traverse
2014-02-07  7:29       ` Francis Moreau
2014-02-06 21:08 ` Peter Wu
2014-02-06 23:28   ` Rafael J. Wysocki
2014-02-06 23:27     ` Peter Wu
2014-02-06 23:48       ` Rafael J. Wysocki
2014-02-07 13:43         ` Peter Wu
2014-02-08 15:01           ` Rafael J. Wysocki
2014-02-08 21:34             ` Peter Wu
2014-02-09 21:46               ` Rafael J. Wysocki
2014-02-09 23:18                 ` Peter Wu
2014-02-10  0:52                   ` Rafael J. Wysocki
2014-02-10  1:15                     ` Peter Wu
2014-02-10 12:10                       ` Rafael J. Wysocki
2014-02-10 12:20                         ` Mika Westerberg
2014-02-10 22:39                           ` Rafael J. Wysocki
2014-02-11 10:42                             ` Mika Westerberg
2014-02-11 12:57                               ` Rafael J. Wysocki
2014-02-11 18:17                               ` Peter Wu
2014-02-11 23:58                                 ` Rafael J. Wysocki [this message]
2014-02-12  7:44                                   ` Francis Moreau
2014-02-12 14:04                                     ` Rafael J. Wysocki
2014-02-18 12:18                                       ` Bastien Traverse
2014-02-12  9:21                                   ` Mika Westerberg
2014-02-06 23:41     ` Bastien Traverse
2014-02-07  1:19       ` Rafael J. Wysocki
2014-02-09 18:44         ` Bastien Traverse
2014-02-09 22:07           ` Peter Wu
2014-02-11 18:14             ` Bastien Traverse
2014-02-10  8:17           ` Francis Moreau
  -- strict thread matches above, loose matches on Subject: below --
2013-12-12  8:00 Francis Moreau
2013-12-12  9:28 ` Francis Moreau
2013-12-12 14:57 ` Rafael J. Wysocki
2013-12-12 17:43   ` Francis Moreau
2013-12-12 17:58     ` Rafael J. Wysocki
2013-12-12 19:17       ` Francis Moreau
2013-12-17  8:05         ` Francis Moreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1835578.EmLUpvTMQe@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=bastien.traverse@gmail.com \
    --cc=francis.moro@gmail.com \
    --cc=lekensteyn@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome