From: Jiri Pirko <jiri@resnulli.us>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Yeoreum Yun <yeoreum.yun@arm.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Suzuki Poulose <suzuki.poulose@arm.com>,
Steven Price <steven.price@arm.com>,
Sami Mujawar <sami.mujawar@arm.com>,
thuth@redhat.com, "Rafael J. Wysocki" <rafael@kernel.org>,
Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>,
Pawel Chmielewski <pawel.chmielewski@intel.com>,
Jonathan Corbet <corbet@lwn.net>, Shuah Khan <shuah@kernel.org>,
Len Brown <lenb@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH RFC v3 7/8] attestation: providers: introduce CCA Guest attestation provider
Date: Mon, 30 Nov 2026 13:56:33 +0100 [thread overview]
Message-ID: <aw1vgdl1YYpVHana@FV6GYCPJ69> (raw)
In-Reply-To: <20261127170722.GT246011@ziepe.ca>
Fri, Nov 27, 2026 at 06:07:22PM +0100, jgg@ziepe.ca wrote:
>On Fri, Nov 27, 2026 at 03:33:02PM +0000, Yeoreum Yun wrote:
>> 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.
>
>This is great to see positive proof that the API fits CCA!
>
>> Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
>> ---
>> drivers/attestation/Kconfig | 10 +
>> drivers/attestation/Makefile | 5 +
>> drivers/attestation/providers/cca_guest.c | 582 ++++++++++++++++++++++++++++++
>> 3 files changed, 597 insertions(+)
>
>But we need to do alot more work on this to make the drivers slimmer.
>
>First, we need to pull drivers/virt/coco/arm-cca-guest/main.c which is
>the evidence part of this driver into drivers/attestation and build
>the MR stuff on top of that.
>
>Second, things like CCEL need to be handled by core code. The driver
>should only indicate it "claims" the CCEL if the core code happens to
>find one. TDX and ARM shouldn't have any direct CCEL stuff beyond
>that.
>
>Similarly the TCG log should work the same way.
>
>I'm also wondering if too much code is leaking into to drivers to
>implement the uAPI. We should take a look at this vs the TDX one and
>make sure we have the right level of helpers and abstraction.
>
>I also can't help but notice there isn't a single comment in any of
>this, it should be a bit more descriptive why some of these things are
>in here.
>
>> +static enum hash_algo cca_guest_attestation_algorithms[] = {
>> + HASH_ALGO_SHA512,
>> +};
>
>static const
>
>> +
>> +static const struct attestation_mr_props cca_guest_attestation_mrs[] = {
>> + {
>> + .id = 0,
>> + .name = "rim",
>> + .algorithms = cca_guest_attestation_algorithms,
>> + .algorithms_count = ARRAY_SIZE(cca_guest_attestation_algorithms),
>> + },
>> + {
>> + .id = 1,
>> + .name = "rem0",
>> + .algorithms = cca_guest_attestation_algorithms,
>> + .algorithms_count = ARRAY_SIZE(cca_guest_attestation_algorithms),
>> + .has_register_index = true,
>> + .register_index = 0,
>> + .extendable = true,
>> + },
>> + {
>> + .id = 2,
>> + .name = "rem1",
>> + .algorithms = cca_guest_attestation_algorithms,
>> + .algorithms_count = ARRAY_SIZE(cca_guest_attestation_algorithms),
>> + .has_register_index = true,
>> + .register_index = 1,
>> + .extendable = true,
>> + },
>> + {
>> + .id = 3,
>> + .name = "rem2",
>> + .algorithms = cca_guest_attestation_algorithms,
>> + .algorithms_count = ARRAY_SIZE(cca_guest_attestation_algorithms),
>> + .has_register_index = true,
>> + .register_index = 2,
>> + .extendable = true,
>> + },
>> + {
>> + .id = 4,
>> + .name = "rem3",
>> + .algorithms = cca_guest_attestation_algorithms,
>> + .algorithms_count = ARRAY_SIZE(cca_guest_attestation_algorithms),
>> + .has_register_index = true,
>> + .register_index = 3,
>> + .extendable = true,
>> + },
>> +};
>
>Jiri this probably isn't going to scale when we get to 32 PCRs on a
>TPM.
Perhaps we can have some groups, like:
static const struct attestation_mr_props cca_guest_attestation_mrs[] = {
{
.first_id = 0,
.mrs_count = 1,
.name = "rim",
.algorithms = cca_guest_attestation_algorithms,
.algorithms_count =
ARRAY_SIZE(cca_guest_attestation_algorithms),
},
{
.first_id = 1,
.mrs_count = 4,
.name = "rem%u",
.algorithms = cca_guest_attestation_algorithms,
.algorithms_count =
ARRAY_SIZE(cca_guest_attestation_algorithms),
.has_register_index = true,
.first_register_index = 0,
.extendable = true,
},
};
?
>
>> +
>> +static const struct attestation_evidence_format cca_attestation_token_formats[] = {
>> + { .vendor = true, .value = CTLV_ATTESTATION_CCA_GUEST_EVIDENCE_VENDOR_FORMAT_CCA_ATTESTATION_TOKEN },
>> +};
>
>should be the generic EAT token type
>
>> +
>> +static const struct attestation_evidence_format cca_guest_attestation_log_formats[] = {
>> + { .value = CTLV_ATTESTATION_EVIDENCE_FORMAT_CCEL },
>> +};
>> +
>> +static const struct attestation_evidence_challenge_length
>> +cca_guest_attestation_challenge_lengths[] = {
>> + { .min = RSI_ATTEST_CHALLENGE_MIN_SIZE, .max = RSI_ATTEST_CHALLENGE_MAX_SIZE },
>> +};
>> +
>> +static struct attestation_evidence_supported_object
>> +cca_guest_attestation_evidence_objects[] = {
>> + {
>> + .evidence_class = ATTESTATION_EVIDENCE_SIGNED,
>> + .formats = cca_attestation_token_formats,
>> + .formats_count = ARRAY_SIZE(cca_attestation_token_formats),
>> + .challenge_lengths = cca_guest_attestation_challenge_lengths,
>> + .challenge_lengths_count =
>> + ARRAY_SIZE(cca_guest_attestation_challenge_lengths),
>> + .max_length = 0,
>> + .binds_mrs = true,
>> + },
>> +#ifdef CONFIG_ACPI
>> + {
>> + .evidence_class = ATTESTATION_EVIDENCE_EVENT_LOG,
>> + .formats = cca_guest_attestation_log_formats,
>> + .formats_count = ARRAY_SIZE(cca_guest_attestation_log_formats),
>> + .max_length = 0,
>> + },
>> +#endif
>
>Jiri, same scaling issue, CCEL should be handled by core code so it
>needs to be inserted dynamically into the evidence list.
Yeah, I was thingking about it. We can build the evidence-object list
during initialization, rather than treating the provider's array as the
final list.
Also. I think each object should have own callback.
>
>> +static long cca_guest_get_max_token_size(void)
>> +{
>> + u8 dummy[RSI_ATTEST_CHALLENGE_MAX_SIZE] = { 0x00, };
>> +
>> + return rsi_attestation_token_init(dummy, RSI_ATTEST_CHALLENGE_MAX_SIZE);
>> +}
>> +
>> +static int cca_guest_get_attest_tokens(const struct cca_guest_attestation *cca_guest_att,
>> + const void *challenge, size_t challenge_size,
>> + u8 *token, size_t *token_size)
>> +{
>> + int ret;
>> + long max_token_size;
>> + void *buf;
>> + unsigned long granule, offset, len, rsi_ret;
>> +
>> + guard(migrate)();
>> +
>> + max_token_size = rsi_attestation_token_init(challenge, challenge_size);
>> + if (max_token_size <= 0)
>> + return -EINVAL;
>> +
>> + if (max_token_size != cca_guest_att->max_token_size)
>> + return -ESTALE;
>
>What is this and the related work? That isn't making sense to
>me. If the token size is not absolutely fixed when the driver starts
>then it should be fully dynamic and this just streams the variable
>sized token.
>
>Ideally directly into user memory so we don't need to allocate a kvmalloc.
>
>> +static int
>> +cca_guest_attestation_evidence_get(struct attestation_dev *att,
>> + const struct attestation_evidence_request *request,
>> + struct attestation_evidence_result *result)
>> +{
>> + struct cca_guest_attestation *cca_guest_att = to_cca_guest_attestation(att);
>> + size_t i, length;
>> + void *buffer;
>> + int ret = 0, ccel_obj_idx;
>> +
>> + ccel_obj_idx = cca_guest_att->ccel_obj_idx;
>> +
>> + for (i = 0; !ret && i < request->objects_count; i++) {
>> + const struct attestation_evidence_object_request *object =
>> + &request->objects[i];
>> + struct attestation_evidence_object_result *produced =
>> + &result->objects[i];
>
>I feel like the core code should be doing more of this for the
>drivers... Drivers should have an op to return a single evidence, for
>an ID that they control. ie the core code should be returning the CCEL
>for its id, and when we get to SPDM other common code will handle ids
>too.
>
>Maybe the evidence itself needs an ops?
Okay, makes sense the core may help a bit more. Perhaps just a simple
change of evidence_get (or per object callback) being called per-object
and core doing the iteration?
>
>> +static const struct arm_smccc_device_id cca_guest_attest_id_table[] = {
>> + { .func_id = SMC_RSI_ABI_VERSION, },
>> + { },
>> +};
>> +MODULE_DEVICE_TABLE(arm_smccc, cca_guest_attest_id_table);
>
>This isn't OK.. We only get one struct device per RSI and it gets to
>bind to only one driver. Given there are other drivers that will need
>to use the RSI, like the TSM and others, this needs some other
>solution?
>
>Jason
next prev parent reply other threads:[~2026-11-30 12:56 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 15:32 [PATCH RFC v3 0/8] attestation: provider: add CCA Realm Guest provider Yeoreum Yun
2026-11-27 15:32 ` [PATCH RFC v3 1/8] arm64: rsi: Add helpers for Arm CCA measurement register operations Yeoreum Yun
2026-11-27 15:32 ` [PATCH RFC v3 2/8] arm64: rsi: Add realm hash algorithm defines Yeoreum Yun
2026-11-27 15:32 ` [PATCH RFC v3 3/8] arm64: acpi: Enable ACPI CCEL support Yeoreum Yun
2026-11-27 16:28 ` Suzuki K Poulose
2026-11-27 18:12 ` Yeoreum Yun
2026-11-27 15:32 ` [PATCH RFC v3 4/8] acpi: add CCtype value macros for CCEL table Yeoreum Yun
2026-11-27 15:33 ` [PATCH RFC v3 5/8] Documentation/ctlv: introduce ctlv-attestation-cca-guest family Yeoreum Yun
2026-11-27 15:33 ` [PATCH RFC v3 6/8] ctlv: add auto-generated files for ctlv-attestation-cca-guest Yeoreum Yun
2026-11-27 15:33 ` [PATCH RFC v3 7/8] attestation: providers: introduce CCA Guest attestation provider Yeoreum Yun
2026-11-27 17:07 ` Jason Gunthorpe
2026-11-27 18:24 ` Yeoreum Yun
2026-11-27 18:35 ` Jason Gunthorpe
2026-11-27 19:11 ` Yeoreum Yun
2026-11-27 19:13 ` Yeoreum Yun
2026-11-27 19:18 ` Jason Gunthorpe
2026-11-27 19:40 ` Yeoreum Yun
2026-11-27 18:27 ` Yeoreum Yun
2026-11-27 18:36 ` Jason Gunthorpe
2026-11-30 12:56 ` Jiri Pirko [this message]
2026-11-27 15:33 ` [PATCH RFC v3 8/8] selftest: attestation: add cca_guest_attestation_test selftest Yeoreum Yun
2026-11-27 17:09 ` 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=aw1vgdl1YYpVHana@FV6GYCPJ69 \
--to=jiri@resnulli.us \
--cc=acpica-devel@lists.linux.dev \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=jgg@ziepe.ca \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=maciej.wieczor-retman@intel.com \
--cc=pawel.chmielewski@intel.com \
--cc=rafael@kernel.org \
--cc=rdunlap@infradead.org \
--cc=sami.mujawar@arm.com \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=steven.price@arm.com \
--cc=suzuki.poulose@arm.com \
--cc=thuth@redhat.com \
--cc=will@kernel.org \
--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