From nobody Fri Oct 3 07:42:41 2025 Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEB0D1F8BD6; Wed, 3 Sep 2025 17:38:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.155 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756921111; cv=none; b=JeHUNWLycWfLHs7A35+9GvWa/KMElWCbM1XrZ0tNVxoi488K55tvLPKPECX0TC2JIikvMad5pIXY4yi0m7WBJOUP2iiZdDIigDYcAKPfCAU5NM9IchvXYZNz/HyMM1k95fgOoNF3e04E9i/ebvB8dl4SakGUztZcDdBQG0EC9eU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756921111; c=relaxed/simple; bh=EDRGbFQEdUCC+T1QqudPKMaG2O2dufiA02tTCWsPiHo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fQ9pTWCh24a/xeHM9czmqYX6WGGlZM7MvxquGnnvg5J/KrEbA/Dtrz5+gxpIOXvoEbQgY/io7nati7BbU3PLPC0R8LfL2FBexNYT1+Gd6Ik3B2o1CdKryc1bQCeGV429F74QXSdxV+E3UAJIQJzzpTVYAHg4w30R22JJ3ciyZkI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca; spf=pass smtp.mailfrom=squebb.ca; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b=lCJnXfS7; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Yv4dS1gN; arc=none smtp.client-ip=202.12.124.155 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=squebb.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b="lCJnXfS7"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Yv4dS1gN" Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailfhigh.stl.internal (Postfix) with ESMTP id B1CB87A0579; Wed, 3 Sep 2025 13:38:28 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Wed, 03 Sep 2025 13:38:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=squebb.ca; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1756921108; x=1757007508; bh=MWaDOy5EsxzPjJKPR/HPfHeBKItwKUOjCav2nL8txcc=; b= lCJnXfS759ez162nC6+OIg37D5u15ZK6JgX0dJI8uJtuwSevxZn48QyWqT3PyIC/ J+zQ67/j03JrHMHlvQpkq8V29gtk7JbCw/N/WhJwEnwCDz/CkAlJzKMNQKqVa7OS 8fiog64J+PkaEffysqVwWkhnLYPVaWjch5qzqREFYQBCDH/dolXox5Q7jUYIJvJZ XOWu7+cTY6XCq/1Hx5HaURyulPOgCt1OWEGoOHPwlr7B74MsNafmcGTx/Mw93QKH 1PGzDtdLohbje4Xu58bNMru10LlebpoTBzqwqcOnMYsN1QWmhFKEbs72DWmhuzKs uD2jmjRBlvRX3xyTqXIEEw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1756921108; x= 1757007508; bh=MWaDOy5EsxzPjJKPR/HPfHeBKItwKUOjCav2nL8txcc=; b=Y v4dS1gNVgfNRIIU4kXzpah4TjEPSSeCxO06pJyVds1g0Y4jEp425CoJuR1bCCDrw 5WprwxiymG3F05fTIri5O79DXm5BiuHpVYMGzbiUmho1IZ0FE2H+NUbJotDkYsr4 9MTjEeE/PXHEuQr8weQGlXheDiabv6MVW9/D6qzFFKFkeh9ISHpQB/ZQQsv3ZOr8 E/26JntSghCq7mXrITF9XBxbPFb9aAox4JujbWhvxDZjJfRMtyHP8fY3Y6XGsa+n 9plBiVwa8XL1oqwSyXwQprLMfJqUkC37cFGAjQhZcnd1Kuwc9z38tAvF2Jhst0QL TKY4yYPHkq86FnZlG+hqQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdefjeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucgoteeftdduqddtudculdduhedmnecujfgurhephffvvefuff fkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpeforghrkhcurfgvrghrshhonhcu oehmphgvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrqeenucggtffrrghtth gvrhhnpeffffefudeuueduueduhfefkeeiueeihfdukeeuffekfffhheeigfehveekhefh hfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmph gvrghrshhonhdqlhgvnhhovhhosehsqhhuvggssgdrtggrpdhnsggprhgtphhtthhopeei pdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehmphgvrghrshhonhdqlhgvnhhovh hosehsqhhuvggssgdrtggrpdhrtghpthhtohepihhlphhordhjrghrvhhinhgvnheslhhi nhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehhrghnshhgsehkvghrnhgvlhdroh hrghdprhgtphhtthhopehkvggrnhdttdegkeesghhmrghilhdrtghomhdprhgtphhtthho pehplhgrthhfohhrmhdqughrihhvvghrqdigkeeisehvghgvrhdrkhgvrhhnvghlrdhorh hgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdho rhhg X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 3 Sep 2025 13:38:27 -0400 (EDT) From: Mark Pearson To: mpearson-lenovo@squebb.ca Cc: ilpo.jarvinen@linux.intel.com, hansg@kernel.org, kean0048@gmail.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/3] platform/x86: think-lmi: Add certificate GUID structure Date: Wed, 3 Sep 2025 13:38:12 -0400 Message-ID: <20250903173824.1472244-2-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250903173824.1472244-1-mpearson-lenovo@squebb.ca> References: <20250903173824.1472244-1-mpearson-lenovo@squebb.ca> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Add a certificate GUID structure to make it easier to add different options for other platforms that need different GUIDs. Suggested-by: Ilpo J=C3=A4rvinen Signed-off-by: Mark Pearson Reviewed-by: Ilpo J=C3=A4rvinen --- Changes in v2: - split patch up into series Changes in v3: - add field details to thinkpad_cert_guid declare. - add missing comma - Move null thumbprint GUID check to later in series Changes in v4: - Moved cert_guid into tlmi_priv - applied const where needed drivers/platform/x86/lenovo/think-lmi.c | 29 +++++++++++++++++-------- drivers/platform/x86/lenovo/think-lmi.h | 13 +++++++++++ 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/lenovo/think-lmi.c b/drivers/platform/x86= /lenovo/think-lmi.c index 0992b41b6221..de287987f20c 100644 --- a/drivers/platform/x86/lenovo/think-lmi.c +++ b/drivers/platform/x86/lenovo/think-lmi.c @@ -177,6 +177,16 @@ MODULE_PARM_DESC(debug_support, "Enable debug command = support"); #define TLMI_CERT_SVC BIT(7) /* Admin Certificate Based */ #define TLMI_CERT_SMC BIT(8) /* System Certificate Based */ =20 +static const struct tlmi_cert_guids thinkpad_cert_guid =3D { + .thumbprint =3D LENOVO_CERT_THUMBPRINT_GUID, + .set_bios_setting =3D LENOVO_SET_BIOS_SETTING_CERT_GUID, + .save_bios_setting =3D LENOVO_SAVE_BIOS_SETTING_CERT_GUID, + .cert_to_password =3D LENOVO_CERT_TO_PASSWORD_GUID, + .clear_bios_cert =3D LENOVO_CLEAR_BIOS_CERT_GUID, + .update_bios_cert =3D LENOVO_UPDATE_BIOS_CERT_GUID, + .set_bios_cert =3D LENOVO_SET_BIOS_CERT_GUID, +}; + static const struct tlmi_err_codes tlmi_errs[] =3D { {"Success", 0}, {"Not Supported", -EOPNOTSUPP}, @@ -668,7 +678,7 @@ static ssize_t cert_thumbprint(char *buf, const char *a= rg, int count) const union acpi_object *obj; acpi_status status; =20 - status =3D wmi_evaluate_method(LENOVO_CERT_THUMBPRINT_GUID, 0, 0, &input,= &output); + status =3D wmi_evaluate_method(tlmi_priv.cert_guid->thumbprint, 0, 0, &in= put, &output); if (ACPI_FAILURE(status)) { kfree(output.pointer); return -EIO; @@ -751,7 +761,7 @@ static ssize_t cert_to_password_store(struct kobject *k= obj, kfree_sensitive(passwd); return -ENOMEM; } - ret =3D tlmi_simple_call(LENOVO_CERT_TO_PASSWORD_GUID, auth_str); + ret =3D tlmi_simple_call(tlmi_priv.cert_guid->cert_to_password, auth_str); kfree(auth_str); kfree_sensitive(passwd); =20 @@ -774,7 +784,7 @@ static ssize_t certificate_store(struct kobject *kobj, char *auth_str, *new_cert; const char *serial; char *signature; - char *guid; + const char *guid; int ret; =20 if (!capable(CAP_SYS_ADMIN)) @@ -797,7 +807,7 @@ static ssize_t certificate_store(struct kobject *kobj, if (!auth_str) return -ENOMEM; =20 - ret =3D tlmi_simple_call(LENOVO_CLEAR_BIOS_CERT_GUID, auth_str); + ret =3D tlmi_simple_call(tlmi_priv.cert_guid->clear_bios_cert, auth_str); kfree(auth_str); =20 return ret ?: count; @@ -834,7 +844,7 @@ static ssize_t certificate_store(struct kobject *kobj, kfree(new_cert); return -EACCES; } - guid =3D LENOVO_UPDATE_BIOS_CERT_GUID; + guid =3D tlmi_priv.cert_guid->update_bios_cert; /* Format: 'Certificate,Signature' */ auth_str =3D cert_command(setting, new_cert, signature); } else { @@ -845,7 +855,7 @@ static ssize_t certificate_store(struct kobject *kobj, kfree(new_cert); return -EACCES; } - guid =3D LENOVO_SET_BIOS_CERT_GUID; + guid =3D tlmi_priv.cert_guid->set_bios_cert; /* Format: 'Certificate, password' */ auth_str =3D cert_command(setting, new_cert, setting->password); } @@ -1071,13 +1081,13 @@ static ssize_t current_value_store(struct kobject *= kobj, goto out; } =20 - ret =3D tlmi_simple_call(LENOVO_SET_BIOS_SETTING_CERT_GUID, set_str); + ret =3D tlmi_simple_call(tlmi_priv.cert_guid->set_bios_setting, set_str); if (ret) goto out; if (tlmi_priv.save_mode =3D=3D TLMI_SAVE_BULK) tlmi_priv.save_required =3D true; else - ret =3D tlmi_simple_call(LENOVO_SAVE_BIOS_SETTING_CERT_GUID, + ret =3D tlmi_simple_call(tlmi_priv.cert_guid->save_bios_setting, tlmi_priv.pwd_admin->save_signature); } else if (tlmi_priv.opcode_support) { /* @@ -1282,7 +1292,7 @@ static ssize_t save_settings_store(struct kobject *ko= bj, struct kobj_attribute * ret =3D -EINVAL; goto out; } - ret =3D tlmi_simple_call(LENOVO_SAVE_BIOS_SETTING_CERT_GUID, + ret =3D tlmi_simple_call(tlmi_priv.cert_guid->save_bios_setting, tlmi_priv.pwd_admin->save_signature); if (ret) goto out; @@ -1728,6 +1738,7 @@ static int tlmi_analyze(struct wmi_device *wdev) } =20 if (tlmi_priv.certificate_support) { + tlmi_priv.cert_guid =3D &thinkpad_cert_guid; tlmi_priv.pwd_admin->cert_installed =3D tlmi_priv.pwdcfg.core.password_state & TLMI_CERT_SVC; tlmi_priv.pwd_system->cert_installed =3D diff --git a/drivers/platform/x86/lenovo/think-lmi.h b/drivers/platform/x86= /lenovo/think-lmi.h index 9b014644d316..59aa03c3f846 100644 --- a/drivers/platform/x86/lenovo/think-lmi.h +++ b/drivers/platform/x86/lenovo/think-lmi.h @@ -41,6 +41,17 @@ enum save_mode { TLMI_SAVE_SAVE, }; =20 +/* GUIDs can differ between platforms */ +struct tlmi_cert_guids { + const char *thumbprint; + const char *set_bios_setting; + const char *save_bios_setting; + const char *cert_to_password; + const char *clear_bios_cert; + const char *update_bios_cert; + const char *set_bios_cert; +}; + /* password configuration details */ #define TLMI_PWDCFG_MODE_LEGACY 0 #define TLMI_PWDCFG_MODE_PASSWORD 1 @@ -121,6 +132,8 @@ struct think_lmi { struct tlmi_pwd_setting *pwd_system; struct tlmi_pwd_setting *pwd_hdd; struct tlmi_pwd_setting *pwd_nvme; + + const struct tlmi_cert_guids *cert_guid; }; =20 #endif /* !_THINK_LMI_H_ */ --=20 2.43.0 From nobody Fri Oct 3 07:42:41 2025 Received: from fout-b1-smtp.messagingengine.com (fout-b1-smtp.messagingengine.com [202.12.124.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 052942D3ECA; Wed, 3 Sep 2025 17:38:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756921113; cv=none; b=GKqUFaFwyJciqUFw0otY28BOWli40SVBKiWs9HxWq5cV/6AotnsugQZuaYdMxsU2irwCEoLp7aYKbNfdIDSqxIs2aZ2IbzBlOKk53bYBK8uBjEf1fCiWEpCuengIXjBFeDbBayBCBtmOvDgszg6HHmGKjxXRpKpRH2bz/HZK98A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756921113; c=relaxed/simple; bh=ItYGcVqP6A+V+mcjkV8fZFfy5Z68J8sXqML1UZMt3XY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F++9krzyZ74I0RsHkSOFZ6nIrw1cUlMYQilGs50Wnw5QEB15PArUUr552iBOMXUlB5pqGoH2yQrhRfm0Lbs6/cHWtJID5H1nlLteJlr/J2lqAHE1USCtyNZqkxJlIuSjnUdxq33VParJyUtast6Oo4DKHMmA0sma8fHm6u49Fbg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca; spf=pass smtp.mailfrom=squebb.ca; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b=yMI8zHJh; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=THoCJYib; arc=none smtp.client-ip=202.12.124.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=squebb.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b="yMI8zHJh"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="THoCJYib" Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfout.stl.internal (Postfix) with ESMTP id EAC5D1D00443; Wed, 3 Sep 2025 13:38:29 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Wed, 03 Sep 2025 13:38:30 -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:subject:subject:to:to; s=fm2; t=1756921109; x= 1757007509; bh=DYnOaiAueoSQYCxZ7k7x4ZOs2okglK8ZwDzjOK2+1KQ=; b=y MI8zHJhL1TSpRYdxh4roANDGmiggsB27SOmLphvP8bkQOt2BnpBTPHpeytghDFDE EbzIzkefbeY9bvF7lWWozWaQNwaPz6bsI83F2osEbeSLJW7RDAqRPnC1J5bPSUQo YgDqenqqzaG7vvvhRa7h7Jm5vMQ0+eUspMQMsH3VBVVzv9cKKwsovywmY17ALKcD 8G4cMlUB5BjDNHHOmDrmcGLX6zzQbPksYFifvT/lBrSLJcilwhSNJTgv2wWiS4bf VD4jK7CGwKYKTpngTZw1Nn2bsqHQCQBCTxHGbAHz7pYeAsYuvqaoF+BsjK2NacRT APa8aA4ATehAFs+AnNyiw== 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:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1756921109; x=1757007509; bh=D YnOaiAueoSQYCxZ7k7x4ZOs2okglK8ZwDzjOK2+1KQ=; b=THoCJYibrYIfSW9z9 txc0msb6Y64SSwO5zqzlXcG0MykBYHMM8XvFR/IysM7Grtryt07nbN0DtVzlKb64 bQQqQvLAGRsclK+Y6MJlwFgyp2jcbZ8vf3bZmD29jH47jB67j9V66h6l78S6SXdL bGn4rUlWk3k07l1x1pLZsrq6CF3uA4KcFut1Y11ZTvgUIfePp7ACe1P+/4g2D8PC eov/88Mrix5w95mSc5jWocycqYTzVqvV0LNmnskLsdJkm9jvr7cq+9jbyaFIJSRk 3Lvu6OAEBWKyYasnD61P7ts6yBa0YWEcYSNoZSS8EUAJTEv1Zkg7DIUvaT71k6B0 QkcTg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdefjeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucgoteeftdduqddtudculdduhedmnecujfgurhephffvvefuff fkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrrhhkucfrvggrrhhsohhnuceo mhhpvggrrhhsohhnqdhlvghnohhvohesshhquhgvsggsrdgtrgeqnecuggftrfgrthhtvg hrnhepfedtvdejfeelffevhffgjeejheduteetieeguefgkefhhfegjeduueethefgvdff necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhpvg grrhhsohhnqdhlvghnohhvohesshhquhgvsggsrdgtrgdpnhgspghrtghpthhtohepiedp mhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhhpvggrrhhsohhnqdhlvghnohhvoh esshhquhgvsggsrdgtrgdprhgtphhtthhopehilhhpohdrjhgrrhhvihhnvghnsehlihhn uhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohephhgrnhhsgheskhgvrhhnvghlrdhorh hgpdhrtghpthhtohepkhgvrghntddtgeeksehgmhgrihhlrdgtohhmpdhrtghpthhtohep phhlrghtfhhorhhmqdgurhhivhgvrhdqgiekieesvhhgvghrrdhkvghrnhgvlhdrohhrgh dprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhr gh X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 3 Sep 2025 13:38:28 -0400 (EDT) From: Mark Pearson To: mpearson-lenovo@squebb.ca Cc: ilpo.jarvinen@linux.intel.com, hansg@kernel.org, kean0048@gmail.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/3] platform/x86: think-lmi: Certificate support for ThinkCenter Date: Wed, 3 Sep 2025 13:38:13 -0400 Message-ID: <20250903173824.1472244-3-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250903173824.1472244-1-mpearson-lenovo@squebb.ca> References: <20250903173824.1472244-1-mpearson-lenovo@squebb.ca> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ThinkCenter platforms use a different set of GUIDs along with some differences in implementation details for their support of certificate based authentication. Update the think-lmi driver to work correctly on these platforms. Tested on M75q Gen 5. Signed-off-by: Kean Ren Signed-off-by: Mark Pearson --- Changes in v2: - split patch up into series Changes in v3: - Move check for no thumbprint GUID to this patch - Add structure fields and missing comma Changes in v4: - Moved cert_guid into tlmi_priv - applied const where needed drivers/platform/x86/lenovo/think-lmi.c | 56 +++++++++++++++++++++---- drivers/platform/x86/lenovo/think-lmi.h | 1 + 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/drivers/platform/x86/lenovo/think-lmi.c b/drivers/platform/x86= /lenovo/think-lmi.c index de287987f20c..f2bef523d6ce 100644 --- a/drivers/platform/x86/lenovo/think-lmi.c +++ b/drivers/platform/x86/lenovo/think-lmi.c @@ -119,6 +119,7 @@ MODULE_PARM_DESC(debug_support, "Enable debug command s= upport"); * You must reboot the computer before the changes will take effect. */ #define LENOVO_SET_BIOS_CERT_GUID "26861C9F-47E9-44C4-BD8B-DFE7FA2610FE" +#define LENOVO_TC_SET_BIOS_CERT_GUID "955aaf7d-8bc4-4f04-90aa-97469512f167" =20 /* * Name: UpdateBiosCert @@ -128,6 +129,7 @@ MODULE_PARM_DESC(debug_support, "Enable debug command s= upport"); * You must reboot the computer before the changes will take effect. */ #define LENOVO_UPDATE_BIOS_CERT_GUID "9AA3180A-9750-41F7-B9F7-D5D3B1BAC3CE" +#define LENOVO_TC_UPDATE_BIOS_CERT_GUID "5f5bbbb2-c72f-4fb8-8129-228eef4fd= bed" =20 /* * Name: ClearBiosCert @@ -137,6 +139,8 @@ MODULE_PARM_DESC(debug_support, "Enable debug command s= upport"); * You must reboot the computer before the changes will take effect. */ #define LENOVO_CLEAR_BIOS_CERT_GUID "B2BC39A7-78DD-4D71-B059-A510DEC44890" +#define LENOVO_TC_CLEAR_BIOS_CERT_GUID "97849cb6-cb44-42d1-a750-26a596a9e= ec4" + /* * Name: CertToPassword * Description: Switch from certificate to password authentication. @@ -145,6 +149,7 @@ MODULE_PARM_DESC(debug_support, "Enable debug command s= upport"); * You must reboot the computer before the changes will take effect. */ #define LENOVO_CERT_TO_PASSWORD_GUID "0DE8590D-5510-4044-9621-77C227F5A70D" +#define LENOVO_TC_CERT_TO_PASSWORD_GUID "ef65480d-38c9-420d-b700-ab3d6c8eb= aca" =20 /* * Name: SetBiosSettingCert @@ -153,6 +158,7 @@ MODULE_PARM_DESC(debug_support, "Enable debug command s= upport"); * Format: "Item,Value,Signature" */ #define LENOVO_SET_BIOS_SETTING_CERT_GUID "34A008CC-D205-4B62-9E67-31DFA8= B90003" +#define LENOVO_TC_SET_BIOS_SETTING_CERT_GUID "19ecba3b-b318-4192-a89b-43d= 94bc60cea" =20 /* * Name: SaveBiosSettingCert @@ -161,6 +167,7 @@ MODULE_PARM_DESC(debug_support, "Enable debug command s= upport"); * Format: "Signature" */ #define LENOVO_SAVE_BIOS_SETTING_CERT_GUID "C050FB9D-DF5F-4606-B066-9EFC40= 1B2551" +#define LENOVO_TC_SAVE_BIOS_SETTING_CERT_GUID "0afaf46f-7cca-450a-b455-a82= 6a0bf1af5" =20 /* * Name: CertThumbprint @@ -187,6 +194,16 @@ static const struct tlmi_cert_guids thinkpad_cert_guid= =3D { .set_bios_cert =3D LENOVO_SET_BIOS_CERT_GUID, }; =20 +static const struct tlmi_cert_guids thinkcenter_cert_guid =3D { + .thumbprint =3D NULL, + .set_bios_setting =3D LENOVO_TC_SET_BIOS_SETTING_CERT_GUID, + .save_bios_setting =3D LENOVO_TC_SAVE_BIOS_SETTING_CERT_GUID, + .cert_to_password =3D LENOVO_TC_CERT_TO_PASSWORD_GUID, + .clear_bios_cert =3D LENOVO_TC_CLEAR_BIOS_CERT_GUID, + .update_bios_cert =3D LENOVO_TC_UPDATE_BIOS_CERT_GUID, + .set_bios_cert =3D LENOVO_TC_SET_BIOS_CERT_GUID, +}; + static const struct tlmi_err_codes tlmi_errs[] =3D { {"Success", 0}, {"Not Supported", -EOPNOTSUPP}, @@ -678,6 +695,9 @@ static ssize_t cert_thumbprint(char *buf, const char *a= rg, int count) const union acpi_object *obj; acpi_status status; =20 + if (!tlmi_priv.cert_guid->thumbprint) + return -EOPNOTSUPP; + status =3D wmi_evaluate_method(tlmi_priv.cert_guid->thumbprint, 0, 0, &in= put, &output); if (ACPI_FAILURE(status)) { kfree(output.pointer); @@ -856,8 +876,16 @@ static ssize_t certificate_store(struct kobject *kobj, return -EACCES; } guid =3D tlmi_priv.cert_guid->set_bios_cert; - /* Format: 'Certificate, password' */ - auth_str =3D cert_command(setting, new_cert, setting->password); + if (tlmi_priv.thinkcenter_mode) { + /* Format: 'Certificate, password, encoding, kbdlang' */ + auth_str =3D kasprintf(GFP_KERNEL, "%s,%s,%s,%s", new_cert, + setting->password, + encoding_options[setting->encoding], + setting->kbdlang); + } else { + /* Format: 'Certificate, password' */ + auth_str =3D cert_command(setting, new_cert, setting->password); + } } kfree(new_cert); if (!auth_str) @@ -1593,6 +1621,15 @@ static int tlmi_analyze(struct wmi_device *wdev) wmi_has_guid(LENOVO_SAVE_BIOS_SETTING_CERT_GUID)) tlmi_priv.certificate_support =3D true; =20 + /* ThinkCenter uses different GUIDs for certificate support */ + if (wmi_has_guid(LENOVO_TC_SET_BIOS_CERT_GUID) && + wmi_has_guid(LENOVO_TC_SET_BIOS_SETTING_CERT_GUID) && + wmi_has_guid(LENOVO_TC_SAVE_BIOS_SETTING_CERT_GUID)) { + tlmi_priv.certificate_support =3D true; + tlmi_priv.thinkcenter_mode =3D true; + pr_info("ThinkCenter modified support being used\n"); + } + /* * Try to find the number of valid settings of this machine * and use it to create sysfs attributes. @@ -1738,11 +1775,16 @@ static int tlmi_analyze(struct wmi_device *wdev) } =20 if (tlmi_priv.certificate_support) { - tlmi_priv.cert_guid =3D &thinkpad_cert_guid; - tlmi_priv.pwd_admin->cert_installed =3D - tlmi_priv.pwdcfg.core.password_state & TLMI_CERT_SVC; - tlmi_priv.pwd_system->cert_installed =3D - tlmi_priv.pwdcfg.core.password_state & TLMI_CERT_SMC; + if (tlmi_priv.thinkcenter_mode) { + tlmi_priv.cert_guid =3D &thinkcenter_cert_guid; + tlmi_priv.pwd_admin->cert_installed =3D tlmi_priv.pwdcfg.core.password_= mode; + } else { + tlmi_priv.cert_guid =3D &thinkpad_cert_guid; + tlmi_priv.pwd_admin->cert_installed =3D + tlmi_priv.pwdcfg.core.password_state & TLMI_CERT_SVC; + tlmi_priv.pwd_system->cert_installed =3D + tlmi_priv.pwdcfg.core.password_state & TLMI_CERT_SMC; + } } return 0; =20 diff --git a/drivers/platform/x86/lenovo/think-lmi.h b/drivers/platform/x86= /lenovo/think-lmi.h index 59aa03c3f846..017644323d46 100644 --- a/drivers/platform/x86/lenovo/think-lmi.h +++ b/drivers/platform/x86/lenovo/think-lmi.h @@ -120,6 +120,7 @@ struct think_lmi { enum save_mode save_mode; bool save_required; bool reboot_required; + bool thinkcenter_mode; =20 struct tlmi_attr_setting *setting[TLMI_SETTINGS_COUNT]; struct device *class_dev; --=20 2.43.0 From nobody Fri Oct 3 07:42:41 2025 Received: from fout-b1-smtp.messagingengine.com (fout-b1-smtp.messagingengine.com [202.12.124.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E70D9320CCC; Wed, 3 Sep 2025 17:38:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756921113; cv=none; b=LX3ZsCa2v37TrhKH0MVSsZyI06dPqqtwP3up5k33YkJ4Va4hP9dM/vzHH0S7gImQP5/Kh8n0UcudRvbB/t54sn+x3HDGxl8+q7rnDnngnxP1OGRCmpSaH/VhurfPPuLmllqKiIRvD72ZY5BcS+XM6QmLeCtDLhbkDSa0UOIM+b8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756921113; c=relaxed/simple; bh=CJIszMBWvbxHJQiGv4kbis1ILLhdG/+p+Uka8iZrT2s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lqYJ/k3H+yhhkk/5yYKzZDiWKeZ5QKAoIRgu1rbn0Jj4QNYCwv5ar6aWx3M1VsCRML7QWUewnpGHU/tm6VzSbwqqtmp0sD/8eut2Odx7kcgM3ZnpcJZhew6Z1PD6qc6gk08WForFOt32KyewYXjAgXyDN3Nac9KHiEErR1Ohwhs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca; spf=pass smtp.mailfrom=squebb.ca; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b=Doh+p8Wb; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=dns2EKHl; arc=none smtp.client-ip=202.12.124.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=squebb.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=squebb.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=squebb.ca header.i=@squebb.ca header.b="Doh+p8Wb"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="dns2EKHl" Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailfout.stl.internal (Postfix) with ESMTP id E9E601D005BF; Wed, 3 Sep 2025 13:38:30 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Wed, 03 Sep 2025 13:38:31 -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:subject:subject:to:to; s=fm2; t=1756921110; x= 1757007510; bh=AYha583EgDlRiD4f7ecC81OwJdm0eeCnppqyvyQv1Aw=; b=D oh+p8WbSNNXCtJR+DJpT8KKyJxxlu71O9lHW6njlVzCYUCvWlZngYpC+4BHejOYt qRm1ur7zRiOUBlTf8a4Iv61jWJY+i9mY1sZvN10XUdtYymet24ha9YpD9xoVbFar cRGrDiwOCFRXoOBUkfy+O09iJmjVzwsQ7H+7aNDgE73wnDZxqzMZZvC96of2YfVW WP4ZlpTkmLXrp8/U1uCncCqgG8C7PRw/EjxGb0lXO+qQDu/Wt30nLV6HvTXl+rks hkBBQlFa2mLRSvZs/XCdMMVlMa2BzAKx3Jm4mrGT7nv/3OQDpBopi8B8jY9mKfoI MzXVmAOiSNfjz7W/h7yYQ== 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:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1756921110; x=1757007510; bh=A Yha583EgDlRiD4f7ecC81OwJdm0eeCnppqyvyQv1Aw=; b=dns2EKHlYj9brO3Mo /a2Trf9wMRa3dZLVCVQFDeTjTH2zs3wZg/qX4zMu0Nmg+XK7DnGzB3yix2giA7WT jP6aWVKD2Ynz+brxRTHpHq3cscng49N0TWrqRHGXcZ3OMYopUPNX/dtujRN9RDm2 UMrUD2AYvpveOV1D+1WBuQsc3ms4uQ6KI42AlHnnY7gpxwHIfz/IPHXUDwTQ2XXf KF8MRf9NkJowKPyz10Y2USMuuokxUzPy0utZEE+oaJy2+fzxwijTPl/StqbBu82+ FN9blZvk+rWsejqZv08l42sCwBRBnAcSmKIeUDAF8szGdOyna+1uxFHH6/8juV6c OJcmQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdefjeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucgoteeftdduqddtudculdduhedmnecujfgurhephffvvefuff fkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrrhhkucfrvggrrhhsohhnuceo mhhpvggrrhhsohhnqdhlvghnohhvohesshhquhgvsggsrdgtrgeqnecuggftrfgrthhtvg hrnhepfedtvdejfeelffevhffgjeejheduteetieeguefgkefhhfegjeduueethefgvdff necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhpvg grrhhsohhnqdhlvghnohhvohesshhquhgvsggsrdgtrgdpnhgspghrtghpthhtohepiedp mhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhhpvggrrhhsohhnqdhlvghnohhvoh esshhquhgvsggsrdgtrgdprhgtphhtthhopehilhhpohdrjhgrrhhvihhnvghnsehlihhn uhigrdhinhhtvghlrdgtohhmpdhrtghpthhtohephhgrnhhsgheskhgvrhhnvghlrdhorh hgpdhrtghpthhtohepkhgvrghntddtgeeksehgmhgrihhlrdgtohhmpdhrtghpthhtohep phhlrghtfhhorhhmqdgurhhivhgvrhdqgiekieesvhhgvghrrdhkvghrnhgvlhdrohhrgh dprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhr gh X-ME-Proxy: Feedback-ID: ibe194615:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 3 Sep 2025 13:38:30 -0400 (EDT) From: Mark Pearson To: mpearson-lenovo@squebb.ca Cc: ilpo.jarvinen@linux.intel.com, hansg@kernel.org, kean0048@gmail.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/3] platform/x86: think-lmi: Add extra TC BIOS error messages Date: Wed, 3 Sep 2025 13:38:14 -0400 Message-ID: <20250903173824.1472244-4-mpearson-lenovo@squebb.ca> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250903173824.1472244-1-mpearson-lenovo@squebb.ca> References: <20250903173824.1472244-1-mpearson-lenovo@squebb.ca> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add extra error messages that are used by ThinkCenter platforms. Signed-off-by: Kean Ren Signed-off-by: Mark Pearson --- Changes in v2: - split patch up into series Changes in v3 & v4: - No changes drivers/platform/x86/lenovo/think-lmi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/platform/x86/lenovo/think-lmi.c b/drivers/platform/x86= /lenovo/think-lmi.c index f2bef523d6ce..540b472b1bf3 100644 --- a/drivers/platform/x86/lenovo/think-lmi.c +++ b/drivers/platform/x86/lenovo/think-lmi.c @@ -206,10 +206,21 @@ static const struct tlmi_cert_guids thinkcenter_cert_= guid =3D { =20 static const struct tlmi_err_codes tlmi_errs[] =3D { {"Success", 0}, + {"Set Certificate operation was successful.", 0}, {"Not Supported", -EOPNOTSUPP}, {"Invalid Parameter", -EINVAL}, {"Access Denied", -EACCES}, {"System Busy", -EBUSY}, + {"Set Certificate operation failed with status:Invalid Parameter.", -EINV= AL}, + {"Set Certificate operation failed with status:Invalid certificate type."= , -EINVAL}, + {"Set Certificate operation failed with status:Invalid password format.",= -EINVAL}, + {"Set Certificate operation failed with status:Password retry count excee= ded.", -EACCES}, + {"Set Certificate operation failed with status:Password Invalid.", -EACCE= S}, + {"Set Certificate operation failed with status:Operation aborted.", -EBUS= Y}, + {"Set Certificate operation failed with status:No free slots to write.", = -ENOSPC}, + {"Set Certificate operation failed with status:Certificate not found.", -= EEXIST}, + {"Set Certificate operation failed with status:Internal error.", -EFAULT}, + {"Set Certificate operation failed with status:Certificate too large.", -= EFBIG}, }; =20 static const char * const encoding_options[] =3D { --=20 2.43.0