PCI/TSM queue
Subsystems (3)
cover PCI/TSM queue
There is a new git repo which is set up to track TSM work.
Establish the tree and start with a set of small fixes.
Previous attempt was here:
https://lore.kernel.org/r/[email protected]
This is based on sha17475ea8b58616 Linus Torvalds "Linux 7.4-rc2".
Please comment. Thanks.
Alexey Kardashevskiy (3):
crypto/ccp/tsm: Fix potential size mismatch in releasing SPDM buffers crypto/ccp/tsm: Remove unused header
crypto/ccp/tsm: Use TSM API for DOE
Aneesh Kumar K.V (Arm) (1):
MAINTAINERS: Update TSM file coverage and repository
drivers/crypto/ccp/sev-dev-tio.c | 14 ++++++-------- drivers/crypto/ccp/sev-dev-tsm.c | 6 +++--- MAINTAINERS | 4 ++++ 3 files changed, 13 insertions(+), 11 deletions(-)
Signature · 1 line
2.55.0
PATCH 1/4 MAINTAINERS: Update TSM file coverage and repository
From: "Aneesh Kumar K.V (Arm)" <[email protected]>
Add drivers/virt/coco/tsm-core.c and git repository to the TSM entry.
Add the AMD TIO backend of TSM. Other arches are going to be added next. Eventually these backends will move under drivers/attestation.
--- MAINTAINERS | 4 ++++ 1 file changed, 4 insertions(+)
MAINTAINERS +4 -0
@@ -28541,11 +28541,15 @@ 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/crypto/ccp/sev-dev-tio.* +F: drivers/crypto/ccp/sev-dev-tsm.c 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/
Signature · 1 line
2.55.0
PATCH 2/4 crypto/ccp/tsm: Fix potential size mismatch in releasing SPDM buffers
In reply to Alexey KardashevskiyAt the moment the CCP driver allocates buffers of the maximum supported sizes which are reported by the PSP, and potentially expands some.
The spdm_ctrl_free() helper though releases all buffers with (incorrectly) calculated sizes.
Drop the calculation for request/response and use the maximum size for free.
Use the actual size (potentially expanded) of scratch and output buffers.
While at this, replace the incorrect check for dev_ctx with the correct check of the output buffer.
This did not bite so far as the maximum for request/response is 4K, alloc and free are page aligned and the expansion is not implemented yet in the PSP.
--- drivers/crypto/ccp/sev-dev-tio.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/crypto/ccp/sev-dev-tio.c +6 -8
@@ -639,25 +639,23 @@ static void spdm_ctrl_init(struct spdm_ctrl *ctrl, struct tsm_dsm_tio *dev_data)static void spdm_ctrl_free (struct tsm_dsm_tio *dev_data) {struct sev_tio_status *tio_status =to_tio_status (dev_data); -size_t len = tio_status->spdm_req_size_max - - (sla_dobj_id_to_size (SPDM_DOBJ_ID_RESP ) + -sizeof (struct sla_buffer_hdr ));struct tsm_spdm *spdm = &dev_data->spdm;sla_buffer_unmap (dev_data->resp, dev_data->respbuf);sla_buffer_unmap (dev_data->req, dev_data->reqbuf); spdm->rsp =NULL ; spdm->req =NULL ; -sla_free (dev_data->req, len, true); -sla_free (dev_data->resp, len, false); -sla_free (dev_data->scratch, tio_status->spdm_scratch_size_max, true); +sla_free (dev_data->req, tio_status->spdm_req_size_max, true); +sla_free (dev_data->resp, tio_status->spdm_req_size_max, false); +sla_free (dev_data->scratch, dev_data->scratch_len, true); dev_data->req.sla =0 ; dev_data->resp.sla =0 ; dev_data->scratch.sla =0 ; dev_data->respbuf =NULL ; dev_data->reqbuf =NULL ; -sla_free (dev_data->output, tio_status->spdm_out_size_max, true); +sla_free (dev_data->output, dev_data->output_len, true); + dev_data->output.sla =0 ; }static int spdm_ctrl_alloc (struct tsm_dsm_tio *dev_data)
@@ -674,7 +672,7 @@ static int spdm_ctrl_alloc(struct tsm_dsm_tio *dev_data) dev_data->output =sla_alloc (dev_data->output_len, true);if (IS_SLA_NULL (dev_data->req) ||IS_SLA_NULL (dev_data->resp) || -IS_SLA_NULL (dev_data->scratch) ||IS_SLA_NULL (dev_data->dev_ctx)) { +IS_SLA_NULL (dev_data->scratch) ||IS_SLA_NULL (dev_data->output)) { ret = -ENOMEM ; goto free_spdm_exit; }
Signature · 1 line
2.55.0
PATCH 3/4 crypto/ccp/tsm: Remove unused header
In reply to Alexey KardashevskiyNo use of IOMMU here, remove the header to avoid confusion.
--- drivers/crypto/ccp/sev-dev-tsm.c | 1 - 1 file changed, 1 deletion(-)
drivers/crypto/ccp/sev-dev-tsm.c +0 -1
@@ -5,7 +5,6 @@#include <linux/pci.h> #include <linux/device.h> #include <linux/tsm.h> -#include <linux/iommu.h> #include <linux/pci-doe.h> #include <linux/bitfield.h> #include <linux/module.h>
Signature · 1 line
2.55.0
PATCH 4/4 crypto/ccp/tsm: Use TSM API for DOE
In reply to Alexey KardashevskiyCompared to the currently used pci_doe(), the pci_tsm_doe_transfer() helper performs a few more sanity checks, use that helper now.
--- drivers/crypto/ccp/sev-dev-tsm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/crypto/ccp/sev-dev-tsm.c +3 -2
@@ -39,8 +39,9 @@ static int sev_tio_spdm_cmd(struct tio_dsm *dsm, int ret)/* ret > 0 means "SPDM requested" */ while (ret ==PCI_DOE_FEATURE_CMA || ret ==PCI_DOE_FEATURE_SSESSION ) { - ret =pci_doe (dsm->tsm.doe_mb,PCI_VENDOR_ID_PCI_SIG , ret, - spdm->req, spdm->req_len, spdm->rsp, spdm->rsp_len); + ret =pci_tsm_doe_transfer (dsm->tsm.base_tsm.pdev, ret, + spdm->req, spdm->req_len, + spdm->rsp, spdm->rsp_len);if (ret <0 )break ;
Signature · 1 line
2.55.0