Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2731488rwd; Fri, 26 May 2023 10:20:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4P7rqewKwDN7L94pIKogIG8oxJrWOr5Zy+uCd2yJUZVeO/pfDkyS7Tdxez4PHsbJDHT2R3 X-Received: by 2002:a05:6a00:2d1f:b0:63d:45f3:9fc with SMTP id fa31-20020a056a002d1f00b0063d45f309fcmr3000876pfb.5.1685121623638; Fri, 26 May 2023 10:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685121623; cv=none; d=google.com; s=arc-20160816; b=ItBDu3zaaAH2ho1+smiuJgcQWHijJk3JxJV5Wkki+BJgal16wx+r/piqhrf9wgD2fH myHlVTB0C35ApogbMdRXiqCC/Q+tUXZ7+oU9b1Eu7MIxePdNU6OP+zAzr/Uxk4Bfz43p AYekQFGNyDcSW1fs0A3wJzwIugy2E/WNm9YAeLCflGcDK4AN/0WybhntDJaQCaon7OtB vfawS0BNgJgVzsy2WoGxJCJlw5BRjt8UOV7ezd7WflrM3sjCWSj9zrvifFKoFFmK7kuw cqq4RLulWuS8CAqejdlbwd+TYOURNTzYO+XKYjju0tpO/EUoyFsDKXlqtpaMcS+NT/K8 NJuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :feedback-id:dkim-signature:dkim-signature; bh=3H+Xr8+kBb0oLRwshP3ohk2SfeItphOtUJ4BgiDd58o=; b=EH94yESZSibleVDkCW2iE1QH0kEDWvphwo34fdC7rmZQPYY4zXKeW83rup+/mc/q2I eMMmEPpcz1LdMs1fqUET/XlgVM/tB76gCotiugyoraikfrPw89K0TRJLoc7kzTa/qgOD 5QPLwYSCf8YNGn9bfFrYyGaetkzRt7KcC9xAb4p8hOdDE8BXd4OqCB4mxS54aLPvjQ4X IuK3Un4kLwERrVELsLGiXXI0wbvgkWJVn4kCUFgPP5ePmhG4RL3q4MFmnTEk5S9tW0ez l3u2pixzP1DszyAyXV6Ikn7hB0JOCMjaFXjF+XFY1UyPqypCOEomxtbau2dV1pCGKcvF sLJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=GjduknsK; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=R3BmtsiE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z129-20020a626587000000b0064490c20e80si4276377pfb.59.2023.05.26.10.20.10; Fri, 26 May 2023 10:20:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=GjduknsK; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=R3BmtsiE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236776AbjEZRRT (ORCPT + 99 others); Fri, 26 May 2023 13:17:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230376AbjEZRRR (ORCPT ); Fri, 26 May 2023 13:17:17 -0400 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE258B2; Fri, 26 May 2023 10:17:14 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 0626F5C00C4; Fri, 26 May 2023 13:17:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Fri, 26 May 2023 13:17:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=squebb.ca; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1685121434; x= 1685207834; bh=3H+Xr8+kBb0oLRwshP3ohk2SfeItphOtUJ4BgiDd58o=; b=G jduknsKae90MfW2LyUQZfGgKk+QNKW0iUGr25IpGpV+e3YmVwOC7/8XrG2j4diBv GPS6Hd4pYABNFAk/DH/0rEfCdyg4kKwD+5Gy3lU0937wZjQlZOGiFpbrn6z9tdDy MrI4omcrIwjA2PZU2DlbS07rgKmRAt4ces9eae5dXxbj7P6lyKkm8YCObEx3UpUb Lkm+LF1pZYCGzmUqUn/RiCWZNzGHAsIOEHwYfkVd4fwBn2qxXYIubSAmD23Cg3Yw zkvbq0I5Ed7I3v8gGG+yG2GKzNsh8FTyJjCG3eLaNa8i61nNbHX0mjdVZQUm/6UA SlYS7yjX2vHNz5GFPYQdQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1685121434; x= 1685207834; bh=3H+Xr8+kBb0oLRwshP3ohk2SfeItphOtUJ4BgiDd58o=; b=R 3BmtsiEzBOBdYJrpouC8kU8xnj7T57Lc4FPIQQxWPkQ6WkXkxS6kEfsyc91R3KBF xss3DywV6Fxh3e4xWez3+oaeRRFpcqOTs3FX9LJD3pCIwWfGeUahheM9ucsDuwra W/Hpg+VDjXUUS6GbvYo6QWglPLBZ4YR2ZotU+GKRCE/9uh9zAd7e0nYR2d2FQCGI VJwBubkH5tENtC0scKvKRdgDoLA3B3xzZMgYQQ/51/rDZYIHoXwqKfSKFfRD+CxX xlm6BiLrrU8XaDKRAQNKcBKfDBo8FulAFkV7P89ivyE50oknUPQhYJ1bwjxgW7R5 y25yvmMAaykx0Nn5mHixw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeejledguddtkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecuogetfedtuddqtdduucdludehmdenucfjughrpe fhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforghrkhcurfgvrghr shhonhcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrqeenucggtf frrghtthgvrhhnpeeftddvjeefleffvefhgfejjeehudetteeigeeugfekhffhgeejudeu teehgfdvffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggr X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 26 May 2023 13:17:13 -0400 (EDT) From: Mark Pearson To: mpearson-lenovo@squebb.ca Cc: hdegoede@redhat.com, markgross@kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/5] platform/x86: think-lmi: Enable opcode support on BIOS settings Date: Fri, 26 May 2023 13:16:54 -0400 Message-Id: <20230526171658.3886-1-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Whilst reviewing some documentation from the FW team on using WMI on Lenovo system I noticed that we weren't using Opcode support when changing BIOS settings in the thinkLMI driver. We should be doing this to ensure we're future proof as the old non-opcode mechanism has been deprecated. Tested on X1 Carbon G10 and G11. Signed-off-by: Mark Pearson --- Changes in v2: Update comment for clearer explanation of what the driver is doing Changes in v3: None. Version bump with rest of series drivers/platform/x86/think-lmi.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index 1138f770149d..2745224f62ab 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -1001,7 +1001,33 @@ static ssize_t current_value_store(struct kobject *kobj, tlmi_priv.pwd_admin->save_signature); if (ret) goto out; - } else { /* Non certiifcate based authentication */ + } else if (tlmi_priv.opcode_support) { + /* + * If opcode support is present use that interface. + * Note - this sets the variable and then the password as separate + * WMI calls. Function tlmi_save_bios_settings will error if the + * password is incorrect. + */ + set_str = kasprintf(GFP_KERNEL, "%s,%s;", setting->display_name, + new_setting); + if (!set_str) { + ret = -ENOMEM; + goto out; + } + + ret = tlmi_simple_call(LENOVO_SET_BIOS_SETTINGS_GUID, set_str); + if (ret) + goto out; + + if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) { + ret = tlmi_opcode_setting("WmiOpcodePasswordAdmin", + tlmi_priv.pwd_admin->password); + if (ret) + goto out; + } + + ret = tlmi_save_bios_settings(""); + } else { /* old non opcode based authentication method (deprecated)*/ if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) { auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;", tlmi_priv.pwd_admin->password, -- 2.40.1