From: Sricharan Ramabadhran <quic_srichara@quicinc.com>
To: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
<jassisinghbrar@gmail.com>, <robh@kernel.org>,
<krzk+dt@kernel.org>, <conor+dt@kernel.org>,
<linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<devicetree@vger.kernel.org>, <andersson@kernel.org>,
<konradybcio@kernel.org>, <manivannan.sadhasivam@linaro.org>,
<dmitry.baryshkov@linaro.org>
Subject: Re: [PATCH V4 2/2] mailbox: tmelite-qmp: Introduce TMEL QMP mailbox driver
Date: Mon, 5 May 2025 18:30:29 +0530 [thread overview]
Message-ID: <043da348-e120-4fac-b051-a7c196d5c685@quicinc.com> (raw)
In-Reply-To: <6b6a163b-be75-4003-a618-f0e928a6d114@oss.qualcomm.com>
On 4/26/2025 3:19 PM, Konrad Dybcio wrote:
> On 3/27/25 7:17 PM, Sricharan R wrote:
>> From: Sricharan Ramabadhran <quic_srichara@quicinc.com>
>>
>> This mailbox facilitates the communication between the TMEL server
>> subsystem (Trust Management Engine Lite) and the TMEL client
>> (APPSS/BTSS/AUDIOSS), used for secure services like secure image
>> authentication, enable/disable efuses, crypto services etc. Each client in
>> the SoC has its own block of message RAM and IRQ for communication with the
>> TMEL SS. The protocol used to communicate in the message RAM is known as
>> Qualcomm Messaging Protocol (QMP).
>>
>> Remote proc driver subscribes to this mailbox and uses the
>> mbox_send_message to use TMEL to securely authenticate/teardown the images.
>>
>> Signed-off-by: Sricharan Ramabadhran <quic_srichara@quicinc.com>
>> ---
>
> [...]
>
>> +
>> +#define QMP_NUM_CHANS 0x1
>
> Quantities make more sense in decimal, but since this is effectively
> a single-use value, you can put in the '1' literal in num_chans and use
> devm_kzalloc instead of devm_kcalloc in the other use
>
ok
>> +#define QMP_TOUT_MS 1000
>
> "TIMEOUT"
>
ok
>> +#define QMP_CTRL_DATA_SIZE 4
>> +#define QMP_MAX_PKT_SIZE 0x18
>
> This is very handwavy, please structurize all data that comes in and
> out of the mailbox.
>
ok
>> +#define QMP_UCORE_DESC_OFFSET 0x1000
>> +#define QMP_SEND_TIMEOUT 30000
>
> Please include the unit in the macro name - although 30s is quite a
> timeout for a couple bytes..
>
ok
> [...]
>
>> +#define QMP_HW_MBOX_SIZE 32
>> +#define QMP_MBOX_RSV_SIZE 4
>> +#define QMP_MBOX_IPC_PACKET_SIZE (QMP_HW_MBOX_SIZE - QMP_CTRL_DATA_SIZE - QMP_MBOX_RSV_SIZE)
>> +#define QMP_MBOX_IPC_MAX_PARAMS 5
>> +
>> +#define QMP_MAX_PARAM_IN_PARAM_ID 14
>> +#define QMP_PARAM_CNT_FOR_OUTBUF 3
>> +#define QMP_SRAM_IPC_MAX_PARAMS (QMP_MAX_PARAM_IN_PARAM_ID * QMP_PARAM_CNT_FOR_OUTBUF)
>> +#define QMP_SRAM_IPC_MAX_BUF_SIZE (QMP_SRAM_IPC_MAX_PARAMS * sizeof(u32))
>
> These should be expressed in terms of structures and sizeof() instead,
> as well
>
ok
>> +
>> +#define TMEL_ERROR_GENERIC (0x1u)
>> +#define TMEL_ERROR_NOT_SUPPORTED (0x2u)
>> +#define TMEL_ERROR_BAD_PARAMETER (0x3u)
>> +#define TMEL_ERROR_BAD_MESSAGE (0x4u)
>> +#define TMEL_ERROR_BAD_ADDRESS (0x5u)
>> +#define TMEL_ERROR_TMELCOM_FAILURE (0x6u)
>> +#define TMEL_ERROR_TMEL_BUSY (0x7u)
>
> Oh I didn't notice this during the first review.. I assume these are
> returned by the mbox. Please create a dictionary such as:
>
> u32 tmel_error_dict[] = {
> [TMEL_ERROR_GENERIC] = EINVAL,
> [TMEL_ERROR_NOT_SUPPORTED] = EOPNOTSUPP
> ...
> };
>
> that we can then plug into the function down below that currently does
> error ? -EINVAL : 0
>
Hmm ok, will try this mapping.
Regards,
Sricharan
next prev parent reply other threads:[~2025-05-05 13:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-27 18:17 [PATCH V4 0/2] mailbox: tmel-qmp: Introduce QCOM TMEL QMP mailbox driver Sricharan R
2025-03-27 18:17 ` [PATCH V4 1/2] dt-bindings: mailbox: Document qcom,ipq5424-tmel Sricharan R
2025-03-28 8:02 ` Krzysztof Kozlowski
2025-04-01 7:29 ` Sricharan Ramabadhran
2025-04-15 11:08 ` Sricharan Ramabadhran
2025-12-18 4:26 ` Bjorn Andersson
2025-12-19 6:08 ` Kathiravan Thirumoorthy
2025-03-28 12:51 ` Dmitry Baryshkov
2025-04-01 8:33 ` Sricharan Ramabadhran
2025-04-01 11:26 ` Sricharan Ramabadhran
2025-04-01 13:16 ` Dmitry Baryshkov
2025-03-27 18:17 ` [PATCH V4 2/2] mailbox: tmelite-qmp: Introduce TMEL QMP mailbox driver Sricharan R
2025-04-26 9:44 ` Konrad Dybcio
2025-05-05 12:41 ` Sricharan Ramabadhran
2025-04-26 9:49 ` Konrad Dybcio
2025-05-05 13:00 ` Sricharan Ramabadhran [this message]
2025-05-20 9:36 ` Sricharan Ramabadhran
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=043da348-e120-4fac-b051-a7c196d5c685@quicinc.com \
--to=quic_srichara@quicinc.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=jassisinghbrar@gmail.com \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=robh@kernel.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