[PATCH v2 11/21] PCI/TSM: Support connecting to PCIe CMA devices

From: alistair23

Date: Tue Jun 23 2026 - 00:59:46 EST


From: Alistair Francis <alistair.francis@xxxxxxx>

In the next patch we are going to add a PCIe CMA TSM driver, as such we
need to ensure that is_pci_tsm_host() will allow us to connect to CMA
capable devices. These devices don't necessarily has DEVCAP_TEE or IDE
support.

Signed-off-by: Alistair Francis <alistair.francis@xxxxxxx>
---
include/linux/pci-tsm.h | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/linux/pci-tsm.h b/include/linux/pci-tsm.h
index 950e2c36a4ca..80e76ecefe71 100644
--- a/include/linux/pci-tsm.h
+++ b/include/linux/pci-tsm.h
@@ -3,6 +3,7 @@
#define __PCI_TSM_H
#include <linux/mutex.h>
#include <linux/pci.h>
+#include <linux/pci-doe.h>
#include <linux/sockptr.h>

struct pci_tsm;
@@ -130,7 +131,7 @@ struct pci_tsm_host {
struct pci_doe_mb *doe_mb;
};

-/* physical function0 and capable of 'connect' */
+/* device is a TSM host and capable of 'connect' */
static inline bool is_pci_tsm_host(struct pci_dev *pdev)
{
if (!pdev)
@@ -142,6 +143,14 @@ static inline bool is_pci_tsm_host(struct pci_dev *pdev)
if (pdev->is_virtfn)
return false;

+ /*
+ * Report capable if CMA is supported, which can be supported on any PCIe
+ * device.
+ */
+ if (pci_find_doe_mailbox(pdev, PCI_VENDOR_ID_PCI_SIG,
+ PCI_DOE_FEATURE_CMA))
+ return true;
+
/*
* Allow for a Device Security Manager (DSM) associated with function0
* of an Endpoint to coordinate TDISP requests for other functions
--
2.54.0