qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ninad Palsule <ninad@linux.vnet.ibm.com>
To: Stefan Berger <stefanb@linux.ibm.com>,
	Ninad Palsule <ninad@linux.ibm.com>,
	qemu-devel@nongnu.org
Cc: joel@jms.id.au, andrew@aj.id.au, clg@kaod.org
Subject: Re: [PATCH 3/3] Add support for TPM devices over I2C bus
Date: Wed, 22 Mar 2023 19:43:34 -0500	[thread overview]
Message-ID: <bf76aa4c-1759-53cb-c9fa-5f102a10e459@linux.vnet.ibm.com> (raw)
In-Reply-To: <57be0b95-adb5-14f0-2674-e832d3f069f2@linux.ibm.com>


On 3/22/23 8:04 AM, Stefan Berger wrote:
>
>
> On 3/22/23 07:50, Stefan Berger wrote:
>>
>>
>> On 3/22/23 07:28, Ninad Palsule wrote:
>>>
>>> On 3/21/23 8:30 PM, Stefan Berger wrote:
>>>>
>
>>>>
>>>> I think there should be tpm_tis_set_data_buffer function that you 
>>>> can call rather than transferring the data byte-by-byte.
>>>>
>>>> Thanks for the series!
>>>>
>>>>   Stefan
>>>
>>> I thought about it but the FIFO case performs multiple operations 
>>> hence I did not want to change it. Currently there is no function to 
>>> set data buffer in the common code.
>>
>> It may not be correct to transfer it in one go, either. I just 
>> printed the I2C specs and I am going to look at them now.
>> When one writes TPM command data to the TIS the STS register has its 
>> TPM_TIS_STS_VALID bit set and TPM_TIS_STS_EXPECT bit reset once the 
>> command is complete. This would imply that you should not have a 
>> holding area for the command bytes but pass them on to the TIS 
>> immediately to get the effect of the STS register...
>
> Regarding the registers defined for the I2C: You can pass the data 
> onto the TIS but you should mask out input flags that are not defined 
> for I2C and if the return value has flags not defined for I2C you 
> should also mask those out as well. This applies to the TPM_INT_ENABLE 
> & TPM_STS registers on read and write and to the TPM_INT_CAPABILITY on 
> read. Also you should implement support for 
> TPM_I2C_INTERACE_CAPABILITY on the I2C layer and return sensible 
> values for the defined bits. The TPM_I2C_DEVICE_ADDRESS register 
> should be handled probably assuming fixed address support only.
>
Good catch.

- Added capability conversion for TPM_I2C_INTERFACE_CAPABILITY.

- Added clearing of bits in TPM_STS register.

- Adde check to reject TPM_I2C_DEVICE_ADDRESS register.

- No changes are required for TPM_INT_ENABLE and TPM_INT_CAPABILITY as 
they have same bits between TPM TIS and TPM I2C.


> Ideally there would be a test case similar to this one here 
> https://github.com/qemu/qemu/blob/master/tests/qtest/tpm-tis-util.c . 
> However, I am not sure how easy it is to talk to I2C without a driver 
> for it.
Ok, Thanks.
>
>   Stefan


Thanks for the review!

Ninad Palsule



  reply	other threads:[~2023-03-23  0:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21  5:29 [PATCH 0/3] Add support for TPM devices over I2C bus Ninad Palsule
2023-03-21  5:29 ` [PATCH 1/3] " Ninad Palsule
2023-03-21 23:35   ` Stefan Berger
2023-03-22 11:13     ` Ninad Palsule
2023-03-21  5:30 ` [PATCH 2/3] " Ninad Palsule
2023-03-21 23:54   ` Stefan Berger
2023-03-22 11:18     ` Ninad Palsule
2023-03-22 11:24       ` Stefan Berger
2023-03-22 16:56         ` Ninad Palsule
2023-03-22 12:05   ` Stefan Berger
2023-03-22 16:58     ` Ninad Palsule
2023-03-21  5:30 ` [PATCH 3/3] " Ninad Palsule
2023-03-22  1:10   ` Stefan Berger
2023-03-22 11:26     ` Ninad Palsule
2023-03-22  1:30   ` Stefan Berger
2023-03-22 11:28     ` Ninad Palsule
2023-03-22 11:50       ` Stefan Berger
2023-03-22 13:04         ` Stefan Berger
2023-03-23  0:43           ` Ninad Palsule [this message]
2023-03-22 17:01         ` Ninad Palsule

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=bf76aa4c-1759-53cb-c9fa-5f102a10e459@linux.vnet.ibm.com \
    --to=ninad@linux.vnet.ibm.com \
    --cc=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=joel@jms.id.au \
    --cc=ninad@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.ibm.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;
as well as URLs for NNTP newsgroup(s).