From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796299538; b=z2+fYuPGvN7T4NVcavUkbAlGH3PmyztknaGHvJ9on7LRyuYsUYB1zQFhg3j+5GtwaAu+ CFHd0RxKtEQEyT5qAy3A63jnYwdp0/UaJXYmkSTeXVPJwF7YFRnZWUzRPdCVl/uwK8MTm V+jl9quceSVW2el45rJZiPIzj23ihEnA693XoUjzgBG3LWudvjElm3b8aVUynWcXHJU4i QBAqeFRN3NDHK5LURIhV7tsJpMA04oGa4pcncBxPHUZNnVVqARhDaZiDHITlKdVmUmu8v K14iiSLBY8biQMuYYXZzmGTsl3Dre4DrR+o0MrqORalin930StiUa906hAWnDzMoYSw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796299538; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type:X-Mailer: Content-Transfer-Encoding; bh=rZJSigvj+pTCgnG5y2QNi+gxQi9CD0t5ud+77470tGY=; b=nOW1SWdEanngKcFzit3MI7BC1QZQnC+61mBAG6BKMUQ3U/bHOKCxOc3zWB4SrhDHvtmL CqPPeSNeYfrrAVzsvDpevi6AKCRTc9irpPomeKQ7pCObhO5QSAV/HCbpL3Fj9me0BuEaU GAUxbx5ewCOndS6RijLnieyCdGKb9lSiviw8Z7Q0uWS77YFLKO2isWZstF6K1lXxYba0i joivMIWFzORlRvY0eHJT7b5ewciSUQWpCx9I1BfOklL4oqbEKU7xROl1vAFZCEE3IRGjy Bu/rAw3ABw64NCtpyl7b4LY118SGCNfMjjVYyoNLJxyPR60F6najUmhw+gf+YilxbXg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Z4pP4vZq; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C2EC60A263F; Thu, 3 Dec 2026 12:05:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Z4pP4vZq Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8FA71F0089C; Thu, 3 Dec 2026 12:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796299537; bh=rZJSigvj+pTCgnG5y2QNi+gxQi9CD0t5ud+77470tGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Z4pP4vZqTGVgq6zrZQ+QUOQ9DTl8rVkesOLASrcse4+Z+HuxANjEafBSPypEx8kKh aGN/Ev+wBkMwas83FomoL72D+M0/O/Zt6rc8S+qWxDEAhFNlyiLBBvV8Xvf/495kmq FvVNaXmYKZ1wXE8pJXWf1KPRerG7BZp+0jFGkulKOtcQnOjbix9Taomghiq3OFGaIJ uGukkPwdiWD93d91kwxZVxgv13cnrZ+7eEulBS2iBICIxSu6kwklf52awa53IBAkuV ZpwDqylGhJB6U+WPh3aad1+8dBwDELWbSiXC6KD9pftgY6I39loJtxJhppr4iFx69U 1mKUOqH2SQmnA== From: Leon Romanovsky To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Dmitry Torokhov , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Johannes Berg , Jonathan Corbet , Shuah Khan , Randy Dunlap , Bjorn Helgaas , "Joerg Roedel (AMD)" , Suravee Suthikulpanit , Vasant Hegde , Will Deacon , Robin Murphy , David Woodhouse , Lu Baolu , Johan Hovold , Eric Dumazet , Marcel Holtmann , Luiz Augusto von Dentz , Nipun Gupta , Nikhil Agarwal , Pieter Jansen van Vuuren , Chris Lu , Mans Rullgard , Alan Stern , Jaroslav Kysela , Takashi Iwai , Andrew Morton , Cornelia Huck , Andrew Morton , Jeff Garzik , "Rafael J. Wysocki" , Bart Van Assche , Alexander Duyck , Dan Williams , Lukas Wunner Cc: linux-kernel@vger.kernel.org, driver-core@lists.linux.dev, linux-input@vger.kernel.org, netdev@vger.kernel.org, linux-wireless@vger.kernel.org, linux-usb@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-acpi@vger.kernel.org, linux-doc@vger.kernel.org, linux-pci@vger.kernel.org, iommu@lists.linux.dev, linux-coco@lists.linux.dev, Alexey Kardashevskiy , Luiz Augusto von Dentz , Greg Kroah-Hartman , linux-sound@vger.kernel.org, Jason Gunthorpe Subject: [PATCH v5 25/33] driver core: Expose committed device trust level Date: Thu, 3 Dec 2026 14:03:47 +0200 Message-ID: <20261203-device-trust-core-v5-25-485cc6eddd46@nvidia.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261203-device-trust-core-v5-0-485cc6eddd46@nvidia.com> References: <20261203-device-trust-core-v5-0-485cc6eddd46@nvidia.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.17-dev-d2b70 Content-Transfer-Encoding: 8bit From: Leon Romanovsky After probe failure or unbind, active trust returns to blocked while the accepted operating level remains committed. IOMMU state and other infrastructure can outlive the driver, so active trust alone cannot tell them which operating level was accepted. Expose the retained commitment separately. This lets infrastructure honor the original level after probe failure or unbind without mistaking inactive driver state for a new authorization opportunity. Signed-off-by: Leon Romanovsky --- drivers/base/trust.c | 13 +++++++++++++ include/linux/device/trust.h | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/base/trust.c b/drivers/base/trust.c index 8ed414d6eb0e..9f7478bd7a6d 100644 --- a/drivers/base/trust.c +++ b/drivers/base/trust.c @@ -157,6 +157,19 @@ enum device_trust_level device_get_trust_level(const struct device *dev) } EXPORT_SYMBOL_GPL(device_get_trust_level); +/** + * device_get_committed_trust_level - Return the lifetime trust commitment + * @dev: device to inspect + * + * Return: %DEVICE_TRUST_BLOCKED before admission, otherwise the level fixed + * before driver setup. The commitment survives setup failure and unbind. + */ +enum device_trust_level device_get_committed_trust_level(const struct device *dev) +{ + return READ_ONCE(dev->trust_committed_level); +} +EXPORT_SYMBOL_GPL(device_get_committed_trust_level); + /** * device_is_adversarial - Test whether a device is operated as an adversary * @dev: device to inspect diff --git a/include/linux/device/trust.h b/include/linux/device/trust.h index f39523df03ae..250cf4004193 100644 --- a/include/linux/device/trust.h +++ b/include/linux/device/trust.h @@ -48,6 +48,7 @@ int device_trust_set_policy_locked(struct device *dev, enum device_trust_policy policy); int device_trust_set_policy(struct device *dev, enum device_trust_policy policy); enum device_trust_level device_get_trust_level(const struct device *dev); +enum device_trust_level device_get_committed_trust_level(const struct device *dev); bool device_is_adversarial(const struct device *dev); #endif /* _DEVICE_TRUST_H_ */ -- 2.56.1