Re: [PATCHv7 2/3] i2c: slave-mqueue: add a slave backend to receive and queue messages

From: Wolfram Sang
Date: Mon Jul 01 2019 - 08:56:26 EST

Hi Eduardo,

thanks for stepping up and pushing this further!

On Wed, Jun 05, 2019 at 09:46:50AM -0700, Eduardo Valentin wrote:
> From: Haiyue Wang <>
> Some protocols over I2C are designed for bi-directional transferring
> messages by using I2C Master Write protocol. Like the MCTP (Management
> Component Transport Protocol) and IPMB (Intelligent Platform Management
> Bus), they both require that the userspace can receive messages from
> I2C dirvers under slave mode.
> This new slave mqueue backend is used to receive and queue messages, it
> will exposes these messages to userspace by sysfs bin file.

So, this is a read-only bin file. Sending is done via the standard
i2c-dev driver? Or not needed at all?

Regarding, IPMB, how does this related to the recently merged IPMB slave

> Note: DT interface and a couple of minor fixes here and there
> by Eduardo, so I kept the original authorship here.
> Cc: Rob Herring <robh+dt@xxxxxxxxxx>
> Cc: Mark Rutland <mark.rutland@xxxxxxx>
> Cc: Wolfram Sang <wsa@xxxxxxxxxxxxx>
> Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
> Cc: linux-i2c@xxxxxxxxxxxxxxx
> Cc: devicetree@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Signed-off-by: Haiyue Wang <>
> Signed-off-by: Eduardo Valentin <eduval@xxxxxxxxxx>

> +M: Eduardo Valentin <eduval@xxxxxxxxxx>

Cool, thanks!

> + int "The message size of I2C mqueue slave"
> + depends on I2C_SLAVE_MQUEUE
> + default 120
> +
> + int "The queue size of I2C mqueue slave"
> + depends on I2C_SLAVE_MQUEUE
> + default 32
> + help
> + This number MUST be power of 2.

I am not happy with this being a Kconfig option. Best would be a
per-instance configuration, so we could have differently sized mqueues
at runtime. I could think of another sysfs-file like
"mqueue-slave-config" which would appear after writing to 'new_device'.
And only after writing to 'mqueue-slave-config', the bin file to read
from would show up. But it is just a quick brainstorming, maybe you have
a better idea?

> +// SPDX-License-Identifier: GPL-2.0
> +// Copyright (c) 2017 - 2018, Intel Corporation.

A short description what this driver does would be nice.

Rest looks decent from a glimpse. I haven't looked into the gory details
yet, though, because I want to get the high level things straight first.

Kind regards,


Attachment: signature.asc
Description: PGP signature