在 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 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.
Thanks,
Qunqin.
BTW, I think I should touch also this driver in the next version of my
series that I'll send after the merge window:
https://lore.kernel.org/linux-integrity/20250514134630.137621-1-sgarz...@redhat.com/
The rest LGTM!
Thanks,
Stefano