From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: Yeoreum Yun <yeoreum.yun@arm.com>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Suzuki Poulose <suzuki.poulose@arm.com>,
Steven Price <steven.price@arm.com>,
Sami Mujawar <sami.mujawar@arm.com>,
"Aneesh Kumar K.V" <aneesh.kumar@kernel.org>,
Jiri Pirko <jiri@resnulli.us>, GONG Ruiqi <gongruiqi1@huawei.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH RFC v2 5/6] attestation: providers: introduce FIRME attestation provider
Date: Tue, 1 Dec 2026 11:57:26 -0800 [thread overview]
Message-ID: <20261201115726.00004cd6@oss.qualcomm.com> (raw)
In-Reply-To: <20261127-firme_interface-v2-5-ab88b2d0b4e0@arm.com>
On Fri, 27 Nov 2026 15:28:35 +0000
Yeoreum Yun <yeoreum.yun@arm.com> wrote:
> Introduce FIRME attestation provider for retrieving an attestation
> token for host.
>
> When a evidence-get is requested, firme attestation provider invokes
> the appropriate FIRME interfaces to query an attestation token.
>
> The steps to retrieve an attestation token are as follows:
>
?
Seems like some editing went a bit far here!
> Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
A few really minor things inline. Very much a drive by review.
I'll try and find time for a proper look at somepoint but don't wait for it!
J
> diff --git a/drivers/attestation/providers/firme.c b/drivers/attestation/providers/firme.c
> new file mode 100644
> index 0000000000000..b8de3e14aff5a
> --- /dev/null
> +++ b/drivers/attestation/providers/firme.c
> +
> +static int
> +firme_attestation_evidence_get(struct attestation_dev *att,
> + const struct attestation_evidence_request *request,
> + struct attestation_evidence_result *result)
> +{
> + const struct attestation_evidence_object_request *object;
> + struct attestation_evidence_object_result *produced;
> + struct firme_attestation *firme_att = to_firme_attestation(att);
> + void *token;
> + size_t token_size;
> + int ret;
> +
> + if (request->objects_count != 1)
> + return -EOPNOTSUPP;
> +
> + object = &request->objects[0];
> + produced = &result->objects[0];
> +
> + token_size = object->supported_object->max_length;
> + token = kvmalloc(token_size, GFP_KERNEL);
> + if (!token)
> + return -ENOMEM;
> + if (object->supported_object == &firme_attestation_evidence_objects[0]) {
> + ret = firme_get_platform_attestion_token(firme_att,
> + request->challenge,
> + request->challenge_length,
> + token, &token_size);
> + if (!ret) {
> + produced->format.vendor = true;
> + produced->format.value = CTLV_ATTESTATION_FIRME_EVIDENCE_VENDOR_FORMAT_PLATFORM_ATTESTATION_TOKEN;
> + }
> + } else {
> + ret = -EOPNOTSUPP;
> + }
> +
> + if (!ret)
> + ret = attestation_evidence_write(object, token, token_size);
> + if (!ret)
> + produced->length = token_size;
> + kvfree(token);
Consider using __free(kvfree) above and that allowing you to do returns on
error rather that that hard to follow if (!ret) approach.
> +
> + return ret;
> +}
> +static int firme_attest_drv_probe(struct arm_smccc_device *sdev)
> +{
> + int ret;
> + u32 version;
> + unsigned long feature;
> + struct firme_shared_buf_info shbuf_info;
> + u8 max_pat_pgcnt;
> + size_t max_pat_size;
> + struct firme_attestation *firme_att;
> +
> + ret = firme_get_shared_buffer_info(&shbuf_info);
> + if (ret)
> + return ret;
> +
> + ret = firme_get_version(FIRME_ATTEST_SERVICE_ID, &version);
> + if (ret)
> + return ret;
> +
> + ret = firme_get_feature(FIRME_ATTEST_SERVICE_ID, 0x01, &feature);
> + if (ret)
> + return ret;
> +
> + max_pat_pgcnt = FIELD_GET(FIRME_ATTEST_FEAT1_MAX_PAT_PG_CNT_MASK, feature);
> + max_pat_size = (max_pat_pgcnt + 1) * shbuf_info.min_size;
> + firme_attestation_evidence_objects[0].max_length = max_pat_size;
> +
> + pr_info("FIRME attest service version %d.%d\n",
> + FIRME_MAJOR_VERSION(version),
> + FIRME_MINOR_VERSION(version));
> + pr_info("Maximum PAT size: 0x%lx\n", max_pat_size);
Can this not all be obtained from the cltv interface? Feels very noisy
given more likely to be useful at runtime than in the kernel log.
> +
> + firme_att = attestation_alloc(&sdev->dev,
> + &firme_attestation_provider,
> + &ctlv_attestation_firme_family,
> + struct firme_attestation, att);
> + if (IS_ERR(firme_att))
> + return PTR_ERR(firme_att);
> +
> + firme_att->version = version;
> + firme_att->max_pat_size = max_pat_size;
> +
> + ret = attestation_register(&firme_att->att);
> + if (ret) {
> + attestation_put(&firme_att->att);
> + return ret;
> + }
> +
> + dev_set_drvdata(&sdev->dev, firme_att);
> +
> + pr_info("FIRME attestation ctlvdev is registered\n");
That's noisy for something we should be able to trivially establish
given there will be a ctlvdev. dbg level at most.
> +
> + return 0;
> +}
> +
> +static void firme_attest_drv_remove(struct arm_smccc_device *sdev)
> +{
> + struct firme_attestation *firme_att = dev_get_drvdata(&sdev->dev);
> +
> + if (!firme_att)
> + return;
> +
> + attestation_unregister(&firme_att->att);
> + attestation_put(&firme_att->att);
> + dev_set_drvdata(&sdev->dev, NULL);
> +}
> +
> +static const struct arm_smccc_device_id firme_attest_id_table[] = {
> + { .func_id = FIRME_SERVICE_VERSION, },
> + { },
Trivial but no reason for that trailing comma. By definition nothing
ever comes after that.
> +};
> +MODULE_DEVICE_TABLE(arm_smccc, firme_attest_id_table);
> +
> +static struct arm_smccc_driver firme_attest_drv = {
> + .name = KBUILD_MODNAME,
> + .probe = firme_attest_drv_probe,
> + .remove = firme_attest_drv_remove,
> + .match = firme_attest_drv_match,
> + .id_table = firme_attest_id_table,
> +};
> +module_arm_smccc_driver(firme_attest_drv);
> +
> +MODULE_DESCRIPTION("FIRME attestation provider");
> +MODULE_LICENSE("GPL");
> +MODULE_IMPORT_NS("ATTESTATION");
> +MODULE_IMPORT_NS("CTLV");
> +MODULE_IMPORT_NS("FIRME");
>
next prev parent reply other threads:[~2026-12-01 19:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 15:28 [PATCH RFC v2 0/6] firmware: arm_firme: introduce FIRME support for host attestation Yeoreum Yun
2026-11-27 15:28 ` [PATCH RFC v2 1/6] firmware: arm-smccc: introduce match function Yeoreum Yun
2026-11-27 15:28 ` [PATCH RFC v2 2/6] firmware: arm_firme: introduce arm_firme Yeoreum Yun
2026-11-27 15:28 ` [PATCH RFC v2 3/6] Documentation/ctlv: introduce ctlv-attestation-firme family Yeoreum Yun
2026-11-27 15:28 ` [PATCH RFC v2 4/6] ctlv: add auto-generated files for ctlv-attestation-firme Yeoreum Yun
2026-11-27 15:28 ` [PATCH RFC v2 5/6] attestation: providers: introduce FIRME attestation provider Yeoreum Yun
2026-12-01 19:57 ` Jonathan Cameron [this message]
2026-11-27 15:28 ` [PATCH RFC v2 6/6] selftest: attestation: add firme_attestation_test selftest Yeoreum Yun
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=20261201115726.00004cd6@oss.qualcomm.com \
--to=jonathan.cameron@oss.qualcomm.com \
--cc=aneesh.kumar@kernel.org \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=gongruiqi1@huawei.com \
--cc=jgg@ziepe.ca \
--cc=jiri@resnulli.us \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=sami.mujawar@arm.com \
--cc=steven.price@arm.com \
--cc=suzuki.poulose@arm.com \
--cc=yeoreum.yun@arm.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