Re: [PATCH v2 1/3] bus: mhi: host: Add loopback driver with sysfs interface
From: Bjorn Andersson
Date: Sun Nov 09 2025 - 22:56:31 EST
On Fri, Nov 07, 2025 at 05:58:18PM +0530, Manivannan Sadhasivam wrote:
> On Wed, Nov 05, 2025 at 04:17:41PM -0600, Bjorn Andersson wrote:
> > On Tue, Nov 04, 2025 at 11:09:05AM +0530, Sumit Kumar wrote:
> > > Add loopback driver for MHI host controllers that provides sysfs based
> > ^--- Here would be e good place to explain why we want this driver. Per
> > https://docs.kernel.org/process/submitting-patches.html#describe-your-changes
> > start your commit message with a description of the problem you're
> > solving.
> >
> > > testing interface for data path validation. The driver supports the
> > > "LOOPBACK" channel and offers configurable test parameters.
> > >
> > > Sysfs interface provides:
> > > - size: Configure TRE size
> > > - num_tre: Set number of TREs for chained transfers
> > > - start: Initiate loopback test
> > > - status: Read test results
> >
> > The words "loopback" and "testing" gives clear indications that this
> > should live in debugfs and not sysfs.
> >
>
> Though the wording gives an impression like that, this interface is for a MHI
> channel that is defined in the MHI spec, so it is perfectly fine to have it
> exposed as a sysfs interface to the users. This channel is intented to be used
> for MHI protocol testing.
>
The fact that the protocol is defined in the specification doesn't imply
that it's intended to be used by the typical user.
Also, the specification defines the LOOPBACK channel, it doesn't define
an interface where the user can request that a certain number of packets
of random data is sent and if those come back we can learn about that
from a "results" file. Downstream has a completely different
implementation of the same specification.
I could imagine that at some point one would want extend this test
interface by altering the behavior of the packet generator, inject
timestamps etc - to measure raw throughput, latency, jitter etc. Good
reasons for not turning this into an ABI.
Thinking more about the use case, I also presume most MHI devices has a
LOOPBACK channel, so every user is going to have this .ko auto-loaded,
just so that they can poke sysfs to send some random data... So perhaps
we should omit MODULE_DEVICE_TABLE()?
That said, these are merely my humble opinions. If you think it's
broadly useful in this form, please proceed.
Regards,
Bjorn