From: Maximilian Luz <luzmaximilian@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
Andrew Halaney <ahalaney@redhat.com>
Cc: Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Elliot Berman <quic_eberman@quicinc.com>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Guru Das Srinagesh <quic_gurus@quicinc.com>,
Alex Elder <elder@linaro.org>,
Srini Kandagatla <srinivas.kandagatla@linaro.org>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, kernel@quicinc.com,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH v3 11/15] firmware: qcom: qseecom: convert to using the TZ allocator
Date: Wed, 11 Oct 2023 22:47:47 +0200 [thread overview]
Message-ID: <b09b6ee4-717c-44fa-abbe-cf9cef7b7d8b@gmail.com> (raw)
In-Reply-To: <CAMRc=MdfZzG-C7=OVhR7x_vEmCexS39GEJ3F-CHM7cfya+A-VA@mail.gmail.com>
On 10/11/23 09:44, Bartosz Golaszewski wrote:
> On Wed, Oct 11, 2023 at 12:49 AM Andrew Halaney <ahalaney@redhat.com> wrote:
>>
>> On Mon, Oct 09, 2023 at 05:34:23PM +0200, Bartosz Golaszewski wrote:
>>> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>>>
>>> Drop the DMA mapping operations from qcom_scm_qseecom_app_send() and
>>> convert all users of it in the qseecom module to using the TZ allocator
>>> for creating SCM call buffers. Together with using the cleanup macros,
>>> it has the added benefit of a significant code shrink. As this is
>>> largely a module separate from the SCM driver, let's use a separate
>>> memory pool.
>>>
>>> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
[...]
>>> @@ -704,12 +635,7 @@ static efi_status_t qsee_uefi_query_variable_info(struct qcuefi_client *qcuefi,
>>> if (max_variable_size)
>>> *max_variable_size = rsp_data->max_variable_size;
>>>
>>> -out_free:
>>> - kfree(rsp_data);
>>> -out_free_req:
>>> - kfree(req_data);
>>> -out:
>>> - return efi_status;
>>> + return EFI_SUCCESS;
>>> }
>>>
>>> /* -- Global efivar interface. ---------------------------------------------- */
>>> @@ -838,6 +764,10 @@ static int qcom_uefisecapp_probe(struct auxiliary_device *aux_dev,
>>> if (status)
>>> qcuefi_set_reference(NULL);
>>>
>>> + qcuefi->mempool = devm_qcom_tzmem_pool_new(&aux_dev->dev, SZ_256K);
>>
>> Any particular reason for this size? Just curious, it was (one) of the
>> reasons I had not marked patch 4 yet (it looks good, but I wanted to get
>> through the series to digest the Kconfig as well).
>>
>
> I cannot test this. Do you know what the minimum correct size would be?
Unfortunately, I don't know a specific size either.
We can try to roughly estimate that though: At most, we have some rather
negligible overhead for the argument struct and GUID, the name buffer,
and the data buffer (get/set variable). The name is limited to 1024
utf-16 characters (although that's a limit that we set in our driver,
not necessarily of the firmware). The thing that's more difficult to
gauge is the maximum data size. Also I think we can reach the alloc code
with multiple threads (unless the EFI subsystem is doing some locking).
Only the actual SCM call is locked on the qseecom side.
The efivar_query_variable_info() call could help with the data size part
(it can return the maximum valid size of a single variable).
Unfortunately it's not directly exposed, but I could code something up
to read it out. The next best thing is `df -h` (which uses the same call
under the hood) to get the total storage space available for EFI
variables. On my Surface Pro X, that's 60K. So I guess overall, 64K
should be enough for a single call. That being said, the biggest variable
stored right now is about 4K in size.
Given that that's a sample-size of one device though and that we might
want to future-proof things, I think 256K is a good choice. But we could
probably go with less if we really want to save some memory.
Regards,
Max
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-10-11 20:48 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-09 15:34 [PATCH v3 00/15] arm64: qcom: add and enable SHM Bridge support Bartosz Golaszewski
2023-10-09 15:34 ` [PATCH v3 01/15] firmware: qcom: move Qualcomm code into its own directory Bartosz Golaszewski
2023-10-11 20:01 ` Maximilian Luz
2023-10-09 15:34 ` [PATCH v3 02/15] firmware: qcom: scm: add a missing forward declaration for struct device Bartosz Golaszewski
2023-10-10 19:44 ` Andrew Halaney
2023-10-09 15:34 ` [PATCH v3 03/15] firmware: qcom: scm: remove unneeded 'extern' specifiers Bartosz Golaszewski
2023-10-10 19:45 ` Andrew Halaney
2023-10-09 15:34 ` [PATCH v3 04/15] firmware: qcom: add a dedicated TrustZone buffer allocator Bartosz Golaszewski
2023-10-09 21:28 ` Andrew Halaney
2023-10-10 6:42 ` Bartosz Golaszewski
2023-10-10 8:26 ` Bartosz Golaszewski
2023-10-10 20:48 ` Andrew Halaney
2023-10-11 7:39 ` Bartosz Golaszewski
2023-10-09 15:34 ` [PATCH v3 05/15] firmware: qcom: scm: enable the TZ mem allocator Bartosz Golaszewski
2023-10-10 9:11 ` kernel test robot
2023-10-09 15:34 ` [PATCH v3 06/15] firmware: qcom: scm: smc: switch to using the SCM allocator Bartosz Golaszewski
2023-10-10 22:12 ` Andrew Halaney
2023-10-09 15:34 ` [PATCH v3 07/15] firmware: qcom: scm: make qcom_scm_assign_mem() use the TZ allocator Bartosz Golaszewski
2023-10-10 22:19 ` Andrew Halaney
2023-10-11 7:41 ` Bartosz Golaszewski
2023-10-11 13:54 ` Andrew Halaney
2023-10-11 14:33 ` Bartosz Golaszewski
2023-10-11 20:13 ` Andrew Halaney
2023-10-09 15:34 ` [PATCH v3 08/15] firmware: qcom: scm: make qcom_scm_ice_set_key() " Bartosz Golaszewski
2023-10-10 22:25 ` Andrew Halaney
2023-10-09 15:34 ` [PATCH v3 09/15] firmware: qcom: scm: make qcom_scm_lmh_dcvsh() " Bartosz Golaszewski
2023-10-10 22:26 ` Andrew Halaney
2023-10-09 15:34 ` [PATCH v3 10/15] firmware: qcom: scm: make qcom_scm_qseecom_app_get_id() " Bartosz Golaszewski
2023-10-10 22:28 ` Andrew Halaney
2023-10-11 20:09 ` Maximilian Luz
2023-10-09 15:34 ` [PATCH v3 11/15] firmware: qcom: qseecom: convert to using " Bartosz Golaszewski
2023-10-10 22:49 ` Andrew Halaney
2023-10-11 7:44 ` Bartosz Golaszewski
2023-10-11 13:55 ` Andrew Halaney
2023-10-11 14:37 ` Bartosz Golaszewski
2023-10-11 20:47 ` Maximilian Luz [this message]
2023-10-11 20:09 ` Maximilian Luz
2023-10-12 23:21 ` kernel test robot
2023-10-09 15:34 ` [PATCH v3 12/15] firmware: qcom: scm: add support for SHM bridge operations Bartosz Golaszewski
2023-10-09 15:34 ` [PATCH v3 13/15] firmware: qcom: tzmem: enable SHM Bridge support Bartosz Golaszewski
2023-10-11 21:14 ` Andrew Halaney
2023-10-11 22:17 ` Andrew Halaney
2023-10-13 8:32 ` Bartosz Golaszewski
2023-10-13 13:30 ` Andrew Halaney
2023-10-13 14:06 ` Bartosz Golaszewski
2023-10-09 15:34 ` [PATCH v3 14/15] firmware: qcom: scm: clarify the comment in qcom_scm_pas_init_image() Bartosz Golaszewski
2023-10-11 21:19 ` Andrew Halaney
2023-10-09 15:34 ` [PATCH v3 15/15] arm64: defconfig: enable SHM Bridge support for the TZ memory allocator Bartosz Golaszewski
2023-10-11 21:20 ` Andrew Halaney
2023-10-12 8:57 ` Bartosz Golaszewski
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=b09b6ee4-717c-44fa-abbe-cf9cef7b7d8b@gmail.com \
--to=luzmaximilian@gmail.com \
--cc=agross@kernel.org \
--cc=ahalaney@redhat.com \
--cc=andersson@kernel.org \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=elder@linaro.org \
--cc=kernel@quicinc.com \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_eberman@quicinc.com \
--cc=quic_gurus@quicinc.com \
--cc=srinivas.kandagatla@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;
as well as URLs for NNTP newsgroup(s).