From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Hector Martin <marcan@marcan.st>
Cc: "Kalle Valo" <kvalo@codeaurora.org>,
"David S. Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Len Brown" <lenb@kernel.org>,
"Arend van Spriel" <aspriel@gmail.com>,
"Franky Lin" <franky.lin@broadcom.com>,
"Hante Meuleman" <hante.meuleman@broadcom.com>,
"Chi-hsien Lin" <chi-hsien.lin@infineon.com>,
"Wright Feng" <wright.feng@infineon.com>,
"Dmitry Osipenko" <digetx@gmail.com>,
"Sven Peter" <sven@svenpeter.dev>,
"Alyssa Rosenzweig" <alyssa@rosenzweig.io>,
"Mark Kettenis" <kettenis@openbsd.org>,
"Rafał Miłecki" <zajec5@gmail.com>,
"Pieter-Paul Giesberts" <pieter-paul.giesberts@broadcom.com>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Hans de Goede" <hdegoede@redhat.com>,
"John W. Linville" <linville@tuxdriver.com>,
"brian m. carlson" <sandals@crustytoothpaste.net>,
"open list:TI WILINK WIRELES..." <linux-wireless@vger.kernel.org>,
netdev <netdev@vger.kernel.org>,
devicetree <devicetree@vger.kernel.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"ACPI Devel Maling List" <linux-acpi@vger.kernel.org>,
"open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER"
<brcm80211-dev-list.pdl@broadcom.com>,
SHA-cyfmac-dev-list@infineon.com
Subject: Re: [PATCH v2 00/35] brcmfmac: Support Apple T2 and M1 platforms
Date: Tue, 4 Jan 2022 16:28:58 +0200 [thread overview]
Message-ID: <CAHp75VdnSCV0HczotPoZRZane90Mt-uQ4MauvFKNR-uJ11sx3Q@mail.gmail.com> (raw)
In-Reply-To: <20220104072658.69756-1-marcan@marcan.st>
On Tue, Jan 4, 2022 at 9:27 AM Hector Martin <marcan@marcan.st> wrote:
>
> Hi everyone,
>
> Happy new year! This 35-patch series adds proper support for the
> Broadcom FullMAC chips used on Apple T2 and M1 platforms:
>
> - BCM4355C1
> - BCM4364B2/B3
> - BCM4377B3
> - BCM4378B1
> - BCM4387C2
>
> As usual for Apple, things are ever so slightly different on these
> machines from every other Broadcom platform. In particular, besides
> the normal device/firmware support changes, a large fraction of this
> series deals with selecting and loading the correct firmware. These
> platforms use multiple dimensions for firmware selection, and the values
> for these dimensions are variously sourced from DT or OTP (see the
> commit message for #9 for the gory details).
>
> This is what is included:
>
> # 01: DT bindings (M1 platforms)
>
> On M1 platforms, we use the device tree to provide properties for PCIe
> devices like these cards. This patch re-uses the existing SDIO binding
> and adds the compatibles for these PCIe chips, plus the properties we
> need to correctly instantiate them:
>
> - brcm,board-type: Overrides the board-type which is used for firmware
> selection on all platforms, which normally comes from the DMI device
> name or the root node compatible. Apple have their own
> mapping/identifier here ("island" name), so we prefix it with "apple,"
> and use it as the board-type override.
>
> - apple,antenna-sku: Specifies the specific antenna configuration in a
> produt. This would normally be filled in by the bootloader from
> device-specific configuration data. On ACPI platforms, this is
> provided via ACPI instead. This is used to build the funky Apple
> firmware filenames. Note: it seems the antenna doesn't actually matter
> for any of the above platforms (they are all aliases to the same files
> and our firmware copier collapses down this dimension), but since
> Apple do support having different firmware or NVRAM depending on
> antenna SKU, we ough to support it in case it starts mattering on a
> future platform.
>
> - brcm,cal-blob: A calibration blob for the Wi-Fi module, specific to a
> given unit. On most platforms, this is stored in SROM on the module,
> and does not need to be provided externally, but Apple instead stores
> this in platform configuration for M1 machines and the driver needs to
> upload it to the device after initializing the firmware. This has a
> generic brcm name, since a priori this mechanism shouldn't be
> Apple-specific, although chances are only Apple do it like this so far.
>
> # 02~09: Apple firmware selection (M1 platforms)
>
> These patches add support for choosing firmwares (binaries, CLM blobs,
> and NVRAM configs alike) using all the dimensions that Apple uses. The
> firmware files are renamed to conform to the existing brcmfmac
> convention. See the commit message for #9 for the gory details as to how
> these filenames are constructed. The data to make the firmware selection
> comes from the above DT properties and from an OTP ROM on the chips on
> M1 platforms.
>
> # 10~14: BCM4378 support (M1 T8103 platforms)
>
> These patches make changes required to support the BCM4378 chip present
> in Apple M1 (T8103) platforms. This includes adding support for passing
> in the MAC address via the DT (this is standard on DT platforms) since
> the chip does not have a burned-in MAC; adding support for PCIe core
> revs >64 (which moved around some registers); tweaking ring buffer
> sizes; and fixing a bug.
>
> # 15~20: BCM4355/4364/4377 support (T2 platforms)
>
> These patches add support for the chips found across T2 Mac platforms.
> This includes ACPI support for fetching properties instead of using DT,
> providing a buffer of entropy to the devices (required for some of the
> firmwares), and adding the required IDs. This also fixes the BCM4364
> firmware naming; it was added without consideration that there are two
> incompatible chip revisions. To avoid this ambiguity in the future, all
> the chips added by this series use firmware names ending in the revision
> (apple/brcm style, that is letter+number), so that future revisions can
> be added without creating confusion.
>
> # 21~27: BCM4387 support (M1 Pro/Max T600x platforms)
>
> These patches add support for the newer BCM4387 present in the recently
> launched M1 Pro/Max platforms. This chip requires a few changes to D11
> reset behavior and TCM size calculation to work properly, and it uses
> newer firmware which needs support for newer firmware interfaces
> in the cfg80211 support. Backwards compatibility is maintained via
> feature flags discovered at runtime from information provided by the
> firmware.
>
> A note on #26: it seems this chip broke the old hack of passing the PMK
> in hexdump form as a PSK, but it seems brcmfmac chips supported passing
> it in binary all along. I'm not sure why it was done this way in the
> Linux driver, but it seems OpenBSD always did it in binary and works
> with older chips, so this should be reasonably well tested. Any further
> insight as to why this was done this way would be appreciated.
>
> # 28~32: Fixes
>
> These are just random things I came across while developing this series.
> #31 is required to avoid a compile warning in subsequent patches. None
> of these are strictly required to support these chips/platforms.
>
> # 33-35: TxCap and calibration blobs
>
> These patches add support for uploading TxCap blobs, which are another
> kind of firmware blob that Apple platforms use (T2 and M1), as well as
> providing Wi-Fi calibration data from the device tree (M1).
>
> I'm not sure what the TxCap blobs do. Given the stray function
> prototype at [5], it would seem the Broadcom folks in charge of Linux
> drivers also know all about Apple's fancy OTP for firmware selection
> and the existence of TxCap blobs, so it would be great if you could
> share any insight here ;-)
>
> These patches are not required for the chips to function, but presumably
> having proper per-device calibration data available matters, and I
> assume the TxCap blobs aren't just for show either.
>
> # On firmware
>
> As you might expect, the firmware for these machines is not available
> under a redistributable license; however, every owner of one of these
> machines *is* implicitly licensed to posess the firmware, and the OS
> packages containing it are available under well-known URLs on Apple's
> CDN with no authentication.
>
> Our plan to support this is to propose a platform firmware mechanism,
> where platforms can provide a firmware package in the EFI system
> partition along with a manifest, and distros will extract it to
> /lib/firmware on boot or otherwise make it available to the kernel.
>
> Then, on M1 platforms, our install script, which performs all the
> bootloader installation steps required to run Linux on these machines in
> the first place, will also take care of copying the firmware from the
> base macOS image to the EFI partition. On T2 platforms, we'll provide an
> analogous script that users can manually run prior to a normal EFI Linux
> installation to just grab the firmware from /usr/share/firmware/wifi in
> the running macOS.
>
> There is an example firmware manifest at [1] which details the files
> copied by our firmware rename script [2], as of macOS 12.0.1.
>
> To test this series on a supported Mac today (T2 or M1), boot into macOS
> and run:
>
> $ git clone https://github.com/AsahiLinux/asahi-installer
> $ cd asahi-installer/src
> $ python -m firmware.wifi /usr/share/firmware/wifi firmware.tar
>
> Then copy firmware.tar to Linux and extract it into /lib/firmware.
I looked into the ~half of the series and basically common mistakes
you have are (but not limited to):
- missed checks for error from allocator calls
- NIH devm_kasprintf()
- quite possible reinveting a wheel of many functions we have already
implemented in the kernel.
Suggestion for the last one is to use `git grep ...`, which is very
powerful instrument, and just always questioning yourself "I'm doing
XYZ and my gut feeling is that XYZ is (so) generic I can't believe
there is no implementation of it already exists in the kernel". This
is how I come up with a lot of cleanups done in the past.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2022-01-04 14:30 UTC|newest]
Thread overview: 122+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-04 7:26 [PATCH v2 00/35] brcmfmac: Support Apple T2 and M1 platforms Hector Martin
2022-01-04 7:26 ` [PATCH v2 01/35] dt-bindings: net: bcm4329-fmac: Add Apple properties & chips Hector Martin
2022-01-11 18:45 ` Rob Herring
2022-01-04 7:26 ` [PATCH v2 02/35] brcmfmac: pcie: Declare missing firmware files in pcie.c Hector Martin
2022-01-06 9:56 ` Arend van Spriel
2022-01-06 11:10 ` Hector Martin
2022-01-04 7:26 ` [PATCH v2 03/35] brcmfmac: firmware: Handle per-board clm_blob files Hector Martin
2022-01-06 10:19 ` Arend van Spriel
2022-01-06 10:59 ` Hector Martin
2022-01-04 7:26 ` [PATCH v2 04/35] brcmfmac: firmware: Support having multiple alt paths Hector Martin
2022-01-04 8:26 ` Dmitry Osipenko
2022-01-04 8:43 ` Hector Martin
2022-01-04 22:09 ` Dmitry Osipenko
2022-01-05 13:22 ` Hector Martin
2022-01-06 17:40 ` Dmitry Osipenko
2022-01-06 17:58 ` Andy Shevchenko
2022-01-07 3:12 ` Dmitry Osipenko
2022-01-07 9:55 ` Andy Shevchenko
2022-01-04 22:36 ` Dmitry Osipenko
2022-01-04 22:38 ` Dmitry Osipenko
2022-01-06 10:43 ` Arend van Spriel
2022-01-06 11:12 ` Hector Martin
2022-01-04 7:26 ` [PATCH v2 05/35] brcmfmac: pcie/sdio/usb: Get CLM blob via standard firmware mechanism Hector Martin
2022-01-06 10:48 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 06/35] brcmfmac: firmware: Support passing in multiple board_types Hector Martin
2022-01-04 10:22 ` Arend van Spriel
2022-01-04 10:30 ` Hector Martin
2022-01-04 11:28 ` Andy Shevchenko
2022-01-07 2:50 ` Hector Martin
2022-01-06 12:16 ` Arend van Spriel
2022-01-07 4:02 ` Hector Martin
2022-01-07 6:17 ` Arend Van Spriel
2022-01-07 7:12 ` Hector Martin
2022-01-04 7:26 ` [PATCH v2 07/35] brcmfmac: pcie: Read Apple OTP information Hector Martin
2022-01-04 11:26 ` Andy Shevchenko
2022-01-07 3:53 ` Hector Martin
2022-01-06 12:37 ` Arend van Spriel
2022-01-06 13:08 ` Hector Martin
2022-01-04 7:26 ` [PATCH v2 08/35] brcmfmac: of: Fetch Apple properties Hector Martin
2022-01-04 11:17 ` Andy Shevchenko
2022-01-07 3:54 ` Hector Martin
2022-01-08 20:03 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 09/35] brcmfmac: pcie: Perform firmware selection for Apple platforms Hector Martin
2022-01-04 14:24 ` Andy Shevchenko
2022-01-06 13:12 ` Hector Martin
2022-01-08 20:03 ` Arend van Spriel
2022-01-17 6:36 ` Hector Martin
2022-01-04 7:26 ` [PATCH v2 10/35] brcmfmac: firmware: Allow platform to override macaddr Hector Martin
2022-01-04 14:23 ` Andy Shevchenko
2022-01-05 13:26 ` Hector Martin
2022-01-06 14:20 ` Andy Shevchenko
2022-01-07 2:39 ` Hector Martin
2022-01-08 20:14 ` Arend van Spriel
2022-01-17 6:38 ` Hector Martin
2022-01-04 7:26 ` [PATCH v2 11/35] brcmfmac: msgbuf: Increase RX ring sizes to 1024 Hector Martin
2022-01-10 7:17 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 12/35] brcmfmac: pcie: Fix crashes due to early IRQs Hector Martin
2022-01-04 14:12 ` Andy Shevchenko
2022-01-06 13:10 ` Hector Martin
2022-01-10 13:54 ` Kalle Valo
2022-01-10 7:19 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 13/35] brcmfmac: pcie: Support PCIe core revisions >= 64 Hector Martin
2022-01-10 7:31 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 14/35] brcmfmac: pcie: Add IDs/properties for BCM4378 Hector Martin
2022-01-10 9:10 ` Arend van Spriel
2022-01-10 11:04 ` Hector Martin
2022-01-04 7:26 ` [PATCH v2 15/35] ACPI / property: Support strings in Apple _DSM props Hector Martin
2022-01-04 7:26 ` [PATCH v2 16/35] brcmfmac: acpi: Add support for fetching Apple ACPI properties Hector Martin
2022-01-04 10:21 ` Arend van Spriel
2022-01-04 11:00 ` Hector Martin
2022-01-10 14:01 ` Kalle Valo
2022-01-10 9:11 ` Arend van Spriel
2022-01-10 11:07 ` Hector Martin
2022-01-10 11:26 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 17/35] brcmfmac: pcie: Provide a buffer of random bytes to the device Hector Martin
2022-01-10 9:11 ` Arend van Spriel
2022-01-10 11:09 ` Hector Martin
2022-01-10 11:28 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 18/35] brcmfmac: pcie: Add IDs/properties for BCM4355 Hector Martin
2022-01-10 9:12 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 19/35] brcmfmac: pcie: Add IDs/properties for BCM4377 Hector Martin
2022-01-10 9:12 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 20/35] brcmfmac: pcie: Perform correct BCM4364 firmware selection Hector Martin
2022-01-10 9:12 ` Arend van Spriel
2022-01-10 11:20 ` Hector Martin
2022-01-10 12:02 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 21/35] brcmfmac: chip: Only disable D11 cores; handle an arbitrary number Hector Martin
2022-01-19 12:36 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 22/35] brcmfmac: chip: Handle 1024-unit sizes for TCM blocks Hector Martin
2022-01-19 12:36 ` Arend van Spriel
2022-01-20 8:49 ` Arend van Spriel
2022-01-31 16:21 ` Hector Martin
2022-01-04 7:26 ` [PATCH v2 23/35] brcmfmac: cfg80211: Add support for scan params v2 Hector Martin
2022-01-04 19:46 ` Arend Van Spriel
2022-01-17 6:57 ` Hector Martin
2022-01-11 8:50 ` Arend van Spriel
2022-01-17 6:58 ` Hector Martin
2022-01-04 7:26 ` [PATCH v2 24/35] brcmfmac: feature: Add support for setting feats based on WLC version Hector Martin
2022-01-21 7:35 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 25/35] brcmfmac: cfg80211: Add support for PMKID_V3 operations Hector Martin
2022-01-21 7:35 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 26/35] brcmfmac: cfg80211: Pass the PMK in binary instead of hex Hector Martin
2022-01-21 7:35 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 27/35] brcmfmac: pcie: Add IDs/properties for BCM4387 Hector Martin
2022-01-21 7:35 ` Arend van Spriel
2022-01-31 16:37 ` Hector Martin
2022-01-04 7:26 ` [PATCH v2 28/35] brcmfmac: pcie: Replace brcmf_pcie_copy_mem_todev with memcpy_toio Hector Martin
2022-01-04 7:26 ` [PATCH v2 29/35] brcmfmac: pcie: Read the console on init and shutdown Hector Martin
2022-01-04 7:26 ` [PATCH v2 30/35] brcmfmac: pcie: Release firmwares in the brcmf_pcie_setup error path Hector Martin
2022-01-04 7:26 ` [PATCH v2 31/35] brcmfmac: firmware: Allocate space for default boardrev in nvram Hector Martin
2022-01-04 7:26 ` [PATCH v2 32/35] brcmfmac: fwil: Constify iovar name arguments Hector Martin
2022-01-04 7:26 ` [PATCH v2 33/35] brcmfmac: common: Add support for downloading TxCap blobs Hector Martin
2022-01-21 7:36 ` Arend van Spriel
2022-01-31 16:28 ` Hector Martin
2022-01-04 7:26 ` [PATCH v2 34/35] brcmfmac: pcie: Load and provide " Hector Martin
2022-01-21 7:36 ` Arend van Spriel
2022-01-04 7:26 ` [PATCH v2 35/35] brcmfmac: common: Add support for external calibration blobs Hector Martin
2022-01-21 7:35 ` Arend van Spriel
2022-01-04 14:28 ` Andy Shevchenko [this message]
2022-01-10 10:14 ` [PATCH v2 00/35] brcmfmac: Support Apple T2 and M1 platforms Kalle Valo
2022-01-10 11:21 ` Hector Martin
2022-01-10 13:46 ` Kalle Valo
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=CAHp75VdnSCV0HczotPoZRZane90Mt-uQ4MauvFKNR-uJ11sx3Q@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=SHA-cyfmac-dev-list@infineon.com \
--cc=alyssa@rosenzweig.io \
--cc=aspriel@gmail.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=chi-hsien.lin@infineon.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=digetx@gmail.com \
--cc=franky.lin@broadcom.com \
--cc=hante.meuleman@broadcom.com \
--cc=hdegoede@redhat.com \
--cc=kettenis@openbsd.org \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=lenb@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=marcan@marcan.st \
--cc=netdev@vger.kernel.org \
--cc=pieter-paul.giesberts@broadcom.com \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=sandals@crustytoothpaste.net \
--cc=sven@svenpeter.dev \
--cc=wright.feng@infineon.com \
--cc=zajec5@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).