From patchwork Mon Nov 30 19:20:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Kaneda X-Patchwork-Id: 335165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-21.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 022FEC63777 for ; Mon, 30 Nov 2020 19:48:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A749220674 for ; Mon, 30 Nov 2020 19:48:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729003AbgK3Tsd (ORCPT ); Mon, 30 Nov 2020 14:48:33 -0500 Received: from mga12.intel.com ([192.55.52.136]:18524 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726769AbgK3Tsc (ORCPT ); Mon, 30 Nov 2020 14:48:32 -0500 IronPort-SDR: ir2feVfZVrUWOpQkmHxLG+f7LPrW6JNyKyMLz8pzg2pY8Av2s9nsnQ2Wo2HYiIPuMDsZGkTFwP AfJgbkv/jbeg== X-IronPort-AV: E=McAfee;i="6000,8403,9821"; a="151954737" X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="151954737" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2020 11:47:52 -0800 IronPort-SDR: jI7g0WILlQMkHpYpzzysrNztOZF3CvBKODa9w7D3A7uwcnX4xpjfetruyRGD4HyQ8L9Dc7SoeJ kiTU+lpvBYXA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="404844865" Received: from sibelius.jf.intel.com ([10.54.75.172]) by orsmga001.jf.intel.com with ESMTP; 30 Nov 2020 11:47:52 -0800 From: Erik Kaneda To: "Rafael J . Wysocki" , ACPI Devel Maling List Cc: Bob Moore , Erik Kaneda Subject: [PATCH 1/6] ACPICA: Add 5 new UUIDs to the known UUID table Date: Mon, 30 Nov 2020 11:20:43 -0800 Message-Id: <20201130192048.3093726-2-erik.kaneda@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201130192048.3093726-1-erik.kaneda@intel.com> References: <20201130192048.3093726-1-erik.kaneda@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Bob Moore All UUID entries are related to NVDIMM and the NFIT table. ACPICA commit c114a02798dd07ccc7e51ffa4365bf039a0dd8d5 Link: https://github.com/acpica/acpica/commit/c114a027 Signed-off-by: Bob Moore Signed-off-by: Erik Kaneda --- include/acpi/acuuid.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/acpi/acuuid.h b/include/acpi/acuuid.h index 10e30a5030ee..fb7d8d1fd93c 100644 --- a/include/acpi/acuuid.h +++ b/include/acpi/acuuid.h @@ -39,6 +39,7 @@ /* NVDIMM - NFIT table */ +#define UUID_NFIT_DIMM "4309ac30-0d11-11e4-9191-0800200c9a66" #define UUID_VOLATILE_MEMORY "7305944f-fdda-44e3-b16c-3f22d252e5d0" #define UUID_PERSISTENT_MEMORY "66f0d379-b4f3-4074-ac43-0d3318b78cdb" #define UUID_CONTROL_REGION "92f701f6-13b4-405d-910b-299367e8234c" @@ -47,6 +48,10 @@ #define UUID_VOLATILE_VIRTUAL_CD "3d5abd30-4175-87ce-6d64-d2ade523c4bb" #define UUID_PERSISTENT_VIRTUAL_DISK "5cea02c9-4d07-69d3-269f-4496fbe096f9" #define UUID_PERSISTENT_VIRTUAL_CD "08018188-42cd-bb48-100f-5387d53ded3d" +#define UUID_NFIT_DIMM_N_MSFT "1ee68b36-d4bd-4a1a-9a16-4f8e53d46e05" +#define UUID_NFIT_DIMM_N_HPE1 "9002c334-acf3-4c0e-9642-a235f0d53bc6" +#define UUID_NFIT_DIMM_N_HPE2 "5008664b-b758-41a0-a03c-27c2f2d04f7e" +#define UUID_NFIT_DIMM_N_HYPERV "5746c5f2-a9a2-4264-ad0e-e4ddc9e09e80" /* Processor Properties (ACPI 6.2) */ From patchwork Mon Nov 30 19:20:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Kaneda X-Patchwork-Id: 334747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-21.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28EDDC63777 for ; Mon, 30 Nov 2020 19:48:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D1EF72063A for ; Mon, 30 Nov 2020 19:48:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729194AbgK3Tsf (ORCPT ); Mon, 30 Nov 2020 14:48:35 -0500 Received: from mga12.intel.com ([192.55.52.136]:18529 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726769AbgK3Tse (ORCPT ); Mon, 30 Nov 2020 14:48:34 -0500 IronPort-SDR: AasYzb2aURz8t85f/aY4pdnmNWeqDyeQ71OLlVYhc/zooD8Th0/DAuk92QanbvjTvyxy13rMrN WY3oZBlc8VaQ== X-IronPort-AV: E=McAfee;i="6000,8403,9821"; a="151954741" X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="151954741" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2020 11:47:54 -0800 IronPort-SDR: B6US28f6gWyR3edampRRKRGUCMpUDnvHMgLo2HZAatYUeXirgI2ozPhS51oz26ceoaT5gX+Bjt bhoZwPNHTMUQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="404844874" Received: from sibelius.jf.intel.com ([10.54.75.172]) by orsmga001.jf.intel.com with ESMTP; 30 Nov 2020 11:47:54 -0800 From: Erik Kaneda To: "Rafael J . Wysocki" , ACPI Devel Maling List Cc: Colin Ian King , Bob Moore , Erik Kaneda Subject: [PATCH 2/6] ACPICA: Remove extreaneous "the" in comments Date: Mon, 30 Nov 2020 11:20:44 -0800 Message-Id: <20201130192048.3093726-3-erik.kaneda@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201130192048.3093726-1-erik.kaneda@intel.com> References: <20201130192048.3093726-1-erik.kaneda@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Colin Ian King ACPICA commit f6eae3961bf39ad8beda70c001d1815780600e39 There are several ocurrances of "the the", remove the extraneous "the". Link: https://github.com/acpica/acpica/commit/f6eae396 Signed-off-by: Colin Ian King Signed-off-by: Bob Moore Signed-off-by: Erik Kaneda --- drivers/acpi/acpica/accommon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/acpica/accommon.h b/drivers/acpi/acpica/accommon.h index 89101e53324b..94e18bb76556 100644 --- a/drivers/acpi/acpica/accommon.h +++ b/drivers/acpi/acpica/accommon.h @@ -13,7 +13,7 @@ /* * Common set of includes for all ACPICA source files. * We put them here because we don't want to duplicate them - * in the the source code again and again. + * in the source code again and again. * * Note: The order of these include files is important. */ From patchwork Mon Nov 30 19:20:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Kaneda X-Patchwork-Id: 335163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-21.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96D64C64E8A for ; Mon, 30 Nov 2020 19:48:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 44F3D2063A for ; Mon, 30 Nov 2020 19:48:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729947AbgK3Tsp (ORCPT ); Mon, 30 Nov 2020 14:48:45 -0500 Received: from mga12.intel.com ([192.55.52.136]:18516 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729943AbgK3Tsp (ORCPT ); Mon, 30 Nov 2020 14:48:45 -0500 IronPort-SDR: 27e/4gornbpcDIF2Ax1CPInbGht5JP0bKp7YOC2dUqHH0C7LCRxhYB32sylnSqEVOYlS/TA+WZ TAgE3kk+iACQ== X-IronPort-AV: E=McAfee;i="6000,8403,9821"; a="151954743" X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="151954743" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2020 11:47:55 -0800 IronPort-SDR: xym4H3v1tT3xqB7zrJRZ4Wu3P2qlIuwTplxGNYHLBp7C/LDYc1EdmzE18/cKVxJH9bSOUplMEO gCNEGv+IgpAg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="404844886" Received: from sibelius.jf.intel.com ([10.54.75.172]) by orsmga001.jf.intel.com with ESMTP; 30 Nov 2020 11:47:55 -0800 From: Erik Kaneda To: "Rafael J . Wysocki" , ACPI Devel Maling List Cc: Hans de Goede , Erik Kaneda , Bob Moore Subject: [PATCH 3/6] ACPICA: Also handle "orphan" _REG methods for GPIO OpRegions Date: Mon, 30 Nov 2020 11:20:45 -0800 Message-Id: <20201130192048.3093726-4-erik.kaneda@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201130192048.3093726-1-erik.kaneda@intel.com> References: <20201130192048.3093726-1-erik.kaneda@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Hans de Goede ACPICA commit b9dc31e2fc67cf196fab5253a9a673bee68b2ef5 Before this commit acpi_ev_execute_reg_methods() had special handling to handle "orphan" (no matching op_region declared) _REG methods for EC nodes. On Intel Cherry Trail devices there are 2 possible ACPI op_regions for accessing GPIOs. The standard general_purpose_io op_region and the Cherry Trail specific user_defined 0x9X op_regions. Having 2 different types of op_regions leads to potential issues with checks for op_region availability, or in other words checks if _REG has been called for the op_region which the ACPI code wants to use. Except for the "orphan" EC handling, ACPICA core does not call _REG on an ACPI node which does not define an op_region matching the type being registered; and the reference design DSDT, from which most Cherry Trail DSDTs are derived, does not define general_purpose_io, nor user_defined(0x93) op_regions for the GPO2 (UID 3) device, because no pins were assigned ACPI controlled functions in the reference design. Together this leads to the perfect storm, at least on the Cherry Trail based Medion Akayo E1239T. This design does use a GPO2 pin from its ACPI code and has added the Cherry Trail specific user_defined(0x93) opregion to its GPO2 ACPI node to access this pin. But it uses a has _REG been called availability check for the standard general_purpose_io op_region. This clearly is a bug in the DSDT, but this does work under Windows. This issue leads to the intel_vbtn driver reporting the device always being in tablet-mode at boot, even if it is in laptop mode. Which in turn causes userspace to ignore touchpad events. So iow this issues causes the touchpad to not work at boot. This commit fixes this by extending the "orphan" _REG method handling to also apply to GPIO address-space handlers. Note it seems that Windows always calls "orphan" _REG methods so me may want to consider dropping the space-id check and always do "orphan" _REG method handling. Link: https://github.com/acpica/acpica/commit/b9dc31e2 Signed-off-by: Hans de Goede Signed-off-by: Erik Kaneda Signed-off-by: Bob Moore --- drivers/acpi/acpica/evregion.c | 54 +++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 738d4b231f34..a8a4c8c9b9ef 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c @@ -21,7 +21,8 @@ extern u8 acpi_gbl_default_address_spaces[]; /* Local prototypes */ static void -acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node); +acpi_ev_execute_orphan_reg_method(struct acpi_namespace_node *device_node, + acpi_adr_space_type space_id); static acpi_status acpi_ev_reg_run(acpi_handle obj_handle, @@ -684,10 +685,12 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, NULL, &info, NULL); - /* Special case for EC: handle "orphan" _REG methods with no region */ - - if (space_id == ACPI_ADR_SPACE_EC) { - acpi_ev_orphan_ec_reg_method(node); + /* + * Special case for EC and GPIO: handle "orphan" _REG methods with + * no region. + */ + if (space_id == ACPI_ADR_SPACE_EC || space_id == ACPI_ADR_SPACE_GPIO) { + acpi_ev_execute_orphan_reg_method(node, space_id); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_NAMES, @@ -760,31 +763,28 @@ acpi_ev_reg_run(acpi_handle obj_handle, /******************************************************************************* * - * FUNCTION: acpi_ev_orphan_ec_reg_method + * FUNCTION: acpi_ev_execute_orphan_reg_method * - * PARAMETERS: ec_device_node - Namespace node for an EC device + * PARAMETERS: device_node - Namespace node for an ACPI device + * space_id - The address space ID * * RETURN: None * - * DESCRIPTION: Execute an "orphan" _REG method that appears under the EC + * DESCRIPTION: Execute an "orphan" _REG method that appears under an ACPI * device. This is a _REG method that has no corresponding region - * within the EC device scope. The orphan _REG method appears to - * have been enabled by the description of the ECDT in the ACPI - * specification: "The availability of the region space can be - * detected by providing a _REG method object underneath the - * Embedded Controller device." - * - * To quickly access the EC device, we use the ec_device_node used - * during EC handler installation. Otherwise, we would need to - * perform a time consuming namespace walk, executing _HID - * methods to find the EC device. + * within the device's scope. ACPI tables depending on these + * "orphan" _REG methods have been seen for both EC and GPIO + * Operation Regions. Presumably the Windows ACPI implementation + * always calls the _REG method independent of the presence of + * an actual Operation Region with the correct address space ID. * * MUTEX: Assumes the namespace is locked * ******************************************************************************/ static void -acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node) +acpi_ev_execute_orphan_reg_method(struct acpi_namespace_node *device_node, + acpi_adr_space_type space_id) { acpi_handle reg_method; struct acpi_namespace_node *next_node; @@ -792,9 +792,9 @@ acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node) struct acpi_object_list args; union acpi_object objects[2]; - ACPI_FUNCTION_TRACE(ev_orphan_ec_reg_method); + ACPI_FUNCTION_TRACE(ev_execute_orphan_reg_method); - if (!ec_device_node) { + if (!device_node) { return_VOID; } @@ -804,7 +804,7 @@ acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node) /* Get a handle to a _REG method immediately under the EC device */ - status = acpi_get_handle(ec_device_node, METHOD_NAME__REG, ®_method); + status = acpi_get_handle(device_node, METHOD_NAME__REG, ®_method); if (ACPI_FAILURE(status)) { goto exit; /* There is no _REG method present */ } @@ -816,23 +816,23 @@ acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node) * with other space IDs to be present; but the code below will then * execute the _REG method with the embedded_control space_ID argument. */ - next_node = acpi_ns_get_next_node(ec_device_node, NULL); + next_node = acpi_ns_get_next_node(device_node, NULL); while (next_node) { if ((next_node->type == ACPI_TYPE_REGION) && (next_node->object) && - (next_node->object->region.space_id == ACPI_ADR_SPACE_EC)) { + (next_node->object->region.space_id == space_id)) { goto exit; /* Do not execute the _REG */ } - next_node = acpi_ns_get_next_node(ec_device_node, next_node); + next_node = acpi_ns_get_next_node(device_node, next_node); } - /* Evaluate the _REG(embedded_control,Connect) method */ + /* Evaluate the _REG(space_id,Connect) method */ args.count = 2; args.pointer = objects; objects[0].type = ACPI_TYPE_INTEGER; - objects[0].integer.value = ACPI_ADR_SPACE_EC; + objects[0].integer.value = space_id; objects[1].type = ACPI_TYPE_INTEGER; objects[1].integer.value = ACPI_REG_CONNECT; From patchwork Mon Nov 30 19:20:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Kaneda X-Patchwork-Id: 334746 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-21.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD52BC71155 for ; Mon, 30 Nov 2020 19:48:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7094520674 for ; Mon, 30 Nov 2020 19:48:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388020AbgK3Tss (ORCPT ); Mon, 30 Nov 2020 14:48:48 -0500 Received: from mga12.intel.com ([192.55.52.136]:18524 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388163AbgK3Tss (ORCPT ); Mon, 30 Nov 2020 14:48:48 -0500 IronPort-SDR: xvOHPqr5IAWLwORR0l/58JE0vN1OUQ9RrwiIQT4OO/XCHWgZuaZ1MN/s8y+dsLhoCBlp3y0Rol wwuRPf0Ex/dA== X-IronPort-AV: E=McAfee;i="6000,8403,9821"; a="151954748" X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="151954748" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2020 11:47:58 -0800 IronPort-SDR: RW+OQS/5NOtwe/YSKhGSScOgBmVMDU+bIrxfu/0Q4/D+2fTdZd+nsGQvDWTpfgVmyTxNZb8TUY XmJjCVn7FDgA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="404844928" Received: from sibelius.jf.intel.com ([10.54.75.172]) by orsmga001.jf.intel.com with ESMTP; 30 Nov 2020 11:47:58 -0800 From: Erik Kaneda To: "Rafael J . Wysocki" , ACPI Devel Maling List Cc: Erik Kaneda , Bob Moore Subject: [PATCH 4/6] ACPICA: Add function trace macros to improve debugging Date: Mon, 30 Nov 2020 11:20:46 -0800 Message-Id: <20201130192048.3093726-5-erik.kaneda@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201130192048.3093726-1-erik.kaneda@intel.com> References: <20201130192048.3093726-1-erik.kaneda@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org ACPICA commit 87b8dba05b4cf8c111948327023c710e2b6b5a05 The namespace repair mechanism does not have function tracing macros. Add several trace macros to improve debuggability. Link: https://github.com/acpica/acpica/commit/87b8dba0 Signed-off-by: Erik Kaneda Signed-off-by: Bob Moore --- drivers/acpi/acpica/nspredef.c | 10 +++++---- drivers/acpi/acpica/nsprepkg.c | 38 +++++++++++++++++---------------- drivers/acpi/acpica/nsrepair2.c | 24 ++++++++++++--------- 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index 0cea9c363ace..167a1c2495ab 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c @@ -71,11 +71,13 @@ acpi_ns_check_return_value(struct acpi_namespace_node *node, acpi_status status; const union acpi_predefined_info *predefined; + ACPI_FUNCTION_TRACE(ns_check_return_value); + /* If not a predefined name, we cannot validate the return object */ predefined = info->predefined; if (!predefined) { - return (AE_OK); + return_ACPI_STATUS(AE_OK); } /* @@ -83,7 +85,7 @@ acpi_ns_check_return_value(struct acpi_namespace_node *node, * validate the return object */ if ((return_status != AE_OK) && (return_status != AE_CTRL_RETURN_VALUE)) { - return (AE_OK); + return_ACPI_STATUS(AE_OK); } /* @@ -102,7 +104,7 @@ acpi_ns_check_return_value(struct acpi_namespace_node *node, if (acpi_gbl_disable_auto_repair || (!predefined->info.expected_btypes) || (predefined->info.expected_btypes == ACPI_RTYPE_ALL)) { - return (AE_OK); + return_ACPI_STATUS(AE_OK); } /* @@ -163,7 +165,7 @@ acpi_ns_check_return_value(struct acpi_namespace_node *node, node->flags |= ANOBJ_EVALUATED; } - return (status); + return_ACPI_STATUS(status); } /******************************************************************************* diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c index 237b3ddeb075..1875b1cba202 100644 --- a/drivers/acpi/acpica/nsprepkg.c +++ b/drivers/acpi/acpica/nsprepkg.c @@ -59,7 +59,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, u32 count; u32 i; - ACPI_FUNCTION_NAME(ns_check_package); + ACPI_FUNCTION_TRACE(ns_check_package); /* The package info for this name is in the next table entry */ @@ -88,14 +88,14 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, */ if (!count) { if (package->ret_info.type == ACPI_PTYPE1_VAR) { - return (AE_OK); + return_ACPI_STATUS(AE_OK); } ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, info->node_flags, "Return Package has no elements (empty)")); - return (AE_AML_OPERAND_VALUE); + return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } /* @@ -152,7 +152,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, package->ret_info. object_type1, i); if (ACPI_FAILURE(status)) { - return (status); + return_ACPI_STATUS(status); } elements++; @@ -186,7 +186,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, object_type[i], i); if (ACPI_FAILURE(status)) { - return (status); + return_ACPI_STATUS(status); } } else { /* These are the optional package elements */ @@ -198,7 +198,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, tail_object_type, i); if (ACPI_FAILURE(status)) { - return (status); + return_ACPI_STATUS(status); } } @@ -214,7 +214,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, acpi_ns_check_object_type(info, elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE(status)) { - return (status); + return_ACPI_STATUS(status); } elements++; @@ -234,7 +234,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, acpi_ns_check_object_type(info, elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE(status)) { - return (status); + return_ACPI_STATUS(status); } /* @@ -279,7 +279,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, acpi_ns_wrap_with_package(info, return_object, return_object_ptr); if (ACPI_FAILURE(status)) { - return (status); + return_ACPI_STATUS(status); } /* Update locals to point to the new package (of 1 element) */ @@ -316,7 +316,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, package->ret_info. object_type1, 0); if (ACPI_FAILURE(status)) { - return (status); + return_ACPI_STATUS(status); } /* Validate length of the UUID buffer */ @@ -326,14 +326,14 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, info->full_pathname, info->node_flags, "Invalid length for UUID Buffer")); - return (AE_AML_OPERAND_VALUE); + return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } status = acpi_ns_check_object_type(info, elements + 1, package->ret_info. object_type2, 0); if (ACPI_FAILURE(status)) { - return (status); + return_ACPI_STATUS(status); } elements += 2; @@ -350,10 +350,10 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, "Invalid internal return type in table entry: %X", package->ret_info.type)); - return (AE_AML_INTERNAL); + return_ACPI_STATUS(AE_AML_INTERNAL); } - return (status); + return_ACPI_STATUS(status); package_too_small: @@ -363,7 +363,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, "Return Package is too small - found %u elements, expected %u", count, expected_count)); - return (AE_AML_OPERAND_VALUE); + return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } /******************************************************************************* @@ -708,6 +708,8 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info, acpi_status status; u32 i; + ACPI_FUNCTION_TRACE(ns_check_package_elements); + /* * Up to two groups of package elements are supported by the data * structure. All elements in each group must be of the same type. @@ -717,7 +719,7 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info, status = acpi_ns_check_object_type(info, this_element, type1, i + start_index); if (ACPI_FAILURE(status)) { - return (status); + return_ACPI_STATUS(status); } this_element++; @@ -728,11 +730,11 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info, type2, (i + count1 + start_index)); if (ACPI_FAILURE(status)) { - return (status); + return_ACPI_STATUS(status); } this_element++; } - return (AE_OK); + return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index 125143c41bb8..24c197d91f29 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c @@ -155,15 +155,17 @@ acpi_ns_complex_repairs(struct acpi_evaluate_info *info, const struct acpi_repair_info *predefined; acpi_status status; + ACPI_FUNCTION_TRACE(ns_complex_repairs); + /* Check if this name is in the list of repairable names */ predefined = acpi_ns_match_complex_repair(node); if (!predefined) { - return (validate_status); + return_ACPI_STATUS(validate_status); } status = predefined->repair_function(info, return_object_ptr); - return (status); + return_ACPI_STATUS(status); } /****************************************************************************** @@ -344,17 +346,19 @@ acpi_ns_repair_CID(struct acpi_evaluate_info *info, u16 original_ref_count; u32 i; + ACPI_FUNCTION_TRACE(ns_repair_CID); + /* Check for _CID as a simple string */ if (return_object->common.type == ACPI_TYPE_STRING) { status = acpi_ns_repair_HID(info, return_object_ptr); - return (status); + return_ACPI_STATUS(status); } /* Exit if not a Package */ if (return_object->common.type != ACPI_TYPE_PACKAGE) { - return (AE_OK); + return_ACPI_STATUS(AE_OK); } /* Examine each element of the _CID package */ @@ -366,7 +370,7 @@ acpi_ns_repair_CID(struct acpi_evaluate_info *info, status = acpi_ns_repair_HID(info, element_ptr); if (ACPI_FAILURE(status)) { - return (status); + return_ACPI_STATUS(status); } if (original_element != *element_ptr) { @@ -380,7 +384,7 @@ acpi_ns_repair_CID(struct acpi_evaluate_info *info, element_ptr++; } - return (AE_OK); + return_ACPI_STATUS(AE_OK); } /****************************************************************************** @@ -500,7 +504,7 @@ acpi_ns_repair_HID(struct acpi_evaluate_info *info, /* We only care about string _HID objects (not integers) */ if (return_object->common.type != ACPI_TYPE_STRING) { - return (AE_OK); + return_ACPI_STATUS(AE_OK); } if (return_object->string.length == 0) { @@ -511,14 +515,14 @@ acpi_ns_repair_HID(struct acpi_evaluate_info *info, /* Return AE_OK anyway, let driver handle it */ info->return_flags |= ACPI_OBJECT_REPAIRED; - return (AE_OK); + return_ACPI_STATUS(AE_OK); } /* It is simplest to always create a new string object */ new_string = acpi_ut_create_string_object(return_object->string.length); if (!new_string) { - return (AE_NO_MEMORY); + return_ACPI_STATUS(AE_NO_MEMORY); } /* @@ -551,7 +555,7 @@ acpi_ns_repair_HID(struct acpi_evaluate_info *info, acpi_ut_remove_reference(return_object); *return_object_ptr = new_string; - return (AE_OK); + return_ACPI_STATUS(AE_OK); } /****************************************************************************** From patchwork Mon Nov 30 19:20:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Kaneda X-Patchwork-Id: 335164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-21.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3B47C71156 for ; Mon, 30 Nov 2020 19:48:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A19BF20679 for ; Mon, 30 Nov 2020 19:48:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388163AbgK3Tsu (ORCPT ); Mon, 30 Nov 2020 14:48:50 -0500 Received: from mga12.intel.com ([192.55.52.136]:18529 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388096AbgK3Tst (ORCPT ); Mon, 30 Nov 2020 14:48:49 -0500 IronPort-SDR: mYi3WqZy7MedbziwTrOI/I5s9JMOgIKoJlZ+px2eD/yz4SmAOftgm4ZxawnTKN7zSB/S8pFEbR 35OFBNhL3Mpw== X-IronPort-AV: E=McAfee;i="6000,8403,9821"; a="151954750" X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="151954750" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2020 11:47:59 -0800 IronPort-SDR: ie7J4z8JAcoY4iuiglC5306yGMx6m5FNHSM41r0yy6fXmFlJEjForEt+xbNcsIQr5kZrqm3Xm9 yWNGnFirQZiw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="404844937" Received: from sibelius.jf.intel.com ([10.54.75.172]) by orsmga001.jf.intel.com with ESMTP; 30 Nov 2020 11:47:59 -0800 From: Erik Kaneda To: "Rafael J . Wysocki" , ACPI Devel Maling List Cc: Erik Kaneda , Bob Moore Subject: [PATCH 5/6] ACPICA: Interpreter: fix memory leak by using existing buffer Date: Mon, 30 Nov 2020 11:20:47 -0800 Message-Id: <20201130192048.3093726-6-erik.kaneda@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201130192048.3093726-1-erik.kaneda@intel.com> References: <20201130192048.3093726-1-erik.kaneda@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org ACPICA commit 52d1da5dcbd79a722b70f02a1a83f04088f51ff6 There was a memory leak that ocurred when a _CID object is defined as a package containing string objects. When _CID is checked for any possible repairs, it calls a helper function to repair _HID (because _CID basically contains multiple _HID entries). The _HID repair function assumes that string objects are standalone objects that are not contained inside of any packages. The _HID repair function replaces the string object with a brand new object and attempts to delete the old object by decrementing the reference count of the old object. Strings inside of packages have a reference count of 2 so the _HID repair function leaves this object in a dangling state and causes a memory leak. Instead of allocating a brand new object and removing the old object, use the existing object when repairing the _HID object. Link: https://github.com/acpica/acpica/commit/52d1da5d Signed-off-by: Erik Kaneda Signed-off-by: Bob Moore --- drivers/acpi/acpica/nsrepair2.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index 24c197d91f29..d2c8d8279e7a 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c @@ -495,9 +495,8 @@ acpi_ns_repair_HID(struct acpi_evaluate_info *info, union acpi_operand_object **return_object_ptr) { union acpi_operand_object *return_object = *return_object_ptr; - union acpi_operand_object *new_string; - char *source; char *dest; + char *source; ACPI_FUNCTION_NAME(ns_repair_HID); @@ -518,13 +517,6 @@ acpi_ns_repair_HID(struct acpi_evaluate_info *info, return_ACPI_STATUS(AE_OK); } - /* It is simplest to always create a new string object */ - - new_string = acpi_ut_create_string_object(return_object->string.length); - if (!new_string) { - return_ACPI_STATUS(AE_NO_MEMORY); - } - /* * Remove a leading asterisk if present. For some unknown reason, there * are many machines in the field that contains IDs like this. @@ -534,7 +526,7 @@ acpi_ns_repair_HID(struct acpi_evaluate_info *info, source = return_object->string.pointer; if (*source == '*') { source++; - new_string->string.length--; + return_object->string.length--; ACPI_DEBUG_PRINT((ACPI_DB_REPAIR, "%s: Removed invalid leading asterisk\n", @@ -549,12 +541,11 @@ acpi_ns_repair_HID(struct acpi_evaluate_info *info, * "NNNN####" where N is an uppercase letter or decimal digit, and * # is a hex digit. */ - for (dest = new_string->string.pointer; *source; dest++, source++) { + for (dest = return_object->string.pointer; *source; dest++, source++) { *dest = (char)toupper((int)*source); } + return_object->string.pointer[return_object->string.length] = 0; - acpi_ut_remove_reference(return_object); - *return_object_ptr = new_string; return_ACPI_STATUS(AE_OK); } From patchwork Mon Nov 30 19:20:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Kaneda X-Patchwork-Id: 334745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-21.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85C04C63777 for ; Mon, 30 Nov 2020 19:49:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E5EF20679 for ; Mon, 30 Nov 2020 19:49:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388167AbgK3TtA (ORCPT ); Mon, 30 Nov 2020 14:49:00 -0500 Received: from mga12.intel.com ([192.55.52.136]:18516 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388096AbgK3TtA (ORCPT ); Mon, 30 Nov 2020 14:49:00 -0500 IronPort-SDR: FsK29jSdC8JmzV1v+0vozUb3tEEUqkdArzPjczhj1Hz46HnvWjVkgVhv5hBa2Zvj40WJJ+4/sJ pSVhYdAGErQA== X-IronPort-AV: E=McAfee;i="6000,8403,9821"; a="151954754" X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="151954754" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2020 11:48:01 -0800 IronPort-SDR: QnqgbhkOzej+iBScMWawlAf1LMjiji6soeJIqTjRUxSKythKG+SdtOBOFB+iQla9O+PFuXsF9+ zIbOeU4Tlqog== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,382,1599548400"; d="scan'208";a="404844953" Received: from sibelius.jf.intel.com ([10.54.75.172]) by orsmga001.jf.intel.com with ESMTP; 30 Nov 2020 11:48:01 -0800 From: Erik Kaneda To: "Rafael J . Wysocki" , ACPI Devel Maling List Cc: Bob Moore , Erik Kaneda Subject: [PATCH 6/6] ACPICA: Update version to 20201113 Date: Mon, 30 Nov 2020 11:20:48 -0800 Message-Id: <20201130192048.3093726-7-erik.kaneda@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201130192048.3093726-1-erik.kaneda@intel.com> References: <20201130192048.3093726-1-erik.kaneda@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Bob Moore ACPICA commit 090f0444238bd49f563bf80f4f3a863463dfdf78 Version 20201113. Link: https://github.com/acpica/acpica/commit/090f0444 Signed-off-by: Bob Moore Signed-off-by: Erik Kaneda --- include/acpi/acpixf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index be7de305a622..0bba8b8c350e 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -12,7 +12,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20200925 +#define ACPI_CA_VERSION 0x20201113 #include #include