[PATCH 3/3] mikrotik: make soft_config writable

2021-12-20 Thread Oskari Lemmela
Parent mtd partition needs to be writable

Signed-off-by: Oskari Lemmela 
---
 target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi   | 1 -
 target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi | 1 -
 .../ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts   | 1 -
 target/linux/ramips/dts/mt7621_mikrotik.dtsi | 1 -
 4 files changed, 4 deletions(-)

diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi 
b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi
index 3ed50abefa..86136289de 100644
--- a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi
+++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi
@@ -99,7 +99,6 @@
partition@0 {
label = "RouterBoot";
reg = <0x0 0x2>;
-   read-only;
compatible = "mikrotik,routerboot-partitions";
#address-cells = <1>;
#size-cells = <1>;
diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi 
b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi
index f0473c7497..dbbe67d33d 100644
--- a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi
+++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi
@@ -38,7 +38,6 @@
partition@0 {
label = "RouterBoot";
reg = <0x0 0x2>;
-   read-only;
compatible = "mikrotik,routerboot-partitions";
#address-cells = <1>;
#size-cells = <1>;
diff --git 
a/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts 
b/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts
index f5c6731bb7..f6e04ae0a4 100644
--- a/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts
+++ b/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts
@@ -73,7 +73,6 @@
partition@0 {
label = "RouterBoot";
reg = <0x0 0x2>;
-   read-only;
compatible = "mikrotik,routerboot-partitions";
#address-cells = <1>;
#size-cells = <1>;
diff --git a/target/linux/ramips/dts/mt7621_mikrotik.dtsi 
b/target/linux/ramips/dts/mt7621_mikrotik.dtsi
index 1fc523ea14..ace194c6d6 100644
--- a/target/linux/ramips/dts/mt7621_mikrotik.dtsi
+++ b/target/linux/ramips/dts/mt7621_mikrotik.dtsi
@@ -37,7 +37,6 @@
partition@0 {
label = "RouterBoot";
reg = <0x0 0x4>;
-   read-only;
compatible = "mikrotik,routerboot-partitions";
#address-cells = <1>;
#size-cells = <1>;
-- 
2.25.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 2/3] mikrotik: enable variable size erase

2021-12-20 Thread Oskari Lemmela
Add support for variable size erase blocks.
Enable it to all targets which has mikrotik targets.

Signed-off-by: Oskari Lemmela 
---
 target/linux/ath79/mikrotik/config-default|   1 +
 target/linux/generic/config-5.10  |   1 +
 ...support-for-minor-aligned-partitions.patch | 397 ++
 target/linux/ipq40xx/mikrotik/config-default  |   1 +
 target/linux/ramips/mt7621/config-5.10|   1 +
 5 files changed, 401 insertions(+)
 create mode 100644 
target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch

diff --git a/target/linux/ath79/mikrotik/config-default 
b/target/linux/ath79/mikrotik/config-default
index 74cfdf0423..ee2e4ebe9a 100644
--- a/target/linux/ath79/mikrotik/config-default
+++ b/target/linux/ath79/mikrotik/config-default
@@ -19,6 +19,7 @@ CONFIG_MTD_NAND_RB91X=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_MTD_ROUTERBOOT_PARTS=y
 CONFIG_MTD_SPI_NAND=y
+CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y
 CONFIG_MTD_SPLIT_MINOR_FW=y
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_BLOCK=y
diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10
index 27e3e90488..f110bfeb8a 100644
--- a/target/linux/generic/config-5.10
+++ b/target/linux/generic/config-5.10
@@ -3640,6 +3640,7 @@ CONFIG_MTD_ROOTFS_ROOT_DEV=y
 # CONFIG_MTD_SPI_NOR is not set
 # CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
 CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=4096
+# CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE is not set
 CONFIG_MTD_SPLIT=y
 # CONFIG_MTD_SPLIT_BCM63XX_FW is not set
 # CONFIG_MTD_SPLIT_BCM_WFI_FW is not set
diff --git 
a/target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch
 
b/target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch
new file mode 100644
index 00..fe92530081
--- /dev/null
+++ 
b/target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch
@@ -0,0 +1,397 @@
+From patchwork Tue Jun  8 04:07:19 2021
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+X-Patchwork-Submitter: John Thomson 
+X-Patchwork-Id: 1489105
+X-Patchwork-Delegate: tudor.amba...@gmail.com
+Return-Path: 
+ 
+X-Original-To: incom...@patchwork.ozlabs.org
+Delivered-To: patchwork-incom...@bilbo.ozlabs.org
+Authentication-Results: ozlabs.org;
+ spf=none (no SPF record) smtp.mailfrom=lists.infradead.org
+ (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org;
+ 
envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs@lists.infradead.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=EMabhVoR;
+   dkim=fail reason="signature verification failed" (2048-bit key;
+ unprotected) header.d=fastmail.com.au header.i=@fastmail.com.au
+ header.a=rsa-sha256 header.s=fm3 header.b=dLzuZ6dB;
+   dkim=fail reason="signature verification failed" (2048-bit key;
+ unprotected) header.d=messagingengine.com header.i=@messagingengine.com
+ header.a=rsa-sha256 header.s=fm3 header.b=nSRGsW+C;
+   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 4FzcFN1j1nz9sW8
+   for ; Tue,  8 Jun 2021 14:09:28 +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:Cc
+   
:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:
+   
Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:
+   List-Owner; bh=6mUWQd71FwsINycGYY1qOhKz+ecWJVNtwDkTebG3XkA=; 
b=EMabhVoRE3ad89
+   
o3L2AgyKrs+blSofUC3hoSsQe7gi3m4si8S9HW8Z+8SsS5TufUsvGwDl80qSYGlQOytQF+1yRUWvE
+   
6FJ/+bqv+TwjqZFibgJ6+9OVsQN9dZ/no1R0bBXIpmrf8ORUmv58QK4ZQquaFKbyXKpFeWOC2MSv4
+   
H2MAhyhTU8a3gtooH6G8+KvsJEfVgh6C+aDbwxyh2UY3chHKuw1kvL6AktbfUE2xl4zxi3x3kc70B
+   
Wi3LiJBFokxVdgnROXxTU5tI0XboWYkQV64gLuQNV4XKClcuhVpzloDK8Iok6NTd7b32a7TdEFlCS
+   lGKsEKmxtUlW2FpfoduA==;
+Received: from localhost ([::1] helo=bombadil.infradead.org)
+   by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux))
+   id 1lqT1r-006OAW-DX; Tue, 08 Jun 2021 04:07:51 +
+Received: from new1-smtp.messagingengine.com ([66.111.4.221])
+ by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux))
+ id 1lqT1l-006O9b-Fq
+ for linux-...@lists.infradead.org; Tue, 08 Jun 2021 04:07:50 

[PATCH 0/3] mikrotik: make soft_config partition writable

2021-12-20 Thread Oskari Lemmela
In order to change boot loader variables in small soft_config partition
SPI NOR need to support erasing 4k blocks.

Adding support for variable size erase blocks and enable it to all
targets which has mikrotik devices.

In some of mikrotik devices parent mtd device is read-only.
It makes soft_config read-only, so changing it to writable.

Variable size erase blocks could be used to replace 
MTD_SPI_NOR_USE_4K_SECTORS_LIMIT patch too.


Oskari Lemmela (3):
  generic: platform/mikrotik: make soft_config writable without 4K
sectors
  mikrotik: enable variable size erase
  mikrotik: make soft_config writable

 .../ar9344_mikrotik_routerboard-sxt-5n.dtsi   |   1 -
 .../dts/qca9533_mikrotik_routerboard-16m.dtsi |   1 -
 ...6_mikrotik_routerboard-wap-g-5hact2hnd.dts |   1 -
 target/linux/ath79/mikrotik/config-default|   1 +
 target/linux/generic/config-5.10  |   1 +
 .../drivers/platform/mikrotik/rb_softconfig.c |  17 +-
 ...support-for-minor-aligned-partitions.patch | 397 ++
 target/linux/ipq40xx/mikrotik/config-default  |   1 +
 target/linux/ramips/dts/mt7621_mikrotik.dtsi  |   1 -
 target/linux/ramips/mt7621/config-5.10|   1 +
 10 files changed, 404 insertions(+), 18 deletions(-)
 create mode 100644 
target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch

-- 
2.25.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 1/3] generic: platform/mikrotik: make soft_config writable without 4K sectors

2021-12-20 Thread Oskari Lemmela
Make soft_config writable in all cases. Performing soft_config commit
will fail if mtd partition is not writable.

Signed-off-by: Oskari Lemmela 
---
 .../drivers/platform/mikrotik/rb_softconfig.c   | 17 +++--
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git 
a/target/linux/generic/files/drivers/platform/mikrotik/rb_softconfig.c 
b/target/linux/generic/files/drivers/platform/mikrotik/rb_softconfig.c
index 070bd32d5a..31d06c423a 100644
--- a/target/linux/generic/files/drivers/platform/mikrotik/rb_softconfig.c
+++ b/target/linux/generic/files/drivers/platform/mikrotik/rb_softconfig.c
@@ -59,20 +59,9 @@
 #define RB_SOFTCONFIG_VER  "0.03"
 #define RB_SC_PR_PFX   "[rb_softconfig] "
 
-/*
- * mtd operations before 4.17 are asynchronous, not handled by this code
- * Also make the driver act read-only if 4K_SECTORS are not enabled, since they
- * are require to handle partial erasing of the small soft_config partition.
- */
-#if defined(CONFIG_MTD_SPI_NOR_USE_4K_SECTORS)
- #define RB_SC_HAS_WRITE_SUPPORT   true
- #define RB_SC_WMODE   S_IWUSR
- #define RB_SC_RMODE   S_IRUSR
-#else
- #define RB_SC_HAS_WRITE_SUPPORT   false
- #define RB_SC_WMODE   0
- #define RB_SC_RMODE   S_IRUSR
-#endif
+#define RB_SC_HAS_WRITE_SUPPORTtrue
+#define RB_SC_WMODES_IWUSR
+#define RB_SC_RMODES_IRUSR
 
 /* ID values for software settings */
 #define RB_SCID_UART_SPEED 0x01// u32*1
-- 
2.25.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Reduced throughput with mt7621 and DSA

2021-12-20 Thread Paul D
I generalize, but this is a problem which affects a few devices in the 
DSA bring-up.


Some platforms require some tinkering and tweaking, and perhaps input 
from the chip-set manufacturer (or information from a datasheet of the 
chip-set) if things are to improve.


DSA brings advantages and is the future: everyone is already committed. 
OEMs have been laying low tho and just used older 2.x kernels which the 
mfrs provided with the chip-sets originally to avoid this maintenance 
themselves if at all possible.


You can have a look at PRs for other platforms and their protracted DSA 
bring-ups on github.


e.g. for the qca8k switch chip, some of the lads have been moving mountains:

https://github.com/openwrt/openwrt/pull/4036
https://github.com/openwrt/openwrt/pull/4622
https://github.com/openwrt/openwrt/pull/4828


This will give you an idea of the amount of work which may be necessary 
to return performance to 19.x swconfig levels.



I don't dabble in mt7621, so cannot be of help there as to whether there 
is something ongoing for those.




On 2021-12-19 12:29, Kristian Evensen wrote:

Hello,

I am currently performing some performance measurements, comparing the
(wired) routing throughput (WAN <-> LAN) of 19.07, 21.02 and master on
mt7621 (ZBT WG-3526). I have connected one client to my LAN and one to
the WAN, and use iperf3 to measure. I create parallel flows (in order
to take advantage of the multiple CPU cores), use TCP and let iperf3
run for 30 sec. per test.

Based on my measurements, the throughput is reduced by ~50% going from
19.07 and to 21.02/master (~450Mbit/s vs. ~900Mbit/s). I do not have a
particular commit I can point to, but I believe the regressions is
caused by the introduction of DSA. Restoring the old swconfig driver,
brings my 21.02/master throughput up to roughly the same level as
19.07.

I am able to alleviate the reduction in throughput by enabling flow
offloading, but there are several cases where flow offloading does not
have an effect. When performing a similar measurement to the one above
over a Wireguard-tunnel, I see a similar reduction in performance (and
no help from flow offloading).

Does anyone know what could be the reason and if there is anything
that can be done to improve the performance when using DSA? Are there
for example any out of tree/not yet accepted patches that I should
try?

Thanks in advance for any help,
Kristian

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v2 7/8] qoriq: new target

2021-12-20 Thread Stijn Tintel
Add a new target named "qoriq", that will support boards using PowerPC
processors from NXP's QorIQ brand.

This doesn't actually add support for any board yet, so that
installation instructions can go in the commit message of the commit
that adds actual support for a board.

Signed-off-by: Stijn Tintel 
---
 package/kernel/linux/modules/other.mk |   2 +-
 target/linux/qoriq/Makefile   |  23 ++
 target/linux/qoriq/config-5.10| 384 ++
 target/linux/qoriq/generic/target.mk  |   3 +
 target/linux/qoriq/image/Makefile |  36 +++
 target/linux/qoriq/image/generic.mk   |   0
 6 files changed, 447 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/qoriq/Makefile
 create mode 100644 target/linux/qoriq/config-5.10
 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

diff --git a/package/kernel/linux/modules/other.mk 
b/package/kernel/linux/modules/other.mk
index fdcc089025..f712c95c8e 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -992,7 +992,7 @@ $(eval $(call KernelPackage,ptp))
 define KernelPackage/ptp-qoriq
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Freescale QorIQ PTP support
-  DEPENDS:=@TARGET_mpc85xx +kmod-ptp
+  DEPENDS:=@(TARGET_mpc85xx||TARGET_qoriq) +kmod-ptp
   KCONFIG:=CONFIG_PTP_1588_CLOCK_QORIQ
   FILES:=$(LINUX_DIR)/drivers/ptp/ptp-qoriq.ko
   AUTOLOAD:=$(call AutoProbe,ptp-qoriq)
diff --git a/target/linux/qoriq/Makefile b/target/linux/qoriq/Makefile
new file mode 100644
index 00..960ab32c98
--- /dev/null
+++ b/target/linux/qoriq/Makefile
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (C) 2021 Stijn Tintel 
+
+include $(TOPDIR)/rules.mk
+
+ARCH:=powerpc64
+BOARD:=qoriq
+BOARDNAME:=NXP QorIQ (PowerPC)
+CPU_TYPE:=e5500
+FEATURES:=boot-part ext4 fpu legacy-sdcard powerpc64 ramdisk root-part rtc 
source-only
+SUBTARGETS:=generic
+
+KERNEL_PATCHVER:=5.10
+KERNEL_TESTING_PATCHVER:=5.10
+
+KERNELNAME:=zImage
+
+include $(INCLUDE_DIR)/target.mk
+
+DEFAULT_PACKAGES += e2fsprogs uboot-envtools
+
+$(eval $(call BuildTarget))
diff --git a/target/linux/qoriq/config-5.10 b/target/linux/qoriq/config-5.10
new file mode 100644
index 00..6984e60475
--- /dev/null
+++ b/target/linux/qoriq/config-5.10
@@ -0,0 +1,384 @@
+CONFIG_64BIT=y
+CONFIG_ALTIVEC=y
+CONFIG_ARCH_DMA_ADDR_T_64BIT=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_KEEP_MEMBLOCK=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
+CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
+CONFIG_ARCH_MMAP_RND_BITS=18
+CONFIG_ARCH_MMAP_RND_BITS_MAX=32
+CONFIG_ARCH_MMAP_RND_BITS_MIN=18
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=17
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_WEAK_RELEASE_ACQUIRE=y
+CONFIG_ASN1=y
+CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y
+CONFIG_AUDIT_ARCH=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_BLK_MQ_PCI=y
+CONFIG_BLK_PM=y
+CONFIG_BLK_SCSI_REQUEST=y
+CONFIG_BLOCK_COMPAT=y
+CONFIG_BOOKE=y
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_CLK_QORIQ=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_CLZ_TAB=y
+CONFIG_COMMON_CLK=y
+CONFIG_COMPAT=y
+CONFIG_COMPAT_32BIT_TIME=y
+CONFIG_COMPAT_BINFMT_ELF=y
+CONFIG_COMPAT_NETLINK_MESSAGES=y
+CONFIG_COMPAT_OLD_SIGACTION=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_CORENET_GENERIC=y
+# CONFIG_CPUFREQ_DT is not set
+CONFIG_CPU_BIG_ENDIAN=y
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
+# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
+# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
+# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
+# CONFIG_CPU_FREQ_STAT is not set
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_IDLE_GOV_TEO=y
+CONFIG_CPU_ISOLATION=y
+CONFIG_CPU_RMAP=y
+CONFIG_CRC16=y
+CONFIG_CRYPTO_AUTHENC=y
+CONFIG_CRYPTO_CRC32C=y
+# CONFIG_CRYPTO_CRC32C_VPMSUM is not set
+CONFIG_CRYPTO_DES=y
+CONFIG_CRYPTO_DEV_FSL_CAAM=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API_DESC=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_COMMON=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_QI=y
+# CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG is not set
+# CONFIG_CRYPTO_DEV_FSL_CAAM_INTC is not set
+CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9
+CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y
+# CONFIG_CRYPTO_DEV_NX is not set
+CONFIG_CRYPTO_ECB=y
+CONFIG_CRYPTO_ENGINE=y
+CONFIG_CRYPTO_GF128MUL=y
+CONFIG_CRYPTO_HW=y
+CONFIG_CRYPTO_LIB_DES=y
+CONFIG_CRYPTO_LIB_POLY1305_RSIZE=1
+# CONFIG_CRYPTO_MD5_PPC is not set
+CONFIG_CRYPTO_NULL2=y
+CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_RSA=y
+# CONFIG_CRYPTO_SHA1_PPC is not set
+CONFIG_CRYPTO_XTS=y
+CONFIG_DATA_SHIFT=12

[PATCH v2 8/8] qoriq: add support for WatchGuard Firebox M300

2021-12-20 Thread Stijn Tintel
This device is based on NXP's QorIQ T2081QDS board, with a quad-core
dual-threaded 1.5 GHz ppc64 CPU and 4GB ECC RAM. The board has 5
ethernet interfaces, of which 3 are connected to the ethernet ports on
the front panel. The other 2 are internally connected to a Marvell
88E6171 switch; the other 5 ports of this switch are also connected to
the ethernet ports on the front panel.

Installation: write the sdcard image to an SD card. Stock U-Boot will
not boot, wait for it to fail then run these commands:

setenv OpenWrt_fdt image-watchguard-firebox-m300.dtb
setenv OpenWrt_kernel watchguard_firebox-m300-kernel.bin
setenv wgBootSysA 'setenv bootargs root=/dev/mmcblk0p2 rw rootdelay=2 
console=$consoledev,$baudrate fsl_dpaa_fman.fsl_fm_max_frm=1530; ext2load mmc 
0:1 $fdtaddr $OpenWrt_fdt; ext2load mmc 0:1 $loadaddr $OpenWrt_kernel; bootm 
$loadaddr - $fdtaddr'
saveenv
reset

The default U-Boot boot entry will now boot OpenWrt from the SD card.

Signed-off-by: Stijn Tintel 
---
 package/boot/uboot-envtools/files/qoriq   |  19 +
 .../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 ++
 .../boot/dts/fsl/watchguard-firebox-m300.dts  | 328 ++
 target/linux/qoriq/image/generic.mk   |  13 +
 6 files changed, 451 insertions(+)
 create mode 100644 package/boot/uboot-envtools/files/qoriq
 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/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts

diff --git a/package/boot/uboot-envtools/files/qoriq 
b/package/boot/uboot-envtools/files/qoriq
new file mode 100644
index 00..df99103203
--- /dev/null
+++ b/package/boot/uboot-envtools/files/qoriq
@@ -0,0 +1,19 @@
+[ -e /etc/config/ubootenv ] && exit 0
+
+touch /etc/config/ubootenv
+
+. /lib/uboot-envtools.sh
+. /lib/functions.sh
+
+board=$(board_name)
+
+case "$board" in
+watchguard,firebox-m300)
+   ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1" "0x1"
+   ;;
+esac
+
+config_load ubootenv
+config_foreach ubootenv_add_app_config ubootenv
+
+exit 0
diff --git a/target/linux/qoriq/base-files/etc/board.d/02_network 
b/target/linux/qoriq/base-files/etc/board.d/02_network
new file mode 100644
index 00..35b7ce9f32
--- /dev/null
+++ b/target/linux/qoriq/base-files/etc/board.d/02_network
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+. /lib/functions/uci-defaults.sh
+. /lib/functions.sh
+. /lib/functions/system.sh
+
+board_config_update
+board=$(board_name)
+
+wg_set_opt_interface() {
+   local device="$1"
+   local offset="$2"
+
+   ucidef_set_interface "$device" device "$device" protocol static ipaddr 
"10.0.${offset}.1" netmask 255.255.255.0
+}
+
+case "$board" in
+watchguard,firebox-m300)
+   ucidef_set_interfaces_lan_wan "eth1" "eth0"
+   wg_set_opt_interface "eth2" "2"
+
+   sweth_mac_offset=0x186d
+
+   for sweth in /sys/class/net/sweth*; do
+   device="$(basename "$sweth")"
+   mac="$(mtd_get_mac_text wg_cfg0 "$sweth_mac_offset")"
+   switchports="$switchports $device"
+   ucidef_set_network_device_mac "$device" "$mac"
+   wg_set_opt_interface "$device" "${device#sweth}"
+   sweth_mac_offset=$(printf "0x%X\n" $(( $sweth_mac_offset + 
0x14)))
+   done
+
+   ;;
+esac
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/qoriq/base-files/lib/preinit/79_move_config 
b/target/linux/qoriq/base-files/lib/preinit/79_move_config
new file mode 100644
index 00..54dd579660
--- /dev/null
+++ b/target/linux/qoriq/base-files/lib/preinit/79_move_config
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+. /lib/functions.sh
+. /lib/upgrade/common.sh
+
+move_config() {
+   local partdev
+
+   if export_bootdevice && export_partdevice partdev 1; then
+   mkdir -p /boot
+   mount -o rw,noatime "/dev/$partdev" /boot
+   [ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" /
+   umount /boot
+   fi
+}
+
+boot_hook_add preinit_mount_root move_config
diff --git a/target/linux/qoriq/base-files/lib/upgrade/platform.sh 
b/target/linux/qoriq/base-files/lib/upgrade/platform.sh
new file mode 100755
index 00..1392d5eb22
--- /dev/null
+++ b/target/linux/qoriq/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+PART_NAME=firmware
+REQUIRE_IMAGE_METADATA=1
+
+platform_check_image() {
+   case "$(board_name)" in
+   watchguard,firebox-m300)
+   legacy_sdcard_check_image "$1"
+   ;;
+   *)
+   return 0
+   ;;
+   esac
+}
+
+platform_copy_config() {
+ 

[PATCH v2 6/8] libunwind: add ppc64 support

2021-12-20 Thread Stijn Tintel
Backport an upstream patch to make libunwind build on ppc64, and add
powerpc64 to the dependencies.

Signed-off-by: Stijn Tintel 
---
 package/libs/libunwind/Makefile   |  4 +--
 ...ce-exec_prefix-lib64-libdir-on-ppc64.patch | 29 +++
 2 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100644 
package/libs/libunwind/patches/001-Don-t-force-exec_prefix-lib64-libdir-on-ppc64.patch

diff --git a/package/libs/libunwind/Makefile b/package/libs/libunwind/Makefile
index 7f79996d25..f129dafcbf 100644
--- a/package/libs/libunwind/Makefile
+++ b/package/libs/libunwind/Makefile
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libunwind
 PKG_VERSION:=1.5.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SAVANNAH/$(PKG_NAME)
@@ -32,7 +32,7 @@ define Package/libunwind
   CATEGORY:=Libraries
   TITLE:=The libunwind project
   URL:=http://www.nongnu.org/libunwind/
-  
DEPENDS:=@((mips||mipsel||mips64||x86_64||arm||aarch64)||(USE_GLIBC&&(powerpc||i386)))
 +zlib
+  
DEPENDS:=@((mips||mipsel||mips64||powerpc64||x86_64||arm||aarch64)||(USE_GLIBC&&(powerpc||i386)))
 +zlib
   ABI_VERSION:=8
 endef
 
diff --git 
a/package/libs/libunwind/patches/001-Don-t-force-exec_prefix-lib64-libdir-on-ppc64.patch
 
b/package/libs/libunwind/patches/001-Don-t-force-exec_prefix-lib64-libdir-on-ppc64.patch
new file mode 100644
index 00..d6010ec0ae
--- /dev/null
+++ 
b/package/libs/libunwind/patches/001-Don-t-force-exec_prefix-lib64-libdir-on-ppc64.patch
@@ -0,0 +1,29 @@
+From 0af7e7a53480ce8e1cf6cfb4e9fe071c1185ef31 Mon Sep 17 00:00:00 2001
+From: Matthias Diener 
+Date: Fri, 2 Jul 2021 12:36:10 -0500
+Subject: [PATCH] Don't force {exec_prefix}/lib64 libdir on ppc64
+
+---
+ configure.ac | 6 --
+ 1 file changed, 6 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 9fadc163..0dec4ca6 100644
+--- a/configure.ac
 b/configure.ac
+@@ -215,12 +215,6 @@ fi
+ AM_CONDITIONAL(USE_DWARF, [test x$use_dwarf = xyes])
+ AC_MSG_RESULT([$use_dwarf])
+ 
+-if test x$target_arch = xppc64; then
+-libdir='${exec_prefix}/lib64'
+-AC_MSG_NOTICE([PowerPC64 detected, lib will be installed ${libdir}]);
+-AC_SUBST([libdir])
+-fi
+-
+ AC_MSG_CHECKING([whether to restrict build to remote support])
+ if test x$target_arch != x$host_arch; then
+   CPPFLAGS="${CPPFLAGS} -DUNW_REMOTE_ONLY"
+-- 
+2.32.0
+
-- 
2.32.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v2 5/8] nettle: disable assembler on ppc64

2021-12-20 Thread Stijn Tintel
As of version 3.7, Nettle added PowerPC64 assembly for several
algorithms. Unfortunately, they cause build to fail due to ABI mismatch:

gcm-hash.o: ABI version 1 is not compatible with ABI version 2 output

Disable assembler when ppc64 and musl are used for now.

Signed-off-by: Stijn Tintel 
---
 package/libs/nettle/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/libs/nettle/Makefile b/package/libs/nettle/Makefile
index 3b4bd9d053..87853baa82 100644
--- a/package/libs/nettle/Makefile
+++ b/package/libs/nettle/Makefile
@@ -44,7 +44,8 @@ CONFIGURE_ARGS += \
--enable-fat \
--disable-openssl \
--disable-documentation \
-   --enable-static
+   --enable-static \
+   $(if $(CONFIG_powerpc64), $(if $(CONFIG_USE_MUSL),--disable-assembler))
 
 ifeq ($(CONFIG_LIBNETTLE_MINI),y)
 CONFIGURE_ARGS += --enable-mini-gmp
-- 
2.32.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v2 2/8] toolchain/musl: ppc64: check for AltiVec in setjmp/longjmp

2021-12-20 Thread Stijn Tintel
Signed-off-by: Stijn Tintel 
---
 ...-check-for-AltiVec-in-setjmp-longjmp.patch | 82 +++
 1 file changed, 82 insertions(+)
 create mode 100644 
toolchain/musl/patches/100-ppc64-check-for-AltiVec-in-setjmp-longjmp.patch

diff --git 
a/toolchain/musl/patches/100-ppc64-check-for-AltiVec-in-setjmp-longjmp.patch 
b/toolchain/musl/patches/100-ppc64-check-for-AltiVec-in-setjmp-longjmp.patch
new file mode 100644
index 00..8b27819022
--- /dev/null
+++ b/toolchain/musl/patches/100-ppc64-check-for-AltiVec-in-setjmp-longjmp.patch
@@ -0,0 +1,82 @@
+From 0b6f90a930fcda6df287065d39e6b865428e3c69 Mon Sep 17 00:00:00 2001
+From: Stijn Tintel 
+Date: Sat, 27 Nov 2021 04:58:50 +0200
+Subject: [PATCH] ppc64: check for AltiVec in setjmp/longjmp
+
+On machines without AltiVec, the lvx and stvx instructions are not
+supported. Use __hwcap to test if AltiVec is supported.
+
+Fixes SIGILL on PowerPC 64 processors without AltiVec support.
+Runtime-tested on e5500 and e6500.
+
+Signed-off-by: Stijn Tintel 
+---
+ src/setjmp/powerpc64/longjmp.s | 13 -
+ src/setjmp/powerpc64/setjmp.s  | 13 -
+ 2 files changed, 24 insertions(+), 2 deletions(-)
+
+diff --git a/src/setjmp/powerpc64/longjmp.s b/src/setjmp/powerpc64/longjmp.s
+index 81d45ff6..da7172af 100644
+--- a/src/setjmp/powerpc64/longjmp.s
 b/src/setjmp/powerpc64/longjmp.s
+@@ -56,7 +56,17 @@ longjmp:
+   lfd 30, 38*8(3)
+   lfd 31, 39*8(3)
+ 
+-  # 6) restore vector registers v20-v31
++  # 6) restore vector registers v20-v31 if hardware supports AltiVec
++  mflr 0
++  bl 1f
++  .hidden __hwcap
++  .long __hwcap-.
++1:  mflr 4
++  lwz 5, 0(4)
++  add 4, 4, 5
++  ld 4, 0(4)
++  andis. 4, 4, 0x1000
++  beq 1f
+   addi 3, 3, 40*8
+   lvx 20, 0, 3 ; addi 3, 3, 16
+   lvx 21, 0, 3 ; addi 3, 3, 16
+@@ -70,6 +80,7 @@ longjmp:
+   lvx 29, 0, 3 ; addi 3, 3, 16
+   lvx 30, 0, 3 ; addi 3, 3, 16
+   lvx 31, 0, 3
++1:mtlr 0
+ 
+   # 7) return r4 ? r4 : 1
+   mr3,   4
+diff --git a/src/setjmp/powerpc64/setjmp.s b/src/setjmp/powerpc64/setjmp.s
+index 37683fda..32853693 100644
+--- a/src/setjmp/powerpc64/setjmp.s
 b/src/setjmp/powerpc64/setjmp.s
+@@ -69,7 +69,17 @@ __setjmp_toc:
+   stfd 30, 38*8(3)
+   stfd 31, 39*8(3)
+ 
+-  # 5) store vector registers v20-v31
++  # 5) store vector registers v20-v31 if hardware supports AltiVec
++  mflr 0
++  bl 1f
++  .hidden __hwcap
++  .long __hwcap-.
++1:mflr 4
++  lwz 5, 0(4)
++  add 4, 4, 5
++  ld 4, 0(4)
++  andis. 4, 4, 0x1000
++  beq 1f
+   addi  3, 3, 40*8
+   stvx 20, 0, 3 ; addi 3, 3, 16
+   stvx 21, 0, 3 ; addi 3, 3, 16
+@@ -83,6 +93,7 @@ __setjmp_toc:
+   stvx 29, 0, 3 ; addi 3, 3, 16
+   stvx 30, 0, 3 ; addi 3, 3, 16
+   stvx 31, 0, 3
++1:mtlr 0
+ 
+   # 6) return 0
+   li 3, 0
+-- 
+2.32.0
+
-- 
2.32.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v2 0/8] qoriq: new target

2021-12-20 Thread Stijn Tintel
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 ffe4e.ethernet eth0: Err FD status = 0x0004

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:  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 ffe4e.ethernet eth0: Err FD status = 

[PATCH v2 4/8] openssl: add ppc64 support

2021-12-20 Thread Stijn Tintel
Backport an upstream patch that adds support for ELFv2 ABI on big endian
ppc64. As musl only supports ELFv2 ABI on ppc64 regardless of
endianness, this is required to be able to build OpenSSL for ppc64be.

Modify our targets patch to add linux-powerpc64-openwrt, which will use
the linux64v2 perlasm scheme. This will probably break the combination
ppc64 with glibc, but as we really only want to support musl, this
shouldn't be a problem.

Signed-off-by: Stijn Tintel 
---
 package/libs/openssl/Makefile |  2 +-
 ...m-ppc-xlate.pl-add-linux64v2-flavour.patch | 63 +++
 .../openssl/patches/110-openwrt_targets.patch |  6 +-
 3 files changed, 69 insertions(+), 2 deletions(-)
 create mode 100644 
package/libs/openssl/patches/001-crypto-perlasm-ppc-xlate.pl-add-linux64v2-flavour.patch

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 3f5fe90d9c..0512abdc48 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -11,7 +11,7 @@ PKG_NAME:=openssl
 PKG_BASE:=1.1.1
 PKG_BUGFIX:=l
 PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX)
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_USE_MIPS16:=0
 ENGINES_DIR=engines-1.1
 
diff --git 
a/package/libs/openssl/patches/001-crypto-perlasm-ppc-xlate.pl-add-linux64v2-flavour.patch
 
b/package/libs/openssl/patches/001-crypto-perlasm-ppc-xlate.pl-add-linux64v2-flavour.patch
new file mode 100644
index 00..bdc0509f8c
--- /dev/null
+++ 
b/package/libs/openssl/patches/001-crypto-perlasm-ppc-xlate.pl-add-linux64v2-flavour.patch
@@ -0,0 +1,63 @@
+From 34ab13b7d8e3e723adb60be8142e38b7c9cd382a Mon Sep 17 00:00:00 2001
+From: Andy Polyakov 
+Date: Sun, 5 May 2019 18:25:50 +0200
+Subject: [PATCH] crypto/perlasm/ppc-xlate.pl: add linux64v2 flavour
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is a big endian ELFv2 configuration. ELFv2 was already being
+used for little endian, and big endian was traditionally ELFv1
+but there are practical configurations that use ELFv2 with big
+endian nowadays (Adélie Linux, Void Linux, possibly Gentoo, etc.)
+
+Reviewed-by: Paul Dale 
+Reviewed-by: Richard Levitte 
+(Merged from https://github.com/openssl/openssl/pull/8883)
+---
+ crypto/perlasm/ppc-xlate.pl | 8 
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/crypto/perlasm/ppc-xlate.pl b/crypto/perlasm/ppc-xlate.pl
+index e52f2f6ea6..5fcd0526df 100755
+--- a/crypto/perlasm/ppc-xlate.pl
 b/crypto/perlasm/ppc-xlate.pl
+@@ -49,7 +49,7 @@ my $globl = sub {
+   /osx/   && do { $name = "_$name";
+   last;
+ };
+-  /linux.*(32|64le)/
++  /linux.*(32|64(le|v2))/
+   && do { $ret .= ".globl $name";
+   if (!$$type) {
+   $ret .= "\n.type$name,\@function";
+@@ -80,7 +80,7 @@ my $globl = sub {
+ };
+ my $text = sub {
+ my $ret = ($flavour =~ /aix/) ? ".csect\t.text[PR],7" : ".text";
+-$ret = ".abiversion   2\n".$ret   if ($flavour =~ /linux.*64le/);
++$ret = ".abiversion   2\n".$ret   if ($flavour =~ 
/linux.*64(le|v2)/);
+ $ret;
+ };
+ my $machine = sub {
+@@ -186,7 +186,7 @@ my $vmr = sub {
+ 
+ # Some ABIs specify vrsave, special-purpose register #256, as reserved
+ # for system use.
+-my $no_vrsave = ($flavour =~ /aix|linux64le/);
++my $no_vrsave = ($flavour =~ /aix|linux64(le|v2)/);
+ my $mtspr = sub {
+ my ($f,$idx,$ra) = @_;
+ if ($idx == 256 && $no_vrsave) {
+@@ -320,7 +320,7 @@ while($line=<>) {
+   if ($label) {
+   my $xlated = ($GLOBALS{$label} or $label);
+   print "$xlated:";
+-  if ($flavour =~ /linux.*64le/) {
++  if ($flavour =~ /linux.*64(le|v2)/) {
+   if ($TYPES{$label} =~ /function/) {
+   printf "\n.localentry   %s,0\n",$xlated;
+   }
+-- 
+2.31.1
+
diff --git a/package/libs/openssl/patches/110-openwrt_targets.patch 
b/package/libs/openssl/patches/110-openwrt_targets.patch
index d0530b4661..828c14d21d 100644
--- a/package/libs/openssl/patches/110-openwrt_targets.patch
+++ b/package/libs/openssl/patches/110-openwrt_targets.patch
@@ -12,7 +12,7 @@ new file mode 100644
 index 00..86a86d31e4
 --- /dev/null
 +++ b/Configurations/25-openwrt.conf
-@@ -0,0 +1,48 @@
+@@ -0,0 +1,52 @@
 +## Openwrt "CONFIG_ARCH" matching targets.
 +
 +# The targets need to end in '-openwrt' for the AFALG patch to work
@@ -52,6 +52,10 @@ index 00..86a86d31e4
 +"linux-powerpc-openwrt" => {
 +inherit_from=> [ "linux-ppc", "openwrt" ],
 +},
++"linux-powerpc64-openwrt" => {
++inherit_from=> [ "linux-ppc64", "openwrt" ],
++perlasm_scheme  => "linux64v2",
++},
 +"linux-x86_64-openwrt" => {
 +inherit_from=> [ "linux-x86_64", "openwrt" ],
 +},
-- 
2.32.0


___
openwrt-devel 

[PATCH v2 3/8] toolchain/gcc: use ELFv2 ABI on ppc64 with musl

2021-12-20 Thread Stijn Tintel
At configuration time, gcc assumes that ppc64be targets use the ELFv1
ABI, and ppc64le targets use the ELFv2 ABI. However, musl libc does not
support the ELFv1 ABI on ppc64 at all, regardless of the endianness.

Therefore, when building for a ppc64 arch and with musl libc, instruct
gcc to use the ELFv2 ABI.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93157 for more info.

Signed-off-by: Stijn Tintel 
---
 toolchain/gcc/common.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
index a195002888..bef4fa37f8 100644
--- a/toolchain/gcc/common.mk
+++ b/toolchain/gcc/common.mk
@@ -108,6 +108,7 @@ GCC_CONFIGURE:= \
$(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
--with-abi=$(call qstrip,$(CONFIG_MIPS64_ABI))) \
$(if $(CONFIG_arc),--with-cpu=$(CONFIG_CPU_TYPE)) \
+   $(if $(CONFIG_powerpc64), $(if 
$(CONFIG_USE_MUSL),--with-abi=elfv2)) \
--with-gmp=$(TOPDIR)/staging_dir/host \
--with-mpfr=$(TOPDIR)/staging_dir/host \
--with-mpc=$(TOPDIR)/staging_dir/host \
-- 
2.32.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v2 1/8] build: add e5500 CPU_TYPE

2021-12-20 Thread Stijn Tintel
This CPU type is compatible with NXP's PPC based QorIQ processors, and
will be used by the upcoming new qoriq target.

Signed-off-by: Stijn Tintel 
---
 include/target.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/target.mk b/include/target.mk
index 60760bf602..fb57553f7d 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -234,6 +234,7 @@ ifeq ($(DUMP),1)
   endif
   ifeq ($(ARCH),powerpc64)
 CPU_TYPE ?= powerpc64
+CPU_CFLAGS_e5500:=-mcpu=e5500
 CPU_CFLAGS_powerpc64:=-mcpu=powerpc64
   endif
   ifeq ($(ARCH),sparc)
-- 
2.32.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH v1] linux-firmware: amd: consolidate amd's linux-firmware entries.

2021-12-20 Thread Christian Lamparter
this patch consolidates the amd64-microcode
(moved to linux-firmware.git, previously this was an extra
debian source package download), amdgpu and radeon firmwares
into a shared "amd" makefile.

With the upcoming 20211216 linux-firmware bump,
this will include a microcode update for ZEN 3 CPUs.

Signed-off-by: Christian Lamparter 
---
 package/firmware/amd64-microcode/Makefile | 47 ---
 package/firmware/linux-firmware/amd.mk| 29 ++
 package/firmware/linux-firmware/amdgpu.mk |  9 -
 package/firmware/linux-firmware/radeon.mk |  9 -
 4 files changed, 29 insertions(+), 65 deletions(-)
 delete mode 100644 package/firmware/amd64-microcode/Makefile
 create mode 100644 package/firmware/linux-firmware/amd.mk
 delete mode 100644 package/firmware/linux-firmware/amdgpu.mk
 delete mode 100644 package/firmware/linux-firmware/radeon.mk

diff --git a/package/firmware/amd64-microcode/Makefile 
b/package/firmware/amd64-microcode/Makefile
deleted file mode 100644
index 883c74..00
--- a/package/firmware/amd64-microcode/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Copyright (C) 2018 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=amd64-microcode
-PKG_VERSION:=20191218
-PKG_RELEASE:=1
-
-PKG_SOURCE:=amd64-microcode_3.$(PKG_VERSION).$(PKG_RELEASE).tar.xz
-PKG_SOURCE_URL:=@DEBIAN/pool/non-free/a/amd64-microcode/
-PKG_HASH:=f469b79348097c5f04641b67a39d0ee5a2a1916c9556281626c04f2275d4132d
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-3.$(PKG_VERSION).$(PKG_RELEASE)
-
-PKG_LICENSE_FILE:=LICENSE.amd-ucode
-
-PKG_FLAGS:=nonshared
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/amd64-microcode
-  SECTION:=firmware
-  CATEGORY:=Firmware
-  URL:=$(PKG_SOURCE_URL)
-  DEPENDS:=@TARGET_x86
-  TITLE:=AMD64 CPU microcode
-endef
-
-define Build/Prepare
-   rm -rf $(PKG_BUILD_DIR)
-   mkdir -p $(PKG_BUILD_DIR)
-   $(TAR) -C $(BUILD_DIR) -xJf $(DL_DIR)/$(PKG_SOURCE)
-endef
-
-define Build/Compile
-endef
-
-define Package/amd64-microcode/install
-   $(INSTALL_DIR) $(1)/lib/firmware/amd-ucode
-   $(INSTALL_DATA) $(PKG_BUILD_DIR)/*.bin $(1)/lib/firmware/amd-ucode
-endef
-
-$(eval $(call BuildPackage,amd64-microcode))
diff --git a/package/firmware/linux-firmware/amd.mk 
b/package/firmware/linux-firmware/amd.mk
new file mode 100644
index 00..68b305e862
--- /dev/null
+++ b/package/firmware/linux-firmware/amd.mk
@@ -0,0 +1,29 @@
+Package/amd64-microcode = $(call Package/firmware-default,AMD64 CPU 
microcode,@TARGET_x86)
+define Package/amd64-microcode/install
+   $(INSTALL_DIR) $(1)/lib/firmware/amd-ucode
+   $(CP) \
+   $(PKG_BUILD_DIR)/amd-ucode/*.bin \
+   $(1)/lib/firmware/amd-ucode
+endef
+
+$(eval $(call BuildPackage,amd64-microcode))
+
+Package/amdgpu-firmware = $(call Package/firmware-default,AMDGPU Video Driver 
firmware)
+define Package/amdgpu-firmware/install
+   $(INSTALL_DIR) $(1)/lib/firmware/amdgpu
+   $(CP) \
+   $(PKG_BUILD_DIR)/amdgpu/*.bin \
+   $(1)/lib/firmware/amdgpu
+endef
+
+$(eval $(call BuildPackage,amdgpu-firmware))
+
+Package/radeon-firmware = $(call Package/firmware-default,Radeon Video Driver 
firmware)
+define Package/radeon-firmware/install
+   $(INSTALL_DIR) $(1)/lib/firmware/radeon
+   $(CP) \
+   $(PKG_BUILD_DIR)/radeon/*.bin \
+   $(1)/lib/firmware/radeon
+endef
+
+$(eval $(call BuildPackage,radeon-firmware))
diff --git a/package/firmware/linux-firmware/amdgpu.mk 
b/package/firmware/linux-firmware/amdgpu.mk
deleted file mode 100644
index 89f11e7c39..00
--- a/package/firmware/linux-firmware/amdgpu.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-Package/amdgpu-firmware = $(call Package/firmware-default,AMDGPU Video Driver 
firmware)
-define Package/amdgpu-firmware/install
-   $(INSTALL_DIR) $(1)/lib/firmware/amdgpu
-   $(CP) \
-   $(PKG_BUILD_DIR)/amdgpu/*.bin \
-   $(1)/lib/firmware/amdgpu
-endef
-
-$(eval $(call BuildPackage,amdgpu-firmware))
diff --git a/package/firmware/linux-firmware/radeon.mk 
b/package/firmware/linux-firmware/radeon.mk
deleted file mode 100644
index b750efbfce..00
--- a/package/firmware/linux-firmware/radeon.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-Package/radeon-firmware = $(call Package/firmware-default,Radeon Video Driver 
firmware)
-define Package/radeon-firmware/install
-   $(INSTALL_DIR) $(1)/lib/firmware/radeon
-   $(CP) \
-   $(PKG_BUILD_DIR)/radeon/*.bin \
-   $(1)/lib/firmware/radeon
-endef
-
-$(eval $(call BuildPackage,radeon-firmware))
-- 
2.34.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] kmod-sched-core: remove fq_codel from the package

2021-12-20 Thread Rui Salvaterra
Since fq_codel is the default (and built-in), it's unnecessary to make it part
of kmod-sched-core. Remove it.

Signed-off-by: Rui Salvaterra 
---
 package/kernel/linux/modules/netsupport.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/package/kernel/linux/modules/netsupport.mk 
b/package/kernel/linux/modules/netsupport.mk
index 166172dbf3..25266594fe 100644
--- a/package/kernel/linux/modules/netsupport.mk
+++ b/package/kernel/linux/modules/netsupport.mk
@@ -722,7 +722,7 @@ $(eval $(call KernelPackage,mppe))
 
 
 SCHED_MODULES = $(patsubst $(LINUX_DIR)/net/sched/%.ko,%,$(wildcard 
$(LINUX_DIR)/net/sched/*.ko))
-SCHED_MODULES_CORE = sch_ingress sch_fq_codel sch_hfsc sch_htb sch_tbf 
cls_basic cls_fw cls_route cls_flow cls_tcindex cls_u32 em_u32 act_gact 
act_mirred act_skbedit cls_matchall
+SCHED_MODULES_CORE = sch_ingress sch_hfsc sch_htb sch_tbf cls_basic cls_fw 
cls_route cls_flow cls_tcindex cls_u32 em_u32 act_gact act_mirred act_skbedit 
cls_matchall
 SCHED_MODULES_FILTER = $(SCHED_MODULES_CORE) act_connmark act_ctinfo sch_cake 
sch_netem sch_mqprio em_ipset cls_bpf cls_flower act_bpf act_vlan
 SCHED_MODULES_EXTRA = $(filter-out $(SCHED_MODULES_FILTER),$(SCHED_MODULES))
 SCHED_FILES = $(patsubst %,$(LINUX_DIR)/net/sched/%.ko,$(filter 
$(SCHED_MODULES_CORE),$(SCHED_MODULES)))
@@ -737,7 +737,6 @@ define KernelPackage/sched-core
CONFIG_NET_SCH_HTB \
CONFIG_NET_SCH_TBF \
CONFIG_NET_SCH_INGRESS \
-   CONFIG_NET_SCH_FQ_CODEL \
CONFIG_NET_CLS=y \
CONFIG_NET_CLS_ACT=y \
CONFIG_NET_CLS_BASIC \
-- 
2.34.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] mt76: fix Makefile dependencies for mt7921

2021-12-20 Thread Lorenzo Bianconi
Signed-off-by: Lorenzo Bianconi 
---
 package/kernel/mt76/Makefile | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile
index 8210478c37f1..9af329b4867d 100644
--- a/package/kernel/mt76/Makefile
+++ b/package/kernel/mt76/Makefile
@@ -227,16 +227,17 @@ define KernelPackage/mt7915e
 endef
 
 define KernelPackage/mt7921-common
+  $(KernelPackage/mt76-default)
   TITLE:=MediaTek MT7615 wireless driver common code
   HIDDEN:=1
-  DEPENDS+=@PCI_SUPPORT +kmod-mt76-core +kmod-mt76-connac
+  DEPENDS+=+kmod-mt76-connac +@DRIVER_11AX_SUPPORT
   FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921-common.ko
 endef
 
 define KernelPackage/mt7921s
   $(KernelPackage/mt76-default)
   TITLE:=MediaTek MT7921s wireless driver
-  DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-mt76-sdio +kmod-mt7921-common
+  DEPENDS+=+kmod-mt76-sdio +kmod-mt7921-common
   FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921s.ko
   AUTOLOAD:=$(call AutoProbe,mt7921s)
 endef
@@ -244,7 +245,7 @@ endef
 define KernelPackage/mt7921e
   $(KernelPackage/mt76-default)
   TITLE:=MediaTek MT7921e wireless driver
-  DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-mt7921-common
+  DEPENDS+=@PCI_SUPPORT +kmod-mt7921-common
   FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921e.ko
   AUTOLOAD:=$(call AutoProbe,mt7921e)
 endef
-- 
2.33.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel