mbox series

[v3,0/9] misc brcmfmac fixes (M1/T2 series spin-off)

Message ID 20220117142919.207370-1-marcan@marcan.st
Headers show
Series misc brcmfmac fixes (M1/T2 series spin-off) | expand

Message

Hector Martin Jan. 17, 2022, 2:29 p.m. UTC
Hi everyone,

This series contains just the fixes / misc improvements from the
previously submitted series:

brcmfmac: Support Apple T2 and M1 platforms

Patches 8-9 aren't strictly bugfixes but rather just general
improvements; they can be safely skipped, although patch 8 will be a
dependency of the subsequent series to avoid a compile warning.

Hector Martin (9):
  brcmfmac: pcie: Release firmwares in the brcmf_pcie_setup error path
  brcmfmac: firmware: Allocate space for default boardrev in nvram
  brcmfmac: firmware: Do not crash on a NULL board_type
  brcmfmac: pcie: Declare missing firmware files in pcie.c
  brcmfmac: pcie: Replace brcmf_pcie_copy_mem_todev with memcpy_toio
  brcmfmac: pcie: Fix crashes due to early IRQs
  brcmfmac: of: Use devm_kstrdup for board_type & check for errors
  brcmfmac: fwil: Constify iovar name arguments
  brcmfmac: pcie: Read the console on init and shutdown

 .../broadcom/brcm80211/brcmfmac/firmware.c    |  5 ++
 .../broadcom/brcm80211/brcmfmac/fwil.c        | 34 ++++----
 .../broadcom/brcm80211/brcmfmac/fwil.h        | 28 +++----
 .../wireless/broadcom/brcm80211/brcmfmac/of.c |  8 +-
 .../broadcom/brcm80211/brcmfmac/pcie.c        | 77 ++++++++-----------
 .../broadcom/brcm80211/brcmfmac/sdio.c        |  1 -
 6 files changed, 72 insertions(+), 81 deletions(-)

Comments

Arend Van Spriel Jan. 19, 2022, 12:34 p.m. UTC | #1
On 1/17/2022 3:29 PM, Hector Martin wrote:
> This avoids leaking memory if brcmf_chip_get_raminfo fails. Note that
> the CLM blob is released in the device remove path.
> 
> Fixes: 82f93cf46d60 ("brcmfmac: get chip's default RAM info during PCIe setup")
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Hector Martin <marcan@marcan.st>
> ---
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 2 ++
>   1 file changed, 2 insertions(+)
Arend Van Spriel Jan. 19, 2022, 12:35 p.m. UTC | #2
On 1/17/2022 3:29 PM, Hector Martin wrote:
> This allows us to get console messages if the firmware crashed during
> early init, or if an operation failed and we're about to shut down.

We do have a module parameter that forces probing to succeed regardless 
any failure so we can create memory dump of the wifi device, read the 
console, etc. Still it can be useful to add these console read calls. 
Thanks.

Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Hector Martin <marcan@marcan.st>
> ---
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 4 ++++
>   1 file changed, 4 insertions(+)
Dmitry Osipenko Jan. 19, 2022, 9:22 p.m. UTC | #3
19.01.2022 20:49, Andy Shevchenko пишет:
> On Mon, Jan 17, 2022 at 4:30 PM Hector Martin <marcan@marcan.st> wrote:
>>
>> This avoids leaking memory if brcmf_chip_get_raminfo fails. Note that
>> the CLM blob is released in the device remove path.
> 
> ...
> 
>>         if (ret) {
> 
>>                 brcmf_err(bus, "Failed to get RAM info\n");
>> +               release_firmware(fw);
>> +               brcmf_fw_nvram_free(nvram);
> 
> Can we first undo the things and only after print a message?

Having message first usually is more preferred because at minimum you'll
get the message if "undoing the things" crashes, i.e. will be more
obvious what happened.
Arend Van Spriel Jan. 20, 2022, 8:22 a.m. UTC | #4
On 1/19/2022 6:49 PM, Andy Shevchenko wrote:
> On Mon, Jan 17, 2022 at 4:30 PM Hector Martin <marcan@marcan.st> wrote:
>>
>> This avoids leaking memory if brcmf_chip_get_raminfo fails. Note that
>> the CLM blob is released in the device remove path.
> 
> ...
> 
>>          if (ret) {
> 
>>                  brcmf_err(bus, "Failed to get RAM info\n");
>> +               release_firmware(fw);
>> +               brcmf_fw_nvram_free(nvram);
> 
> Can we first undo the things and only after print a message?

What would be your motivation? When reading logs I am used to seeing an 
error message followed by cleanup related messages. Following your 
suggestion you could see cleanup related messages, the error print as 
above, followed by more cleanup related messages. The cleanup routine 
would preferably be silent, but I tend to flip on extra debug message 
levels.

Regards,
Arend

>>                  goto fail;
>>          }
> 
>
Dmitry Osipenko Jan. 20, 2022, 1:15 p.m. UTC | #5
20.01.2022 00:31, Andy Shevchenko пишет:
> On Wed, Jan 19, 2022 at 11:22 PM Dmitry Osipenko <digetx@gmail.com> wrote:
>>
>> 19.01.2022 20:49, Andy Shevchenko пишет:
>>> On Mon, Jan 17, 2022 at 4:30 PM Hector Martin <marcan@marcan.st> wrote:
>>>>
>>>> This avoids leaking memory if brcmf_chip_get_raminfo fails. Note that
>>>> the CLM blob is released in the device remove path.
>>>
>>> ...
>>>
>>>>         if (ret) {
>>>
>>>>                 brcmf_err(bus, "Failed to get RAM info\n");
>>>> +               release_firmware(fw);
>>>> +               brcmf_fw_nvram_free(nvram);
>>>
>>> Can we first undo the things and only after print a message?
>>
>> Having message first usually is more preferred because at minimum you'll
>> get the message if "undoing the things" crashes, i.e. will be more
>> obvious what happened.
> 
> If "undo the things" crashes, I would rather like to see that crash
> report, while serial UART at 9600 will continue flushing the message
> and then hang without any pointers to what the heck happened. Not
> here, but in general, messages are also good to be out of the locks.

The hang is actually a better example. It's the most annoying when there
is a silent hang and no error messages.