All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Huewe <peterhuewe@gmx.de>
To: Wolfram Sang <wsa@the-dreams.de>,
	Enric Balletbo Serra <eballetbo@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	apronin@google.com, tpmdd-devel@lists.sourceforge.net,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [tpmdd-devel] [PATCH 1/2] tpm: Apply an adapterlimit for retransmission.
Date: Thu, 02 Mar 2017 14:15:09 +0100	[thread overview]
Message-ID: <9E9945C5-50AD-465C-BE0E-F77499D79A04@gmx.de> (raw)
In-Reply-To: <20170227191245.ecord2i7o6jwec5k@ninjato>



Am 27. Februar 2017 20:12:45 MEZ schrieb Wolfram Sang <wsa@the-dreams.de>:
>Hi,
>
>> >> > Rather than trying small and smaller transfers, would it not be
>better
>> >> > to get the i2c core to expose the quirk info about transfer
>limits?
>> >> >
>> >>
>> >> Sounds a good idea to me, I guess the quirk info can be accessed
>with
>> >>
>> >>   tpm_dev.client->adapter->quirks->max_read_len
>> >>
>> >> so I think we don't need to touch the i2c core. I'll propose a
>second version of the patch.
>> >
>> > Hi Enric
>> >
>> > You should probably ask Wolfram Sang <wsa@the-dreams.de>, the i2c
>> > subsystem maintainer. He may prefer adding an API call.
>
>Thanks for pointing me to this thread.
>
>I understand it looks tempting to use the quirks struct directly, but I
>don't think this is the proper solution. Quirks are complex and and to
>determine which one finally applies, you need all the logic encoded in
>i2c_check_for_quirks(). Which already gets called on every transfer.
>
>So, my suggestion would be to simply fall back to a sane minimum when
>the maximum failed. 32 (I2C_SMBUS_BLOCK_MAX) should be a good choice.

Hi,
One problem is however that e.g. in the case of the atmel tpms, there is no sane minimum, since you mustn't split the tpm apdu.

If the command is larger than the supported adapter limit the command the only viable option is to return an error.
For this the tpm layer would need the adapter limit.

If somehow possible I would seriously vote for a adapter limit field (maybe not in the quirks).

TPMs are a not the best devices when it comes to i2c :/

Peter


>
>BTW I noted that the original patch checks for -EINVAL. The core
>returns
>-EOPNOTSUPP, though. So, a) the patch needs to be adapted and b) it
>looks the i2c host driver returning -EINVAL could be converted to use
>the quirk infrastructure? Which driver is it?
>
>Regards,
>
>   Wolfram

-- 
Sent from my mobile

WARNING: multiple messages have this Message-ID (diff)
From: Peter Huewe <peterhuewe-Mmb7MZpHnFY@public.gmane.org>
To: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	Enric Balletbo Serra
	<eballetbo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-kernel
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	apronin-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH 1/2] tpm: Apply an adapterlimit for retransmission.
Date: Thu, 02 Mar 2017 14:15:09 +0100	[thread overview]
Message-ID: <9E9945C5-50AD-465C-BE0E-F77499D79A04@gmx.de> (raw)
In-Reply-To: <20170227191245.ecord2i7o6jwec5k@ninjato>



Am 27. Februar 2017 20:12:45 MEZ schrieb Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>:
>Hi,
>
>> >> > Rather than trying small and smaller transfers, would it not be
>better
>> >> > to get the i2c core to expose the quirk info about transfer
>limits?
>> >> >
>> >>
>> >> Sounds a good idea to me, I guess the quirk info can be accessed
>with
>> >>
>> >>   tpm_dev.client->adapter->quirks->max_read_len
>> >>
>> >> so I think we don't need to touch the i2c core. I'll propose a
>second version of the patch.
>> >
>> > Hi Enric
>> >
>> > You should probably ask Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>, the i2c
>> > subsystem maintainer. He may prefer adding an API call.
>
>Thanks for pointing me to this thread.
>
>I understand it looks tempting to use the quirks struct directly, but I
>don't think this is the proper solution. Quirks are complex and and to
>determine which one finally applies, you need all the logic encoded in
>i2c_check_for_quirks(). Which already gets called on every transfer.
>
>So, my suggestion would be to simply fall back to a sane minimum when
>the maximum failed. 32 (I2C_SMBUS_BLOCK_MAX) should be a good choice.

Hi,
One problem is however that e.g. in the case of the atmel tpms, there is no sane minimum, since you mustn't split the tpm apdu.

If the command is larger than the supported adapter limit the command the only viable option is to return an error.
For this the tpm layer would need the adapter limit.

If somehow possible I would seriously vote for a adapter limit field (maybe not in the quirks).

TPMs are a not the best devices when it comes to i2c :/

Peter


>
>BTW I noted that the original patch checks for -EINVAL. The core
>returns
>-EOPNOTSUPP, though. So, a) the patch needs to be adapted and b) it
>looks the i2c host driver returning -EINVAL could be converted to use
>the quirk infrastructure? Which driver is it?
>
>Regards,
>
>   Wolfram

-- 
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

  parent reply	other threads:[~2017-03-02 13:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21 14:44 [PATCH 1/2] tpm: Apply an adapterlimit for retransmission Enric Balletbo i Serra
2017-02-21 14:45 ` [PATCH 2/2] tpm: Do not assume an i2c adapter preserves the msg len Enric Balletbo i Serra
2017-02-21 16:29 ` [tpmdd-devel] [PATCH 1/2] tpm: Apply an adapterlimit for retransmission Andrew Lunn
2017-02-22 11:16   ` Enric Balletbo i Serra
2017-02-22 14:01     ` Andrew Lunn
2017-02-27 18:48       ` Enric Balletbo Serra
2017-02-27 19:12         ` Wolfram Sang
2017-02-27 19:12           ` Wolfram Sang
2017-02-27 21:30           ` [tpmdd-devel] " Enric Balletbo Serra
2017-02-27 21:30             ` Enric Balletbo Serra
2017-03-02 13:15           ` Peter Huewe [this message]
2017-03-02 13:15             ` Peter Huewe
2017-03-02 14:05             ` [tpmdd-devel] " Wolfram Sang
2017-03-02 14:10             ` Wolfram Sang
2017-02-22 12:39   ` Peter Huewe
2017-02-22 12:39     ` Peter Huewe

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=9E9945C5-50AD-465C-BE0E-F77499D79A04@gmx.de \
    --to=peterhuewe@gmx.de \
    --cc=andrew@lunn.ch \
    --cc=apronin@google.com \
    --cc=eballetbo@gmail.com \
    --cc=enric.balletbo@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.net \
    --cc=wsa@the-dreams.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.