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=1796290724; b=MhzGtfsbopWr6GyWkZh7wiX7ldGbLJ7jZiInwvDgeZ6HJP7/9SN6Z6auY5YRdYU1U6+t wYHxaN8E+C/ePgzmJEpWWkl74gsZYEqgBeELCGxJQmUOBIS1BpQ7ABUD6EKyTRcYdnLnA B39XW8g/8FBzXcE9C1BXogWYFjMiDRppA/mo0hr6GFZTOMu5nc0VzZ/jzc48EbRB//4rC YmoBZdVgVBZN03IPD1ioo+8iykPREjXzoZODt6AxvzvcN19tf4HTfnYiYWKr2mj3yKBga 9X9EOAJaMxf08p1ap/Seu9bvlR7CLVMvwPS42OGekqO3pbyXShfNinWkf4uKacEnMZg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796290724; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=j7ZL6iUCsoltAibJ7a3edGkOnDfEOIvrAIDUxs4NDVI=; b=JLPgldXn1FmFXxfwyOY4xVKj1/MejzYgIG7xiPv4UFZFT7JiJaRwHD3PvsSWVOGbFZLy czlSKRTYp3x0Xr0L52XLlJ1jAQH8TGL25CvJPoPPKJ2/QN+xaLwcvpOZOvg1bCMsXdUAV 4xvZHjr5c9JC7Mu6nsrCyTGmxhSxnjUyA35aiXpVo9YcvnIOPcllbC99UhgI8jxlo3Bjf hglZGmFOU6lepi8o7yIBgVUehtsahxgVYpnPS3R7R3DXKSfA0RJrM1/OpU1djyz567Yua h+RpX01zaLnbxy8TcJvjvgi1HwfouX780zo9k062xjclvq5WQWlijat2oMy21cn4wbw== 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=NNELY8l6; 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 AEE05606A335; Thu, 3 Dec 2026 09:38:44 +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=NNELY8l6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFB2D1F00896; Thu, 3 Dec 2026 09:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796290724; bh=j7ZL6iUCsoltAibJ7a3edGkOnDfEOIvrAIDUxs4NDVI=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=NNELY8l6D788F8YWY0rCb25LAwmIAhUVcgfxOV7TlwTJKSpBON3KTxH3fPaf9I37/ JLtt+fRh6EHAp8FOpEOgmwoVD1iGjG6nfrfn7/3tKIERsqLB97GUx20yxkCi/NCM38 wBASxIhK/vpC9RdNTCUKDS65Xkf4D25WvNqzWW4mOgymDsnfrW5MuM9WLjK4nALK/u e65id9QokjjeXZOh6tjnTrfXnA6Ih65yVkNkdZEACe6bVL+mW6n5jaLJ/L0NoxiPbQ AEK5LbnqdjiiGpj8pKQJvA7MfVW0KGD872VlxBTXtMXJviBt5A7lhSY5xEz9+g1eE7 eqbJ3yfTBGulQ== Date: Thu, 3 Dec 2026 11:38:39 +0200 From: Leon Romanovsky To: Alexey Kardashevskiy Cc: 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 , 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, Luiz Augusto von Dentz , Greg Kroah-Hartman , linux-sound@vger.kernel.org, Jason Gunthorpe Subject: Re: [PATCH v4 21/33] driver core: Introduce a generic device trust level Message-ID: <20261203093839.GO31440@unreal> References: <20261124-device-trust-core-v4-0-037eb0d17b1f@nvidia.com> <20261124-device-trust-core-v4-21-037eb0d17b1f@nvidia.com> <1ef0e056-779f-4ac4-9346-b38de6419d50@amd.com> X-Mailing-List: linux-pci@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 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1ef0e056-779f-4ac4-9346-b38de6419d50@amd.com> On Tue, Dec 01, 2026 at 10:11:29PM +1100, Alexey Kardashevskiy wrote: > On 24/11/26 20:43, Leon Romanovsky wrote: > > From: Leon Romanovsky > > > > Attestation needs to hold devices before driver probing and DMA setup. > > Authorization on individual buses does not provide a common policy that > > drivers and infrastructure can use. > > > > Introduce a shared admission policy and operating trust level. Keep the > > accepted level fixed for the device's lifetime because unbind or failed > > setup does not necessarily undo hardware configuration. Retain active trust > > through teardown so cleanup uses the same assumptions as setup. Preserve > > existing behavior when no trust boot options are supplied. > > > > Signed-off-by: Leon Romanovsky > > > Reviewed-by: Alexey Kardashevskiy Thanks <...> > > #define to_driver(obj) container_of(obj, struct driver_private, kobj) > > +/** > > + * enum device_trust_state - Device trust authorization and commitment > > + * @DEVICE_TRUST_SELECTABLE: No authorization or commitment. When runtime > > + * policy changes are enabled, any policy can be selected. Selecting > > + * blocked enters %DEVICE_TRUST_WAITING. > > + * @DEVICE_TRUST_WAITING: Blocked policy without commitment. Runtime > > + * authorization requires adversarial or unrestricted and enters > > + * %DEVICE_TRUST_AUTHORIZED; selecting default is rejected. > > + * @DEVICE_TRUST_AUTHORIZED: Adversarial or unrestricted selected from > > + * %DEVICE_TRUST_WAITING. Policy is fixed, but no operating level has > > + * been committed. > > + * @DEVICE_TRUST_COMMITTED: Policy and operating level accepted before > > + * driver setup. Both remain fixed through setup failure and unbind. > > > My AI says that binding a driver is possible in all of them except WAITING so it is quite exceptional but the name is not. Dunno, may be add the note about drivers binding in this comment. I don't think so. This is internal state required by the trust_state logic and its corresponding KUnit tests. <...> > > +/** > > + * device_is_adversarial - Test whether a device is operated as an adversary > > + * @dev: device to inspect > > + * > > + * Return: True when the active trust level is %DEVICE_TRUST_ADVERSARIAL. > > + */ > > +bool device_is_adversarial(const struct device *dev) > > +{ > > + return device_get_trust_level(dev) == DEVICE_TRUST_ADVERSARIAL; > > +} > > +EXPORT_SYMBOL_GPL(device_is_adversarial); > > Can be static inline. This function is used later in the patch "iommu: Use device trust for DMA restrictions". > > > + > > +static const char * const device_trust_policy_names[] = { > > + [DEVICE_TRUST_POLICY_DEFAULT] = "default", > > This "default" is a bus-specific default? Yes. default means “don’t override” - each device keeps whatever its bus decides. > I'd probably call it "bus": > > device_trust.default=bus Sure, let's change. > > > Seeing device_trust.default=default makes my brain explode :) Thanks, Thanks