mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Slark Xiao" <slark_xiao@163.com>
To: "Jeff Hugo" <jeff.hugo@oss.qualcomm.com>
Cc: mani@kernel.org, mhi@lists.linux.dev,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re:Re: [PATCH] bus: mhi: host: Only expose controller sysfs attributes on the controller device
Date: Sat, 21 Nov 2026 15:09:43 +0800 (CST)	[thread overview]
Message-ID: <c12e013.1776.1a1fcf0853d.Coremail.slark_xiao@163.com> (raw)
In-Reply-To: <ca6de262-80e3-4c38-8f3c-122712d3f54d@oss.qualcomm.com>


At 2026-11-21 00:45:30, "Jeff Hugo" <jeff.hugo@oss.qualcomm.com> wrote:
>On 11/18/2026 12:05 AM, Slark Xiao wrote:
>> 
>> At 2026-11-14 02:42:46, "Jeff Hugo" <jeff.hugo@oss.qualcomm.com> wrote:
>>> On 11/11/2026 4:56 AM, Slark Xiao wrote:
>>>> The serial_number, oem_pk_hash and soc_reset attributes are registered
>>>> through mhi_bus_type.dev_groups, so the driver core creates them for
>>>> every device on the MHI bus.  MHI client devices (the per-channel
>>>> devices such as mhi0_DUN or mhi0_MBIM) are also MHI bus devices, so
>>>> each of them ends up with its own copies of these files even though
>>>> they all operate on the same mhi_controller:
>>>>
>>>>     $ ls /sys/bus/mhi/devices/mhi0_DUN/
>>>>     driver  oem_pk_hash  power  serial_number  soc_reset  subsystem  uevent
>>>>
>>>> This is wrong for several reasons:
>>>>
>>>>     - The attributes describe the controller, not the channel.  Their
>>>>       callbacks all dereference mhi_dev->mhi_cntrl and read BHI registers
>>>>       or issue a controller-wide SoC reset, so writing soc_reset through
>>>>       mhi0_DUN resets the whole device while looking like a per-channel
>>>>       operation.
>>>>     - oem_pk_hash reports failures with dev_err(dev, ...), so a single
>>>>       failing controller produces one log line per registered channel
>>>>       device instead of one.
>>>>     - Userspace has no way to tell which copy is authoritative.
>>>>
>>>> Move the attributes off the bus and attach them to the controller
>>>> device only.  mhi_register_controller() now installs the group via
>>>> mhi_dev->dev.groups before device_add(), while the channel devices
>>>> created by mhi_create_devices() are left untouched.  No functional
>>>> change for the controller device; the files stay at the paths listed
>>>> in Documentation/ABI/stable/sysfs-bus-mhi.
>>>>
>>>> Note that trigger_edl was already handled this way, through an explicit
>>>> sysfs_create_file() on the controller kobject, which is why it never
>>>> appeared on the channel devices.
>>> I agree with the rationale, but this does appear to change uAPI. Are you
>>> sure no one is using these on the channel devices?
>>>
>>> -Jeff
>> Hi Jeff,
>> For oem_pk_hash and serial_number, all interface returns same value.
>> I think there is no need to keep these interfaces under the channel
>> devices.
>> 
>> For soc_reset, it write the register directly and it works for the entire
>> device rather than a single channel.
>> 
>> So I think there is no problem to remove them.
>
>These are uAPI. The golden rule of the kernel is that we do not break 
>userspace. It does not matter that their existence is a "bug", if there 
>is userspace using them, then we must keep them.
>
>I could agree with you assessment that having these items on the channel 
>device is a mistake (and I do), but that does not change the rule.
>
>So far you have not provided any data to say that userspace is in fact 
>not using these, and therefore removing them would have no impact.
>
>Without that analysis, I am sorry to say I am uncomfortable proceeding 
>with this change.  Mani is free to ignore my concerns and apply this 
>patch at his own risk.
>
>-Jeff
Hi Jeff,
I understand your concerns. We must ensure that introducing
modifications does not lead to any unintended side effects.

I checked the import history and found that both serial_number
and oem_pk_hash were added by Mr BHAUMIK Bhatt in commit
"21cb9b18edea bus: mhi: host: core: Introduce sysfsentries for MHI ".
The comment as below:
"OEMs need to read these device-specific hardware information values
through userspace for factory testing purposes"

Actually I have to say we don't have such a factory requirement for 
these 2 APIs for  all  Foxconn MHI devices. 

And, we can see the "What" from the Document/ABI/stable/sysfs-bus-mhi:
/sys/bus/mhi/devices/.../serialnumber
/sys/bus/mhi/devices/.../oem_pk_hash
/sys/bus/mhi/devices/.../soc_reset

I believe the formal meaning represented by this path is
 /sys/bus/mhi/devices/mhi0/[TARGET SYSFS] or 
/sys/bus/mhi/devices/mhi1/[TARGET SYSFS]. But not  
/sys/bus/mhi/devices/mhi0/mhi0_DUN/[TARGET SYSFS] or
 /sys/bus/mhi/devices/mhi0/mhi0_DIAG/[TARGET SYSFS].

These 4 APIs only soc_reset and trigger_edl would be used
in daily development or usage.

In our local, the frequency shall be:
trigger_edl (normal) > soc_reset( rare) > serial number=oem_pk_hash(almost never)

Hope this  explanation helps you understand this issue from
the developer's perspective and our actual needs.

Thanks. 

      reply	other threads:[~2026-11-21  7:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 11:56 Slark Xiao
2026-11-13 18:42 ` Jeff Hugo
2026-11-18  7:05   ` Slark Xiao
2026-11-20 16:45     ` Jeff Hugo
2026-11-21  7:09       ` Slark Xiao [this message]

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=c12e013.1776.1a1fcf0853d.Coremail.slark_xiao@163.com \
    --to=slark_xiao@163.com \
    --cc=jeff.hugo@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=mhi@lists.linux.dev \
    --cc=stable@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

all inboxes | Powered by JetHome®