From patchwork Tue Feb 11 10:42:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 3626161 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DE5739F382 for ; Tue, 11 Feb 2014 10:35:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1D652201FB for ; Tue, 11 Feb 2014 10:35:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 262C220171 for ; Tue, 11 Feb 2014 10:35:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751108AbaBKKfe (ORCPT ); Tue, 11 Feb 2014 05:35:34 -0500 Received: from mga14.intel.com ([143.182.124.37]:41035 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751053AbaBKKfd (ORCPT ); Tue, 11 Feb 2014 05:35:33 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by azsmga102.ch.intel.com with ESMTP; 11 Feb 2014 02:35:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,825,1384329600"; d="scan'208";a="473322302" Received: from lahna.fi.intel.com ([10.237.72.166]) by fmsmga001.fm.intel.com with ESMTP; 11 Feb 2014 02:35:30 -0800 Received: from westeri by lahna.fi.intel.com with local (Exim 4.77) (envelope-from ) id 1WDAnW-0004wl-4s; Tue, 11 Feb 2014 12:42:38 +0200 Date: Tue, 11 Feb 2014 12:42:37 +0200 From: Mika Westerberg To: "Rafael J. Wysocki" Cc: Peter Wu , Bastien Traverse , 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 Message-ID: <20140211104237.GE18029@intel.com> References: <52F2CC7B.80406@gmail.com> <1747020.MhBDqPO9oJ@vostro.rjw.lan> <20140210122035.GY18029@intel.com> <4302366.hs31VgE4VT@vostro.rjw.lan> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4302366.hs31VgE4VT@vostro.rjw.lan> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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)