Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Jeffrey Hugo <jhugo@codeaurora.org>
To: Loic Poulain <loic.poulain@linaro.org>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	Hemant Kumar <hemantk@codeaurora.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH] bus: mhi: core: Indexed MHI controller name
Date: Wed, 25 Nov 2020 09:24:04 -0700	[thread overview]
Message-ID: <97494f35-2d00-9df9-a6f9-7ad69978f3cd@codeaurora.org> (raw)
In-Reply-To: <CAMZdPi_9vWxupthj0piMM_cHjma1qpSU+sQWVF_c1SjBkEKX4w@mail.gmail.com>

On 11/25/2020 9:15 AM, Loic Poulain wrote:
> On Wed, 25 Nov 2020 at 16:42, Jeffrey Hugo <jhugo@codeaurora.org> wrote:
>>
>> On 11/25/2020 8:43 AM, Loic Poulain wrote:
>>> Today the MHI controller name is simply cloned from the underlying
>>> bus device (its parent), that gives the following device structure
>>> for e.g. a MHI/PCI controller:
>>> devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:02:00.0
>>> devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:02:00.0/0000:02:00.0_IPCR
>>> ...
>>>
>>> That's quite misleading/confusing and can cause device registering
>>> issues because of duplicate dev name (e.g. if a PCI device register
>>> two different MHI instances).
>>>
>>> This patch changes MHI core to create indexed mhi controller names
>>> (mhi0, mhi1...) in the same way as other busses (i2c0, usb0...).
>>>
>>> The previous example becomes:
>>> devices/pci0000:00/0000:00:01.2/0000:02:00.0/mhi0
>>> devices/pci0000:00/0000:00:01.2/0000:02:00.0/mhi0/mhi0_IPCR
>>> ...
>>>
>>> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
>>
>>
>> How does this change /sys/bus/mhi/devices/ ?
> 
> That does change sysfs device dir names:
> $ ls -al /sys/bus/mhi/devices/
> lrwxrwxrwx 1 root root 0 nov.  25 16:27 mhi0 ->
> ../../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/mhi0
> lrwxrwxrwx 1 root root 0 nov.  25 16:28 mhi0_DIAG ->
> ../../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/mhi0/mhi0_DIAG
> lrwxrwxrwx 1 root root 0 nov.  25 16:28 mhi0_IPCR ->
> ../../../devices/pci0000:00/0000:00:01.2/0000:02:00.0/mhi0/mhi0_IPCR
> 
>> The point of having the bus name in the mhi device name is to give an
>> easy way to correlate those devices back to the "root" device (I have a
>> lot of users which do that).
> 
> I see your point but it's not a problem specific to MHI bus, user can
> rely on sysfs/uevent to get device information such ass devices
> attributes, children, or parent devices. Do you have a concrete
> example in mind for your case?

3 I think -

1. I think its same to assume these names are going to trickle down to 
mhi_uci.  For a QAIC device, there is a /dev/qaic chardev for doing the 
AI work, and a /dev chardev from mhi_uci exposing the DIAG channel. 
Both of these are correlated to a specific PCI device by the BDF, which 
the user application will want to know so that relevant DIAG traffic for 
a qaic device is routed to the correct chardev, and thus the correct 
device.  For 1 device, this is simple.  For 12, some correlation needs 
to be done programmatically.

2. User is physically on the shell, and wants to look at 
/sys/bus/mhi/devices to see the state of a device.  Perhaps the expected 
mhi_uci devices are not present.

3. User is physically on the shell, and wants to invoke soc_reset on the 
controller.  The user needs to know which mhi controller instance 
(mhi1?) maps to a specific PCI BDF to make sure the right device is reset.

1 is used a lot by our userspace stack.  2/3 is used a lot by testers 
and developers.

> 
>>
>> Also, do we actually have some device that actually exposes multiple MHI
>> interfaces?
> 
> No, but better to fix possible problems ahead of time.

Good to know.  I was thinking this was not needed, and unlikely to be 
needed, but it just occurs to me I might have a usecase for this in 
development.

-- 
Jeffrey Hugo
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

  reply	other threads:[~2020-11-25 16:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 15:43 [PATCH] bus: mhi: core: Indexed MHI controller name Loic Poulain
2020-11-25 15:42 ` Jeffrey Hugo
2020-11-25 15:49   ` Jeffrey Hugo
2020-11-25 16:23     ` Loic Poulain
2020-11-25 16:26       ` Jeffrey Hugo
2020-11-25 16:15   ` Loic Poulain
2020-11-25 16:24     ` Jeffrey Hugo [this message]
2020-11-25 17:14 ` Jeffrey Hugo

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=97494f35-2d00-9df9-a6f9-7ad69978f3cd@codeaurora.org \
    --to=jhugo@codeaurora.org \
    --cc=hemantk@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=manivannan.sadhasivam@linaro.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