2024-05-02 10:11:48

by Johan Hovold

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: qca: generalise device address check

On Thu, May 02, 2024 at 12:35:19PM +0530, Janaki Ramaiah Thota wrote:
> On 4/30/2024 6:37 PM, Johan Hovold wrote:

> > But here we disagree. A non-unique address is not a valid one as it will
> > cause collisions if you have more than one such controller.
> >
> > I understand that this may be convenient/good enough for developers in
> > some cases, but this can hurt end users that do not realise why things
> > break.
> >
> > And a developer can always configure an address manually or patch the
> > driver as needed for internal use.
> >
> > Are there any other reasons that makes you want to keep the option to
> > configure the device address through NVM files? I'm assuming you're not
> > relying on patching NVM files to provision device-specific addresses
> > after installation on target?

> We prefer unique address to be flashed on OTP (persistent) memory of
> BT-Chip, which is supported by almost all QC BT-chips.

Yes, that is certainly the best option for everyone.

> If someone is not able to do that/ does not prefer that, they still
> have an option to flash unique address in firmware binary (NVM)file.
> This does not require setting BD address from user space.
>
> Also until a developer flashes OTP/ keep unique BD-Address in NVM,
> he should be able to run most of the use cases from Device, that's
> why we want to make it as configured.

Ok, but a developer can still do this since they can patch the driver to
disable the check temporarily or, alternatively, just update the
devicetree with a valid unique address.

> In our opinion this provides best Out of box experience.

You can also look into improving support in user space (e.g. bluez) for
providing a valid unique address in a simple text-based configuration
file.

That would be useful for all Linux users and not require having access
to Qualcomm specific tools to update the NVM configuration file (which
could also be in a read-only file system, e.g. on Android).

Johan


2024-05-02 17:04:17

by Janaki Ramaiah Thota

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: qca: generalise device address check

Hi Johan,

On 5/2/2024 3:41 PM, Johan Hovold wrote:
> On Thu, May 02, 2024 at 12:35:19PM +0530, Janaki Ramaiah Thota wrote:
>> On 4/30/2024 6:37 PM, Johan Hovold wrote:
>
>>> But here we disagree. A non-unique address is not a valid one as it will
>>> cause collisions if you have more than one such controller.
>>>
>>> I understand that this may be convenient/good enough for developers in
>>> some cases, but this can hurt end users that do not realise why things
>>> break.
>>>
>>> And a developer can always configure an address manually or patch the
>>> driver as needed for internal use.
>>>
>>> Are there any other reasons that makes you want to keep the option to
>>> configure the device address through NVM files? I'm assuming you're not
>>> relying on patching NVM files to provision device-specific addresses
>>> after installation on target?
>
>> We prefer unique address to be flashed on OTP (persistent) memory of
>> BT-Chip, which is supported by almost all QC BT-chips.
>
> Yes, that is certainly the best option for everyone.
>
>> If someone is not able to do that/ does not prefer that, they still
>> have an option to flash unique address in firmware binary (NVM)file.
>> This does not require setting BD address from user space.
>>
>> Also until a developer flashes OTP/ keep unique BD-Address in NVM,
>> he should be able to run most of the use cases from Device, that's
>> why we want to make it as configured.
>
> Ok, but a developer can still do this since they can patch the driver to
> disable the check temporarily or, alternatively, just update the
> devicetree with a valid unique address.
>
>> In our opinion this provides best Out of box experience.
>

If a developer has to patch a code/update device-tree, that is not
a "out of box" experience. By "out of box" we meant, things should
work without much changes required.

> You can also look into improving support in user space (e.g. bluez) for
> providing a valid unique address in a simple text-based configuration
> file.
>

We don't think putting a must-have dependency in user space is the
right thing to do, especially when we own a code in kernel space.

> That would be useful for all Linux users and not require having access
> to Qualcomm specific tools to update the NVM configuration file (which
> could also be in a read-only file system, e.g. on Android).
>

Having a non-unique valid address allows a developer to handle all
scenarios where he/she is dealing with DUT + commercial device and
in such case, default BD-Address from nvm file should also be okay.
Only when 2/more similar devices are in the mix, they need unique
address. In that case we are providing end developers with a NVM
utility(part of Qcom build Not open source tool)to change this
default BD-Address.

> Johan

-Janaki Ram

2024-05-02 17:33:04

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: qca: generalise device address check

Hi Janaki,

On Thu, May 2, 2024 at 1:03 PM Janaki Ramaiah Thota
<[email protected]> wrote:
>
> Hi Johan,
>
> On 5/2/2024 3:41 PM, Johan Hovold wrote:
> > On Thu, May 02, 2024 at 12:35:19PM +0530, Janaki Ramaiah Thota wrote:
> >> On 4/30/2024 6:37 PM, Johan Hovold wrote:
> >
> >>> But here we disagree. A non-unique address is not a valid one as it will
> >>> cause collisions if you have more than one such controller.
> >>>
> >>> I understand that this may be convenient/good enough for developers in
> >>> some cases, but this can hurt end users that do not realise why things
> >>> break.
> >>>
> >>> And a developer can always configure an address manually or patch the
> >>> driver as needed for internal use.
> >>>
> >>> Are there any other reasons that makes you want to keep the option to
> >>> configure the device address through NVM files? I'm assuming you're not
> >>> relying on patching NVM files to provision device-specific addresses
> >>> after installation on target?
> >
> >> We prefer unique address to be flashed on OTP (persistent) memory of
> >> BT-Chip, which is supported by almost all QC BT-chips.
> >
> > Yes, that is certainly the best option for everyone.
> >
> >> If someone is not able to do that/ does not prefer that, they still
> >> have an option to flash unique address in firmware binary (NVM)file.
> >> This does not require setting BD address from user space.
> >>
> >> Also until a developer flashes OTP/ keep unique BD-Address in NVM,
> >> he should be able to run most of the use cases from Device, that's
> >> why we want to make it as configured.
> >
> > Ok, but a developer can still do this since they can patch the driver to
> > disable the check temporarily or, alternatively, just update the
> > devicetree with a valid unique address.
> >
> >> In our opinion this provides best Out of box experience.
> >
>
> If a developer has to patch a code/update device-tree, that is not
> a "out of box" experience. By "out of box" we meant, things should
> work without much changes required.
>
> > You can also look into improving support in user space (e.g. bluez) for
> > providing a valid unique address in a simple text-based configuration
> > file.
> >
>
> We don't think putting a must-have dependency in user space is the
> right thing to do, especially when we own a code in kernel space.
>
> > That would be useful for all Linux users and not require having access
> > to Qualcomm specific tools to update the NVM configuration file (which
> > could also be in a read-only file system, e.g. on Android).
> >
>
> Having a non-unique valid address allows a developer to handle all
> scenarios where he/she is dealing with DUT + commercial device and
> in such case, default BD-Address from nvm file should also be okay.
> Only when 2/more similar devices are in the mix, they need unique
> address. In that case we are providing end developers with a NVM
> utility(part of Qcom build Not open source tool)to change this
> default BD-Address.

And we don't agree with doing that, that is why the controller shall
be marked as unconfigured when a non-unique address is used and if you
insist in doing that I will probably have to escalate that you guys
are intentionally using addresses that can clash over the air.

If the firmware is intended for developer, it shall be kept private,
public firmware shall never use duplicate addresses, ever, and don't
come back with arguments like that only when 2/more similar devices
are in the mix but that would just stress even more the point that you
are breaking stuff _on purpose_, which is pretty bad by itself, and
then suggesting to use a non-open-source tool to fix the address is
making things worse because end users can be affected by this, that
really fills like you don't care if your hardware works on regular
Linux distros and in that case I will probably move it to
driver/staging.

> > Johan
>
> -Janaki Ram



--
Luiz Augusto von Dentz

2024-05-03 07:13:14

by Janaki Ramaiah Thota

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: qca: generalise device address check

Hi Luiz,

On 5/2/2024 11:02 PM, Luiz Augusto von Dentz wrote:
> Hi Janaki,
>
> On Thu, May 2, 2024 at 1:03 PM Janaki Ramaiah Thota
> <[email protected]> wrote:
>>
>> Hi Johan,
>>
>> On 5/2/2024 3:41 PM, Johan Hovold wrote:
>>> On Thu, May 02, 2024 at 12:35:19PM +0530, Janaki Ramaiah Thota wrote:
>>>> On 4/30/2024 6:37 PM, Johan Hovold wrote:
>>>
>>>>> But here we disagree. A non-unique address is not a valid one as it will
>>>>> cause collisions if you have more than one such controller.
>>>>>
>>>>> I understand that this may be convenient/good enough for developers in
>>>>> some cases, but this can hurt end users that do not realise why things
>>>>> break.
>>>>>
>>>>> And a developer can always configure an address manually or patch the
>>>>> driver as needed for internal use.
>>>>>
>>>>> Are there any other reasons that makes you want to keep the option to
>>>>> configure the device address through NVM files? I'm assuming you're not
>>>>> relying on patching NVM files to provision device-specific addresses
>>>>> after installation on target?
>>>
>>>> We prefer unique address to be flashed on OTP (persistent) memory of
>>>> BT-Chip, which is supported by almost all QC BT-chips.
>>>
>>> Yes, that is certainly the best option for everyone.
>>>
>>>> If someone is not able to do that/ does not prefer that, they still
>>>> have an option to flash unique address in firmware binary (NVM)file.
>>>> This does not require setting BD address from user space.
>>>>
>>>> Also until a developer flashes OTP/ keep unique BD-Address in NVM,
>>>> he should be able to run most of the use cases from Device, that's
>>>> why we want to make it as configured.
>>>
>>> Ok, but a developer can still do this since they can patch the driver to
>>> disable the check temporarily or, alternatively, just update the
>>> devicetree with a valid unique address.
>>>
>>>> In our opinion this provides best Out of box experience.
>>>
>>
>> If a developer has to patch a code/update device-tree, that is not
>> a "out of box" experience. By "out of box" we meant, things should
>> work without much changes required.
>>
>>> You can also look into improving support in user space (e.g. bluez) for
>>> providing a valid unique address in a simple text-based configuration
>>> file.
>>>
>>
>> We don't think putting a must-have dependency in user space is the
>> right thing to do, especially when we own a code in kernel space.
>>
>>> That would be useful for all Linux users and not require having access
>>> to Qualcomm specific tools to update the NVM configuration file (which
>>> could also be in a read-only file system, e.g. on Android).
>>>
>>
>> Having a non-unique valid address allows a developer to handle all
>> scenarios where he/she is dealing with DUT + commercial device and
>> in such case, default BD-Address from nvm file should also be okay.
>> Only when 2/more similar devices are in the mix, they need unique
>> address. In that case we are providing end developers with a NVM
>> utility(part of Qcom build Not open source tool)to change this
>> default BD-Address.
>
> And we don't agree with doing that, that is why the controller shall
> be marked as unconfigured when a non-unique address is used and if you
> insist in doing that I will probably have to escalate that you guys
> are intentionally using addresses that can clash over the air.
>
> If the firmware is intended for developer, it shall be kept private,
> public firmware shall never use duplicate addresses, ever, and don't
> come back with arguments like that only when 2/more similar devices
> are in the mix but that would just stress even more the point that you
> are breaking stuff _on purpose_, which is pretty bad by itself, and
> then suggesting to use a non-open-source tool to fix the address is
> making things worse because end users can be affected by this, that
> really fills like you don't care if your hardware works on regular
> Linux distros and in that case I will probably move it to
> driver/staging.
>

Our intention is not to break things, instead we wanted driver should
be sufficient to set a BD-Address, without putting a necessary
requirement on user space/Stack to configure BD-Address.
Other solutions ( like Android ) were approaching this
problem in this way. Now we also agree with your point
that we should not leave any scope for having a non-unique
BD-Address. Current bottleneck that we see with driver creating
and managing unique BD-Address on its own is how to ensure
persistence on reboot. If you are aware of any mechanism with
which we can ensure persistence in kernel across reboot please
let us know, otherwise we will write/reuse bluez-mgmt user
space utility to solve this problem.

>>> Johan
>>
>> -Janaki Ram
>
>
> --
> Luiz Augusto von Dentz

-Janaki Ram