From patchwork Thu Jun 1 20:05:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Pearson X-Patchwork-Id: 102169 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp586422vqr; Thu, 1 Jun 2023 13:11:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6NfTS81euWPYsEAIJwTg29XKAc8nJ37zaB+c39lQwfyx0EVdIa9w9/9Tvm4i9DEGMuSBy1 X-Received: by 2002:a17:90a:4142:b0:256:23f:abc5 with SMTP id m2-20020a17090a414200b00256023fabc5mr379204pjg.10.1685650282588; Thu, 01 Jun 2023 13:11:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685650282; cv=none; d=google.com; s=arc-20160816; b=dBk8dBvVPKjk3eQuhFmbuPYG6YeQvfUiL2TMCars7ugmFhC3vtMTIo+ASZlgeo5oW7 4Esspmy7GIKvb4aDYniwGxSHyVD88nx3sx/mvwqgSgDw0ftBsUaXgnLaTdYJliyb0di4 v7ErPTemq9oxvm/f8czFqnkjiPrgywF4aUUCViBAubo9Z8Eqdpz3nvDDalg9rmCZ1VsA uNxnlhwzUeIgJT+OesieIOifE4hX3+8LaCI17LbVTgbCAXBmHhReWfYdAwHD2pPJdWRO HSSEFpDePilejC7vU7iwV0ZIoHMIyV03LP+xPnI7Kv0GnO/GYetc9SFpmK9En0OJDodw 0e+Q== 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=wwrl/88jn/a0BD/DhG3Tosh5K8gTAwVmFmge7TvKrps=; b=IFQIbGmDg7FHI5b+hR01b4tnREPA8zt3oeb5CguMaugs42+vcfd3Uap8U3QymriL1Z zlMSDYxZbBoKlieOvCsaCgc5JF8JGCqNuLTG23iOUgPtmFIKig+w+r/LY52/v/NvfTA7 aO7ulSxH22vqxyYjtH8diCKFGu7djidlW8d7S2Obyz2JyHTE8Mc3pz/xO/rWyL7tnryi 8k/uIhPhFyBDFKhpWAwqF3gFJMHRooogQx/b4tKh5SN2kvg6Hi7/kDKKqV+P9RfpvoZi LgiSHjsiEU9OeqIT6r4s85p+c1QkL89nEaEZFCv6NHc8/6Lxy12KqUtVOzioWLF5vo/D h7PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=BuY+uBQF; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=rifA9ljK; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p22-20020a17090b011600b002563e365aeasi1631468pjz.53.2023.06.01.13.11.09; Thu, 01 Jun 2023 13:11:22 -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=BuY+uBQF; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=rifA9ljK; 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 S231303AbjFAUGG (ORCPT + 99 others); Thu, 1 Jun 2023 16:06:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbjFAUGB (ORCPT ); Thu, 1 Jun 2023 16:06:01 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22456133; Thu, 1 Jun 2023 13:05:59 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 96B8C3200923; Thu, 1 Jun 2023 16:05:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 01 Jun 2023 16:05:57 -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=1685649956; x= 1685736356; bh=wwrl/88jn/a0BD/DhG3Tosh5K8gTAwVmFmge7TvKrps=; b=B uY+uBQFNanNfjzjPdJlEEe2l9Akf4nGuX8V9jVo/dJ8AcDSrVD0veNWC1cOrzt9y o6Fu2y2UpTEPl4GOjCuWfV9YWnzfo5GIWCM6OSsPr1G6TbKNu4enm7hobBWL6ZZB WSZ3UF3ASfhkyyWidsIfhUMlrcavgcmYbrea7n1xUQTUi1ZvdAfmMD3niUUtm0uq IXUL1/liGSYy1YNfdBYGLmXFKWqRA/AMDxBKxfSqU51/jAGzbm3b/v8D9RICEqvC FeT69bM1p4uSEZlqphXPoXR6QFUgoce8lRTdUAn39vcAv3WpAji4Kbfr3g4CFsT3 /6GBPOHhvMxRVXRjqpJyA== 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=1685649956; x= 1685736356; bh=wwrl/88jn/a0BD/DhG3Tosh5K8gTAwVmFmge7TvKrps=; b=r ifA9ljKY3Z8xZ06pU6OxoXVtYH6dhC3I8WMoktWHJQTJWtIW+ly49U5Pc3mChvOU AyF5y9FmDxafr4D8oWfRooGXQVwXss7iRjXdhR8OdKXaJURAt2FttQ4GAkEcsJD7 xvxrF2ytVlPot1C2vEoiixuE1rbbwOS6IFdytM3KqpuRaeOEAoJttWJS17oYiZRT lcez2S3CRW9Fxf0yHoYY2/82KgLHDD9iDbLwbL4BHXQVA+w7Sgs3JWOPV+/rrG/c eleDjghMaWaaUOGKzLuWNiMpSPU8fRUbUZp10xkgVWfnjXcjTZXogjAXxP3lJasf hgZTM0m2B/yq0JRqDUsUQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeluddgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecuogetfedtuddqtdduucdludehmdenucfjughrpe fhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforghrkhcurfgvrghr shhonhcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrqeenucggtf frrghtthgvrhhnpeeftddvjeefleffvefhgfejjeehudetteeigeeugfekhffhgeejudeu teehgfdvffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggr X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Jun 2023 16:05:55 -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, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 1/8] platform/x86: think-lmi: mutex protection around multiple WMI calls Date: Thu, 1 Jun 2023 16:05:45 -0400 Message-Id: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 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,TVD_PH_BODY_ACCOUNTS_PRE,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766896832493706891?= X-GMAIL-MSGID: =?utf-8?q?1767532430877210227?= When an attribute is being changed if the Admin account is enabled, or if a password is being updated then multiple WMI calls are needed. Add mutex protection to ensure no race conditions are introduced. Fixes: b49f72e7f96d ("platform/x86: think-lmi: Certificate authentication support") Signed-off-by: Mark Pearson --- Changes in v2: - New commit added after review of other patches in series. Changes in v3: - Simplified mutex handling as recommended. Changes in v4: - This was the 5th patch in the series but moved to be first. - Added Fixes tag. - Improved commit information to be clearer. drivers/platform/x86/think-lmi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index 1138f770149d..6cf77bc26b05 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -195,6 +196,7 @@ static const char * const level_options[] = { }; static struct think_lmi tlmi_priv; static struct class *fw_attr_class; +static DEFINE_MUTEX(tlmi_mutex); /* ------ Utility functions ------------*/ /* Strip out CR if one is present */ @@ -437,6 +439,9 @@ static ssize_t new_password_store(struct kobject *kobj, /* Strip out CR if one is present, setting password won't work if it is present */ strip_cr(new_pwd); + /* Use lock in case multiple WMI operations needed */ + mutex_lock(&tlmi_mutex); + pwdlen = strlen(new_pwd); /* pwdlen == 0 is allowed to clear the password */ if (pwdlen && ((pwdlen < setting->minlen) || (pwdlen > setting->maxlen))) { @@ -493,6 +498,7 @@ static ssize_t new_password_store(struct kobject *kobj, kfree(auth_str); } out: + mutex_unlock(&tlmi_mutex); kfree(new_pwd); return ret ?: count; } @@ -981,6 +987,9 @@ static ssize_t current_value_store(struct kobject *kobj, /* Strip out CR if one is present */ strip_cr(new_setting); + /* Use lock in case multiple WMI operations needed */ + mutex_lock(&tlmi_mutex); + /* Check if certificate authentication is enabled and active */ if (tlmi_priv.certificate_support && tlmi_priv.pwd_admin->cert_installed) { if (!tlmi_priv.pwd_admin->signature || !tlmi_priv.pwd_admin->save_signature) { @@ -1039,6 +1048,7 @@ static ssize_t current_value_store(struct kobject *kobj, kobject_uevent(&tlmi_priv.class_dev->kobj, KOBJ_CHANGE); } out: + mutex_unlock(&tlmi_mutex); kfree(auth_str); kfree(set_str); kfree(new_setting); From patchwork Thu Jun 1 20:05:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Pearson X-Patchwork-Id: 102168 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp586316vqr; Thu, 1 Jun 2023 13:11:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5VRs5PcWolA7ziSxRBBEO9qtY16hWepWNyb/bIyxxE+EQvlq2cgNWgJzNfrdbpntLkfVv1 X-Received: by 2002:a05:6a00:2450:b0:63f:2f00:c6d with SMTP id d16-20020a056a00245000b0063f2f000c6dmr10387099pfj.2.1685650270477; Thu, 01 Jun 2023 13:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685650270; cv=none; d=google.com; s=arc-20160816; b=fpEI+ggxIcVUmRuXTrWVDtMnhPFP+N7Ipwm416FSdRtGCWpQavKoIItkyV21EiS3cF 6GovpvOp1uPOtGJIJtNWZb2bpYYzJAQuRb2ZzoALNxCtTmU5RpqDi4fBI8ECFXIrdw3f 8NlleJxRTiwLHuR8RA+g0coJ9kCUOINg/ejbE7rm4B+Z7YQ9gZ8fBzvPZYs5pgxyQko6 WJEWV7n3iARcgmoT2KtkGtp4MVVaPN8IZfjFnP/myxcXZMqBLeqTKLm4e9hLVrylTvF0 OvId5wBtP9Pvdcdgaj9na1ecuvXHQX7AnGWAxljZhINYlN+6khlMbZmFmx6wwIcW0NrL W7yQ== 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=BuihjXCY0FZRPM1FRQ1H6wx+Ft5lKyW8JMDLJbKUpdE=; b=SY2B/vg6tyLh6nGC9m3+OtOLuDeU16GeKHR+Q34w9Q6NFEHJ6A8eL1FppGaYlulyVW P3vascCCWY8ZGflksEFZiMS49GsLO+oY/ucSO1/m9ERz62rf5atTxr00kYL2k7G5RM6Z hj5la4V7VxAAcOQLo+auslqpzE0jWrJfgQlgnLEaKH6uA3vLl59QUjAqEmrWOCM9Az1Y SirjGx7euewIydH4vwuaShYQlOt64QvAy8DfCFFt+aPKwJ84fd9JuSVzjgiDQFxXzWnY qQeNguQ7I4IY2dD6ihm6gb6QCvdvy1dFvJpo7Px6mxnLQoy42TEXQ8056k9vpCvPnxUk J8qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=pTFEbXB2; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=g3aoVubI; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r201-20020a632bd2000000b005347d6bd7eesi3411923pgr.141.2023.06.01.13.10.52; Thu, 01 Jun 2023 13:11:10 -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=pTFEbXB2; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=g3aoVubI; 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 S230410AbjFAUGD (ORCPT + 99 others); Thu, 1 Jun 2023 16:06:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbjFAUGB (ORCPT ); Thu, 1 Jun 2023 16:06:01 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48E8C134; Thu, 1 Jun 2023 13:05:59 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 6EB7C32001FC; Thu, 1 Jun 2023 16:05:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 01 Jun 2023 16:05:58 -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=1685649958; x= 1685736358; bh=BuihjXCY0FZRPM1FRQ1H6wx+Ft5lKyW8JMDLJbKUpdE=; b=p TFEbXB2nZmJpBzR2g/prdstVVpfbEzaj0wJ+vCmlyrCotpnJ0G8igJajZ4DojHKh jez4xHv2Fx9WV0jggwH0FRO7vRhqTuveCjU6cif3iLa9wgkpxO0c4IcU+tSbVOk5 CqWECsJzplVCsGSYOYQsVc3tiBb0lrKs8wiGQAaTZx+w58wswgpgqh8+5Jya0YSM rQpZmVqszmP6uWqgjXJqjPJofHHifPzr+KAyNEXfu+RgZ/Mbp6itog3L6+J3UGiH PsBO34LrY8WFxTS9nAh44VeLhs3yQ3NtBd2ykDjY9z/ffr0U2MTIFsk8M95VSLjn nakJIIhLnIX1Yap9usQ2w== 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=1685649958; x= 1685736358; bh=BuihjXCY0FZRPM1FRQ1H6wx+Ft5lKyW8JMDLJbKUpdE=; b=g 3aoVubITj4Yqj+bVpLgZA+HbXFBGAKK87N1jZ84aYdeYO60D/NlOYIfe+hMGaK/H Z+TnLHdUAIdWY96g0zSNU46LbTYJGLBDy6BeUS0x5Fq9pIs280qnsBMDFEwHbDB8 AVBviyOr0Enw9y627yU14MEnz/DGTyawEM+UC1wDnvVuTpYs88Z1D7GktrLd9SpI cHAhJaCjaDD6QxLGH7w+AaXkDgKBkqpA4i2M2DIoU1wvXECyDvsnh22CLUGecKxC XlV9S5Lr58b+cKTAzTdkfe9pFkas8ayBN77mM65xqCjARtVQAMCkAeUACF0SBsRR UtdBq+Ng6hu6yyuBZlIag== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeluddgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecuogetfedtuddqtdduucdludehmdenucfjughrpe fhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforghrkhcurfgvrghr shhonhcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrqeenucggtf frrghtthgvrhhnpeeftddvjeefleffvefhgfejjeehudetteeigeeugfekhffhgeejudeu teehgfdvffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggr X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Jun 2023 16:05:57 -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, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 2/8] platform/x86: think-lmi: Enable opcode support on BIOS settings Date: Thu, 1 Jun 2023 16:05:46 -0400 Message-Id: <20230601200552.4396-2-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> References: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> MIME-Version: 1.0 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766167530633866281?= X-GMAIL-MSGID: =?utf-8?q?1767532417861839260?= 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. Changes in v4: - Fixed code alignment as requested. - changed 'non opcode' to 'non-opcode'. - Missing space added at end of comment. - This patch was previously #1 and is now #2 in 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 6cf77bc26b05..80a5c989db03 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -1010,7 +1010,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, From patchwork Thu Jun 1 20:05:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Pearson X-Patchwork-Id: 102165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp584380vqr; Thu, 1 Jun 2023 13:07:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6q3af1rfHHDcTzE4JWCTWeEYfLdCut0vCTfu41lXlK0viNfzLu7DIbgNMnyH8aduz5z5Wx X-Received: by 2002:a05:6a00:1996:b0:652:a559:b2c5 with SMTP id d22-20020a056a00199600b00652a559b2c5mr565223pfl.13.1685650057790; Thu, 01 Jun 2023 13:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685650057; cv=none; d=google.com; s=arc-20160816; b=CF3rThBg62AzMftvGZvJDZURT1XKaCZqF2gUYbKnDZWVA0SmNXhz4Vuu4a2rze+pO4 8NffHgZsk6TF+n1U5DJbeTBrSBs8Ao6FF8QG4MLLi8jsBD/TxUE3YHgeaUjcS6vJojbU CHYkiiNBCaBNxgZXndY4DGRozze5eH6KqGdVZ+JN/UsiEMx4BPeboAkRUmS/nxLG67w0 DK0Q8Z/uN/XJLSFjAtwbydeZIeTXhbIyoSAJSreRfoAA0Ym/9broogIMkbMlI2zqN99E fHIqStQJUbEz18cLRckfPAHlS3MMVvVx79aygKU4EIYKtFT+II3T1iHAnBiIMLc+pb5A E4YA== 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=cLRPgHTyo6c+6/oybL3A1mBCEIZMGkL9lFVRPDGt43Y=; b=r2lyfRkngFo14p98SMnbs3z/U6KZcT2Zdv+FP2Uw78KWItTU71u9B5y6k1bA8afqZS qJP/fEeEksZF60yPtSOWll2JPjvsz8c0qjmPEzjJgTtgsmjEILPIns14BdOyJ19p4Fvs GnnTFjF7mndSC92patyo38hQ/XP3UP7BT1U1TzHQnIwnqqqn199lROrfCp3mM5pSF4MH /7hN+ewoEJFymbBWDSLU9P2WewOcvW98fDBsZKFEvlNsYNWgqYvGEtZx0Qo4GVW0iuvN atia8G9n4HMSt11NYBMXyaQyvAW3f+IHCH00lkUPvvk794I4uwN0QHsQtKPn9u54XImv GF+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=oirn+iIS; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=mwD3SyB2; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b67-20020a62cf46000000b0064122441638si5913144pfg.276.2023.06.01.13.07.25; Thu, 01 Jun 2023 13:07:37 -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=oirn+iIS; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=mwD3SyB2; 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 S231660AbjFAUGJ (ORCPT + 99 others); Thu, 1 Jun 2023 16:06:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231418AbjFAUGC (ORCPT ); Thu, 1 Jun 2023 16:06:02 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0331613D; Thu, 1 Jun 2023 13:06:01 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 20D563200934; Thu, 1 Jun 2023 16:06:00 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 01 Jun 2023 16:06:00 -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=1685649959; x= 1685736359; bh=cLRPgHTyo6c+6/oybL3A1mBCEIZMGkL9lFVRPDGt43Y=; b=o irn+iISfJ2v2EiO0BiBzXMNutmFAim0Ed/VDO69SfSuvKkpMGIyrkoEou54p4Ywk dQVgAUOUWp75+MLcMWliJb7TV2brHPzaK0fZ51pV9iPevQa3wyi1naqTo352fqv3 moQIzmxsVhiThXMAaJGhjFN1oRiXmn4s1941y0srcLleyIYyKP7SY8jNNpF8aAyf LrgQVscA/8iz7Wlfp0JLHKE0X2ZlqnoS4+hrvk8UFtYT96gEcclBfDSTeMqBooFF /LZ1UMbP79a03LtgTxkgHbnB/07sy8MlWPNjdehrVPDrn8xmgeDlN3MGY8M4UvFu QkYCaN4SXcN/z9Lj5Vilg== 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=1685649959; x= 1685736359; bh=cLRPgHTyo6c+6/oybL3A1mBCEIZMGkL9lFVRPDGt43Y=; b=m wD3SyB2r5oQrgbxOuR+t45kOCGcEil8va8a6hZnmLKu/TFZCP3G8VSU1sAQCOcOW +H0jpBJs3jNRPw9KrSkemqoKt5nNmGTzgP/mk2P17O+rDQj38VEKOKQy/qHcW9eg Z9x0THnN/e5Bq02TIGEIBSkJVZXag7Cs2qGF8EzRkqQ6eeOqkq0U/eTT2tvv0q0H rDoqQORPjyz0bDwZGc3yV1oaAfNy3mlZRaQQK5CGODC9vpNJIcny7913ZAUtXduq JpeWdWDbtwOvAnJFxkV+stPQTOUUCCIoqwo2++BY4URZqv5mKbD8hDj3Dz4d1WSg h5dHuMGtQBX9BgVCXc0oQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeluddgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecuogetfedtuddqtdduucdludehmdenucfjughrpe fhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforghrkhcurfgvrghr shhonhcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrqeenucggtf frrghtthgvrhhnpeeftddvjeefleffvefhgfejjeehudetteeigeeugfekhffhgeejudeu teehgfdvffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggr X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Jun 2023 16:05:59 -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, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 3/8] platform/x86: think-lmi: Correct System password interface Date: Thu, 1 Jun 2023 16:05:47 -0400 Message-Id: <20230601200552.4396-3-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> References: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> MIME-Version: 1.0 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766166726793065627?= X-GMAIL-MSGID: =?utf-8?q?1767532195073560009?= The system password identification was incorrect. This means that if the password was enabled it wouldn't be detected correctly; and setting it would not work. Also updated code to use TLMI_SMP_PWD instead of TLMI_SYS_PWD to be in sync with Lenovo documentation. Fixes: 640a5fa50a42 ("platform/x86: think-lmi: Opcode support") Signed-off-by: Mark Pearson --- Changes in v2: - Updated define name to be SMP_PWD instead of SYS_PWD. - Clarified in comments what each password type is. Changes in v3: - None. Version bump with rest of series. Changes in v4: - This patch was previously #2 and is now #3 in series. - Patch split so comment updates moved into new patch (next in series). drivers/platform/x86/think-lmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index 80a5c989db03..f6d1931540f1 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -172,7 +172,7 @@ MODULE_PARM_DESC(debug_support, "Enable debug command support"); #define TLMI_POP_PWD (1 << 0) #define TLMI_PAP_PWD (1 << 1) #define TLMI_HDD_PWD (1 << 2) -#define TLMI_SYS_PWD (1 << 3) +#define TLMI_SMP_PWD (1 << 6) /* System Management */ #define TLMI_CERT (1 << 7) #define to_tlmi_pwd_setting(kobj) container_of(kobj, struct tlmi_pwd_setting, kobj) @@ -1519,11 +1519,11 @@ static int tlmi_analyze(void) tlmi_priv.pwd_power->valid = true; if (tlmi_priv.opcode_support) { - tlmi_priv.pwd_system = tlmi_create_auth("sys", "system"); + tlmi_priv.pwd_system = tlmi_create_auth("smp", "system"); if (!tlmi_priv.pwd_system) goto fail_clear_attr; - if (tlmi_priv.pwdcfg.core.password_state & TLMI_SYS_PWD) + if (tlmi_priv.pwdcfg.core.password_state & TLMI_SMP_PWD) tlmi_priv.pwd_system->valid = true; tlmi_priv.pwd_hdd = tlmi_create_auth("hdd", "hdd"); From patchwork Thu Jun 1 20:05:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Pearson X-Patchwork-Id: 102173 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp588044vqr; Thu, 1 Jun 2023 13:14:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5B3U1XECupntsYtejhlNtRCP2tA3RkZdE1+Fct8KYiH4K4eYqLifvsvMIcpCU3E67ccMax X-Received: by 2002:a05:6a20:3950:b0:10f:d1d4:40c6 with SMTP id r16-20020a056a20395000b0010fd1d440c6mr9150509pzg.7.1685650471340; Thu, 01 Jun 2023 13:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685650471; cv=none; d=google.com; s=arc-20160816; b=G6uoxlaWDOwoyoujLKHNE5M638UcjoPv3iPuYt4e/IIYHY0aJxlMl5hCXDzaI7SKVJ KagFvsnnuaMLpt84pv/WLqxQl90hDc9Uxk/fXs+7WRzi/PZv2Ig90yFSCGPSCxZjRe3A YamN6GBU1oTCcnf9cQCiJ+iBYNZ1LPOd1z14tP86XZ04a7+S84PB10MbVdxJlk45YkYt 1nT2/Fs++kLAvxdWslAa7eU+iqkks34+b5yVggf+M92eYf3C2b/QdFce5WRivqLzH0EU lcrojX4mKLteaRTfsbO7WX69HQSGViFeX2ZAFzgXD0YIXWwj7nUcvjMU+MeDUz9+jyph QVmw== 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=rsnvI6ZEp/JoaUhAmxQlv079Dx9MuMsySoRPjlJZ+pM=; b=bEtBcdL/e/N+KwfhohCoIrR94GZRfL8xHUpohq9hrhqk/5Uto2pGoff3xyrtEnDsnw T8xMn4Z8VeaCT128avPpe2jI9Y+2vLgeyk6hWHRUETqAxLPxsPWUThAcACOMBP7NQYQa zsJEXz4y4PTeIA3dX2QcSFwdB8OrEgar6NsXnhxxhnybRICbdMBpx9ayMeKp0LSqtTuC 6jT0xLg2nClnw5uXmYNZ9LdJqOpqkb0VLyr/Y5daQYRaTlZpZJQCWtzTO+ngH2kE+FiE Q+MbLJ4jRdBiszqq4ERubto/5e0BqRYbQVAFQwRWoR32oN+4HyPdqULhEKysVsJ2eyMf 00tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=KFF8XJIV; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=xprHedPv; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r1-20020aa79621000000b0063d33fc3e08si5981940pfg.79.2023.06.01.13.14.08; Thu, 01 Jun 2023 13:14:31 -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=KFF8XJIV; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=xprHedPv; 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 S231408AbjFAUGO (ORCPT + 99 others); Thu, 1 Jun 2023 16:06:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231605AbjFAUGD (ORCPT ); Thu, 1 Jun 2023 16:06:03 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ADC7133; Thu, 1 Jun 2023 13:06:02 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 9F68632001FC; Thu, 1 Jun 2023 16:06:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 01 Jun 2023 16:06:02 -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=1685649961; x= 1685736361; bh=rsnvI6ZEp/JoaUhAmxQlv079Dx9MuMsySoRPjlJZ+pM=; b=K FF8XJIVr5n6Lz38MWifQ9Tdz7OCINt4PZoioIkSQi3a2sY/e7pRQ1rBpUfS6FetT iUG4CpcffnXIdsuth/mdBIl0vWUJ7gT1Kh4RgEbVb6l+RpPHulPoEzKk8YC7m/02 bsC5xk/n2/tU2ZzjPdz2T9tazzPpKeMfD4ORSXSPIMCb7Zn1nrFRiB5laSOy4OPR UJv3MzYE0L167rQrDNMWLLx2ZzFAvIvEaqfe8SdajUyw92FBYD9geit/NTbG/qC/ voLHWOkw/1oMHaMHxMVGQbPCblh8EXYpOF5lDuF1/0Mrtbc0CzjiWK5dVDaa7ta0 AUz/8bHXWVacy+qghE+qQ== 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=1685649961; x= 1685736361; bh=rsnvI6ZEp/JoaUhAmxQlv079Dx9MuMsySoRPjlJZ+pM=; b=x prHedPveuDoLuTck2jbZWnGzbszvRSALvtisZ5K4ngeeQY0GJF0ofMXjugrWt2EP Kck52VghWMj2sNZLgWJdl2Ggxjr6XTHV6ess96QaYx5PEuivM6urr7mXfEcmbWNM 0sB8l509q2kAT5oCRkMqUz+dc/BY6Agq1LuGTyxVGK0b9IQByu/TIl3kCoo7kzOR fpleESsAQ8Gc+MM55UkD0vTiGGpvv9bBzxQ91dxAzqdnu6DP3Sl8L3DQsVWYBx03 DvBqCAXp+Bt5IyOe6aPi5dHAuhqljKP1zG7g9mJ1jhhYrjGCfrZ0TPeua1l5QWC+ 0UKTE7sOXsJ5IaamU2ofA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeluddgudeggecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecuogetfedtuddqtdduucdludehmdenucfjughrpe fhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforghrkhcurfgvrghr shhonhcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrqeenucggtf frrghtthgvrhhnpeeftddvjeefleffvefhgfejjeehudetteeigeeugfekhffhgeejudeu teehgfdvffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggr X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Jun 2023 16:06:00 -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, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 4/8] platform/x86: think-lmi: Update password attribute comments Date: Thu, 1 Jun 2023 16:05:48 -0400 Message-Id: <20230601200552.4396-4-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> References: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> MIME-Version: 1.0 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767532628479056606?= X-GMAIL-MSGID: =?utf-8?q?1767532628479056606?= Add comments to clarify what the different password attributes are (as requested). Signed-off-by: Mark Pearson --- Changes in v4: - New patch split out from previous patch #2. drivers/platform/x86/think-lmi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index f6d1931540f1..564e3fc33cfb 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -169,11 +169,11 @@ MODULE_PARM_DESC(debug_support, "Enable debug command support"); */ #define LENOVO_CERT_THUMBPRINT_GUID "C59119ED-1C0D-4806-A8E9-59AA318176C4" -#define TLMI_POP_PWD (1 << 0) -#define TLMI_PAP_PWD (1 << 1) -#define TLMI_HDD_PWD (1 << 2) +#define TLMI_POP_PWD (1 << 0) /* Supervisor */ +#define TLMI_PAP_PWD (1 << 1) /* Power-on */ +#define TLMI_HDD_PWD (1 << 2) /* HDD/NVME */ #define TLMI_SMP_PWD (1 << 6) /* System Management */ -#define TLMI_CERT (1 << 7) +#define TLMI_CERT (1 << 7) /* Certificate Based */ #define to_tlmi_pwd_setting(kobj) container_of(kobj, struct tlmi_pwd_setting, kobj) #define to_tlmi_attr_setting(kobj) container_of(kobj, struct tlmi_attr_setting, kobj) From patchwork Thu Jun 1 20:05:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Pearson X-Patchwork-Id: 102172 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp587761vqr; Thu, 1 Jun 2023 13:13:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5r1MX0JgS0FBvTpRMDK5tkBxg5aZ1r806MKHSCJoltO2e3y9nGtp1vUJPv0/8Sn6k2g0Yf X-Received: by 2002:a05:6a20:729e:b0:10e:f800:2d75 with SMTP id o30-20020a056a20729e00b0010ef8002d75mr8772455pzk.43.1685650437919; Thu, 01 Jun 2023 13:13:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685650437; cv=none; d=google.com; s=arc-20160816; b=VTG/hrE6Hq4zmQYA88pDE7exiD0Sijz24EcCD+LbYIDW6xKbYhrJlugFzh6nMdrOVo L0T/V9moPiLPlruWe+0ZVvqyG+0fAFEy8G6ynuDGfFo1HDk/uoFip431Dp6TtGSzHvzn VBFDMW0LBI7BH2OCc+zlE5dqYU6aPf/jITfxG2rEWhl+shpgEk9lnJolPtO/5o3dt+gu nyy8Vk4KG1Dfnxhwr7gFgqoZ887IfC+hmJ9HlJwC0PX8jO8nmyoujV3zVNjO3fbVt7uE 2vuHkh8FvWdZsUUj/VHzDpz/xZLabNWHroBscDoPZJeYZ/amC2VlmmJfj/QygPyoGAus pnxQ== 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=aQVnrUtWK2iD10mHCHPBgoH3zv4+A/ErwEDXziIOT4Y=; b=xLuO2bB90nMY3Lk/JcgxQZucD2HrWiPGu8D/SWsPDSbIuxYNF4lwz73z5jhdIT+/Gz c6+VXUhHulD3dZxBb8Am8dYsSw6kT/Wx0erZf7QdVgLDtMi1xCTzYqgAMAKv/JZr/upX Vz4cq6Ay1tc46EOjsYof3owaFfzQyCiQSHSGVN5U4Z94Nr0m/V4hDI9mQXQ9M7dCE/Kw EEfbE4LL1j5UHEUrClYVKDVOBJ5EjEXKsrft9guQQfXmmwTMKkuwaeJyRETrcjGLNo+u 0W4XVqnPbpVv+YkCsL/kQOCdwCOvtZE/snyjrvTtEEhL4xFhtwyD6oU/QNneTbViq6er 4VHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=A1QHzVjZ; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=hqV+vs8P; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r1-20020aa79621000000b0063d33fc3e08si5981940pfg.79.2023.06.01.13.13.45; Thu, 01 Jun 2023 13:13:57 -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=A1QHzVjZ; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=hqV+vs8P; 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 S231917AbjFAUGR (ORCPT + 99 others); Thu, 1 Jun 2023 16:06:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230526AbjFAUGF (ORCPT ); Thu, 1 Jun 2023 16:06:05 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27C0A134; Thu, 1 Jun 2023 13:06:04 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 46F1A32002F9; Thu, 1 Jun 2023 16:06:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 01 Jun 2023 16:06:03 -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=1685649962; x= 1685736362; bh=aQVnrUtWK2iD10mHCHPBgoH3zv4+A/ErwEDXziIOT4Y=; b=A 1QHzVjZuTET09em988ya3g3r6xXQHIs6GQkU3VC3ZdUo2D2mV31RhrtJhn/SAbTP MeMDfcWDROzN6frZYU3DYZf51+lyuAw9JW+QbYUuhZNsY3dz35IowNpwkPkPBdZV jIuzu1GOQ7SvD6Z//aV2w8mWCVSIO4VcOgysZppZmsPEjSxOx0Iq529YIle+KyEC g50B5NtoNnihpUsbFIcKBAQbQiiFZl2Vp3Z/JCCTqyrQa2JNtFhjIZ3vIsW2DLH8 /orZYIia97KCj0mpLJ+gJEY4W13E7BOZqzuNsMWzQJJif3cIoa+c40WbWWzrlD46 i7xOfgNmbIjKSVy13dqUA== 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=1685649962; x= 1685736362; bh=aQVnrUtWK2iD10mHCHPBgoH3zv4+A/ErwEDXziIOT4Y=; b=h qV+vs8PG36jy6iwxv7JFh7TKtwTbGMjlCDXhQR1DHbZIGuCiRUX7KQ/AcOT6SV8y We4mx1jPHGg43a2eEGPm0C8rJfjTWeVd1CNDeagBRN97ri+J4PNiWFGhG3JoKjZU AvWbyHC4g+TkByRS40Went7Z7VBc+od4T86O580i2fX7/51J3uZws0asLO4UYm90 wDC84Xj5ShEmMK5w899NhWFptzwujZFCx2fazw1dJYmfdZuCvV5QpBm+hoTHWmK1 aE0vo6f5KrHzWE08e6B4u9cvRMNnb2iDf+GyAUieYal5UG82hPvbBYwkjhwtYRSY KE+5yhGxsRy2NzEEMULSA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeluddgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecuogetfedtuddqtdduucdludehmdenucfjughrpe fhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforghrkhcurfgvrghr shhonhcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrqeenucggtf frrghtthgvrhhnpeeftddvjeefleffvefhgfejjeehudetteeigeeugfekhffhgeejudeu teehgfdvffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggr X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Jun 2023 16:06:02 -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, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 5/8] platform/x86: think-lmi: Update password fields to use BIT Date: Thu, 1 Jun 2023 16:05:49 -0400 Message-Id: <20230601200552.4396-5-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> References: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> MIME-Version: 1.0 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767532593635128954?= X-GMAIL-MSGID: =?utf-8?q?1767532593635128954?= Code clean up to use BIT macro as suggested. Signed-off-by: Mark Pearson --- Changes in v4: - New patch split out from previous patch #2. drivers/platform/x86/think-lmi.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index 564e3fc33cfb..e3be99b44ce0 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -169,11 +169,11 @@ MODULE_PARM_DESC(debug_support, "Enable debug command support"); */ #define LENOVO_CERT_THUMBPRINT_GUID "C59119ED-1C0D-4806-A8E9-59AA318176C4" -#define TLMI_POP_PWD (1 << 0) /* Supervisor */ -#define TLMI_PAP_PWD (1 << 1) /* Power-on */ -#define TLMI_HDD_PWD (1 << 2) /* HDD/NVME */ -#define TLMI_SMP_PWD (1 << 6) /* System Management */ -#define TLMI_CERT (1 << 7) /* Certificate Based */ +#define TLMI_POP_PWD BIT(0) /* Supervisor */ +#define TLMI_PAP_PWD BIT(1) /* Power-on */ +#define TLMI_HDD_PWD BIT(2) /* HDD/NVME */ +#define TLMI_SMP_PWD BIT(6) /* System Management */ +#define TLMI_CERT BIT(7) /* Certificate Based */ #define to_tlmi_pwd_setting(kobj) container_of(kobj, struct tlmi_pwd_setting, kobj) #define to_tlmi_attr_setting(kobj) container_of(kobj, struct tlmi_attr_setting, kobj) From patchwork Thu Jun 1 20:05:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Pearson X-Patchwork-Id: 102166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp584538vqr; Thu, 1 Jun 2023 13:07:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6fzzjCH1YFkLRkkLBW6BriD23oUIO/3TRPdSOiU3BCFa6C29BpxhMV6m6U8IST5cNdiCSQ X-Received: by 2002:a17:90a:3d02:b0:258:785f:f1ef with SMTP id h2-20020a17090a3d0200b00258785ff1efmr402628pjc.7.1685650076612; Thu, 01 Jun 2023 13:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685650076; cv=none; d=google.com; s=arc-20160816; b=ciLOMzGFs17HGf29t9J0zguShBuZ7cQZT/mTAWhBLNzrZXHgD535QplXUWRLqhAl9f trDRPZHuPteHMvycy44oglKu5aHv9wK52WCTCmnq62QAUaL6MSs9uN3sLrY2ZNz1iaVR FEr/scGAA6lOa/e0W23ezBcwvQpsD7z+oi4JpRC9oGiA+rVGFqiddabtwOK7v73edeSQ Zg0Majltw8qn7YJKmccds9jtf6cWlI/R8IQ4umsE/N9x4WiMCZxtdy4Wwu/P0nHjg/Iy /JAAkKkoTRRoulKhtFUe0jCkNB50oQdEu18dKPTwcUOLBruBNekcgntaUGqTAQfQmKFr LEBw== 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=Gu+WlP+2bsePT/P2fB0521Gn91OZaDLXsUxYcTQ73gA=; b=HaoWNnBKJXmNLaoLVNwN2fwucXsSzrF0+u+1EiiyCHFNvIEYnt3RxT4z1gQSkwiHGA 8WIAe05rZnPoip4CVBYW7RGIB6Mhdqbq+pnf1H8niokhs497t2ccU/6YD7qyE9UBTsie 8JdTnLb4Gk8JjNRCtMoMTJiDgL5QInL+ummooBqXjpzsKgrbRnZveP/Wfy5/YRcuJ8mC ji32b5KdOuZIvsVl7DAasE9isqrr/xj1sQ4JPAN3ltmYOY49aFGh2O57mbDPfD8mhl6i 5NT28evb74ff8lGFpfu2iskw91Xd6BhVZ8mCCl+SCvrusJuDePmE5t+SJq69NhzHVarZ P8gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=GCLKakvD; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=uiWm9Xtt; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m14-20020a63710e000000b0054130108266si866063pgc.567.2023.06.01.13.07.44; Thu, 01 Jun 2023 13:07:56 -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=GCLKakvD; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=uiWm9Xtt; 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 S231947AbjFAUGT (ORCPT + 99 others); Thu, 1 Jun 2023 16:06:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231663AbjFAUGG (ORCPT ); Thu, 1 Jun 2023 16:06:06 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6196195; Thu, 1 Jun 2023 13:06:05 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id CF49A32001FC; Thu, 1 Jun 2023 16:06:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 01 Jun 2023 16:06:05 -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=1685649964; x= 1685736364; bh=Gu+WlP+2bsePT/P2fB0521Gn91OZaDLXsUxYcTQ73gA=; b=G CLKakvDROosoZIhS9uesLtHiY9/K2xF8wnhlA7pr72YLGFl4XMm9Vwpf8kU8YZ4w VLB4eWcz7DVNGF/wreqhbYtIm+kFDGmwNj6BMb715x+wIS+tLKxqI/XgeCeJ7G+e plfGTCbL5hCI3ygPcDSdGR5ftBUFqFvsuB6VlfU6WvYBGInAwPM+fiOQ6rbTY+WC YCsOGsLJO9pRylC+TTJgO8CFmY9PSlWG6JmtsKyPRqk2Q2bXAZ8Ix9F+3eYMSLd4 jOoPD/EiUMo43YMLlHdL5+Eecrvqdcfpj4FUJxZUg7pjSEBFBPFd9Sz8Z5QbANNy U+t3QjZ3G8jEtCkGTFnPQ== 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=1685649964; x= 1685736364; bh=Gu+WlP+2bsePT/P2fB0521Gn91OZaDLXsUxYcTQ73gA=; b=u iWm9XttH9QCd4fTbstd2YQ8a81N5ltimJSHXQEryNcSEoAEK42t0BijgHYKp3wC+ 1KEnkoh4ZHfAS99NfNG3Jx7cPwGFBcr6L65ARWvqg2SxoWs9SQpbiQUlXlVKoZ4t UwUG1ZN/YwkXFmXOYjGOB2tK5Q0qIIRwvEBo0LKsuuRdMzgDpCRcMBRsEJQG/YiN zt3hKlf8yB9nRu/6WIcKt6bwNJVRC61Wdyk4JCgXq9a+7riEjj8LWvZqUWAd6hTM 4qt6EQAV13GF/nIXGuIdqfmDCGRLu7JdzsHOLAKFxlowVKbKGR7fOgSZmaTQVoGi fx7OELSOEpNhB9At+50kA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeluddgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecuogetfedtuddqtdduucdludehmdenucfjughrpe fhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforghrkhcurfgvrghr shhonhcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrqeenucggtf frrghtthgvrhhnpeeftddvjeefleffvefhgfejjeehudetteeigeeugfekhffhgeejudeu teehgfdvffenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhroh hmpehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggr X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Jun 2023 16:06:03 -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, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 6/8] platform/x86: think-lmi: Correct NVME password handling Date: Thu, 1 Jun 2023 16:05:50 -0400 Message-Id: <20230601200552.4396-6-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> References: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> MIME-Version: 1.0 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766167450796745109?= X-GMAIL-MSGID: =?utf-8?q?1767532214353604750?= NVME passwords identifier have been standardised across the Lenovo systems and now use udrp and adrp (user and admin level) instead of unvp and mnvp. This should apparently be backwards compatible. Fixes: 640a5fa50a42 ("platform/x86: think-lmi: Opcode support") Signed-off-by: Mark Pearson --- Changes in v2 & v3: - None. Version bumped in series. Changes in v4: - This patch was previously #2 and is now #6 in series. - index default change split into new patch (next in series). drivers/platform/x86/think-lmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index e3be99b44ce0..71bbe169c77e 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -461,9 +461,9 @@ static ssize_t new_password_store(struct kobject *kobj, sprintf(pwd_type, "mhdp%d", setting->index); } else if (setting == tlmi_priv.pwd_nvme) { if (setting->level == TLMI_LEVEL_USER) - sprintf(pwd_type, "unvp%d", setting->index); + sprintf(pwd_type, "udrp%d", setting->index); else - sprintf(pwd_type, "mnvp%d", setting->index); + sprintf(pwd_type, "adrp%d", setting->index); } else { sprintf(pwd_type, "%s", setting->pwd_type); } From patchwork Thu Jun 1 20:05:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Pearson X-Patchwork-Id: 102167 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp584655vqr; Thu, 1 Jun 2023 13:08:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6c3M8jl7EjY+nwEM1HNqRP3cKesSQqJNChGRNnXCFgatQJJ8FgO/YPU4oTGYwkVtJpEnTa X-Received: by 2002:a17:90a:540e:b0:256:710a:2578 with SMTP id z14-20020a17090a540e00b00256710a2578mr340528pjh.34.1685650087240; Thu, 01 Jun 2023 13:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685650087; cv=none; d=google.com; s=arc-20160816; b=L+zFJtvdEMs3xBIE0x71DEjXcVOVabN/F6GTNWoNCo5lLyn0RBDMkj+kvGVpSwUiGB vjUG9RS+rdrRrVvSRXbbNcHa/mtuPgovwR2QWr6KDUwgJqNKewXYpp56Mbfy4Ly/sBgX tFckIXR58tkOr2VWhPSLlq6xvVHwOGtN0UDWkV4ngEPl16Sgo5IDgAbL7IQa9yUQAdwy N77QZvFwUXlegTfesuWSFzhUV0kn7PP+Ly2wlOtX9/lICm3SwF+sGbJLN/Swh5/iSso6 pjlzqYvRLwJ6CP1hdw14gGSs9AtRkUOHONHdc2Lvu8MaABEMyyfsPxLtf6Bm3bEXTkvB L7qw== 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=dxVy3ktA+8k714kk6B+Z5XPnFHTfcK197zZKcwM4lPc=; b=HKuY51b6o85T0NuwcEh51+t1yrOwi7/2Pe4u34CBxFgpGVs/BDhVcTw/Dl/fsSLP8E ciReh6V7guy9rKRTf+RtCo6sVmPcJyenPdiLr0U+8NWG/nJODYqbMNletZni7mMxz0OL gbwEBSPiTz0dFdz8YP3OkxN/f9PVfMqzk62fJJZULazhQGFF95zYpa8ZxKJq8/tUPTDK ZqhkMFYL8sQwr/RVql/uC/No6nA/BG+WlBt8Jw4ITG2uhzlunLf83HV2ERBqd9P1tFVg UOpkwk4+QRKASytAVxdJ7XrNt1URdDa4LONiczP3/fArJbPcI+NFIaPU2dmFzwZJLUyE zqwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=Lva76V+N; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=LnAG8HDY; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p22-20020a17090b011600b002563e365aeasi1631468pjz.53.2023.06.01.13.07.55; Thu, 01 Jun 2023 13:08:07 -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=Lva76V+N; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=LnAG8HDY; 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 S232014AbjFAUGY (ORCPT + 99 others); Thu, 1 Jun 2023 16:06:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231724AbjFAUGI (ORCPT ); Thu, 1 Jun 2023 16:06:08 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FEE919A; Thu, 1 Jun 2023 13:06:07 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 856AE320091A; Thu, 1 Jun 2023 16:06:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 01 Jun 2023 16:06:07 -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=1685649966; x= 1685736366; bh=dxVy3ktA+8k714kk6B+Z5XPnFHTfcK197zZKcwM4lPc=; b=L va76V+N+KAZ+6lBIWyzeIKPpaIFxFTDx7itudSnVXPv8WulpZXbFWT1cDdYeuTK7 WIwjrmsKFmlztMmlhWz4YK+7b4uNWC1mK77aUtJAHtGdFPoU8LMVEOjFGX1FuLux XY9dzSdHL5apB8AAY49Cdl1ow03e54l4qACQ6QXUpeiOZT6CiHOxER6z68tmD7/z rrntV+fm9opTs25YBRefT4bZg9kRh18XcCjX5HaH9ym4Rr8qdsYo8XWl0BYm/9Zz xC1pRTXge8lyLEVzxHBboj6xEuzPmysZ6FpAcD83hTIB7tYEEx/sJDasp2rD/PDS AMNvFzw8V0nfZk4KZFHLQ== 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=1685649966; x= 1685736366; bh=dxVy3ktA+8k714kk6B+Z5XPnFHTfcK197zZKcwM4lPc=; b=L nAG8HDYpRtkNtq1K2UW0LLzpc693JnHIhQkMF3+HRjGZTzuG/vBjBsjmhrQMuIrw 2XwsJNbJOUwcIeALitkKSXoOsH6EbYK2xsoHZ8Pk5PxzOW39gM0cFHBb5gYs2xBz R8omuJTbUf4Nx+qc5TzCfhHGiQiccX5nMJilZIpzonDyaPcVlo6PHafeieyczOab UQ3zyywGD4OKHfv09dUb/3yN8h+F4uhVertPp1F7NWoKEPb7dghoHMNCZQHDJLtE JBFPoVDarPz3JVoEUeTKpnM25DYl4tIPUM+DT8/MqOTGPeeY6Y69Bi5nrIfwQmOA Ec9eu95tAugsT2FnaDLGA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeluddgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecuogetfedtuddqtdduucdludehmdenucfjughrpe fhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforghrkhcurfgvrghr shhonhcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrqeenucggtf frrghtthgvrhhnpeeftddvjeefleffvefhgfejjeehudetteeigeeugfekhffhgeejudeu teehgfdvffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggr X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Jun 2023 16:06:05 -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, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 7/8] platform/x86: think-lmi: Correct NVME index default Date: Thu, 1 Jun 2023 16:05:51 -0400 Message-Id: <20230601200552.4396-7-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> References: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> MIME-Version: 1.0 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767532225872569283?= X-GMAIL-MSGID: =?utf-8?q?1767532225872569283?= The NVME/HDD index used by WMI starts at 1 so corrected the default appropriately. Note, zero index is still permitted in case it is required on future platforms. Documentation updated correspondingly Signed-off-by: Mark Pearson --- Changes in v4: - New patch. Split out changes into separate commit as requested. - Update documentation. - Details on zero index added to commit message. Documentation/ABI/testing/sysfs-class-firmware-attributes | 4 ++-- drivers/platform/x86/think-lmi.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-class-firmware-attributes b/Documentation/ABI/testing/sysfs-class-firmware-attributes index 4cdba3477176..1b3ecae80b3d 100644 --- a/Documentation/ABI/testing/sysfs-class-firmware-attributes +++ b/Documentation/ABI/testing/sysfs-class-firmware-attributes @@ -243,8 +243,8 @@ Description: index: Used with HDD and NVME authentication to set the drive index - that is being referenced (e.g hdd0, hdd1 etc) - This attribute defaults to device 0. + that is being referenced (e.g hdd1, hdd2 etc) + This attribute defaults to device 1. certificate, signature, save_signature: These attributes are used for certificate based authentication. This is diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index 71bbe169c77e..2aaaee879488 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -1534,6 +1534,10 @@ static int tlmi_analyze(void) if (!tlmi_priv.pwd_nvme) goto fail_clear_attr; + /* Set default hdd/nvme index to 1 as there is no device 0 */ + tlmi_priv.pwd_hdd->index = 1; + tlmi_priv.pwd_nvme->index = 1; + if (tlmi_priv.pwdcfg.core.password_state & TLMI_HDD_PWD) { /* Check if PWD is configured and set index to first drive found */ if (tlmi_priv.pwdcfg.ext.hdd_user_password || From patchwork Thu Jun 1 20:05:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Pearson X-Patchwork-Id: 102170 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp586614vqr; Thu, 1 Jun 2023 13:11:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6gyHT6YKYpQ3D0JkD5ivUAvM1hj+DWVBa694BgNbwk9p+rp4RYBo2X8otGO4gHwCaAd7Yg X-Received: by 2002:a17:90a:1d46:b0:256:bc96:45ad with SMTP id u6-20020a17090a1d4600b00256bc9645admr310867pju.40.1685650304886; Thu, 01 Jun 2023 13:11:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685650304; cv=none; d=google.com; s=arc-20160816; b=N+SgD8zXgE6o3FqkRWrm2hnM4e8s0luSdnxeuPbhN1h4Zinwb3nxShgguwFX6mZTQP pUZkIAvSzg9eLtyTbu4qZW2SPvV2YPHebPgNlINiV3w0pJL/+JC1Y1CZR+ESD5VOEmlD WKzwi/Z1V/eVoRiT+J9xNHhD0P+nZEIyQyBDXcJ//BQQTbJG5yS2vT4H+1yW5ILlULD0 perHOWyiOVKdwCTysXJEIE+T3wUR8h+n0A9SE3H1Zz3Pq9prqZHZVA4u//hCeWIsHduG zZ3UXQY7ioEzGgG5zshwAgMNt6venlSnO7Vm18mdA1rYWxkNmZTGu5NekB9HMiilIgFq 4QZw== 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=o+3ik6sPv/8JEzwolLx/y3xpaXAaNLnim4nqn40eZqA=; b=evz3YHTDRg/rSec8zypz+9ALUDXzDIk8b5YMmlA9bk862duj8q+R6g/3Xvylz6W4eJ hu80iXHSYpOj/b4w0YpD+aPLviDOI4lOg5j1+QaATqA9WvOIqX6vq8M/28KSMy2cGTAW ZUgcgCDMFraBQIaxofv8BNt4/P6iOtgs3Jbwom5POFQhPITII61CnqylEnT7P1hYh5oL k/4RQuP4hBIhXR3bdL1fDxl0efxUwBE+jg9zp6XYIU4qGZaWuOs1Gewd6t6uXU02q6Kw isygpJp2kLZP6ezmK5gRcprZZ8xAvj5ZFHcBavEL5aeN9mdufkAwNeaG+ZAn9qlqAT9w //2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@squebb.ca header.s=fm2 header.b=as5b4FEN; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=pIDHkdtb; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p22-20020a17090b011600b002563e365aeasi1631468pjz.53.2023.06.01.13.11.33; Thu, 01 Jun 2023 13:11:44 -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=as5b4FEN; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=pIDHkdtb; 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 S231724AbjFAUGb (ORCPT + 99 others); Thu, 1 Jun 2023 16:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231669AbjFAUGR (ORCPT ); Thu, 1 Jun 2023 16:06:17 -0400 Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 049361A4; Thu, 1 Jun 2023 13:06:09 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 28A5A32003CE; Thu, 1 Jun 2023 16:06:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 01 Jun 2023 16:06:08 -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=1685649967; x= 1685736367; bh=o+3ik6sPv/8JEzwolLx/y3xpaXAaNLnim4nqn40eZqA=; b=a s5b4FENdBlIJPyV69bgZMeNamdRI+ULrDkC6tZj9i0kswy/gG2OKlbJMHX6YT+SV Umx7PM++fNj/74SEHbHhvJNFjnYRwdLyT06O3IUOLA1XCjqjyQ6AZstPv7t1zFY3 RdQ0KfW3yMH/3vcUPB1bBCOPOaiJ496vjInvx5b/pxR+yxf8MCq+uxHkdY6O1Spy QwdUQytjgjwm03xVEGvaJNNUb+LPL4NEXyoqavSGoQjULu371MYrsH0+WWrVgt6w fkoxGw2WTAeTa9cxPd6UoHAS00J8Nc2Re9b3OBs7jn4hx9kkCVKuUDjWSNJPSmAx hpd1/CjnPo7jOxWMxjRFg== 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=1685649967; x= 1685736367; bh=o+3ik6sPv/8JEzwolLx/y3xpaXAaNLnim4nqn40eZqA=; b=p IDHkdtbEH3euih4Dchnq0FAnUTsq2/5I09VaSTZ7c2TEed4gMy8rq6bcVVFfPTqL oE4ntgKrAQ3gaLgIvTbqisueyUSeY3fsFVIL5/p+ZD+ffpAy2BC5bXqQLX0JJiIZ ppJMf3HGBA2d6PrtqAYl4hsUvGOAw/Bsgvlhf2qyKV5diUmZBogxT2u7RjWvCalG 4qy0y+tmm+b9srBGG35i4jjrlNeNQt0gAeYGPTolOit0IP8Ylq/vrucAe5NuZgIb eHLB9gCDWIdFG52Qy0vbAxjFrBs6djIFahYePyhbvPGAab3gxfpQhMluZNXg3kYC PscbR+nCFvHr/mC4MkSVw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeluddgudeghecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecuogetfedtuddqtdduucdludehmdenucfjughrpe fhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforghrkhcurfgvrghr shhonhcuoehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrqeenucggtf frrghtthgvrhhnpeeftddvjeefleffvefhgfejjeehudetteeigeeugfekhffhgeejudeu teehgfdvffenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhroh hmpehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggr X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 1 Jun 2023 16:06:07 -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, ilpo.jarvinen@linux.intel.com Subject: [PATCH v4 8/8] platform/x86: think-lmi: Don't display unnecessary authentication settings Date: Thu, 1 Jun 2023 16:05:52 -0400 Message-Id: <20230601200552.4396-8-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> References: <20230601200552.4396-1-mpearson-lenovo@squebb.ca> MIME-Version: 1.0 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766167512884632470?= X-GMAIL-MSGID: =?utf-8?q?1767532454216630121?= If Opcode support is available (which is the standard for all platforms going forward) then there is no need to have the encoding and kbdlang attributes visible. Signed-off-by: Mark Pearson Reviewed-by: Ilpo Järvinen --- Changes in v2 & v3: - None. Version bumped in series. Changes in v4: - Fixed code alignment as requested. - This patch was previously #4 and is now #8 in series. drivers/platform/x86/think-lmi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c index 2aaaee879488..52d1ce8dfe44 100644 --- a/drivers/platform/x86/think-lmi.c +++ b/drivers/platform/x86/think-lmi.c @@ -885,6 +885,11 @@ static umode_t auth_attr_is_visible(struct kobject *kobj, return 0; } + /* Don't display un-needed settings if opcode available */ + if ((attr == &auth_encoding.attr || attr == &auth_kbdlang.attr) && + tlmi_priv.opcode_support) + return 0; + return attr->mode; }