From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD1DA606A322 for ; Thu, 3 Dec 2026 11:32:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=VRoRqAcl; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=oYDOXvRV DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=ldCADu2rAbSPoLc5Ll4quh8LJZHqhqAxlHXYL083Z+8=; b=VRoRqAcl16GxcIs8nUiTO010GP fI+C46MgPPZ/pa9emGI9XLxxYHtw4V9UNneY296q+8va5qmk6w/WnFIrxDwbi3SfTdQ/EFDrilITF Dxp8ttOdgbirmmmgNhxEMaIH6pmdbuBNkSb6Ki1s9A2rB0Voch+H1dVdOD1gs28bc2vrnaSgIghlg 3r+LYrgajMAaObNwtMZIHjlJ33sAi4oobNs1PJ5QVxAgIUwgDEpKepJxgh11DZdms8SIsWOo2GbOu ct18R1qmJJxUDFqGefYkkR7UJyRzCYj4ooQ7eL5ySyS1vHpTPvnAUbMt6Cg2nMmySff6ZvduFqVt9 VDStW6+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ52h-0000000EOhJ-1ZE3; Thu, 03 Dec 2026 11:32:03 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ52e-0000000EOgW-2wzi for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2026 11:32:02 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8836A14BF; Thu, 3 Dec 2026 03:31:54 -0800 (PST) Received: from e129823.arm.com (e129823.arm.com [10.2.213.3]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 652D83F7D8; Thu, 3 Dec 2026 03:31:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796297517; bh=hglYaiU/H6toMFmcpAErtEFjz4AHlTqd11PxYRrhM/o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oYDOXvRV/60kzGbQtlIliCWl0M1q0hL6p5YNyAoRbTiFd0ZhK0Rca8u5vCIHtrLX7 ypU67lx/0wjwRswYVcHFttCRscxdgNyFMKSPd9izl2CRYSVsMxPT1oNBfGXI7iFahV 1PeCAt6kf4APACFVONTboTyk186k4fH7uK/QVWkI= Date: Thu, 3 Dec 2026 11:31:51 +0000 From: Yeoreum Yun To: Jonathan Cameron Cc: Yeoreum Yun , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Lorenzo Pieralisi , Catalin Marinas , Suzuki Poulose , Steven Price , Sami Mujawar , "Aneesh Kumar K.V" , Jiri Pirko , GONG Ruiqi , Jason Gunthorpe , Mark Brown Subject: Re: [PATCH RFC v2 5/6] attestation: providers: introduce FIRME attestation provider Message-ID: References: <20261127-firme_interface-v2-0-ab88b2d0b4e0@arm.com> <20261127-firme_interface-v2-5-ab88b2d0b4e0@arm.com> <20261201115726.00004cd6@oss.qualcomm.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261201115726.00004cd6@oss.qualcomm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261203_033201_031517_17BF29B3 X-CRM114-Status: GOOD ( 28.20 ) X-Spam-Score: -4.4 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Tue, Dec 01, 2026 at 11:57:26AM -0800, Jonathan Cameron wrote: > On Fri, 27 Nov 2026 15:28:35 +0000 > Yeoreum Yun 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! Sorry, I've missed that... > > > Signed-off-by: Yeoreum Yun > > 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! Thanks ;) > > 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. Okay. I'll apply it. > > > > + > > + 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. Yes. this seems redandant. I'll remove it. > > + > > + 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. Yeap. I'll change to pr_debug(). > > > + > > + 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. Acked. > > > +}; > > +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"); > > > -- Sincerely, Yeoreum Yun