[PATCH RFC v3 7/8] attestation: providers: introduce CCA Guest attestation provider

Aneesh Kumar K.V aneesh.kumar at kernel.org
Tue Dec 1 12:41:39 UTC 2026


Yeoreum Yun <yeoreum.yun at arm.com> writes:

> Introduce CCA Realm Guest attestation provider for retrieving:
>
>   - RIM, REM0-REM3 measurement registers.
>   - CCA attestation token
>   - CCEL event log
>
> used for CCA Realm Guest attestation.
>
> Signed-off-by: Yeoreum Yun <yeoreum.yun at arm.com>
> ---
>  drivers/attestation/Kconfig               |  10 +
>  drivers/attestation/Makefile              |   5 +
>  drivers/attestation/providers/cca_guest.c | 582 ++++++++++++++++++++++++++++++
>  3 files changed, 597 insertions(+)
>

 [ ... 507 lines skipped ... ] 

> +static int cca_guest_attest_drv_probe(struct arm_smccc_device *sdev)
> +{
> +	int ret, objects_count = 0;
> +	unsigned long lower, upper, digest_size;
> +	long max_token_size;
> +	void *eventlog;
> +	size_t eventlog_size;
> +	struct cca_guest_attestation *cca_guest_att;
> +	int ccel_obj_idx = 0;
> +
> +	ret = rsi_request_version(RSI_ABI_VERSION, &lower, &upper);
> +	if (ret)
> +		return ret;
> +
> +	ret = cca_guest_hash_init(&digest_size);
> +	if (ret)
> +		return ret;
> +
> +	max_token_size = cca_guest_get_max_token_size();
> +	if (max_token_size <= 0)
> +		return -EINVAL;
> +
> +	eventlog = cca_guest_ccel_init(&eventlog_size);
> +	if (IS_ERR(eventlog))
> +		return PTR_ERR(eventlog);
> +
> +	pr_info("CCA Realm guest RSI version %lu.%lu\n",
> +		RSI_ABI_VERSION_GET_MAJOR(RSI_ABI_VERSION),
> +		RSI_ABI_VERSION_GET_MINOR(RSI_ABI_VERSION));
> +	pr_info("Maximum Attestation token size: 0x%lx\n", max_token_size);
> +	pr_info("Eventlog Size: 0x%zx\n", eventlog_size);
> +
> +	cca_guest_attestation_evidence_objects[objects_count++].max_length = max_token_size;
> +
> +	if (eventlog && eventlog_size > 0) {
> +		ccel_obj_idx = objects_count;
> +		cca_guest_attestation_evidence_objects[objects_count++].max_length = eventlog_size;
> +	}
> +
> +	if (WARN_ON_ONCE(objects_count > ARRAY_SIZE(cca_guest_attestation_evidence_objects)))
> +		return -EINVAL;
> +
> +	cca_guest_attestation_evidence_caps.objects_count = objects_count;
> +
> +	cca_guest_att = attestation_alloc(&sdev->dev,
> +					  &cca_guest_attestation_provider,
> +					  &ctlv_attestation_cca_guest_family,
> +					  struct cca_guest_attestation, att);
> +	if (IS_ERR(cca_guest_att)) {
> +		ret = PTR_ERR(cca_guest_att);
> +		goto free_eventlog;
> +	}
> +
> +	cca_guest_att->version = RSI_ABI_VERSION;
> +	cca_guest_att->digest_size = digest_size;
> +	cca_guest_att->max_token_size = max_token_size;
> +	cca_guest_att->ccel_obj_idx = ccel_obj_idx;
> +	cca_guest_att->ccel_eventlog = eventlog;
> +	cca_guest_att->ccel_eventlog_size = eventlog_size;
> +	INIT_WORK(&cca_guest_att->state_work, cca_guest_state_workfn);
> +
> +	ret = attestation_register(&cca_guest_att->att);
> +	if (ret) {
> +		attestation_put(&cca_guest_att->att);
> +		goto free_eventlog;
> +	}
> +
> +	dev_set_drvdata(&sdev->dev, cca_guest_att);
> +
> +	pr_info("CCA Realm Guest attestation ctlvdev is registered\n");
> +
> +	return 0;
> +
> +free_eventlog:
> +	if (eventlog)
> +		kvfree(eventlog);
> +	return ret;
> +}
> +


Could you make the above a helper that can be called from
arm-cca-guest.ko instead of making it an SMCCC driver?

-aneesh



More information about the Linux-security-module-archive mailing list