Skip to contentSkip to conversation

MAINTAINERS: Update TSM file coverage and repository

PATCH In review Aneesh Kumar K.V (Arm) 3 participants 15 messages Nov 16 – Nov 23

Subsystems (3)
lore
Share & tools
lore

Aneesh Kumar K.V (Arm)

author maintainer
#0 lore raw

PATCH 1/2 MAINTAINERS: Update TSM file coverage and repository

Add drivers/virt/coco/tsm-core.c and git repository to the TSM entry.

Cc Alexey Kardashevskiy <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Lukas Wunner <[email protected]>
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
index ccbcdc0799b9..720fe907885b 100644
@@ -28545,11 +28545,13 @@ M:	Jason Gunthorpe <[email protected]>
 R:	Lukas Wunner <[email protected]>
 L:	[email protected]
 S:	Maintained
+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/virt/coco/guest/
+F:	drivers/virt/coco/tsm-core.c
 F:	include/linux/*tsm*.h
 F:	samples/tsm-mr/
 

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3

Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH 2/2 PCI/TSM: Move core code into its own directory

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 <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Lukas Wunner <[email protected]>
Cc Bjorn Helgaas <[email protected]>
---
 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%)
Documentation/driver-api/pci/tsm.rst +1 -1
index 232b92bec93f..c95c513019b5 100644
@@ -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:
MAINTAINERS +1 -1
index 720fe907885b..3e626e45d432 100644
@@ -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
drivers/pci/Makefile +1 -1
index 41ebc3b9a518..211f195ff2c9 100644
@@ -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
drivers/pci/tsm/Makefile new file +7 -0
new file mode 100644
index 000000000000..464414c11a72
@@ -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
drivers/pci/tsm/core.c renamed from drivers/pci/tsm.c +1 -1
similarity index 99%
rename from drivers/pci/tsm.c
rename to drivers/pci/tsm/core.c
index 5fdcd7f2e820..76ef03a1b3ec 100644
@@ -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
Signature · 1 line
2.43.0
maintainer
#2 lore raw

Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory

drivers/pci/tsm/core.c

Quoted 4 lines · Aneesh Kumar K.V (Arm)
drivers/pci/tsm/core.c renamed from drivers/pci/tsm.c +0 -0
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

author maintainer
#3 lore raw

Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory

Quoted 8 lines · Jason Gunthorpe

drivers/pci/tsm/core.c

Quoted 4 lines · Aneesh Kumar K.V (Arm)
drivers/pci/tsm/core.c renamed from drivers/pci/tsm.c +0 -0
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?

Quoted 9 lines

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

maintainer
#4 lore raw

Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory

Quoted 3 lines · Aneesh Kumar K.V

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

author maintainer
#5 lore raw

Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory

Quoted 4 lines · Jason Gunthorpe
Quoted 2 lines · Aneesh Kumar K.V

The complete CCA patch series adds the following files:

Quoted 9 lines
Quoted 1 line

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

maintainer
#6 lore raw

Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory

Quoted 10 lines · Aneesh Kumar K.V
Quoted 8 lines · Jason Gunthorpe
Quoted 3 lines · Aneesh Kumar K.V

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 ?

Quoted 7 lines
Quoted 5 lines

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.

Quoted 1 line

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.

Quoted 3 lines

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

author maintainer
#7 lore raw

Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory

Quoted 33 lines · Jason Gunthorpe
Quoted 10 lines · Aneesh Kumar K.V
Quoted 8 lines · Jason Gunthorpe
Quoted 3 lines · Aneesh Kumar K.V

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 ?

Quoted 7 lines
Quoted 5 lines

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.

Quoted 1 line

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.

Quoted 3 lines

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.

Quoted 5 lines

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

#9 lore raw
In reply to Aneesh Kumar K.V (Arm)
Quoted 18 lines · Aneesh Kumar K.V (Arm)

Add drivers/virt/coco/tsm-core.c and git repository to the TSM entry.

Cc Alexey Kardashevskiy <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Lukas Wunner <[email protected]>
---
  MAINTAINERS | 2 ++
  1 file changed, 2 insertions(+)
MAINTAINERS +0 -0
index ccbcdc0799b9..720fe907885b 100644
@@ -28545,11 +28545,13 @@ M:	Jason Gunthorpe <[email protected]>
  R:	Lukas Wunner <[email protected]>
  L:	[email protected]

MAINTAINERS M: Jason Gunthorpe <[email protected]> · line 28556

Quoted 10 lines
MAINTAINERS +2 -0
  S:	Maintained
+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/virt/coco/guest/
+F:	drivers/virt/coco/tsm-core.c
  F:	include/linux/*tsm*.h
  F:	samples/tsm-mr/

I wonder if we can/should also do this now?

+F: drivers/crypto/ccp/sev-dev-tsm.c
+F: drivers/crypto/ccp/sev-dev-tio.*

Or move the files but where, drivers/attestation/tio? drivers/attestation/amd? And the same question for ARM/Intel. And do these drivers/attestation/* become modules? Thoughts? Thanks,

Quoted 3 lines

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3

Signature · 1 line
Alexey
maintainer
#10 lore raw
Quoted 36 lines · Alexey Kardashevskiy
Quoted 18 lines · Aneesh Kumar K.V (Arm)

Add drivers/virt/coco/tsm-core.c and git repository to the TSM entry.

Cc Alexey Kardashevskiy <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Lukas Wunner <[email protected]>
---
  MAINTAINERS | 2 ++
  1 file changed, 2 insertions(+)
MAINTAINERS +0 -0
index ccbcdc0799b9..720fe907885b 100644
@@ -28545,11 +28545,13 @@ M:	Jason Gunthorpe <[email protected]>
  R:	Lukas Wunner <[email protected]>
  L:	[email protected]

MAINTAINERS M: Jason Gunthorpe <[email protected]> · line 28556

Quoted 10 lines
MAINTAINERS +2 -0
  S:	Maintained
+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/virt/coco/guest/
+F:	drivers/virt/coco/tsm-core.c
  F:	include/linux/*tsm*.h
  F:	samples/tsm-mr/

I wonder if we can/should also do this now?

(quoted diff) +2 -0
+F:     drivers/crypto/ccp/sev-dev-tsm.c
+F:     drivers/crypto/ccp/sev-dev-tio.*
Quoted 3 lines

Or move the files but where, drivers/attestation/tio? drivers/attestation/amd? And the same question for ARM/Intel. And do these drivers/attestation/* become modules? Thoughts? Thanks,

Some goes to drivers/attestation/amd and ideally they become modules

Some other goes to drivers/virt/coco/tsm/ I guess? I haven't thought too much about that part yet.

But sure for now we should have those files too until we can move them.

Jason

maintainer
#8 lore raw

Re: [PATCH 2/2] PCI/TSM: Move core code into its own directory

In reply to Aneesh Kumar K.V
Quoted 4 lines · Aneesh Kumar K.V

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
Quoted 10 lines

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.

Quoted 5 lines

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.

Quoted 2 lines

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

author maintainer
#11 lore raw
In reply to Alexey Kardashevskiy
Quoted 36 lines · Alexey Kardashevskiy
Quoted 18 lines · Aneesh Kumar K.V (Arm)

Add drivers/virt/coco/tsm-core.c and git repository to the TSM entry.

Cc Alexey Kardashevskiy <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Lukas Wunner <[email protected]>
---
  MAINTAINERS | 2 ++
  1 file changed, 2 insertions(+)
MAINTAINERS +0 -0
index ccbcdc0799b9..720fe907885b 100644
@@ -28545,11 +28545,13 @@ M:	Jason Gunthorpe <[email protected]>
  R:	Lukas Wunner <[email protected]>
  L:	[email protected]

MAINTAINERS M: Jason Gunthorpe <[email protected]> · line 28556

Quoted 10 lines
MAINTAINERS +2 -0
  S:	Maintained
+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/virt/coco/guest/
+F:	drivers/virt/coco/tsm-core.c
  F:	include/linux/*tsm*.h
  F:	samples/tsm-mr/

I wonder if we can/should also do this now?

(quoted diff) +2 -0
+F:     drivers/crypto/ccp/sev-dev-tsm.c
+F:     drivers/crypto/ccp/sev-dev-tio.*
Quoted 3 lines

Or move the files but where, drivers/attestation/tio? drivers/attestation/amd? And the same question for ARM/Intel. And do these drivers/attestation/* become modules? Thoughts? Thanks,

We may want to consider this in the context of the full series. I have a tree that includes attestation, guest_memfd, device trust, and iommufd integration, with the layout below:

drivers/attestation/cca/guest/spdm.c drivers/attestation/cca/host/spdm.c drivers/attestation/cca/host/vdev.c drivers/attestation/spdm/core.c drivers/firmware/arm_rmm/da-guest-rhi.c drivers/firmware/arm_rmm/da-guest.c drivers/firmware/arm_rmm/da-host-stream.c drivers/firmware/arm_rmm/da-host-vdev.c drivers/firmware/arm_rmm/da-host.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-realm.c drivers/vfio/pci/vfio_pci_gmem.c drivers/vfio/pci/vfio_pci_gmem.h .../coco/{arm-cca-guest => arm-cca/guest}/main.c drivers/virt/coco/arm-cca/guest/rsi-da.h drivers/virt/coco/arm-cca/host/main.c drivers/virt/coco/arm-cca/host/rmi-da.c drivers/virt/coco/arm-cca/host/rmi-da.h drivers/virt/coco/arm-cca/host/viommu.c drivers/virt/coco/arm-cca/pci/guest-pci.c drivers/virt/coco/arm-cca/pci/host-pci.c

-aneesh

maintainer
#12 lore raw
Quoted 58 lines · Aneesh Kumar K.V
Quoted 36 lines · Alexey Kardashevskiy
Quoted 18 lines · Aneesh Kumar K.V (Arm)

Add drivers/virt/coco/tsm-core.c and git repository to the TSM entry.

Cc Alexey Kardashevskiy <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Lukas Wunner <[email protected]>
---
  MAINTAINERS | 2 ++
  1 file changed, 2 insertions(+)
MAINTAINERS +0 -0
index ccbcdc0799b9..720fe907885b 100644
@@ -28545,11 +28545,13 @@ M:	Jason Gunthorpe <[email protected]>
  R:	Lukas Wunner <[email protected]>
  L:	[email protected]

MAINTAINERS M: Jason Gunthorpe <[email protected]> · line 28556

Quoted 10 lines
MAINTAINERS +2 -0
  S:	Maintained
+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/virt/coco/guest/
+F:	drivers/virt/coco/tsm-core.c
  F:	include/linux/*tsm*.h
  F:	samples/tsm-mr/

I wonder if we can/should also do this now?

(quoted diff) +2 -0
+F:     drivers/crypto/ccp/sev-dev-tsm.c
+F:     drivers/crypto/ccp/sev-dev-tio.*
Quoted 3 lines

Or move the files but where, drivers/attestation/tio? drivers/attestation/amd? And the same question for ARM/Intel. And do these drivers/attestation/* become modules? Thoughts? Thanks,

We may want to consider this in the context of the full series. I have a tree that includes attestation, guest_memfd, device trust, and iommufd integration, with the layout below:

drivers/attestation/cca/guest/spdm.c drivers/attestation/cca/host/spdm.c drivers/attestation/cca/host/vdev.c drivers/attestation/spdm/core.c drivers/firmware/arm_rmm/da-guest-rhi.c drivers/firmware/arm_rmm/da-guest.c drivers/firmware/arm_rmm/da-host-stream.c drivers/firmware/arm_rmm/da-host-vdev.c drivers/firmware/arm_rmm/da-host.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-realm.c drivers/vfio/pci/vfio_pci_gmem.c drivers/vfio/pci/vfio_pci_gmem.h

Quoted 8 lines

.../coco/{arm-cca-guest => arm-cca/guest}/main.c
drivers/virt/coco/arm-cca/guest/rsi-da.h
drivers/virt/coco/arm-cca/host/main.c
drivers/virt/coco/arm-cca/host/rmi-da.c
drivers/virt/coco/arm-cca/host/rmi-da.h
drivers/virt/coco/arm-cca/host/viommu.c
drivers/virt/coco/arm-cca/pci/guest-pci.c
drivers/virt/coco/arm-cca/pci/host-pci.c

It seems okay, though I wonder what pci/host&guest-pci.c is?

I kind of wish we had a directory called tsm too..

drivers/firmware/tsm/

Maybe?

Can you be consistent with the cca/arm_rmm/arm-cca naming?

arm_rmm seems reasonable to me, the host tsm doesn't have to be used with VMs.

Jason

author maintainer
#13 lore raw
Quoted 68 lines · Jason Gunthorpe
Quoted 58 lines · Aneesh Kumar K.V
Quoted 36 lines · Alexey Kardashevskiy
Quoted 18 lines · Aneesh Kumar K.V (Arm)

Add drivers/virt/coco/tsm-core.c and git repository to the TSM entry.

Cc Alexey Kardashevskiy <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Lukas Wunner <[email protected]>
---
  MAINTAINERS | 2 ++
  1 file changed, 2 insertions(+)
MAINTAINERS +0 -0
index ccbcdc0799b9..720fe907885b 100644
@@ -28545,11 +28545,13 @@ M:	Jason Gunthorpe <[email protected]>
  R:	Lukas Wunner <[email protected]>
  L:	[email protected]

MAINTAINERS M: Jason Gunthorpe <[email protected]> · line 28556

Quoted 10 lines
MAINTAINERS +2 -0
  S:	Maintained
+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/virt/coco/guest/
+F:	drivers/virt/coco/tsm-core.c
  F:	include/linux/*tsm*.h
  F:	samples/tsm-mr/

I wonder if we can/should also do this now?

(quoted diff) +2 -0
+F:     drivers/crypto/ccp/sev-dev-tsm.c
+F:     drivers/crypto/ccp/sev-dev-tio.*
Quoted 3 lines

Or move the files but where, drivers/attestation/tio? drivers/attestation/amd? And the same question for ARM/Intel. And do these drivers/attestation/* become modules? Thoughts? Thanks,

We may want to consider this in the context of the full series. I have a tree that includes attestation, guest_memfd, device trust, and iommufd integration, with the layout below:

drivers/attestation/cca/guest/spdm.c drivers/attestation/cca/host/spdm.c drivers/attestation/cca/host/vdev.c drivers/attestation/spdm/core.c drivers/firmware/arm_rmm/da-guest-rhi.c drivers/firmware/arm_rmm/da-guest.c drivers/firmware/arm_rmm/da-host-stream.c drivers/firmware/arm_rmm/da-host-vdev.c drivers/firmware/arm_rmm/da-host.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-realm.c drivers/vfio/pci/vfio_pci_gmem.c drivers/vfio/pci/vfio_pci_gmem.h

Quoted 8 lines

.../coco/{arm-cca-guest => arm-cca/guest}/main.c
drivers/virt/coco/arm-cca/guest/rsi-da.h
drivers/virt/coco/arm-cca/host/main.c
drivers/virt/coco/arm-cca/host/rmi-da.c
drivers/virt/coco/arm-cca/host/rmi-da.h
drivers/virt/coco/arm-cca/host/viommu.c
drivers/virt/coco/arm-cca/pci/guest-pci.c
drivers/virt/coco/arm-cca/pci/host-pci.c

Quoted 2 lines

It seems okay, though I wonder what pci/host&guest-pci.c is?

The host side handles:

1. Allocating the Root Port PDEV.
2. Allocating IDE resources for an external endpoint.
3. Connecting the firmware stream and enabling IDE.
4. Using a system stream for an RcIEP, without Root Port or PCI IDE resources.
5. Marking PF0 ready for device assignment only after setup succeeds.

The guest side handles:

1. Preventing PCI driver attachment.
2. Comparing the current RSI device information with the report and creating MMIO descriptors from it.
3. Validating the mappings.
4. Requesting RUN and marking the device as accepted.

Most of these are driven during evidence-accept, so the module dependencies are (based on lsmod):

Host:
arm-cca-host.ko

    +--> attestation-cca-host.ko
    |      +--> arm-cca-host-pci.ko
    |      |      `--> arm-rmm-da-host.ko
    |      +--> arm-rmm-da-host.ko
    |      +--> attestation-spdm.ko
    |      `--> attestation.ko
    +--> arm-cca-host-pci.ko
    +--> arm-rmm-da-host.ko
    +--> attestation-spdm.ko
    `--> attestation.ko

Realm guest:
arm-cca-guest.ko

    +--> attestation-cca-guest.ko
    |      +--> arm-cca-guest-pci.ko
    |      |      `--> arm-rmm-da-guest.ko
    |      +--> arm-rmm-da-guest.ko
    |      +--> attestation-spdm.ko
    |      `--> attestation.ko
    +--> arm-cca-guest-pci.ko
    +--> arm-rmm-da-guest.ko
    `--> tsm_report.ko

Common attestation dependencies:

attestation-spdm.ko

    +--> attestation.ko
    |      `--> ctlv.ko
    `--> ctlv.ko
Quoted 9 lines

I kind of wish we had a directory called tsm too..

drivers/firmware/tsm/

Maybe?

Can you be consistent with the cca/arm_rmm/arm-cca naming?

Will name it arm_cca ?

Quoted 3 lines

arm_rmm seems reasonable to me, the host tsm doesn't have to be used with VMs.

-aneesh

maintainer
#14 lore raw
Quoted 21 lines · Aneesh Kumar K.V
Quoted 21 lines
Quoted 20 lines

drivers/attestation/cca/guest/spdm.c drivers/attestation/cca/host/spdm.c drivers/attestation/cca/host/vdev.c drivers/attestation/spdm/core.c drivers/firmware/arm_rmm/da-guest-rhi.c drivers/firmware/arm_rmm/da-guest.c drivers/firmware/arm_rmm/da-host-stream.c drivers/firmware/arm_rmm/da-host-vdev.c drivers/firmware/arm_rmm/da-host.c drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-realm.c drivers/vfio/pci/vfio_pci_gmem.c drivers/vfio/pci/vfio_pci_gmem.h .../coco/{arm-cca-guest => arm-cca/guest}/main.c drivers/virt/coco/arm-cca/guest/rsi-da.h drivers/virt/coco/arm-cca/host/main.c drivers/virt/coco/arm-cca/host/rmi-da.c drivers/virt/coco/arm-cca/host/rmi-da.h drivers/virt/coco/arm-cca/host/viommu.c drivers/virt/coco/arm-cca/pci/guest-pci.c drivers/virt/coco/arm-cca/pci/host-pci.c

Quoted 5 lines
Quoted 2 lines

It seems okay, though I wonder what pci/host&guest-pci.c is?

The host side handles:

1. Allocating the Root Port PDEV.

Oh? That's exciting, I didn't know we needed to do that... That's going to need some thought.

Quoted 4 lines

2. Allocating IDE resources for an external endpoint.
3. Connecting the firmware stream and enabling IDE.
4. Using a system stream for an RcIEP, without Root Port or PCI IDE resources.
5. Marking PF0 ready for device assignment only after setup succeeds.

That's just the normal TSM driver, why is it seperated?

Quoted 3 lines

The guest side handles:

1. Preventing PCI driver attachment.

That's Leon's series, shouldn't be in TSM.

Quoted 3 lines

2. Comparing the current RSI device information with the report and creating MMIO descriptors from it.
3. Validating the mappings.
4. Requesting RUN and marking the device as accepted.

This also looks like normal TSM stuff, why seperated?

Quoted 2 lines

Most of these are driven during evidence-accept, so the module dependencies are (based on lsmod):

The attestation driver should probably have a callback for its accept operation to the TSM in some way, so we don't have this weird pci module too.

The tsm struct should be passed in when creating the attestation driver and it can call back through it for accept.. But I don't know why we need to leave the

Quoted 12 lines

Host:
arm-cca-host.ko

    +--> attestation-cca-host.ko
    |      +--> arm-cca-host-pci.ko
    |      |      `--> arm-rmm-da-host.ko
    |      +--> arm-rmm-da-host.ko
    |      +--> attestation-spdm.ko
    |      `--> attestation.ko
    +--> arm-cca-host-pci.ko
    +--> arm-rmm-da-host.ko
    +--> attestation-spdm.ko
    `--> attestation.ko

The last two should be depenencies of attestation-cca-host.ko not arm-cca-host..

Quoted 11 lines

Realm guest:
arm-cca-guest.ko

    +--> attestation-cca-guest.ko
    |      +--> arm-cca-guest-pci.ko
    |      |      `--> arm-rmm-da-guest.ko
    |      +--> arm-rmm-da-guest.ko
    |      +--> attestation-spdm.ko
    |      `--> attestation.ko
    +--> arm-cca-guest-pci.ko
    +--> arm-rmm-da-guest.ko
    `--> tsm_report.ko

Like this, but tsm_report should also be a dependency of attestation-cca-guest.ko and eventually rolled into attestation.ko

Quoted 12 lines

Common attestation dependencies:

attestation-spdm.ko

    +--> attestation.ko
    |      `--> ctlv.ko
    `--> ctlv.ko
Quoted 4 lines

I kind of wish we had a directory called tsm too..

drivers/firmware/tsm/

This still seems necessary.

Quoted 6 lines
Quoted 4 lines

Maybe?

Can you be consistent with the cca/arm_rmm/arm-cca naming?

Will name it arm_cca ?

I'm OK but like I said it doesn't have to do anything with confidential VMs, so RMM seems better to me.

Also it might make more sense to start with the arch name in the directory structure. Maybe:

attestation/arm/cca_host/
attestation/arm/cca_guest/
attestation/arm/firme.c

Jason