From patchwork Sat Mar 5 15:11:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Bainbridge X-Patchwork-Id: 8510531 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1ED699F372 for ; Sat, 5 Mar 2016 15:16:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2308120253 for ; Sat, 5 Mar 2016 15:16:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 029072014A for ; Sat, 5 Mar 2016 15:16:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753648AbcCEPQb (ORCPT ); Sat, 5 Mar 2016 10:16:31 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:34267 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751310AbcCEPQa (ORCPT ); Sat, 5 Mar 2016 10:16:30 -0500 Received: by mail-wm0-f52.google.com with SMTP id p65so55394240wmp.1; Sat, 05 Mar 2016 07:16:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4wPOi/JddU5WCVY/AZ/9ZRTvmLf2fE+RxU/+48hgyFM=; b=Q4LfQFlqohc15nOUtcpftCrqEkerpcK73ApqLNMLYFtNPsQmd6rWayVbZm62WTvNd4 LUlOKG3+74p1egL7rQLA50ZrxEWBRVgUDH0bcuHR7ezU+hIU8rfa06eVtLIiHB7iW8Su g+RlXBnBmDhgbYCbjZ5vohC3uP7Kt0X4rBkBWzboj5dtiSQdWIHhpihd8Z2LzJ9w7/4B ok9S/xCr3mJWzijF5JRu3adWr44qw2jKNzwuYYqBNCm6zAaqGngXo21dOLIkEFl844ZD RnoU9D0sYI4w5Wr0rLCwcyHBJu2c2WFrOLtRxLJNwAQ9v5CgtGbB4NYtekDny3HBP9jX xU2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4wPOi/JddU5WCVY/AZ/9ZRTvmLf2fE+RxU/+48hgyFM=; b=aMopsMFirZgobdI/jrV2AwFaDqlnw1bB7jvJIgNfnl2UKO892ylOH9djTnaS8Yi524 q9MwHJ3ACAd/pFUvd9nRzj2J+h08VfBZa6RFs0mkDHVg3BTfSDqR/nWSLYy9a1ssc81A YXik1FLZ+4wTN1Y3SN74D0eLuHYBJbrw1AWTelNLvLQukAJJ2rEFsz2aH9F/ltdNnobx 72qCEo0k13k7c0iQ2aZECf797KWIjAj1SW6ko/YI7XzFfbp17Kqfn32WMTPjUISCkvuT PqRLUFskFt5Tu/wvCIyql+1VO0MuAdu7/9nGPHO/kCYAke6u1vlC+qGu3WeLIfXtNoS/ HB6w== X-Gm-Message-State: AD7BkJIz3fnjYVepnftopRqHEQgpyqUFt2oUGR2d9KhJ30uTGJdfBJv6gWc3yBd4TZEofw== X-Received: by 10.194.78.83 with SMTP id z19mr13998400wjw.5.1457190988869; Sat, 05 Mar 2016 07:16:28 -0800 (PST) Received: from debian.local (cpc5-sgyl32-2-0-cust224.sgyl.cable.virginm.net. [94.174.200.225]) by smtp.gmail.com with ESMTPSA id 82sm4265137wmd.4.2016.03.05.07.16.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 05 Mar 2016 07:16:27 -0800 (PST) From: Chris Bainbridge To: lv.zheng@intel.com Cc: Chris Bainbridge , robert.moore@intel.com, rafael.j.wysocki@intel.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ACPICA: Events: Execute some _REG methods in early boot Date: Sat, 5 Mar 2016 15:11:55 +0000 Message-Id: <1457190715-5851-1-git-send-email-chris.bainbridge@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <20160227190828.GA4751@localhost> References: <20160227190828.GA4751@localhost> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 The regression caused _REG methods to not be run in early boot for all space IDs, but a removed comment stated that _REG methods should be executed for IDs like embedded_controller. Before the regression this was the case: [ 0.230469] Executing Method \_SB.PCI0.LPCB.EC._REG [ 0.230531] Initializing Region \GNVS [ 0.230607] Initializing Region \_SB.PCI0.LPCB.EC.ECOR [ 0.231043] Initializing Region \_SB.PCI0.IGPU.IGDM After the regression the initialisation is not done and ODEBUG warnings are shown at boot and/or shutdown: [ 6.676570] WARNING: CPU: 0 PID: 3317 at lib/debugobjects.c:263 debug_print_object+0x85/0xa0() [ 6.676576] ODEBUG: assert_init not available (active state 0) object type: timer_list hint: stub_timer+0x0/0x20 [ 6.676578] Modules linked in: [ 6.676582] CPU: 0 PID: 3317 Comm: ccpd Not tainted 4.5.0-rc6 #509 [ 6.676584] Hardware name: Apple Inc. MacBookPro10,2/Mac-AFD8A9D944EA4843, BIOS MBP102.88Z.0106.B0A.1509130955 09/13/2015 [ 6.676586] 0000000000000000 ffff880256543db0 ffffffff814802b5 ffff880256543df8 [ 6.676590] ffffffff81f40dbd ffff880256543de8 ffffffff810bd0ec ffff880256543e90 [ 6.676594] ffffffff822532c0 ffffffff81f40e63 ffffffff83138c88 0000000001fdf040 [ 6.676598] Call Trace: [ 6.676603] [] dump_stack+0x67/0x92 [ 6.676608] [] warn_slowpath_common+0x7c/0xb0 [ 6.676611] [] warn_slowpath_fmt+0x47/0x50 [ 6.676614] [] debug_print_object+0x85/0xa0 [ 6.676616] [] ? cascade+0x70/0x70 [ 6.676620] [] debug_object_assert_init+0xf8/0x130 [ 6.676624] [] ? trace_hardirqs_on+0xd/0x10 [ 6.676626] [] del_timer+0x1f/0x70 [ 6.676631] [] laptop_sync_completion+0x61/0x100 [ 6.676633] [] ? laptop_io_completion+0x30/0x30 [ 6.676637] [] sys_sync+0x7f/0x90 [ 6.676641] [] entry_SYSCALL_64_fastpath+0x12/0x6f Fixes: efaed9be998b ("ACPICA: Events: Enhance acpi_ev_execute_reg_method() to ensure no _REG evaluations can happen during OS early boot stages") Link: https://lkml.org/lkml/2016/2/3/273 Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=112911 Signed-off-by: Chris Bainbridge --- drivers/acpi/acpica/evregion.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 47092b4d633c..d0b02ef0effa 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c @@ -590,6 +590,7 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) union acpi_operand_object *args[3]; union acpi_operand_object *region_obj2; acpi_status status; + bool sp; ACPI_FUNCTION_TRACE(ev_execute_reg_method); @@ -598,9 +599,28 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) return_ACPI_STATUS(AE_NOT_EXIST); } + /* + * For the default space_IDs, (the IDs for which there are default region handlers + * installed) Only execute the _REG methods if the global initialization _REG + * methods have already been run (via acpi_initialize_objects). In other words, + * we will defer the execution of the _REG methods for these space_IDs until + * execution of acpi_initialize_objects. This is done because we need the handlers + * for the default spaces (mem/io/pci/table) to be installed before we can run + * any control methods (or _REG methods). There is known BIOS code that depends + * on this. + * + * For all other space_IDs, we can safely execute the _REG methods immediately. + * This means that for IDs like embedded_controller, this function should be called + * only after acpi_enable_subsystem has been called. + */ + + sp = (region_obj->region.space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY || + region_obj->region.space_id == ACPI_ADR_SPACE_SYSTEM_IO || + region_obj->region.space_id == ACPI_ADR_SPACE_PCI_CONFIG || + region_obj->region.space_id == ACPI_ADR_SPACE_DATA_TABLE); if (region_obj2->extra.method_REG == NULL || region_obj->region.handler == NULL || - !acpi_gbl_reg_methods_enabled) { + (sp && !acpi_gbl_reg_methods_enabled)) { return_ACPI_STATUS(AE_OK); }