Linux Confidential Computing Development
 help / color / mirror / Atom feed
From: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
To: Alexey Kardashevskiy <aik@amd.com>, linux-coco@lists.linux.dev
Cc: Jiri Pirko <jiri@resnulli.us>, Kevin Tian <kevin.tian@intel.com>,
	Xu Yilun <yilun.xu@linux.intel.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Steven Price <steven.price@arm.com>,
	Kiryl Shutsemau <kas@kernel.org>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Jason Gunthorpe <jgg@nvidia.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Ashish Kalra <ashish.kalra@amd.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	John Allen <john.allen@amd.com>, Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	patches@lists.linux.dev
Subject: Re: [RFC PATCH v1 09/11] crypto/ccp: Defer SEV-TIO link setup until evidence acceptance
Date: Fri, 06 Nov 2026 18:44:27 +0530	[thread overview]
Message-ID: <yq5ao6c2p0ek.fsf@kernel.org> (raw)
In-Reply-To: <e8785bcb-45ed-492f-af66-deadfba6ac25@amd.com>

Alexey Kardashevskiy <aik@amd.com> writes:

> On 29/10/26 02:26, Aneesh Kumar K.V (Arm) wrote:
>> AMD SEV-TIO currently establishes its SPDM session and enables IDE during
>> connect, before userspace can retrieve or accept the device identity.
>> Move AMD link setup behind its evidence_accept callback.

 [ ... 49 lines skipped ... ] 

>>   	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_NULL;
>
> This is a bugfix (thanks for pointing!) and does not belong here. Want to repost, or I can (and should, really)?
>
>>   }
>>   
>>   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)) {
>
> the same.
>
>>   		ret = -ENOMEM;
>>   		goto free_spdm_exit;
>>   	}
>> @@ -773,7 +771,8 @@ int sev_tio_dev_create(struct tsm_dsm_tio *dev_data, u16 device_id,
>>   free_data_pg_exit:
>>   	snp_free_firmware_page(data_pg);
>>   free_ctx_exit:
>> -	sla_free(create.dev_ctx_sla, tio_status->devctx_size, true);
>> +	sla_free(dev_data->dev_ctx, tio_status->devctx_size, true);
>
> and this. Is this codex? :)
>

Yes. 

>
>> +	dev_data->dev_ctx = SLA_NULL;
>>   	return ret;
>>   }
>>   

 [ ... 179 lines skipped ... ] 

>> +
>> +	/* Reserve TC0's stream ID without programming or enabling IDE. */
>> +	memset(ids, 0xff, sizeof(ids));
>> +	ids[0] = dev_data->ide[0]->stream_id;
>> +	dev_data->cert_slot = 0;
>> +	ret = sev_tio_dev_connect(dev_data, BIT(0), ids, dev_data->cert_slot);
>> +	ret = dsm_collect_identity(dsm, ret);
>
> Cannot librspdm do that collection, directly via DOE? Ideally in the
> generic code? There nothing special for the PSP to do and stopping
> SEV-TIO's connect half way is weird.
>


This patch does not use rust-spdm and avoids introducing that
dependency. It uses slot 0 to initiate the session, retrieve the
certificate chain, and return it to the host. After host approval, it
resumes the session and enables IDE. Only slot 0 is supported, and the
host can reject the device identity before IDE is enabled.

>
>
>> +	if (!ret)
>> +		return 0;
>> +
>> +disconnect:
>> +	dsm_disconnect(pdev);
>> +	return ret;
>> +}
>>   
>> -	tc_mask = streams_setup(dev_data->ide, ids);
>> +static int dsm_evidence_accept(struct pci_dev *pdev)
>> +{
>> +	struct tio_dsm *dsm = pdev_to_tio_dsm(pdev);
>> +	struct tsm_dsm_tio *dev_data = &dsm->data;
>> +	u8 ids[TIO_IDE_MAX_TC];
>> +	int ret;
>>   
>> -	dev_data->cert_slot = pdev->tsm->evidence.slot;
>> -	ret = sev_tio_dev_connect(dev_data, tc_mask, ids, dev_data->cert_slot);
>> -	ret = sev_tio_spdm_cmd(dsm, ret);
>> -	if (ret)
>> -		goto free_exit;
>> +	if (pdev->tsm->evidence.slot)
>> +		return -EOPNOTSUPP;
>> +	if (!dsm->pending_spdm)
>> +		return -ENODATA;
>>   
>> -	streams_enable(dev_data->ide);
>> +	streams_setup(dev_data->ide, ids);
>
>
> I kinda get the appeal of not enabling IDE before accepting but in
> practice the host still has to have a knob in IOMMU to prevent a
> malicious device from DMAing T=1 trafic so accept() would trigger
> enable_dma() hook.
>

This enables IDE; it is not the TDISP RUN transition. Am I missing
something here?

>
>
>> +	ret = sev_tio_spdm_cmd(dsm, dsm->pending_spdm);
>> +	dsm->pending_spdm = 0;
>> +	if (ret)
>> +		goto err_session;
>> +	dsm->session_connected = true;
>>   
>> +	ret = streams_enable(dev_data->ide);
>> +	if (ret)
>> +		goto err_session;
>>   	ret = streams_register(dev_data->ide);
>>   	if (ret)
>> -		goto free_exit;
>> -
>> +		goto err_session;
>>   	return 0;
>>   
>> -free_exit:
>> -	sev_tio_dev_reclaim(dev_data);
>> -
>> -	streams_disable(dev_data->ide);
>> -ide_free_exit:
>> -
>> -	streams_teardown(dev_data->ide);
>> -
>> +err_session:
>> +	/* Disconnect owns cleanup after firmware or IDE setup has started. */
>> +	pdev->tsm->error = true;
>>   	return ret;
>>   }
>>   
>> @@ -339,14 +468,20 @@ static void dsm_disconnect(struct pci_dev *pdev)
>>   	struct tsm_dsm_tio *dev_data = &dsm->data;
>>   	int ret;
>>   
>> -	ret = sev_tio_dev_disconnect(dev_data, force);
>> -	ret = sev_tio_spdm_cmd(dsm, ret);
>> -	if (ret && !force) {
>> -		ret = sev_tio_dev_disconnect(dev_data, true);
>> -		sev_tio_spdm_cmd(dsm, ret);
>> +	/* A paused or failed connect needs forced firmware cleanup. */
>> +	if (dev_data->reqbuf && dev_data->respbuf) {
>> +		force |= !dsm->session_connected;
>> +		ret = sev_tio_dev_disconnect(dev_data, force);
>> +		ret = sev_tio_spdm_cmd(dsm, ret);
>> +		if (ret && !force) {
>> +			ret = sev_tio_dev_disconnect(dev_data, true);
>> +			sev_tio_spdm_cmd(dsm, ret);
>> +		}
>>   	}
>>   
>>   	sev_tio_dev_reclaim(dev_data);
>> +	dsm->session_connected = false;
>> +	dsm->pending_spdm = 0;
>>   
>>   	streams_disable(dev_data->ide);
>>   	streams_unregister(dev_data->ide);
>> @@ -357,6 +492,8 @@ static struct pci_tsm_ops sev_tsm_ops = {
>>   	.probe = dsm_probe,
>>   	.remove = dsm_remove,
>>   	.connect = dsm_connect,
>> +	.evidence_accept = dsm_evidence_accept,
>
> I saw in your branch you are ditching the connect() hook, is that the plan? Thanks,
>


Yes. In the full branch, once rust-spdm is integrated, this entire flow
moves to the SPDM accept/evidence_accept phase.

>
>
>> +	.evidence_types = BIT(PCI_TSM_EVIDENCE_TYPE_CERT0),
>>   	.disconnect = dsm_disconnect,
>>   };
>>   
>

-aneesh

  reply	other threads:[~2026-11-06 13:14 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 15:26 [RFC PATCH v1 00/11] PCI/TSM: Add CTLV attestation Aneesh Kumar K.V (Arm)
2026-10-28 15:26 ` [RFC PATCH v1 01/11] attestation: Restrict inherited operations per instance Aneesh Kumar K.V (Arm)
2026-10-30 13:29   ` Jiri Pirko
2026-10-28 15:26 ` [RFC PATCH v1 02/11] attestation: Filter evidence objects " Aneesh Kumar K.V (Arm)
2026-10-30 13:44   ` Jiri Pirko
2026-10-31  6:24     ` Aneesh Kumar K.V
2026-11-02 19:14       ` Jiri Pirko
2026-10-28 15:26 ` [RFC PATCH v1 03/11] attestation: Enter secure operation when evidence is accepted Aneesh Kumar K.V (Arm)
2026-10-30 13:51   ` Jiri Pirko
2026-10-30 15:36     ` Jason Gunthorpe
2026-10-31  4:09     ` Aneesh Kumar K.V
2026-11-02 11:28       ` Jiri Pirko
2026-10-28 15:26 ` [RFC PATCH v1 04/11] attestation: Bind object selection to accepted evidence snapshots Aneesh Kumar K.V (Arm)
2026-10-28 15:26 ` [RFC PATCH v1 05/11] attestation: Make the evidence-get challenge attribute optional Aneesh Kumar K.V (Arm)
2026-10-28 15:26 ` [RFC PATCH v1 06/11] PCI/TSM: Describe the PCI attestation control family Aneesh Kumar K.V (Arm)
2026-10-30 14:01   ` Jiri Pirko
2026-10-30 15:43     ` Jason Gunthorpe
2026-11-02 12:45       ` Jiri Pirko
2026-11-03 15:45         ` Jason Gunthorpe
2026-11-04  9:21           ` Jiri Pirko
2026-11-04 14:00             ` Jason Gunthorpe
2026-10-31  4:05     ` Aneesh Kumar K.V
2026-11-02 11:50       ` Jiri Pirko
2026-11-03 15:35       ` Jason Gunthorpe
2026-10-31  4:22     ` Aneesh Kumar K.V
2026-11-02 11:30       ` Jiri Pirko
2026-11-03 15:39       ` Jason Gunthorpe
2026-10-28 15:26 ` [RFC PATCH v1 07/11] attestation: Add attestation helpers for PCI/TSM integration Aneesh Kumar K.V (Arm)
2026-10-28 15:26 ` [RFC PATCH v1 08/11] PCI/TSM: Bind CTLV attestation to connected and locked contexts Aneesh Kumar K.V (Arm)
2026-10-28 22:56   ` Dave Jiang
2026-10-29  5:30     ` Aneesh Kumar K.V
2026-10-29 12:41       ` Jason Gunthorpe
2026-10-30 14:04   ` Jiri Pirko
2026-10-30 14:08   ` Jiri Pirko
2026-10-30 15:39     ` Jason Gunthorpe
2026-11-02 12:11       ` Jiri Pirko
2026-11-03 15:41         ` Jason Gunthorpe
2026-10-28 15:26 ` [RFC PATCH v1 09/11] crypto/ccp: Defer SEV-TIO link setup until evidence acceptance Aneesh Kumar K.V (Arm)
2026-11-06  7:47   ` Alexey Kardashevskiy
2026-11-06 13:14     ` Aneesh Kumar K.V [this message]
2026-11-06 14:21       ` Jason Gunthorpe
2026-11-09 10:03       ` Alexey Kardashevskiy
2026-10-28 15:26 ` [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance Aneesh Kumar K.V (Arm)
2026-10-29 16:56   ` Dave Jiang
2026-10-29 17:10     ` Jason Gunthorpe
2026-10-30  9:58       ` Reshetova, Elena
2026-10-30 13:15         ` Jason Gunthorpe
2026-10-31  3:47           ` Aneesh Kumar K.V
2026-11-02 10:11             ` Reshetova, Elena
2026-11-02 17:26               ` Jason Gunthorpe
2026-11-03 12:01                 ` Reshetova, Elena
2026-11-03 15:16                   ` Jason Gunthorpe
2026-11-04  8:03                     ` Xu Yilun
2026-11-04  9:49                       ` Reshetova, Elena
2026-11-04 13:41                         ` Jason Gunthorpe
2026-11-04 16:54                           ` Dave Jiang
2026-11-06 15:53                             ` Dave Jiang
2026-11-06 19:30                               ` Jason Gunthorpe
2026-11-06 22:39                                 ` Dave Jiang
2026-11-08 18:33                                   ` Jason Gunthorpe
2026-11-09 10:55                                     ` Reshetova, Elena
2026-11-09 13:47                                       ` Jason Gunthorpe
2026-11-09 17:37                                     ` Dave Jiang
2026-11-09 18:53                                       ` Jason Gunthorpe
2026-11-09 20:54                                         ` Dave Jiang
2026-11-09 23:40                                           ` Jason Gunthorpe
2026-11-10 13:15                                             ` Reshetova, Elena
2026-11-10 14:20                                               ` Jason Gunthorpe
2026-11-11 13:09                                                 ` Reshetova, Elena
2026-11-10  1:40                                         ` Alistair
2026-11-10 15:07                                           ` Jason Gunthorpe
2026-11-10  5:32                                         ` Alexey Kardashevskiy
2026-11-10 12:52                                           ` Jason Gunthorpe
2026-11-11  9:03                                             ` Alexey Kardashevskiy
2026-11-10 20:07                               ` Jason Gunthorpe
2026-11-04  9:03                     ` Reshetova, Elena
2026-11-04 13:48                       ` Jason Gunthorpe
2026-11-06  8:24                     ` Aneesh Kumar K.V
2026-11-06 12:49                       ` Reshetova, Elena
2026-11-06 15:53                         ` Aneesh Kumar K.V
2026-11-06 18:54                           ` Jason Gunthorpe
2026-11-03 16:31                 ` Aneesh Kumar K.V
2026-11-03 17:56                   ` Jason Gunthorpe
2026-11-02 10:05           ` Reshetova, Elena
2026-11-02 10:22           ` Reshetova, Elena
2026-11-02 17:37             ` Jason Gunthorpe
2026-10-28 15:26 ` [RFC PATCH v1 11/11] virt: coco: arm-cca-guest: Refresh selected evidence against trusted digests Aneesh Kumar K.V (Arm)
2026-10-30 12:34 ` [RFC PATCH v1 00/11] PCI/TSM: Add CTLV attestation Xu Yilun
2026-10-30 15:32   ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yq5ao6c2p0ek.fsf@kernel.org \
    --to=aneesh.kumar@kernel.org \
    --cc=aik@amd.com \
    --cc=ashish.kalra@amd.com \
    --cc=bhelgaas@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jgg@nvidia.com \
    --cc=jic23@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=john.allen@amd.com \
    --cc=kas@kernel.org \
    --cc=kevin.tian@intel.com \
    --cc=linux-coco@lists.linux.dev \
    --cc=mark.rutland@arm.com \
    --cc=patches@lists.linux.dev \
    --cc=rick.p.edgecombe@intel.com \
    --cc=steven.price@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=thomas.lendacky@amd.com \
    --cc=will@kernel.org \
    --cc=yilun.xu@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox