Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1447761rwd; Thu, 25 May 2023 12:46:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7cTHGES/66fIGLR9oJ3yEbZSUvaBFQ3wJK6Nu1P95vLmHFKjeRUk2phv9JmzHfFIux8r11 X-Received: by 2002:a05:6a00:14cb:b0:64c:ecf7:f492 with SMTP id w11-20020a056a0014cb00b0064cecf7f492mr11403973pfu.4.1685043994458; Thu, 25 May 2023 12:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685043994; cv=none; d=google.com; s=arc-20160816; b=gpgbMlwZeRFiK3mPJrd1cW8EBgNvtepG2PJbt0aDBJMOE7S+f8KnFVGwGxBGqSex39 G2dSiJlRL58UV0El3vftwFcO0yquo6OrgZlwsZ+/JBv8Sfb/UzttGQaQBeLmrkmH6Nxc KEXq+CjlgIP4FoY45TJAwjRikEQU0RJr3kWHcO4AnfzxhHSA6ynGBE4kDFpeTzsi5kO3 AokE6JvAs2QpDI/09u/bmacDyvkDZClwECAsEowZNOvsHqbFozL0byrbokdH6dD8qg3T QEkB7RG9ZHjDp8HFCMsqhK/dHI9/8JVcpYZGXt506JuKcFrdjY5ly6ORiofa+2gZGq8r sCTA== 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=2YuucB8ge+Gjjiz/CAErVcfKQLxgmGcYZa0k32yeS+o=; b=vVJbiHTeZ41VRUadqOzVFXJ9Pdu2anTCkhkTv1UA7L6jDwz8vz4LEE2q3ES9d2ebRc E9zKuBNhgDNLfLjV38w4awPJeBZCPQcsitnMuQKngEw2Av6R9MqoiGqitGc64AJuZbEg tuDeYFkLhnoX9bK4svad9lhW3p9DBupCr9NymFGHk04jWj2T1XaDL7QVd1+STQvoEwTh GnZO690p5M/8f4iYCW/d5ueu4phk4ROhjXSrNNu/WMsGcTVx3LVqtH5NH0zhJRpifAtK vAvhMhWM0GTZWPW4jPTL52G8XNfMtvAiQDNaxYxDWAEKMdO1aiKyyzoTKyMYmH+Karm/ EXkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=VNddOGdr; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=iNGvbCK7; 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 a193-20020a6390ca000000b0053ef5432117si1845066pge.461.2023.05.25.12.46.21; Thu, 25 May 2023 12:46:34 -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=VNddOGdr; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=iNGvbCK7; 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 S234499AbjEYTdk (ORCPT + 99 others); Thu, 25 May 2023 15:33:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233039AbjEYTdf (ORCPT ); Thu, 25 May 2023 15:33:35 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D949E69; Thu, 25 May 2023 12:32:59 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 255DB5C010E; Thu, 25 May 2023 15:31:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 25 May 2023 15:31:36 -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=1685043096; x= 1685129496; bh=2YuucB8ge+Gjjiz/CAErVcfKQLxgmGcYZa0k32yeS+o=; b=V NddOGdr11wVcCWiNRkYsBegF/WljAvWvksusx68y/+1/FNxd4EE7nJmHqnr/qCgD Sypzx3vSWxUHSO1cSl9dhr1NxjyuD1+osg30HIBihODpLP8GGYGUQv+XuMfDEy1g UPkT/ylzF4hGTjeqjr5TaUifsWKz//nwmvHfsM1bXKSe1RnPX6bStfphsk7POoP+ 1fhWz1rH1ha/Ib2c9Thw8646R5uE0aY3v9bqP7L1jNfPCsT+gC35NKdqQ7cMEW1m GotGxUE7iprVjIfEE01fm41JS6m/w9V0uVpSMNcwgzgo06tUY/JloeK7FyTb2oi7 vLdMPInASb4BOvifBIXbw== 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=1685043096; x= 1685129496; bh=2YuucB8ge+Gjjiz/CAErVcfKQLxgmGcYZa0k32yeS+o=; b=i NGvbCK7t0iqhF1zqVLwOYOE2BCiXEKtGx56hLHKAPclCBHKgIJWijZssastntqKt OJOCy8JIhxonAEHir8h/OCn+yQA8I8rjD28SVWcn0KZU1K6Ad7wOyITZQYCULCK8 krhYvUNpC1b3N8mjDD+/yZpWFUVAVJi0XZnk5QQI+QsIZAwH5XPlHDa4OZBKgbhL cvFMC2hAAVQ4wiDHEh8ZKc+mFZ+4W5B9Gk7KMx5T461/r3EO/r/WCUqKnA/dcIeJ UGcDIrtQcAopp1nEgGgjBrQP4G3C45/IXRG5P1WmjCWvP/lLNp3nHsTnqUIFlYrj f/oqbS1NfeEyku2jkIE7w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeejjedgudefjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecuogetfedtuddqtdduucdludehmdenucfjughrpe fhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforghrkhcurfgvrghr shhonhcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrqeenucggtf frrghtthgvrhhnpeeftddvjeefleffvefhgfejjeehudetteeigeeugfekhffhgeejudeu teehgfdvffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggr X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 25 May 2023 15:31:35 -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 1/5] platform/x86: think-lmi: Enable opcode support on BIOS settings Date: Thu, 25 May 2023 15:31:28 -0400 Message-Id: <20230525193132.3727-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,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 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