Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752444AbdHJLNp convert rfc822-to-8bit (ORCPT ); Thu, 10 Aug 2017 07:13:45 -0400 Received: from mga11.intel.com ([192.55.52.93]:62052 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751455AbdHJLNn (ORCPT ); Thu, 10 Aug 2017 07:13:43 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,352,1498546800"; d="scan'208";a="1002094955" From: "Zheng, Lv" To: Lukas Wunner , "Rafael J. Wysocki" CC: Linux ACPI , Mika Westerberg , Srinivas Pandruvada , Linux PCI , LKML , "Moore, Robert" Subject: RE: [PATCH 3/3] ACPI / scan: Enable GPEs before scanning the namespace Thread-Topic: [PATCH 3/3] ACPI / scan: Enable GPEs before scanning the namespace Thread-Index: AQHTEWDc9PYC2GRiNEaKPlzp7VOGt6J8hQkAgACvi5A= Date: Thu, 10 Aug 2017 07:45:44 +0000 Message-ID: <1AE640813FDE7649BE1B193DEA596E886CF078E7@SHSMSX101.ccr.corp.intel.com> References: <12346760.yAFCnkEgf6@aspire.rjw.lan> <6344941.kJ2o2XerZ0@aspire.rjw.lan> <20170810051016.GA7953@wunner.de> In-Reply-To: <20170810051016.GA7953@wunner.de> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWYyNjZiMWYtM2EzYi00YjU2LWE1NGItMTQ0ZTc0YWJmMjlhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IkZrYUlTdXU1TnJHQ3plQlc5dFZTMzA3blUxcGJ3OTIrZ3JvNVEyOGc5Mzg9In0= x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1838 Lines: 55 Hi, > From: Lukas Wunner [mailto:lukas@wunner.de] > Subject: Re: [PATCH 3/3] ACPI / scan: Enable GPEs before scanning the namespace > > On Thu, Aug 10, 2017 at 12:34:23AM +0200, Rafael J. Wysocki wrote: > > --- linux-pm.orig/drivers/acpi/scan.c > > +++ linux-pm/drivers/acpi/scan.c > > @@ -2139,6 +2139,10 @@ int __init acpi_scan_init(void) > > acpi_get_spcr_uart_addr(); > > } > > > > + acpi_gpe_apply_masked_gpes(); > > + acpi_update_all_gpes(); > > + acpi_ec_ecdt_start(); > > + > > mutex_lock(&acpi_scan_lock); > > /* > > * Enumerate devices in the ACPI namespace. > > I notice this is called from a subsys_initcall(). We scan the PCI bus > much earlier in arch/x86/kernel/early-quirks.c and it would be possible > to identify presence of Thunderbolt host controllers in an early quirk > (using the method of pci_is_thunderbolt_attached()) and, if found, > enable their GPEs or all GPEs. We have 2 choices here: 1. GPE is a part of device enumeration. GPE must be enabled one by one after making sure that all related bus/devices are powered on. But it seems there is no such relationship between GPE and bus/device in ACPI spec. However if Windows works in this way, we'll regress by applying this patch. 2. GPE is not a part of device enumeration. Then probably we can even move GPE enabling into acip_initialize_objects(), before calling acpi_ns_initialize_devices(). As after preparing ACPI namespace, _Lxx/_Exx is ready, and ACPI subsystem should be able to handle early GPEs. And ACPI subsystem's device enumeration starts from acpi_ns_initialize_devices(). So this patch should be correct in theory. ;) Thanks and best regards Lv > > Just as an aside in case your method doesn't work, I'm not affected by > this issue being a Mac user... ;-) > > Thanks, > > Lukas