From: Qunqin Zhao <zhaoqunqin@loongson.cn>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: lee@kernel.org, herbert@gondor.apana.org.au, jarkko@kernel.org,
linux-kernel@vger.kernel.org, loongarch@lists.linux.dev,
davem@davemloft.net, linux-crypto@vger.kernel.org,
peterhuewe@gmx.de, jgg@ziepe.ca, linux-integrity@vger.kernel.org,
Yinggang Gu <guyinggang@loongson.cn>,
Huacai Chen <chenhuacai@loongson.cn>
Subject: Re: [PATCH v10 4/5] tpm: Add a driver for Loongson TPM device
Date: Wed, 28 May 2025 17:34:49 +0800 [thread overview]
Message-ID: <cfaf2fbb-5c6a-9f85-fdc9-325d82fb7821@loongson.cn> (raw)
In-Reply-To: <ccb1927d-c06a-9fde-6cbb-652974464f4b@loongson.cn>
在 2025/5/28 下午5:24, Qunqin Zhao 写道:
>
> 在 2025/5/28 下午5:00, Stefano Garzarella 写道:
>> On Wed, May 28, 2025 at 04:42:05PM +0800, Qunqin Zhao wrote:
>>>
>>> 在 2025/5/28 下午3:57, Stefano Garzarella 写道:
>>>>> + chip = tpmm_chip_alloc(dev, &tpm_loongson_ops);
>>>>> + if (IS_ERR(chip))
>>>>> + return PTR_ERR(chip);
>>>>> + chip->flags = TPM_CHIP_FLAG_TPM2 | TPM_CHIP_FLAG_IRQ;
>>>>
>>>> Why setting TPM_CHIP_FLAG_IRQ?
>>>
>>> When tpm_engine completes TPM_CC* command,
>>>
>>> the hardware will indeed trigger an interrupt to the kernel.
>>
>> IIUC that is hidden by loongson_se_send_engine_cmd(), that for this
>> driver is completely synchronous, no?
>>
>>>
>>>>
>>>> IIUC this driver is similar to ftpm and svsm where the send is
>>>> synchronous so having .status, .cancel, etc. set to 0 should be
>>>> enough to call .recv() just after send() in tpm_try_transmit(). See
>>>> commit 980a573621ea ("tpm: Make chip->{status,cancel,req_canceled}
>>>> opt")
>>> The send callback would wait until the TPM_CC* command complete. We
>>> don't need a poll.
>>
>> Right, that's what I was saying too, send() is synchronous (as in
>> ftpm and svsm). The polling in tpm_try_transmit() is already skipped
>> since we are setting .status = 0, .req_complete_mask = 0,
>> .req_complete_val = 0, etc. so IMHO this is exactly the same of ftpm
>> and svsm, so we don't need to set TPM_CHIP_FLAG_IRQ.
>
> I see, but why not skip polling directly in "if (chip->flags &
> TPM_CHIP_FLAG_IRQ)" instead of do while?
I mean, why not skip polling directly in "if (chip->flags &
TPM_CHIP_FLAG_IRQ)"?
And In my opinion, TPM_CHIP_FLAG_SYNC and TPM_CHIP_FLAG_IRQ are
essentially the same, only with different names.
Thanks,
Qunqin
>
> And TPM_CHIP_FLAG_IRQ flag can remind us this hardware is "IRQ" not
> "POLL".
>
> Thanks,
>
> Qunqin.
>
>>
>> Thanks,
>> Stefano
next prev parent reply other threads:[~2025-05-28 9:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-28 6:59 [PATCH v10 0/5] Add Loongson Security Engine chip driver Qunqin Zhao
2025-05-28 6:59 ` [PATCH v10 1/5] mfd: Add support for Loongson Security Engine chip controller Qunqin Zhao
2025-05-28 6:59 ` [PATCH v10 2/5] crypto: loongson - add Loongson RNG driver support Qunqin Zhao
2025-06-11 9:23 ` Herbert Xu
2025-06-17 9:49 ` Qunqin Zhao
2025-05-28 6:59 ` [PATCH v10 3/5] MAINTAINERS: Add entry for Loongson crypto driver Qunqin Zhao
2025-05-28 6:59 ` [PATCH v10 4/5] tpm: Add a driver for Loongson TPM device Qunqin Zhao
2025-05-28 7:57 ` Stefano Garzarella
2025-05-28 8:42 ` Qunqin Zhao
2025-05-28 9:00 ` Stefano Garzarella
2025-05-28 9:24 ` Qunqin Zhao
2025-05-28 9:34 ` Qunqin Zhao [this message]
2025-05-28 9:53 ` Stefano Garzarella
2025-05-29 2:16 ` Qunqin Zhao
2025-05-28 9:36 ` Stefano Garzarella
2025-05-28 7:17 ` [PATCH v10 0/5] Add Loongson Security Engine chip driver Huacai Chen
2025-05-28 7:42 ` Yanteng Si
2025-05-28 8:05 ` Qunqin Zhao
2025-05-28 8:17 ` Huacai Chen
2025-05-28 9:14 ` Yanteng Si
2025-05-28 10:25 ` Huacai Chen
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=cfaf2fbb-5c6a-9f85-fdc9-325d82fb7821@loongson.cn \
--to=zhaoqunqin@loongson.cn \
--cc=chenhuacai@loongson.cn \
--cc=davem@davemloft.net \
--cc=guyinggang@loongson.cn \
--cc=herbert@gondor.apana.org.au \
--cc=jarkko@kernel.org \
--cc=jgg@ziepe.ca \
--cc=lee@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=peterhuewe@gmx.de \
--cc=sgarzare@redhat.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
all inboxes | Powered by JetHome®