[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH kernel 11/17] tsm/core: Add TDI status



Define a structure with all info about a TDI such as TDISP status,
bind state, used START_INTERFACE options and the report digest.

Signed-off-by: Alexey Kardashevskiy <aik@xxxxxxx>
---
 include/linux/pci-tsm.h | 69 ++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/include/linux/pci-tsm.h b/include/linux/pci-tsm.h
index 9b34304d9a1f..2ca577e2a37e 100644
--- a/include/linux/pci-tsm.h
+++ b/include/linux/pci-tsm.h
@@ -11,6 +11,7 @@
 struct pci_tsm;
 struct tsm_dev;
 struct kvm;
+struct tsm_tdi_status;
 enum pci_tsm_req_scope;
 
 /*
@@ -88,6 +89,7 @@ struct pci_tsm_ops {
 
        int (*refresh_evidence)(struct pci_tsm *tsm, const void *nonce,
                                size_t nonce_len);
+       int (*tdi_status)(struct pci_dev *pdev, struct tsm_tdi_status *ts);
 };
 
 /**
@@ -331,4 +333,71 @@ static inline ssize_t pci_tsm_guest_req(struct pci_dev 
*pdev,
        return -ENXIO;
 }
 #endif
+
+/* private: */
+
+enum tsm_tdisp_state {
+       TDISP_STATE_CONFIG_UNLOCKED = 0,
+       TDISP_STATE_CONFIG_LOCKED = 1,
+       TDISP_STATE_RUN = 2,
+       TDISP_STATE_ERROR = 3,
+};
+
+enum tsm_tdisp_status {
+       TDISP_STATE_BOUND = 0,
+       TDISP_STATE_INVALID = 1,
+       TDISP_STATE_UNBOUND = 2,
+};
+
+/*
+ * struct tdisp_interface_id - TDISP INTERFACE_ID Definition
+ *
+ * @function_id: Identifies the function of the device hosting the TDI
+ *   15:0: @rid: Requester ID
+ *   23:16: @rseg: Requester Segment (Reserved if Requester Segment Valid is 
Clear)
+ *   24: @rseg_valid: Requester Segment Valid
+ *   31:25 – Reserved
+ * 8B - Reserved
+ */
+#define TSM_TDISP_IID_REQUESTER_ID      GENMASK(15, 0)
+#define TSM_TDISP_IID_RSEG              GENMASK(23, 16)
+#define TSM_TDISP_IID_RSEG_VALID        BIT(24)
+
+struct tdisp_interface_id {
+       __u32 function_id; /* TSM_TDISP_IID_xxxx */
+       __u8 reserved[8];
+} __packed;
+
+struct tsm_tdi_status {
+       __u8 status; /* enum tsm_tdisp_status */
+       __u8 state; /* enum tsm_tdisp_state */
+       __u8 meas_digest_fresh;
+       __u8 meas_digest_valid;
+       __u8 all_request_redirect;
+       __u8 bind_p2p;
+       __u8 lock_msix;
+       __u8 no_fw_update;
+       __u16 cache_line_size;
+       __u64 spdm_algos; /* Bitmask of TSM_SPDM_ALGOS */
+       __u8 certs_digest[48];
+       __u8 meas_digest[48];
+       __u8 interface_report_digest[48];
+       __u64 intf_report_counter;
+       struct tdisp_interface_id id;
+       __u64 tdi_id;
+} __packed;
+
+enum tsm_spdm_algos {
+       TSM_SPDM_ALGOS_DHE_SECP256R1,
+       TSM_SPDM_ALGOS_DHE_SECP384R1,
+       TSM_SPDM_ALGOS_AEAD_AES_128_GCM,
+       TSM_SPDM_ALGOS_AEAD_AES_256_GCM,
+       TSM_SPDM_ALGOS_ASYM_TPM_ALG_RSASSA_3072,
+       TSM_SPDM_ALGOS_ASYM_TPM_ALG_ECDSA_ECC_NIST_P256,
+       TSM_SPDM_ALGOS_ASYM_TPM_ALG_ECDSA_ECC_NIST_P384,
+       TSM_SPDM_ALGOS_HASH_TPM_ALG_SHA_256,
+       TSM_SPDM_ALGOS_HASH_TPM_ALG_SHA_384,
+       TSM_SPDM_ALGOS_KEY_SCHED_SPDM_KEY_SCHEDULE,
+};
+
 #endif /*__PCI_TSM_H */
-- 
2.55.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.