Received: by 10.213.65.68 with SMTP id h4csp1121141imn; Sun, 18 Mar 2018 15:39:01 -0700 (PDT) X-Google-Smtp-Source: AG47ELvwnjHVyw0cn2YV713VUG8DDLAMNjfxnm/ENUdgcX0nfMrlkEXXzjOUMkVRCg7wUvB07UBL X-Received: by 10.101.100.9 with SMTP id a9mr7480351pgv.209.1521412741711; Sun, 18 Mar 2018 15:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521412741; cv=none; d=google.com; s=arc-20160816; b=aCXceXRu3ZrhOHqZO6Iw+b0i3ieJSvd1AwMWR/TXptI66ri5YlcHWkdv1favktuQj/ yNxXCVA1iEgac9+aeeGgV6LNaY0z7CdHAKdpIItNfvtGJadBZ4nUcD8XRmYSWm/25k5t WLXAtyK4ZdsFWXnRJE3QSbEguMXJQTO23Qufmkebr0Ht121IWMBO71mFhVmTX7esaq8W 9dyzSsn+bRom+7nPnbCRxkeHIWNKusqOO9hBjL7Y2b0ta/iBnSrAdhdqPrUsGD5G3mGM nWgn/RAj8vzg6qokBvf7cIlUYQtBCdNH5QjhY+lWbgKPwfmmIx9XmDIZHxegJgtu++yW THSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=YZ+ROqLF6EXjHieIPVZh9modVuEHA4Gx/AzQeRXkZi8=; b=df9g5kZwxv6v3VuOhI1nTDlJTAdU9rUsHvxcW1FvOPAMjTYGJ+XUUdcUTIoW4X+fU8 ssZQeATNSz1G9QR5ScevRq3i86eQeEUYdhCWFJOhaKZDi3zkRn/YDT59p3I6U0CHW7N1 gDUQUIH2T2+fXQUc8lUreLCh9EktGsUR/rgvdbnQndIrKwDDdzbN8EPN0nCIXZPPINC7 ziSAneoBal3OpqXldDfNR4QCPq1P/WKtVj+jAm8BhWbdtLf/Gn/ZBT0DprMiqBEgXn7N /bDCQqVclos4EnOUrM6qUJVOU/F5bwXgQXxwp3LwszA94njzLz1FIp3X9mRUGrvUsQn4 IL3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=W3bx+O35; 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 n6si8638447pgf.310.2018.03.18.15.38.47; Sun, 18 Mar 2018 15:39:01 -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=fail header.i=@gmail.com header.s=20161025 header.b=W3bx+O35; 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 S1754689AbeCRWgy (ORCPT + 99 others); Sun, 18 Mar 2018 18:36:54 -0400 Received: from mail-ot0-f194.google.com ([74.125.82.194]:44535 "EHLO mail-ot0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754756AbeCRWgt (ORCPT ); Sun, 18 Mar 2018 18:36:49 -0400 Received: by mail-ot0-f194.google.com with SMTP id 79-v6so15474394oth.11; Sun, 18 Mar 2018 15:36:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=YZ+ROqLF6EXjHieIPVZh9modVuEHA4Gx/AzQeRXkZi8=; b=W3bx+O355dmeHwuy+g2KBv6DcnnH4YNboPjx2MMyh2VENhN1t+9/oEKwNeBF63PlLg sDAAXflJrgaaU11KRZ0g1YbG+A/WAQIK+NNW4ZALJ6nST9X2il3vw9d3jQEOioezkCog ZtjWKZW9HmcwLQKkeBX1YBkg93K8o72GiBvZqahZj5EOL2lN2AQyLE5v5TFDCzRbOI0s /ACZI6vzguR93ZdRuPKDR7GZK00o5ftMcEoi70CJLrFJFhbvGqu7DO003/FIbP5UpEcW hP/VeKh3R7VHgJtyWc0rbq2QVKRm3d73XMxHLALSDjtYU/TraWtzhGW2LOg18Wjjx4ck V/Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=YZ+ROqLF6EXjHieIPVZh9modVuEHA4Gx/AzQeRXkZi8=; b=j6ZD80SrPdAspGEAUUJ151TmBCMeW+mLPX5ek/lLDyQ0NtRfYKtfJTiqHuqrOE00G2 VDtBuQJyXuWIBrIJwVKl2T2J9d1AN2Mr/3LsZAGmsctfWtAkunMyfGUoWLz4+YHCcJqg gD10yiqlO5LblcLaokpwxkfBgUub5zN0CxOerXkmz/uH5EXoWH9wl6Luecu0TnwDLYmC fpW1uHieNb91sKUQp1xI+Iihth/PBK/Jj7YfcrNQh5MAJow4juHYD7uIouw8U3PoWcHF wMeUBlCoXM4vh/8epPzZ1M+xy8B8+9ujnyMe2B1brTPOuJD1vnaxT1KMvM+09RuiELbL K99g== X-Gm-Message-State: AElRT7HCQcYXsCDNIDT+2i2iAtrgiIa21OB6V6ZnrtnrEVkGJ3kPboVI ZxR19YAPyMr/fk9H2luNTjHEItQjR49Rh4teGlA= X-Received: by 2002:a9d:5b44:: with SMTP id e4-v6mr5212834otj.305.1521412608135; Sun, 18 Mar 2018 15:36:48 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:9f7:0:0:0:0:0 with HTTP; Sun, 18 Mar 2018 15:36:47 -0700 (PDT) In-Reply-To: <71f9b3cb-a66b-937a-8cfc-7b9127f6f5b9@linux.intel.com> References: <20180316082320.12636-1-drake@endlessm.com> <71f9b3cb-a66b-937a-8cfc-7b9127f6f5b9@linux.intel.com> From: "Rafael J. Wysocki" Date: Sun, 18 Mar 2018 23:36:47 +0100 X-Google-Sender-Auth: r3ImCNRgKQm9AuU4pl4-oHwPl44 Message-ID: Subject: Re: Intel GemniLake xHCI connected devices can never wake up the system from suspend To: Mathias Nyman Cc: Daniel Drake , Chris Chiu , "Nyman, Mathias" , Greg Kroah-Hartman , "open list:ULTRA-WIDEBAND (UWB) SUBSYSTEM:" , Linux Upstreaming Team , Linux Kernel Mailing List , ACPI Devel Maling List , "Rafael J. Wysocki" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 16, 2018 at 10:06 AM, Mathias Nyman wrote: > Adding Rafael directly to CC > > In short, if _S3D and _S3W are missing in DSDT then a PCI device > stays in D0 during suspend in Linux, but goes to D3 in Windows. > > USB wake doesn't work in Geminilake because of this. > > Should this be changed? reasoning below. It can be changed if that doesn't cause problems to happen. > On 16.03.2018 10:23, Daniel Drake wrote: >>> >>> I've studied the ACPI spec trying to understand better, but I'm >>> struggling with the question: >>> What is the maximum number (lowest power) permitted device power state >>> for a device that is configured as able to wake the system from S3, >>> **that does not implement the _S3W method**? >> >> >> Actually the ACPI spec has an answer for the case when _S3D is present. >> The lack of clarity is only over the situation when both _S3D and _S3W >> are missing - like on the platforms being worked on here. >> >> The _S3D docs say: >>> >>> If the device can wake the system from the S3 system sleeping state (see >>> _PRW) then the device must support wake in the D-state returned by this >>> object. However, OSPM cannot assume wake from the S3 system sleeping >>> state >>> is supported in any deeper D-state unless specified by a corresponding >>> _S3W object >> >> >> Looking at the design of the existing Linux code, it seems like this >> "max = min" assignment that is causing us trouble originates directly >> from an attempt to implement that logic: if we didn't get a response from >> _S3W, then we must clamp ourselves to the data we got from _S3D. >> >> If I modify the Linux code to be a little more specific in that logic >> (only applying when we actually got something from _S3D) then the >> problematic behaviour is avoided and USB wakeups work. >> >> I feel that this change makes the Linux implementation more directly >> mirror the wording in the ACPI spec and it's associated lack of clarity >> for when both methods are missing. Thoughts? >> >> --- >> drivers/acpi/device_pm.c | 11 ++++++++--- >> 1 file changed, 8 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c >> index a4c8ad98560d..44f12c5c75ee 100644 >> --- a/drivers/acpi/device_pm.c >> +++ b/drivers/acpi/device_pm.c >> @@ -543,6 +543,7 @@ static int acpi_dev_pm_get_state(struct device *dev, >> struct acpi_device *adev, >> unsigned long long ret; >> int d_min, d_max; >> bool wakeup = false; >> + acpi_status sxd_status; >> acpi_status status; >> /* >> @@ -565,8 +566,8 @@ static int acpi_dev_pm_get_state(struct device *dev, >> struct acpi_device *adev, >> * provided if AE_NOT_FOUND is returned. >> */ >> ret = d_min; >> - status = acpi_evaluate_integer(handle, method, NULL, >> &ret); >> - if ((ACPI_FAILURE(status) && status != AE_NOT_FOUND) >> + sxd_status = acpi_evaluate_integer(handle, method, NULL, >> &ret); >> + if ((ACPI_FAILURE(sxd_status) && sxd_status != >> AE_NOT_FOUND) >> || ret > ACPI_STATE_D3_COLD) >> return -ENODATA; >> @@ -599,7 +600,11 @@ static int acpi_dev_pm_get_state(struct device >> *dev, struct acpi_device *adev, >> method[3] = 'W'; >> status = acpi_evaluate_integer(handle, method, NULL, >> &ret); >> if (status == AE_NOT_FOUND) { >> - if (target_state > ACPI_STATE_S0) >> + /* No _SxW. In this case, the ACPI spec says that >> we >> + * must not go into any power state deeper than >> the >> + * value returned from _SxD. >> + */ >> + if (sxd_status == AE_OK && target_state > >> ACPI_STATE_S0) >> d_max = d_min; >> } else if (ACPI_SUCCESS(status) && ret <= >> ACPI_STATE_D3_COLD) { >> /* Fall back to D3cold if ret is not a valid >> state. */ >> > > -- > To unsubscribe from this list: send the line "unsubscribe linux-acpi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html