From patchwork Fri May 19 07:07:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 9736011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B84DC6041F for ; Fri, 19 May 2017 07:08:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94F5E28658 for ; Fri, 19 May 2017 07:08:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88824288B2; Fri, 19 May 2017 07:08:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FABF288A7 for ; Fri, 19 May 2017 07:08:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751871AbdESHH7 (ORCPT ); Fri, 19 May 2017 03:07:59 -0400 Received: from mga03.intel.com ([134.134.136.65]:63980 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753181AbdESHH5 (ORCPT ); Fri, 19 May 2017 03:07:57 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 May 2017 00:07:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,362,1491289200"; d="scan'208";a="263901239" Received: from unknown (HELO Surface-Pro-3.sh.intel.com) ([10.239.159.64]) by fmsmga004.fm.intel.com with ESMTP; 19 May 2017 00:07:49 -0700 From: Lv Zheng To: "Rafael J . Wysocki" , "Rafael J . Wysocki" , Len Brown Cc: Lv Zheng , Lv Zheng , linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH v2 2/3] ACPI / EC: Add support to skip boot stage DSDT probe Date: Fri, 19 May 2017 15:07:44 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Long time ago, Linux EC driver won't probe DSDT EC during boot. It was added by the following commit (see link #1 for bug report): Commit: c5279dee26c0e8d7c4200993bfc4b540d2469598 Subject: ACPI: EC: Add some basic check for ECDT data This is wrong as the only way to know if the DSDT EC is valid is to evaluate its _STA control method, but it's not proper to evaluate this control method that early and out of the ACPI enumeration process. But after we reverted back to the expected behavior, someone reported a regression (see link #2 for reference). On that platform, there is no ECDT, but the platform control methds access EC operation region earlier than Linux expects. Without knowing the exact device enumeration order on Windows, we in fact cannot conclude anything but can just follow the regression rule to revert to old wrong behavior to probe DSDT EC at the old position. Now we've been reported 3rd functional breakage (link #3). The safest way of solving it includes evaluating _STA. Due to the reason above, it is not such safe to evaluate _STA in acpi_ec_dsdt_probe(). In order to handle both issues (link #2 and link #3), we could just skip boot stage DSDT probe when ECDT exists. Note this change doesn't solve the reported problem, it can only be resolved by a GPE setting quirk, and without this commit but with only the GPE setting quirk, the reported problem can be solved. However, this commit can improve our code quality by making unexpected behavior less effective. Link: http://bugzilla.kernel.org/show_bug.cgi?id=11880 [#1] Link: http://bugzilla.kernel.org/show_bug.cgi?id=119261 [#2] Link: http://bugzilla.kernel.org/show_bug.cgi?id=195651 [#3] Tested-by: Daniel Drake Signed-off-by: Lv Zheng --- drivers/acpi/ec.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index a920db6..e232a1c 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -1679,6 +1679,14 @@ int __init acpi_ec_dsdt_probe(void) struct acpi_ec *ec; int ret; + /* + * If a platform has ECDT, there is no need to proceed as the + * following unsafe probe is not a part of ACPI device enumeration, + * and hence _STA is not executed. + */ + if (boot_ec) + return -ENODEV; + ec = acpi_ec_alloc(); if (!ec) return -ENOMEM;