Re: [PATCH 01/16] docs: Add documentation for MHI bus

Jeffrey Hugo
2020-01-23T14:52:59Z

On 1/23/2020 6:30 AM, Manivannan Sadhasivam wrote:
> On Thu, Jan 23, 2020 at 02:19:51PM +0100, Arnd Bergmann wrote:
>> On Thu, Jan 23, 2020 at 2:10 PM Manivannan Sadhasivam
>> <manivannan.sadhasivam@linaro.org> wrote:
>>>
>>> On Thu, Jan 23, 2020 at 01:58:22PM +0100, Arnd Bergmann wrote:
>>>> On Thu, Jan 23, 2020 at 12:18 PM Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> wrote:
>>>>
>>>> I don't see any callers of mhi_register_controller(). Did I just miss it or did
>>>> you not post one? I'm particularly interested in where the configuration comes
>>>> from, is this hardcoded in the driver, or parsed from firmware or from registers
>>>> in the hardware itself?
>>>>
>>>
>>> I have not included the controller driver in this patchset. But you can take a
>>> look at the ath11k controller driver here:
>>> https://git.linaro.org/people/manivannan.sadhasivam/linux.git/tree/drivers/net/wireless/ath/ath11k/mhi.c?h=ath11k-qca6390-mhi#n13
>>>
>>> So the configuration comes from the static structures defined in the controller
>>> driver. Earlier revision derived the configuration from devicetree but there are
>>> many cases where this MHI bus is being used in non DT environments like x86.
>>> So inorder to be platform agnostic, we chose static declaration method.
>>>
>>> In future we can add DT/ACPI support for the applicable parameters.
>>
>> What determines the configuration? Is this always something that is fixed
>> in hardware, or can some of the properties be changed based on what
>> firmware runs the device?
>>
>
> AFAIK, these configurations are fixed in hardware (this could come from
> the firmware I'm not sure but they don't change with firmware revisions
> for sure)
>
> The reason for defining in the driver itself implies that these don't
> change. But I'll confirm this with Qcom folks.
>
> Thanks,
> Mani
>
>> If this is determined by the firmware, maybe the configuration would also
>> need to be loaded from the file that contains the firmware, which in turn
>> could be a blob in DT.
>>
>> Arnd

We can't derive the configuration from hardware, and its something that
is currently a priori known since the host (linux) needs to initialize
the hardware with the configuration before it can communicate with the
device (ie the on device FW).

99% of the time the configuration is fixed, however there have been
instances where features have been added on the device, which result in
new channels, which then impact the configuration. In the cases I'm
aware of this, both sides were updated in lockstep. I don't know how
upstream would handle it. I'm thinking we can ignore that case until it
comes up.

DT/ACPI is tricky, since the cases where we want this currently are
essentially standalone PCI(e) cards. Those are likely to be on systems
which don't support DT (ie x86), and there really isn't a place in ACPI
to put PCI(e) device configuration information, since its supposed to be
a discoverable bus.

There are hardware limitations to the configuration, and that varies
from device to device. Since the host (linux) programs the
configuration into the hardware, its possible for an invalid
configuration to be programed, but I would expect that in the majority
of cases (ie programming a channel that the device FW doesn't know
about), there is no adverse impact.

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