[PATCH 0/6] qoriq: new target

Stijn Tintel stijn at linux-ipv6.be
Sat Aug 21 16:15:07 PDT 2021

This patch series adds a new target "qoriq", that will support boards using
PowerPC processors from NXP's QorIQ brand. It started as a subtarget of the
mpc85xx target, but as all PowerQUICC 85xx devices are based on e500 cores,
this probably wasn't the right place for it.

The target will initially support the WatchGuard Firebox M300 appliance, which
is based on the NXP QorIQ T2081 processor. These devices can be found on eBay
for about EUR 150-200. They will reach EOL on 31/12/2022, so expect more to
become available for even cheaper. At this price, I think they're a bargain.

The series first adds requirements to support the new target and architecture,
then adds the target without support for any board yet. The reason for this,
is to be able to add the installation instructions for the M300 to the commit
that actually introduces support for it. I don't think it makes sense to add
these instructions to a single large commit adding both the target and support
for the device. Additionally, the commit that adds the target compiles fine,
so it should not cause any issues during git bisect.

Some notes worth mentioning:
* PPC32 defaults to THREAD_SHIFT=13, while PPC64 defaults to THREAD_SHIFT=14
  As this started as a subtarget of mpc85xx, which is PPC32 and thus has
  THREAD_SHIFT=13, I initially built the kernel for the M300 also with that
  value, which caused random kernel crashes relatively early during boot.
  This was quite hard to debug, and caused me to eventually throw the device
  in the closet for half year. It was only due to other people showing
  interest in similar devices that I got motivated to work on it again.
* Enabling HARDENED_USERCOPY causes another bunch of random crashes, so it is
  disabled for now.
* The DTS resulting from decompiling the OEM DTB does not contain any
  references to the switch, and contains several properties that do not exist
  in the upstream kernel, so keep that in mind when you're adding support for
  other devices.
* USB storage is enabled in the kernel to allow recovery by booting OpenWrt
  from a USB stick.
* NR_CPUS=24 to potentially support the T4240
* The LD_HEAD_STUB_CATCH kernel config symbol keeps getting removed after
  running make kernel_{menu,old}config, then pops up again during build.
  If anyone can suggest how to solve this, that would be appreciated.
* As this is a new target with probably limited interest, it's set to
  source-only to avoid unneeded load on the build infrastructure.
* When using squashfs images, mount_root crashes with invalid instruction.
* To get the DSA ports to work, the max frame size of the DPAA FMan driver had
  to be increased from 1522 to 1530. This is required because the max MTU is
  derived from the max frame size substractedi by VLAN_ETH_HLEN (18) and
  ETH_FCS_LEN (4), leaving no space for the Marvell DSA header. Increasing the
  max frame size also made the following error disappear [1]:
    fsl_dpaa_mac ffe4e0000.ethernet eth0: Err FD status = 0x00040000

Sending out this series early to gather some feedback while I work out some
remaining quirks.

One of those quirks is the dropped packets counter on the ethernet interfaces
is increasing rapidly. This seems to be amplified by things like enabling SQM
or using MACVLAN interfaces on top of them. I doubt those packets are
effectively being dropped, as the amount of RX packets on the MACVLAN
interface is roughly the sum of the amount or RX and dropped RX packets on the
underlying ethernet interface:

3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:90:7f:d7:e0:d0 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped missed  mcast
    12208872560 13813030 206     73081128 0       0
    TX: bytes  packets  errors  dropped carrier collsns
    15585381146 59857639 0       0       0       0
28: wan at eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 02:68:71:2e:62:67 brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped missed  mcast
    67371562326 86886346 0       175     0       537479
    TX: bytes  packets  errors  dropped carrier collsns
    15585382928 59857674 0       0       0       0

Another error that sometimes appears:
  fsl_dpaa_mac ffe4e0000.ethernet eth0: Err FD status = 0x00000020

I couldn't find anything directly explaining this error, but in ethtool claims
these are "rx header error". I believe these errors occur when FMan fails to
parse the receive frame protocol header, so it cannot perform classification
on these frames. As we don't use this feature, they are probably harmless.
That said, I will look into packaging the Frame Manager Configuration tool [2]
and see if anything can be done there to hide these errors.

One more thing I'd like to see is that the labels on the ethernet ports on the
front panel of the device match the number of the interface name in the OS,
like in the OEM firmware. Unfortunately I don't think it is possible to rename
the ethernet interfaces via DTS, so any suggestions on how to do this welcome.

Looking forward to feedback.


[1] https://community.nxp.com/t5/CodeWarrior-for-QorIQ/What-causes-quot-cpu1-fsl-dpa-ethernet-30-dpaa-eth-c-828-dpa-rx/m-p/266154
[2] https://source.codeaurora.org/external/qoriq/qoriq-components/fmc/

Stijn Tintel (6):
  build: add e6500 CPU_TYPE
  toolchain/gcc: use ELFv2 ABI on ppc64 with musl
  openssl: add ppc64 support
  nettle: disable assembler on ppc64
  qoriq: new target
  qoriq: add support for WatchGuard Firebox M300

 include/target.mk                             |   1 +
 package/libs/nettle/Makefile                  |   3 +-
 ...m-ppc-xlate.pl-add-linux64v2-flavour.patch |  63 +++
 .../openssl/patches/110-openwrt_targets.patch |   6 +-
 target/linux/qoriq/Makefile                   |  21 +
 .../base-files/lib/preinit/79_move_config     |  17 +
 .../qoriq/base-files/lib/upgrade/platform.sh  |  38 ++
 target/linux/qoriq/config-5.10                | 414 ++++++++++++++++++
 .../files/arch/powerpc/boot/dts/fsl/m300.dts  | 294 +++++++++++++
 target/linux/qoriq/generic/target.mk          |   3 +
 target/linux/qoriq/image/Makefile             |  34 ++
 target/linux/qoriq/image/generic.mk           |  13 +
 toolchain/gcc/common.mk                       |   1 +
 13 files changed, 906 insertions(+), 2 deletions(-)
 create mode 100644 package/libs/openssl/patches/001-crypto-perlasm-ppc-xlate.pl-add-linux64v2-flavour.patch
 create mode 100644 target/linux/qoriq/Makefile
 create mode 100644 target/linux/qoriq/base-files/lib/preinit/79_move_config
 create mode 100755 target/linux/qoriq/base-files/lib/upgrade/platform.sh
 create mode 100644 target/linux/qoriq/config-5.10
 create mode 100644 target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/m300.dts
 create mode 100644 target/linux/qoriq/generic/target.mk
 create mode 100644 target/linux/qoriq/image/Makefile
 create mode 100644 target/linux/qoriq/image/generic.mk


More information about the openwrt-devel mailing list