From: Krzysztof Kozlowski <krzk@kernel.org>
To: Balint Dobszay <balint.dobszay@arm.com>,
op-tee@lists.trustedfirmware.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: jens.wiklander@linaro.org, sumit.garg@linaro.org, corbet@lwn.net,
sudeep.holla@arm.com, gyorgy.szing@arm.com
Subject: Re: [PATCH 2/3] tee: tstee: Add Trusted Services TEE driver
Date: Thu, 15 Feb 2024 09:59:50 +0100 [thread overview]
Message-ID: <ed8aaee7-be14-43ab-981c-d2ac04f4fc71@kernel.org> (raw)
In-Reply-To: <20240213145239.379875-3-balint.dobszay@arm.com>
On 13/02/2024 15:52, Balint Dobszay wrote:
> The Trusted Services project provides a framework for developing and
> deploying device Root of Trust services in FF-A Secure Partitions. The
> FF-A SPs are accessible through the FF-A driver, but this doesn't
> provide a user space interface. The goal of this TEE driver is to make
> Trusted Services SPs accessible for user space clients.
>
> All TS SPs have the same FF-A UUID, it identifies the RPC protocol used
> by TS. A TS SP can host one or more services, a service is identified by
> its service UUID. The same type of service cannot be present twice in
> the same SP. During SP boot each service in an SP is assigned an
> interface ID, this is just a short ID to simplify message addressing.
> There is 1:1 mapping between TS SPs and TEE devices, i.e. a separate TEE
> device is registered for each TS SP. This is required since contrary to
> the generic TEE design where memory is shared with the whole TEE
> implementation, in case of FF-A, memory is shared with a specific SP. A
> user space client has to be able to separately share memory with each SP
> based on its endpoint ID.
>
> Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
> ---
> +static int tstee_probe(struct ffa_device *ffa_dev)
> +{
> + struct tstee *tstee;
> + int rc;
> +
> + ffa_dev->ops->msg_ops->mode_32bit_set(ffa_dev);
> +
> + if (!tstee_check_rpc_compatible(ffa_dev))
> + return -EINVAL;
> +
> + tstee = kzalloc(sizeof(*tstee), GFP_KERNEL);
> + if (!tstee)
> + return -ENOMEM;
> +
> + tstee->ffa_dev = ffa_dev;
> +
> + tstee->pool = tstee_create_shm_pool();
> + if (IS_ERR(tstee->pool)) {
> + rc = PTR_ERR(tstee->pool);
> + tstee->pool = NULL;
> + goto err;
Is it logically correct to call here tee_device_unregister()?
> + }
> +
> + tstee->teedev = tee_device_alloc(&tstee_desc, NULL, tstee->pool, tstee);
> + if (IS_ERR(tstee->teedev)) {
> + rc = PTR_ERR(tstee->teedev);
> + tstee->teedev = NULL;
> + goto err;
> + }
> +
> + rc = tee_device_register(tstee->teedev);
> + if (rc)
> + goto err;
> +
> + ffa_dev_set_drvdata(ffa_dev, tstee);
> +
> + pr_info("driver initialized for endpoint 0x%x\n", ffa_dev->vm_id);
Don't print simple probe success messages. Anyway all prints in device
context should be dev_*.
> +
> + return 0;
> +
> +err:
> + tstee_deinit_common(tstee);
> + return rc;
> +}
> +
> +static void tstee_remove(struct ffa_device *ffa_dev)
> +{
> + tstee_deinit_common(ffa_dev->dev.driver_data);
> +}
> +
> +static const struct ffa_device_id tstee_device_ids[] = {
> + /* TS RPC protocol UUID: bdcd76d7-825e-4751-963b-86d4f84943ac */
> + { TS_RPC_UUID },
> + {}
> +};
> +
> +static struct ffa_driver tstee_driver = {
> + .name = "arm_tstee",
> + .probe = tstee_probe,
> + .remove = tstee_remove,
> + .id_table = tstee_device_ids,
> +};
> +
> +static int __init mod_init(void)
> +{
> + return ffa_register(&tstee_driver);
> +}
> +module_init(mod_init)
> +
> +static void __exit mod_exit(void)
> +{
> + ffa_unregister(&tstee_driver);
> +}
> +module_exit(mod_exit)
> +
> +MODULE_ALIAS("arm-tstee");
Why do you need this alias? I don't see MODULE_DEVICE_TABLE, so how this
bus handles module loading?
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-02-15 8:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 14:52 [PATCH 0/3] TEE driver for Trusted Services Balint Dobszay
2024-02-13 14:52 ` [PATCH 1/3] tee: optee: Move pool_op helper functions Balint Dobszay
2024-02-14 13:01 ` kernel test robot
2024-02-14 13:11 ` kernel test robot
2024-02-13 14:52 ` [PATCH 2/3] tee: tstee: Add Trusted Services TEE driver Balint Dobszay
2024-02-15 8:59 ` Krzysztof Kozlowski [this message]
2024-02-15 10:32 ` Jens Wiklander
2024-02-22 16:20 ` Balint Dobszay
2024-02-15 10:00 ` Jens Wiklander
2024-02-21 9:58 ` Balint Dobszay
2024-02-13 14:52 ` [PATCH 3/3] Documentation: tee: Add TS-TEE driver Balint Dobszay
2024-02-13 21:44 ` Randy Dunlap
2024-02-14 16:56 ` Balint Dobszay
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=ed8aaee7-be14-43ab-981c-d2ac04f4fc71@kernel.org \
--to=krzk@kernel.org \
--cc=balint.dobszay@arm.com \
--cc=corbet@lwn.net \
--cc=gyorgy.szing@arm.com \
--cc=jens.wiklander@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=op-tee@lists.trustedfirmware.org \
--cc=sudeep.holla@arm.com \
--cc=sumit.garg@linaro.org \
/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