* [PATCH 2/2] PCI/TSM: Move core code into its own directory [not found] <20261116075420.76205-1-aneesh.kumar@kernel.org> @ 2026-11-16 7:54 ` Aneesh Kumar K.V (Arm) 2026-11-16 13:00 ` Jason Gunthorpe 0 siblings, 1 reply; 7+ messages in thread From: Aneesh Kumar K.V (Arm) @ 2026-11-16 7:54 UTC (permalink / raw) To: linux-coco Cc: Aneesh Kumar K.V (Arm), Alexey Kardashevskiy, Jason Gunthorpe, Lukas Wunner, Jason Gunthorpe, Bjorn Helgaas, linux-pci Multiple patch series modify drivers/pci/tsm.c, and some add new files to the PCI/TSM subsystem. Move tsm.c to tsm/core.c so these series can share the directory layout and reduce merge conflicts. Update the build rules, local header include, and MAINTAINERS entry for the new location. No functional change. Cc: Alexey Kardashevskiy <aik@amd.com> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Lukas Wunner <lukas@wunner.de> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: linux-coco@lists.linux.dev Cc: linux-pci@vger.kernel.org Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org> --- Documentation/driver-api/pci/tsm.rst | 2 +- MAINTAINERS | 2 +- drivers/pci/Makefile | 2 +- drivers/pci/tsm/Makefile | 7 +++++++ drivers/pci/{tsm.c => tsm/core.c} | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 drivers/pci/tsm/Makefile rename drivers/pci/{tsm.c => tsm/core.c} (99%) diff --git a/Documentation/driver-api/pci/tsm.rst b/Documentation/driver-api/pci/tsm.rst index 232b92bec93f..c95c513019b5 100644 --- a/Documentation/driver-api/pci/tsm.rst +++ b/Documentation/driver-api/pci/tsm.rst @@ -17,5 +17,5 @@ Subsystem Interfaces .. kernel-doc:: include/linux/pci-tsm.h :internal: -.. kernel-doc:: drivers/pci/tsm.c +.. kernel-doc:: drivers/pci/tsm/core.c :export: diff --git a/MAINTAINERS b/MAINTAINERS index 720fe907885b..3e626e45d432 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -28549,7 +28549,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tsm/linux.git F: Documentation/ABI/testing/configfs-tsm-report F: Documentation/driver-api/coco/ F: Documentation/driver-api/pci/tsm.rst -F: drivers/pci/tsm.c +F: drivers/pci/tsm/ F: drivers/virt/coco/guest/ F: drivers/virt/coco/tsm-core.c F: include/linux/*tsm*.h diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 41ebc3b9a518..211f195ff2c9 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile @@ -35,7 +35,7 @@ obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += xen-pcifront.o obj-$(CONFIG_VGA_ARB) += vgaarb.o obj-$(CONFIG_PCI_DOE) += doe.o obj-$(CONFIG_PCI_IDE) += ide.o -obj-$(CONFIG_PCI_TSM) += tsm.o +obj-$(CONFIG_PCI_TSM) += tsm/ obj-$(CONFIG_PCI_DYNAMIC_OF_NODES) += of_property.o obj-$(CONFIG_PCI_NPEM) += npem.o obj-$(CONFIG_PCIE_TPH) += tph.o diff --git a/drivers/pci/tsm/Makefile b/drivers/pci/tsm/Makefile new file mode 100644 index 000000000000..464414c11a72 --- /dev/null +++ b/drivers/pci/tsm/Makefile @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for the PCI/TSM infrastructure + +obj-$(CONFIG_PCI_TSM) += tsm.o + +tsm-y := core.o diff --git a/drivers/pci/tsm.c b/drivers/pci/tsm/core.c similarity index 99% rename from drivers/pci/tsm.c rename to drivers/pci/tsm/core.c index 5fdcd7f2e820..76ef03a1b3ec 100644 --- a/drivers/pci/tsm.c +++ b/drivers/pci/tsm/core.c @@ -15,7 +15,7 @@ #include <linux/sysfs.h> #include <linux/tsm.h> #include <linux/xarray.h> -#include "pci.h" +#include "../pci.h" /* * Provide a read/write lock against the init / exit of pdev tsm -- 2.43.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory 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 0 siblings, 1 reply; 7+ messages in thread From: Jason Gunthorpe @ 2026-11-16 13:00 UTC (permalink / raw) To: Aneesh Kumar K.V (Arm) Cc: linux-coco, Alexey Kardashevskiy, Lukas Wunner, Bjorn Helgaas, linux-pci On Mon, Nov 16, 2026 at 01:24:20PM +0530, Aneesh Kumar K.V (Arm) wrote: > diff --git a/drivers/pci/tsm.c b/drivers/pci/tsm/core.c > similarity index 99% > rename from drivers/pci/tsm.c > rename to drivers/pci/tsm/core.c What's the point of a subdirectory if there is onle one file? If you were to move it to drivers/virt/coco/tsm-pci.c or something that would be more interesting.. I think we are going to delete most of this file, right? I'm also seriously wondering if adding sysfs to pci devices is even a good idea. If there is only one left we can just not do that. Then we don't need most of the file.. Jason ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory 2026-11-16 13:00 ` Jason Gunthorpe @ 2026-11-16 13:15 ` Aneesh Kumar K.V 2026-11-16 13:19 ` Jason Gunthorpe 0 siblings, 1 reply; 7+ messages in thread From: Aneesh Kumar K.V @ 2026-11-16 13:15 UTC (permalink / raw) To: Jason Gunthorpe Cc: linux-coco, Alexey Kardashevskiy, Lukas Wunner, Bjorn Helgaas, linux-pci Jason Gunthorpe <jgg@nvidia.com> writes: > On Mon, Nov 16, 2026 at 01:24:20PM +0530, Aneesh Kumar K.V (Arm) wrote: >> diff --git a/drivers/pci/tsm.c b/drivers/pci/tsm/core.c >> similarity index 99% >> rename from drivers/pci/tsm.c >> rename to drivers/pci/tsm/core.c > > What's the point of a subdirectory if there is onle one file? > > If you were to move it to drivers/virt/coco/tsm-pci.c or something > that would be more interesting.. > > I think we are going to delete most of this file, right? > > I'm also seriously wondering if adding sysfs to pci devices is even a > good idea. If there is only one left we can just not do that. Then we > don't need most of the file.. > 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 The final implementation is spread across multiple series, and the attestation series creates drivers/pci/tsm/. I suggested making that split early to avoid conflicts while these series are being developed. -aneesh ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory 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 0 siblings, 1 reply; 7+ messages in thread From: Jason Gunthorpe @ 2026-11-16 13:19 UTC (permalink / raw) To: Aneesh Kumar K.V Cc: linux-coco, Alexey Kardashevskiy, Lukas Wunner, Bjorn Helgaas, linux-pci 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/ Send a series to move tsm-report.c and tsm-mr.c to drivers/attestation to kick it off. Then we can extract the AMD and Intel drivers Jason ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory 2026-11-16 13:19 ` Jason Gunthorpe @ 2026-11-16 14:34 ` Aneesh Kumar K.V 2026-11-16 14:42 ` Jason Gunthorpe 0 siblings, 1 reply; 7+ messages in thread From: Aneesh Kumar K.V @ 2026-11-16 14:34 UTC (permalink / raw) To: Jason Gunthorpe Cc: linux-coco, Alexey Kardashevskiy, Lukas Wunner, Bjorn Helgaas, linux-pci 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/ and stored by drivers/pci/tsm.c:pci_tsm_evidence. 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. If this is not how you foresee it working, we can defer this patch, and I can carry it in my tree until the PCI attestation design is clear. -aneesh ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory 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 0 siblings, 1 reply; 7+ messages in thread From: Jason Gunthorpe @ 2026-11-16 14:42 UTC (permalink / raw) To: Aneesh Kumar K.V Cc: linux-coco, Alexey Kardashevskiy, Lukas Wunner, Bjorn Helgaas, linux-pci 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory 2026-11-16 14:42 ` Jason Gunthorpe @ 2026-11-18 7:40 ` Aneesh Kumar K.V 0 siblings, 0 replies; 7+ messages in thread From: Aneesh Kumar K.V @ 2026-11-18 7:40 UTC (permalink / raw) To: Jason Gunthorpe Cc: linux-coco, Alexey Kardashevskiy, Lukas Wunner, Bjorn Helgaas, linux-pci 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-18 7:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20261116075420.76205-1-aneesh.kumar@kernel.org>
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 is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox