[PATCH v2 0/8] qoriq: new target

Stijn Tintel stijn at linux-ipv6.be
Mon Dec 20 11:00:56 PST 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. An attempt to get support from upstream was ignored.
* 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.
* The target uses CPU_TYPE e5500 to support the lower models in the QorIQ PPC
  range. As the kernel and musl check for AltiVec at runtime, I believe this
  should have negligible performance impact.
* As this is a new target with probably limited interest, it's set to
  source-only to avoid unneeded load on the build infrastructure.
* 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

Issues fixed since v1:
* Ethernet interface ordering is now like OEM, numbers match labels
* SIGILL on some math instructions (CONFIG_MATH_EMULATION_HW_UNIMPLEMENTED)
* Squashfs images now work due to disabling of BCJ for the target.

The quirks below still exist, but as I have been using a Firebox M300 as my
main router since August this year, and the target seems to be gaining
traction, I would like to push this to master in the current state. Once the
target is in master, I will work on the WatchGuard Firebox M200 and the Adtran
BSAP-3040. The latter was kindly donated to me by Slimey on IRC.


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.


Thanks,
Stijn

[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/


Changes since v1:
- Bump OpenSSL PKG_RELEASE
- Change CPU_TYPE to e5500
- Disable BCJ in squashfs images
- Add ppc64 support to libunwind
- Add target DEFAULT_PACKAGES:
  - e2fsprogs
  - uboot-envtools
- Disable BCJ in squashfs compression
- Change default DEVICE_DTS in target/linux/qoriq/image/Makefile
- Add qoriq to target dependency of kmod-ptp-qoriq
- Add kmod-ptp-qoriq to DEVICE_PACKAGES for M300
- Add /etc/board.d/02_network
  - Network config like OEM firmware
- Configure u-boot-env partition in uboot-envtools
- SPDX identifier in:
  - target/linux/qoriq/base-files/lib/preinit/79_move_config
  - target/linux/qoriq/base-files/lib/upgrade/platform.sh
- Changes in m300.dts:
  - Renamed to watchguard-firebox-m300.dts
  - Empty line after compatible
  - Drop empty aliases node
  - Define fixed-link array properties as object to improve readability
  - Remove padding in partition at x labels
  - Drop commented out dsa,member property from switch node
  - Drop Marvell switch detected comment, should be clear from the switch node
  - Renamed all partitions and made all but u-boot-env read-only
  - Include qoriq-fman3-0-10g-1.dtsi before t2081si-post.dtsi to fix interface
    order (digit matches front panel)
  - Name switchports swethX (digit matches front panel)
  - Override ethernetX aliases to have MAC address like OEM firmware
- Changes in target/linux/qoriq/image/generic.mk
  - Rename device to watchguard_firebox-m300
  - Drop SUPPORTED_DEVICES line
- Added in target/linux/qoriq/config-5.10
  - CONFIG_MATH_EMULATION=y
  - CONFIG_MATH_EMULATION_HW_UNIMPLEMENTED=y
  - CONFIG_PPC_QUEUED_SPINLOCKS=y
  - CONFIG_QUEUED_RWLOCKS=y
  - CONFIG_QUEUED_SPINLOCKS=y
- Dropped from target/linux/qoriq/config-5.10
  - CONFIG_CONSOLE_POLL=y
  - CONFIG_DEBUGGER=y
  - CONFIG_DEBUG_MEMORY_INIT=y
  - CONFIG_DEBUG_STACKOVERFLOW=y
  - CONFIG_EXT4_FS_SECURITY=y
  - CONFIG_GCC_PLUGINS=y
  - CONFIG_KGDB=y
  - CONFIG_NET_DSA_MV88E6XXX_PTP=y
  - CONFIG_NET_PTP_CLASSIFY=y
  - CONFIG_NMI_IPI=y
  - CONFIG_PTP_1588_CLOCK=y
  - CONFIG_PTP_1588_CLOCK_QORIQ=y
  - CONFIG_RCU_NEED_SEGCBLIST=y
  - CONFIG_RCU_STALL_COMMON=y
  - CONFIG_RCU_TRACE=y
  - CONFIG_SCHED_SMT=y
  - CONFIG_SCHED_STACK_END_CHECK=y
  - CONFIG_SLUB_DEBUG_ON=y
  - CONFIG_TRACE_CLOCK=y


Stijn Tintel (8):
  build: add e5500 CPU_TYPE
  toolchain/musl: ppc64: check for AltiVec in setjmp/longjmp
  toolchain/gcc: use ELFv2 ABI on ppc64 with musl
  openssl: add ppc64 support
  nettle: disable assembler on ppc64
  libunwind: add ppc64 support
  qoriq: new target
  qoriq: add support for WatchGuard Firebox M300

 include/target.mk                             |   1 +
 package/boot/uboot-envtools/files/qoriq       |  19 +
 package/kernel/linux/modules/other.mk         |   2 +-
 package/libs/libunwind/Makefile               |   4 +-
 ...ce-exec_prefix-lib64-libdir-on-ppc64.patch |  29 ++
 package/libs/nettle/Makefile                  |   3 +-
 package/libs/openssl/Makefile                 |   2 +-
 ...m-ppc-xlate.pl-add-linux64v2-flavour.patch |  63 +++
 .../openssl/patches/110-openwrt_targets.patch |   6 +-
 target/linux/qoriq/Makefile                   |  23 ++
 .../qoriq/base-files/etc/board.d/02_network   |  38 ++
 .../base-files/lib/preinit/79_move_config     |  17 +
 .../qoriq/base-files/lib/upgrade/platform.sh  |  36 ++
 target/linux/qoriq/config-5.10                | 384 ++++++++++++++++++
 .../boot/dts/fsl/watchguard-firebox-m300.dts  | 328 +++++++++++++++
 target/linux/qoriq/generic/target.mk          |   3 +
 target/linux/qoriq/image/Makefile             |  36 ++
 target/linux/qoriq/image/generic.mk           |  13 +
 toolchain/gcc/common.mk                       |   1 +
 ...-check-for-AltiVec-in-setjmp-longjmp.patch |  82 ++++
 20 files changed, 1084 insertions(+), 6 deletions(-)
 create mode 100644 package/boot/uboot-envtools/files/qoriq
 create mode 100644 package/libs/libunwind/patches/001-Don-t-force-exec_prefix-lib64-libdir-on-ppc64.patch
 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/etc/board.d/02_network
 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/watchguard-firebox-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
 create mode 100644 toolchain/musl/patches/100-ppc64-check-for-AltiVec-in-setjmp-longjmp.patch

-- 
2.32.0




More information about the openwrt-devel mailing list