On Wed, Jul 29, 2020 at 08:36:58PM +0000, daniel.stodden@xxxxxxxxx wrote: > From: Daniel Stodden <dns@xxxxxxxxxx> > > 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:
signature.asc
Description: PGP signature