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

Aneesh Kumar K.V <[email protected]>
Newsgroups org.infradead.lists.linux-arm-kernel,dev.linux.lists.kvmarm,dev.linux.lists.linux-coco,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Kameron Carr <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.