From: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: linux-coco@lists.linux.dev, Alexey Kardashevskiy <aik@amd.com>,
Lukas Wunner <lukas@wunner.de>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory
Date: Wed, 18 Nov 2026 13:10:56 +0530 [thread overview]
Message-ID: <yq5a1p8iy4c7.fsf@kernel.org> (raw)
In-Reply-To: <20261116144237.GB2245175@nvidia.com>
Jason Gunthorpe <jgg@nvidia.com> writes:
> On Mon, Nov 16, 2026 at 08:04:44PM +0530, Aneesh Kumar K.V wrote:
>> Jason Gunthorpe <jgg@nvidia.com> writes:
>>
>> > On Mon, Nov 16, 2026 at 06:45:03PM +0530, Aneesh Kumar K.V wrote:
>> >
>> >> The complete CCA patch series adds the following files:
>> >>
>> >> attestation.c core.c ctlv_attestation_pci_gen.c ctlv_attestation_pci_gen.h internal.h Makefile spdm.c
>> >
>> > Why would any of this go under drivers/pci ?
>> >
>> > The whole point here is to make an 'attestation subsystem', so that
>> > all belongs under
>> >
>> > drivers/attestation/
>> >
>>
>> So the attestation evidence would be fetched via drivers/coco/tsm/
>
> No.
>
> The tsm code causes an attestation driver to start, it doesn't do any
> attestation activties itself.
>
>> and stored by drivers/pci/tsm.c:pci_tsm_evidence.
>
> Why would we do that? Evidence is fetched, returned to userspace and
> discarded by the kernel.
>
>> I would expect drivers/attestation/ to provide helpers, like other
>> core kernel components, allowing different subsystems to register as
>> attestation backends, with PCI/TSM being one of them.
>
> I expect the thing in drivers/attestation/ to provide the full end to
> end driver. It calls the RMI/RSI/RHI's as directly as it can. Without
> spreading stuff around all over the place.
>
> Jason
I tried separating the CCA attestation driver from arm-cca-host in my
local tree. The main difficulty is coordinating locking and object
lifetimes with the existing PF0 and vDEVICE ownership rules.
PF0 owns the PDEV state and resources used for authentication and stream
activation. vDEVICE operations also depend on that PDEV, so a live
vDEVICE must keep PF0 and its resources alive. Restarting attestation
must not destroy a PDEV while active VDEVICEs still depend on it.
Placing the attestation backend in drivers/attestation/cca/ makes these
checks and locking requirements span two drivers. The attestation driver
calls PDEV_CREATE and PDEV_COMMUNICATE using the PDEV and communication
buffers owned by arm-cca-host. arm-cca-host uses the same PDEV to
connect streams and create vDEVICEs. The two drivers must therefore
coordinate access to these objects and their destruction.
My first attempt used pci_tsm_rwsem to serialize attestation operations.
That would require TSM callbacks for the attestation driver to acquire
and release the lock.
I also tried introducing an attestation_connection object with its own
mutex, reference count. Each vDEVICE then had to hold both its existing
PCI/TSM reference and a reference to this new object. The stream setup
still requires pci_tsm_rwsem, so this approach would also need callbacks
to acquire that lock before accepting evidence.
I am now considering implementing the CCA SPDM attestation ops directly
in arm-cca-host, similar to the viommu ops. The SPDM attestation ops
could then directly use PF0's PDEV, communication buffers, and existing
vDEVICE references. The same driver could prevent conflicting
PDEV/vDEVICE operations, and stop attestation commands before freeing
the associated resources.
-aneesh
prev parent reply other threads:[~2026-11-18 7:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 7:54 [PATCH 1/2] MAINTAINERS: Update TSM file coverage and repository Aneesh Kumar K.V (Arm)
2026-11-16 7:54 ` [PATCH 2/2] PCI/TSM: Move core code into its own directory Aneesh Kumar K.V (Arm)
2026-11-16 13:00 ` Jason Gunthorpe
2026-11-16 13:15 ` Aneesh Kumar K.V
2026-11-16 13:19 ` Jason Gunthorpe
2026-11-16 14:34 ` Aneesh Kumar K.V
2026-11-16 14:42 ` Jason Gunthorpe
2026-11-18 7:40 ` Aneesh Kumar K.V [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yq5a1p8iy4c7.fsf@kernel.org \
--to=aneesh.kumar@kernel.org \
--cc=aik@amd.com \
--cc=bhelgaas@google.com \
--cc=jgg@nvidia.com \
--cc=linux-coco@lists.linux.dev \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.