From patchwork Sat Aug 21 23:15:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stijn Tintel X-Patchwork-Id: 1519313 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=1LFwjkoM; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linux-ipv6.be header.i=@linux-ipv6.be header.a=rsa-sha256 header.s=502B7754-045F-11E5-BBC5-64595FD46BE8 header.b=tMCRYhjQ; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GsZJk2L58z9sWc for ; Sun, 22 Aug 2021 09:21:42 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=9uYHFVtbQiWChTPjfuzPnPrAlVOfO5Kex9SR9pVbeuw=; b=1LFwjkoMyDU9AT Vq65Psnq1E4PQB6he7HYrJPoNCXbdyVi+kiRSDf/KTJGFHIzPLr793JdaDUJbw8AKu6IWkD5qJvx7 qY4p37Gu59QiC/2y43QCqc/Gq9lprwTBPZ6AdhlMJS8HYaEGyQLGDOqxmjL5202rBg0xL1x166Bgc 9PB0R8dHKCzduVoemAn1wEUWUfiTAJfIKwMb/eDVBvXydsGsSRUERLJiEv3mDzxJtwfOK2mc99/5p JCDuNoRRH1jQvxCflA7wixvOT30C9LnERwcOIT0EHFx3VGj2zRHHmzHzPdk3knpcdTbp/cDgryzP9 UdaqMk4yFdo9MhxyV2oQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mHaDu-00DGp5-GJ; Sat, 21 Aug 2021 23:16:22 +0000 Received: from mail.tintel.eu ([51.83.127.189]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mHaDg-00DGlw-31 for openwrt-devel@lists.openwrt.org; Sat, 21 Aug 2021 23:16:12 +0000 Received: from localhost (localhost [IPv6:::1]) by mail.tintel.eu (Postfix) with ESMTP id F129A4BEB7E9 for ; Sun, 22 Aug 2021 01:15:52 +0200 (CEST) Received: from mail.tintel.eu ([IPv6:::1]) by localhost (mail.tintel.eu [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id QpuJlG5dh96q for ; Sun, 22 Aug 2021 01:15:52 +0200 (CEST) Received: from localhost (localhost [IPv6:::1]) by mail.tintel.eu (Postfix) with ESMTP id 3E23B4C1B639 for ; Sun, 22 Aug 2021 01:15:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.tintel.eu 3E23B4C1B639 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-ipv6.be; s=502B7754-045F-11E5-BBC5-64595FD46BE8; t=1629587752; bh=IY+OhH7NCyUgdkAkoGoDitNBarJSRbFLghEmvlhJsWE=; h=From:To:Date:Message-Id:MIME-Version; b=tMCRYhjQJ0wJwdvkILSFarXwOiySS9M2Oi/0IFho5qXUVsVGxrTiVvc1sfM2ug8Tb 5hYAw3maIkgMZ0lSraJzTD8gDU840IXFR/HCPhlYLwh09IXml5i2aSYQ8e7d/zWYPJ do6Vbu7rQxmvyvcA8d+Nrpvc1/XZB10vpRUmGd6M= X-Virus-Scanned: amavisd-new at mail.tintel.eu Received: from mail.tintel.eu ([IPv6:::1]) by localhost (mail.tintel.eu [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id 3hyNpNwNy9wm for ; Sun, 22 Aug 2021 01:15:52 +0200 (CEST) Received: from taz.sof.bg.adlevio.net (unknown [IPv6:2001:67c:21bc:20::10]) by mail.tintel.eu (Postfix) with SMTP id 03C384BEB7E9 for ; Sun, 22 Aug 2021 01:15:51 +0200 (CEST) Received: (nullmailer pid 91044 invoked by uid 1000); Sat, 21 Aug 2021 23:15:13 -0000 From: Stijn Tintel To: openwrt-devel@lists.openwrt.org Subject: [PATCH 0/6] qoriq: new target Date: Sun, 22 Aug 2021 02:15:07 +0300 Message-Id: <20210821231513.90996-1-stijn@linux-ipv6.be> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Rspamd-Queue-Id: 03C384BEB7E9 X-Spamd-Result: default: False [0.00 / 15.00]; ASN(0.00)[asn:200533, ipnet:2001:67c:21bc::/48, country:BG]; IP_WHITELIST(0.00)[2001:67c:21bc:20::10] X-Rspamd-Server: skulls X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210821_161608_449467_5B370626 X-CRM114-Status: GOOD ( 27.82 ) X-Spam-Score: 0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 devic [...] Content analysis details: (0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.1 DKIM_INVALID DKIM or DK signature exists, but is not valid X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 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: 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@eth1: 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. 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/ 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 Reviewed-by: Rui Salvaterra