The IDE key programming happens via Secure SPDM channel, initialise it
at the PF0 probing.
Add the SPDM certificate slot (up to 8 are allowed by SPDM), the platform
is expected to select one.
While at this, add a common struct for SPDM request/response as these
are going to needed by every platform.
Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
---
(!tsm->doe_mb_sec) is definitely an error on AMD SEV-TIO, is not it on other platforms?
---
include/linux/pci-tsm.h | 14 ++++++++++++++
drivers/pci/tsm.c | 4 ++++
2 files changed, 18 insertions(+)
diff --git a/include/linux/pci-tsm.h b/include/linux/pci-tsm.h
index 40c5e4c31a3f..b6866f7c14b4 100644
--- a/include/linux/pci-tsm.h
+++ b/include/linux/pci-tsm.h
@@ -10,6 +10,14 @@ struct tsm_dev;
struct kvm;
enum pci_tsm_req_scope;
+/* SPDM control structure for DOE */
+struct tsm_spdm {
+ unsigned long req_len;
+ void *req;
+ unsigned long rsp_len;
+ void *rsp;
+};
+
/*
* struct pci_tsm_ops - manage confidential links and security state
* @link_ops: Coordinate PCIe SPDM and IDE establishment via a platform TSM.
@@ -130,11 +138,17 @@ struct pci_tsm {
* @base_tsm: generic core "tsm" context
* @lock: mutual exclustion for pci_tsm_ops invocation
* @doe_mb: PCIe Data Object Exchange mailbox
+ * @doe_mb_sec: DOE mailbox used when secured SPDM is requested
+ * @spdm: cached SPDM request/response buffers for the link
+ * @cert_slot: SPDM certificate slot
*/
struct pci_tsm_pf0 {
struct pci_tsm base_tsm;
struct mutex lock;
struct pci_doe_mb *doe_mb;
+ struct pci_doe_mb *doe_mb_sec;
+ struct tsm_spdm spdm;
+ u8 cert_slot;
};
struct pci_tsm_mmio {
diff --git a/drivers/pci/tsm.c b/drivers/pci/tsm.c
index ed8a280a2cf4..378748b15825 100644
--- a/drivers/pci/tsm.c
+++ b/drivers/pci/tsm.c
@@ -1067,6 +1067,10 @@ int pci_tsm_pf0_constructor(struct pci_dev *pdev, struct pci_tsm_pf0 *tsm,
pci_warn(pdev, "TSM init failure, no CMA mailbox\n");
return -ENODEV;
}
+ tsm->doe_mb_sec = pci_find_doe_mailbox(pdev, PCI_VENDOR_ID_PCI_SIG,
+ PCI_DOE_FEATURE_SSESSION);
+ if (!tsm->doe_mb_sec)
+ pci_warn(pdev, "TSM init failed to init SSESSION mailbox\n");
return pci_tsm_link_constructor(pdev, &tsm->base_tsm, tsm_dev);
}
--
2.51.0