From: Jason Gunthorpe <jgg@nvidia.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
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 09:14:27 -0400 [thread overview]
Message-ID: <20261118131427.GM2245175@nvidia.com> (raw)
In-Reply-To: <yq5a1p8iy4c7.fsf@kernel.org>
On Wed, Nov 18, 2026 at 01:10:56PM +0530, Aneesh Kumar K.V wrote:
> 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.
Yeah, you'll definately need some kind of "core" module that handles
these issues. Due to circular module dependencies it has to be
distinct from the tsm:
rmm_core
tsm_rmm_host
tsm_rmm_guest
attestation_rmm_host
attestation_rmm_guest
?
The module graph is
tsm_rmm_host -> rmm_core
-> attestation_rmm_host -> rmm_core
> 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.
Why callbacks? The TSM driver should create some kind of "pdev state"
when it attaches to the PCI device and link it into the pci world so
we can find this object from pci_dev.
The "pdev state" is an object managed by rmm_core, has a lock and a
refcounting scheme to ensure it cannot be destroyed out of order. It
would have information about the one and only vdev, if it exists, as
well.
The TSM driver triggers attestation creation and passes in the "pdev
state" pointer. Probably through an aux device scheme.
Now we have the necessary shared state between three modules to have
locks and some lifecycle rules, without any callbacks.
> 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.
Which stream setup do you mean? The device to host stream can be
locked by the pdev object.
The future P2P streams.. IDK how we even do uAPI for that, or cross
lock different PCI devices.
> I am now considering implementing the CCA SPDM attestation ops directly
> in arm-cca-host, similar to the viommu ops.
I really prefer we try to avoid this. At that point you may as well
give up and just implement one giant uber module.
I don't see that needing to get a lock on a pdev is so serious that we
should give up?
Jason
next prev parent reply other threads:[~2026-11-18 13:14 UTC|newest]
Thread overview: 11+ 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
2026-11-18 13:14 ` Jason Gunthorpe [this message]
2026-11-18 8:44 ` [PATCH 1/2] MAINTAINERS: Update TSM file coverage and repository Alexey Kardashevskiy
2026-11-18 12:55 ` Jason Gunthorpe
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=20261118131427.GM2245175@nvidia.com \
--to=jgg@nvidia.com \
--cc=aik@amd.com \
--cc=aneesh.kumar@kernel.org \
--cc=bhelgaas@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox