* Atmel I2C TPM transfer length issues
@ 2017-02-14 2:33 Andrew Lunn
[not found] ` <20170214023336.GC21340-g2DYL2Zd6BY@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2017-02-14 2:33 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Hi Jason
I'm hoping you can help me with an issue i have with an ATMEL I2C
TPM. I have one connected to an DLN2 USB-I2C bus controller. Initial
probe works, i can get the capabilites in /sys/class/tpm/tpm0,
tpm_version etc:
/sys/class/tpm/tpm0# cat caps
Manufacturer: 0x41544d4c
TCG version: 1.2
Firmware version: 66.4
But i have issues with pubek and other long i2c transfers:
/sys/class/tpm/tpm0# hexdump pubek
[11621.731960] i2c i2c-11: adapter quirk: msg too long (addr 0x0029, size 314, read)
[11621.738208] tpm tpm0: tpm_transmit: tpm_recv: error -95
The dln2 i2c bus controller has a transfer limit of 256 bytes. Getting
the pubek is doing a read for 314 bytes, which is getting rejected.
Is there any way to fragment the reads/writes? Looking at
tpm_i2c_atmel i don't see any. It seems the raw TCG commands need to
be passed in a single i2c transaction. The comment in i2c_atmel_recv()
suggests that multiple reads will always start from the beginning of
the TCG response. There are no comments in the send function, but i
guess an I2C start condition indicates the start of a new command?
Or am i missing something?
Can fragmentation happen at a higher layer?
Any other ideas?
Thanks
Andrew
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Atmel I2C TPM transfer length issues
[not found] ` <20170214023336.GC21340-g2DYL2Zd6BY@public.gmane.org>
@ 2017-02-14 8:39 ` Peter Huewe
[not found] ` <A6C9A409-4FF4-41A7-AE4F-0727B1464447-Mmb7MZpHnFY@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Peter Huewe @ 2017-02-14 8:39 UTC (permalink / raw)
To: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Andrew Lunn,
Jason Gunthorpe
Am 14. Februar 2017 03:33:36 MEZ schrieb Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>:
>Hi Jason
>
>I'm hoping you can help me with an issue i have with an ATMEL I2C
>TPM. I have one connected to an DLN2 USB-I2C bus controller. Initial
>probe works, i can get the capabilites in /sys/class/tpm/tpm0,
>tpm_version etc:
>
>/sys/class/tpm/tpm0# cat caps
>Manufacturer: 0x41544d4c
>TCG version: 1.2
>Firmware version: 66.4
>
>But i have issues with pubek and other long i2c transfers:
>
>/sys/class/tpm/tpm0# hexdump pubek
>[11621.731960] i2c i2c-11: adapter quirk: msg too long (addr 0x0029,
>size 314, read)
>[11621.738208] tpm tpm0: tpm_transmit: tpm_recv: error -95
>
>The dln2 i2c bus controller has a transfer limit of 256 bytes. Getting
>the pubek is doing a read for 314 bytes, which is getting rejected.
>
>Is there any way to fragment the reads/writes? Looking at
>tpm_i2c_atmel i don't see any. It seems the raw TCG commands need to
>be passed in a single i2c transaction. The comment in i2c_atmel_recv()
>suggests that multiple reads will always start from the beginning of
>the TCG response. There are no comments in the send function, but i
>guess an I2C start condition indicates the start of a new command?
>
>Or am i missing something?
>
>Can fragmentation happen at a higher layer?
>
>Any other ideas?
Just limit the value which get_burstcount() returns to 256.
This should do the trick - because that would be the mechanism the tpm itself would use to fragment its response.
Atleast for other tpms like our infineon slb9645 i2c tpm that would work.
>
>Thanks
> Andrew
>
>------------------------------------------------------------------------------
>Check out the vibrant tech community on one of the world's most
>engaging tech sites, SlashDot.org! http://sdm.link/slashdot
>_______________________________________________
>tpmdd-devel mailing list
>tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>https://lists.sourceforge.net/lists/listinfo/tpmdd-devel
--
Sent from my mobile
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Atmel I2C TPM transfer length issues
[not found] ` <A6C9A409-4FF4-41A7-AE4F-0727B1464447-Mmb7MZpHnFY@public.gmane.org>
@ 2017-02-14 13:05 ` Andrew Lunn
[not found] ` <20170214130511.GA32480-g2DYL2Zd6BY@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2017-02-14 13:05 UTC (permalink / raw)
To: Peter Huewe; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
> Just limit the value which get_burstcount() returns to 256.
>
> This should do the trick - because that would be the mechanism the
> tpm itself would use to fragment its response. Atleast for other
> tpms like our infineon slb9645 i2c tpm that would work.
Yes, that was one idea i had. But then i found the comment on the top
of tpm_i2c_atmel:
* Teddy Reed determined the basic I2C command flow, unlike other I2C TPM
* devices the raw TCG formatted TPM command data is written via I2C and then
* raw TCG formatted TPM command data is returned via I2C.
The driver does not do anything like read the burst size and then
transfer in blocks. It reads/writes all in one go.
However, you have answered what was going to be a follow question. The
hardware is not yet set in stone. We could change the TPM. Use the
Infinion TPM with a modified get_burstcount(). And you think this will
work. Great.
Thanks
Andrew
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Atmel I2C TPM transfer length issues
[not found] ` <20170214130511.GA32480-g2DYL2Zd6BY@public.gmane.org>
@ 2017-02-14 14:06 ` Peter Huewe
2017-02-14 17:37 ` Jason Gunthorpe
1 sibling, 0 replies; 5+ messages in thread
From: Peter Huewe @ 2017-02-14 14:06 UTC (permalink / raw)
To: Andrew Lunn; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Am 14. Februar 2017 14:05:11 MEZ schrieb Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>:
>> Just limit the value which get_burstcount() returns to 256.
>>
>> This should do the trick - because that would be the mechanism the
>> tpm itself would use to fragment its response. Atleast for other
>> tpms like our infineon slb9645 i2c tpm that would work.
>
>Yes, that was one idea i had. But then i found the comment on the top
>of tpm_i2c_atmel:
>
>* Teddy Reed determined the basic I2C command flow, unlike other I2C
>TPM
>* devices the raw TCG formatted TPM command data is written via I2C and
>then
> * raw TCG formatted TPM command data is returned via I2C.
>
>The driver does not do anything like read the burst size and then
>transfer in blocks. It reads/writes all in one go.
Sorry I should have read the code before replying. I just remembered that one case we solved a similar issue on a qualcomm master with the same limitation - and limiting the burstcount worked fine for us.
>From the code and comments it seems that the tpm does not offer any continuation or offset mechanism.
>
>However, you have answered what was going to be a follow question. The
>hardware is not yet set in stone. We could change the TPM. Use the
>Infinion TPM with a modified get_burstcount(). And you think this will
>work. Great.
As a heads up in my dayjob I do work for Infineon.
I did not intend to advertise our tpm, but we have resolved a similar situation.
Thanks,
Peter
>
>Thanks
> Andrew
--
Sent from my mobile
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Atmel I2C TPM transfer length issues
[not found] ` <20170214130511.GA32480-g2DYL2Zd6BY@public.gmane.org>
2017-02-14 14:06 ` Peter Huewe
@ 2017-02-14 17:37 ` Jason Gunthorpe
1 sibling, 0 replies; 5+ messages in thread
From: Jason Gunthorpe @ 2017-02-14 17:37 UTC (permalink / raw)
To: Andrew Lunn; +Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Tue, Feb 14, 2017 at 02:05:11PM +0100, Andrew Lunn wrote:
> > Just limit the value which get_burstcount() returns to 256.
> >
> > This should do the trick - because that would be the mechanism the
> > tpm itself would use to fragment its response. Atleast for other
> > tpms like our infineon slb9645 i2c tpm that would work.
>
> Yes, that was one idea i had. But then i found the comment on the top
> of tpm_i2c_atmel:
>
> * Teddy Reed determined the basic I2C command flow, unlike other I2C TPM
> * devices the raw TCG formatted TPM command data is written via I2C and then
> * raw TCG formatted TPM command data is returned via I2C.
>
> The driver does not do anything like read the burst size and then
> transfer in blocks. It reads/writes all in one go.
Yes, as far as I know, there is no option to do a smaller I2C read,
the I2C controller must support large reads. Future reads return the
first bytes of the message and I know of no way to offset the read.
> However, you have answered what was going to be a follow question. The
> hardware is not yet set in stone. We could change the TPM. Use the
> Infinion TPM with a modified get_burstcount(). And you think this will
> work. Great.
FWIW, on all our hardware we design for 2-3 different TPMs because
they are a bit difficult to get. There is now a new TCG specification
for I2C and SPI connected TPMs, so there may be better choices for
compatability.
IIRC, our alt for the atmel i2c part is a nuvoton part.
Jason
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-02-14 17:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-14 2:33 Atmel I2C TPM transfer length issues Andrew Lunn
[not found] ` <20170214023336.GC21340-g2DYL2Zd6BY@public.gmane.org>
2017-02-14 8:39 ` Peter Huewe
[not found] ` <A6C9A409-4FF4-41A7-AE4F-0727B1464447-Mmb7MZpHnFY@public.gmane.org>
2017-02-14 13:05 ` Andrew Lunn
[not found] ` <20170214130511.GA32480-g2DYL2Zd6BY@public.gmane.org>
2017-02-14 14:06 ` Peter Huewe
2017-02-14 17:37 ` Jason Gunthorpe
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).