[RFC PATCH v4 09/11] coco: guest: arm64: Hook TSM accept to Realm TDISP RUN transition

Aneesh Kumar K.V aneesh.kumar at kernel.org
Mon Aug 24 21:47:43 PDT 2026


Kameron Carr <kameroncarr at linux.microsoft.com> writes:

> On 4/27/2026 1:28 AM, Aneesh Kumar K.V (Arm) wrote:
 
...

> 
>> +	/*
>> +	 * Present the private mmio range in the resource hierarchy.
>> +	 * We don't use this for ioremap, ioremap check the RIPAS value.
>> +	 */
>> +	ret = pci_tsm_mmio_setup(pdev, tsm_mmio);
>> +	if (ret) {
>> +		pci_err(pdev, "Protected mmio setup failure\n");
>> +		return ret;
>> +	}
>> +
>> +	ret = cca_map_evidence_report_range(pdev, tsm_mmio);
>> +	if (ret) {
>> +		pci_err(pdev, "failed to validate the interface report\n");
>> +		return ret;
>> +	}
>> +
>> +	ret = rhi_vdev_set_tdi_state(pdev, RHI_DA_TDI_CONFIG_RUN);
>> +	if (ret) {
>> +		pci_err(pdev, "failed to switch the device (%u) to RUN state\n", ret);
>> +		return ret;
>> +	}
>
> After calling pci_tsm_mmio_setup() we have mappings from insert_resource()
> then failures from later return codes never call mmio_teardown() so
> remove_resource() is never called, only kfree on the tsm_mmio.
>
> Likewise after cca_map_evidence_report_range() the mmio entry memory ranges
> have state RIPAS_DEV. Later failures never restore RIPAS_EMPTY.
>
> Could clean up be handled better? Is there a reason these failures don't
> have a rollback path?
>

Thanks for the review. I’ll incorporate these changes in the next
version.

-aneesh



More information about the linux-arm-kernel mailing list