linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@kernel.org>
To: daniel.stodden@gmail.com
Cc: linux-i2c@vger.kernel.org, dns@arista.com, jdelvare@suse.de
Subject: Re: [RFC PATCH v2] i2c: Support Smbus 3.0 block sizes up to 255 bytes.
Date: Wed, 6 Jan 2021 16:27:57 +0100	[thread overview]
Message-ID: <20210106152757.GB997@kunai> (raw)
In-Reply-To: <20200729203658.411-1-daniel.stodden@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2785 bytes --]

On Wed, Jul 29, 2020 at 08:36:58PM +0000, daniel.stodden@gmail.com wrote:
> From: Daniel Stodden <dns@arista.com>
> 
> WIP, v2. (And still haven't had an opportunity to verify, but rsn.)
> 
> Updates since v1:
> 
>  * Prefer stack storage for user_len[] in i2cdev_ioctl_rdwr. Sized 84
>    bytes, small enough to not kmalloc.
> 
>  * Keep original transfer type values around. For reference, and
>    possibly for reverse compatibility (new code on old kernels).
> 
>  * Renames old transfer types to I2C_SMBUS1_*, assigns new transfer
>    type values to old names.
> 
>  * Promotes new transfer types via source compatibility. This is not
>    necessarily the agreed solution, just a proposed one.
> 
>  * Define I2C_FUNC_SMBUS3_BLOCKSIZE 0x20000000.  No use yet, assuming
>    only adapter implementations will employ it.
> 
> Ongoing:
> 
>  * Like v1, I2C_SMBUS and I2C_RDWR return -EMSGSIZE to legacy clients,
>    if the client buffer is 32 bytes but the device produced > 32
>    bytes.
> 
>    Like the -EFAULT case, code will truncate data, but copy what can
>    be copied before returning. Not 100% sure if this is really useful,
>    or if truncated data should return 0 and rely on the client to
>    figure it out.
> 
>    PS: I didn't notice the 'while (res >= 0..' in I2C_RDWR when I
>        wrote that. But one could make it so...? (Or give up.)
> 
>    PPS: The old behavior was driver dependent. Some would fail
>    	(e.g. piix4, -EPROTO), some would truncate (e.g. viapro).
> 
>    I'm starting to lean toward silent truncate, return 0.
>    Most permissive.

I am sorry, this has been a while... :(

But now I reserved some time and I am eager to get some SMBus3 blocklen
support into 5.12. My suggested roadmap looks like this:


1) enable 256 block length in the kernel

I will right now start to work on this. Add support to the I2C core and
audit the existing drivers because quite some get block length or
RECV_LEN wrong. This ensures we have working platforms for testing and
in-kernel users (TPM) can benefit already. I'd like to have that in 5.12
upstream.

2) expose this to userspace

Once I send out my first RFC-patches, we can build on top of those by
adding userspace support preserving backwards compatibility. If we have
this ready for 5.12, awesome! If not, we can still modify the kernel
interface to fit the needs. 5.13 would be great to have, I think.


I hope you guys are still with me. Especially for the userspace
backwards compatibility, I'd much appreciate if Daniel and Jean could
spend some time/thoughts on it. And everyone else interested, too, of
course. The more eyes the better.

Thanks everyone, happy hacking and a healthy 2021 for you all!

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-01-06 15:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29 20:36 [RFC PATCH v2] i2c: Support Smbus 3.0 block sizes up to 255 bytes daniel.stodden
2021-01-06 15:27 ` Wolfram Sang [this message]
2021-01-06 18:13   ` Daniel Stodden
2021-01-08 13:11     ` Wolfram Sang

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=20210106152757.GB997@kunai \
    --to=wsa@kernel.org \
    --cc=daniel.stodden@gmail.com \
    --cc=dns@arista.com \
    --cc=jdelvare@suse.de \
    --cc=linux-i2c@vger.kernel.org \
    /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).