From 6ca347379ab548b886723b754c70807de3be3538 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 20 Jan 2023 15:13:21 +0100 Subject: [PATCH 001/104] CI: kernel: enable target testing also for pull request event Testing target changes was only set for push events. Enable this also for pull request events to enable testing pr making specific target changes. Fixes: 57a02cbbff5b ("CI: kernel: test each target with additional changes than target/linux") Signed-off-by: Christian Marangi --- .github/workflows/kernel.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kernel.yml b/.github/workflows/kernel.yml index 2582a594ba4..6a94e797798 100644 --- a/.github/workflows/kernel.yml +++ b/.github/workflows/kernel.yml @@ -8,7 +8,7 @@ on: - '.github/workflows/kernel.yml' - 'include/kernel*' - 'package/kernel/**' - - 'target/linux/generic/**' + - 'target/linux/**' push: paths: - '.github/workflows/check-kernel-patches.yml' From 6475d030b9463bf0386b10f258e1866b7793e209 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Thu, 19 Jan 2023 09:10:41 +0100 Subject: [PATCH 002/104] mvebu: cortexa9: use renamed U-boot binaries Due to upstream change in U-boot the binaries were renamed [1]. [1] https://source.denx.de/u-boot/u-boot/-/commit/87ac4b4b4ca5f00e2ddcdac41c9dc691ab2aecf1 Fixes: 2f83369e3e97 ("uboot-mvebu: update to version 2023.01") Signed-off-by: Josef Schlehofer --- target/linux/mvebu/image/cortexa9.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index d9738903fb0..4b8884383a8 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -101,7 +101,7 @@ define Device/kobol_helios4 IMAGES := sdcard.img.gz IMAGE/sdcard.img.gz := boot-scr | boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata SOC := armada-388 - UBOOT := helios4-u-boot-spl.kwb + UBOOT := helios4-u-boot-with-spl.kwb BOOT_SCRIPT := clearfog endef TARGET_DEVICES += kobol_helios4 @@ -278,7 +278,7 @@ define Device/solidrun_clearfog-base-a1 IMAGES := sdcard.img.gz IMAGE/sdcard.img.gz := boot-scr | boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata DEVICE_DTS := armada-388-clearfog-base armada-388-clearfog-pro - UBOOT := clearfog-u-boot-spl.kwb + UBOOT := clearfog-u-boot-with-spl.kwb BOOT_SCRIPT := clearfog SUPPORTED_DEVICES += armada-388-clearfog-base DEVICE_COMPAT_VERSION := 1.1 @@ -296,7 +296,7 @@ define Device/solidrun_clearfog-pro-a1 IMAGES := sdcard.img.gz IMAGE/sdcard.img.gz := boot-scr | boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base - UBOOT := clearfog-u-boot-spl.kwb + UBOOT := clearfog-u-boot-with-spl.kwb BOOT_SCRIPT := clearfog SUPPORTED_DEVICES += armada-388-clearfog armada-388-clearfog-pro endef From bf1634f318e191e7da17e34de98dbd7d5122ef8b Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 12 Jan 2023 21:32:21 -0800 Subject: [PATCH 003/104] ucode: update to latest Git HEAD To bring in isatty() support. Includes new commits: be30472bfdbb fs: add `isatty()` function 0a58d510529e nl80211: add support for NL80211_ATTR_MPATH_INFO Signed-off-by: Brian Norris [ remove additional merge commit ] Signed-off-by: Christian Marangi --- package/utils/ucode/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index 228403e0415..3913fd2aa43 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2023-01-07 -PKG_SOURCE_VERSION:=1e4d20932646f90523d21ea358c72901e3ee689e -PKG_MIRROR_HASH:=8c43b9a0a80c3de92961caad65c934bd3989e6f7f9389f676d91e2e926c9e4a6 +PKG_SOURCE_DATE:=2023-01-09 +PKG_SOURCE_VERSION:=8dad974baa4696fcba85837fa70cde8b68dd7c12 +PKG_MIRROR_HASH:=91494352ac298ac2735d62355837a1f18e366999c9e940613e6fa3265edc0364 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From d3c19c71f6044eff1677563365cea0f9e919b462 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 12 Jan 2023 21:32:16 -0800 Subject: [PATCH 004/104] base-files: Remove nand.sh dependency from emmc upgrade emmc_do_upgrade() relies on identify() from the nand.sh upgrade helper. This only works because FEATURES=emmc targets also tend to include FEATURES=nand. Rename identify_magic() to identify_magic_long() to match the common.sh style and make it clear it pairs with other *_long() variants (and not, say *_word()). Signed-off-by: Brian Norris --- .../base-files/files/lib/upgrade/common.sh | 27 ++++++++++++++++ package/base-files/files/lib/upgrade/emmc.sh | 2 +- package/base-files/files/lib/upgrade/nand.sh | 32 ++----------------- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index 5af061f6a43..53b8865a578 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -127,6 +127,33 @@ get_magic_fat32() { (get_image "$@" | dd bs=1 count=5 skip=82) 2>/dev/null } +identify_magic_long() { + local magic=$1 + case "$magic" in + "55424923") + echo "ubi" + ;; + "31181006") + echo "ubifs" + ;; + "68737173") + echo "squashfs" + ;; + "d00dfeed") + echo "fit" + ;; + "4349"*) + echo "combined" + ;; + "1f8b"*) + echo "gzip" + ;; + *) + echo "unknown $magic" + ;; + esac +} + part_magic_efi() { local magic=$(get_magic_gpt "$@") [ "$magic" = "EFI PART" ] diff --git a/package/base-files/files/lib/upgrade/emmc.sh b/package/base-files/files/lib/upgrade/emmc.sh index c3b02864aa9..49cffe1c658 100644 --- a/package/base-files/files/lib/upgrade/emmc.sh +++ b/package/base-files/files/lib/upgrade/emmc.sh @@ -58,7 +58,7 @@ emmc_copy_config() { } emmc_do_upgrade() { - local file_type=$(identify $1) + local file_type=$(identify_magic_long "$(get_magic_long "$1")") case "$file_type" in "fit") emmc_upgrade_fit $1;; diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh index a8e3cab0b8b..a1dbd6e2663 100644 --- a/package/base-files/files/lib/upgrade/nand.sh +++ b/package/base-files/files/lib/upgrade/nand.sh @@ -65,40 +65,12 @@ get_magic_long_tar() { (tar xO${3}f "$1" "$2" | dd bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2> /dev/null } -identify_magic() { - local magic=$1 - case "$magic" in - "55424923") - echo "ubi" - ;; - "31181006") - echo "ubifs" - ;; - "68737173") - echo "squashfs" - ;; - "d00dfeed") - echo "fit" - ;; - "4349"*) - echo "combined" - ;; - "1f8b"*) - echo "gzip" - ;; - *) - echo "unknown $magic" - ;; - esac -} - - identify() { - identify_magic $(nand_get_magic_long "$@") + identify_magic_long $(nand_get_magic_long "$@") } identify_tar() { - identify_magic $(get_magic_long_tar "$@") + identify_magic_long $(get_magic_long_tar "$@") } identify_if_gzip() { From 84ee3436a44dac3809b05a1c900e34dbebf030c1 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 12 Jan 2023 21:32:17 -0800 Subject: [PATCH 005/104] ipq806x: Point to externally compiled dtbs in recipes Similar to commit 4d8b42d8a777 ("ipq40xx: point to externally compiled dtbs in recipes"). Currently, we patch our DTS files into the kernel source tree, so the kernel build process will produce DTBs for us. The kernel-to-DTS dependency can cause buildroot to perform excessive rebuilds of the kernel though, which slows down device development iteration. Buildroot also compiles DTBs on its own, to $(KDIR)/image-$(DEVICE_DTS).dtb. With small adjustments, we can leverage this, and stop patching DTS files into the kernel Makefile at the same time. Signed-off-by: Brian Norris --- target/linux/ipq806x/image/Makefile | 5 +-- .../0069-arm-boot-add-dts-files.patch | 43 ------------------- .../0069-arm-boot-add-dts-files.patch | 43 ------------------- 3 files changed, 2 insertions(+), 89 deletions(-) delete mode 100644 target/linux/ipq806x/patches-5.10/0069-arm-boot-add-dts-files.patch delete mode 100644 target/linux/ipq806x/patches-5.15/0069-arm-boot-add-dts-files.patch diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile index f4f829b35c6..8c1fc88010c 100644 --- a/target/linux/ipq806x/image/Makefile +++ b/target/linux/ipq806x/image/Makefile @@ -5,7 +5,6 @@ include $(INCLUDE_DIR)/image.mk define Device/Default PROFILES := Default - KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts) KERNEL_LOADADDR = 0x42208000 DEVICE_DTS = $$(SOC)-$(lastword $(subst _, ,$(1))) DEVICE_DTS_CONFIG := config@1 @@ -22,13 +21,13 @@ endef define Device/FitImage KERNEL_SUFFIX := -fit-uImage.itb - KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb + KERNEL = kernel-bin | gzip | fit gzip $$(KDIR)/image-$$(DEVICE_DTS).dtb KERNEL_NAME := Image endef define Device/FitImageLzma KERNEL_SUFFIX := -fit-uImage.itb - KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb + KERNEL = kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(DEVICE_DTS).dtb KERNEL_NAME := Image endef diff --git a/target/linux/ipq806x/patches-5.10/0069-arm-boot-add-dts-files.patch b/target/linux/ipq806x/patches-5.10/0069-arm-boot-add-dts-files.patch deleted file mode 100644 index 4c42f40e3d7..00000000000 --- a/target/linux/ipq806x/patches-5.10/0069-arm-boot-add-dts-files.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 8f68331e14dff9a101f2d0e1d6bec84a031f27ee Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 9 Mar 2017 11:03:18 +0100 -Subject: [PATCH 69/69] arm: boot: add dts files - -Signed-off-by: John Crispin ---- - arch/arm/boot/dts/Makefile | 8 ++++++++ - 1 file changed, 8 insertions(+) - ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -909,8 +909,30 @@ dtb-$(CONFIG_ARCH_QCOM) += \ - qcom-ipq4019-ap.dk04.1-c3.dtb \ - qcom-ipq4019-ap.dk07.1-c1.dtb \ - qcom-ipq4019-ap.dk07.1-c2.dtb \ -+ qcom-ipq8062-wg2600hp3.dtb \ - qcom-ipq8064-ap148.dtb \ - qcom-ipq8064-rb3011.dtb \ -+ qcom-ipq8064-c2600.dtb \ -+ qcom-ipq8064-d7800.dtb \ -+ qcom-ipq8064-db149.dtb \ -+ qcom-ipq8064-ap161.dtb \ -+ qcom-ipq8064-ea7500-v1.dtb \ -+ qcom-ipq8064-ea8500.dtb \ -+ qcom-ipq8064-g10.dtb \ -+ qcom-ipq8064-r7500.dtb \ -+ qcom-ipq8064-r7500v2.dtb \ -+ qcom-ipq8064-unifi-ac-hd.dtb \ -+ qcom-ipq8064-wg2600hp.dtb \ -+ qcom-ipq8064-wpq864.dtb \ -+ qcom-ipq8064-wxr-2533dhp.dtb \ -+ qcom-ipq8065-nbg6817.dtb \ -+ qcom-ipq8065-r7800.dtb \ -+ qcom-ipq8065-rt4230w-rev6.dtb \ -+ qcom-ipq8065-tr4400-v2.dtb \ -+ qcom-ipq8065-xr500.dtb \ -+ qcom-ipq8068-ecw5410.dtb \ -+ qcom-ipq8068-mr42.dtb \ -+ qcom-ipq8068-mr52.dtb \ - qcom-msm8660-surf.dtb \ - qcom-msm8960-cdp.dtb \ - qcom-msm8974-fairphone-fp2.dtb \ diff --git a/target/linux/ipq806x/patches-5.15/0069-arm-boot-add-dts-files.patch b/target/linux/ipq806x/patches-5.15/0069-arm-boot-add-dts-files.patch deleted file mode 100644 index 698df248fb5..00000000000 --- a/target/linux/ipq806x/patches-5.15/0069-arm-boot-add-dts-files.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 8f68331e14dff9a101f2d0e1d6bec84a031f27ee Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Thu, 9 Mar 2017 11:03:18 +0100 -Subject: [PATCH 69/69] arm: boot: add dts files - -Signed-off-by: John Crispin ---- - arch/arm/boot/dts/Makefile | 8 ++++++++ - 1 file changed, 8 insertions(+) - ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -957,8 +957,30 @@ dtb-$(CONFIG_ARCH_QCOM) += \ - qcom-ipq4019-ap.dk04.1-c3.dtb \ - qcom-ipq4019-ap.dk07.1-c1.dtb \ - qcom-ipq4019-ap.dk07.1-c2.dtb \ -+ qcom-ipq8062-wg2600hp3.dtb \ - qcom-ipq8064-ap148.dtb \ - qcom-ipq8064-rb3011.dtb \ -+ qcom-ipq8064-c2600.dtb \ -+ qcom-ipq8064-d7800.dtb \ -+ qcom-ipq8064-db149.dtb \ -+ qcom-ipq8064-ap161.dtb \ -+ qcom-ipq8064-ea7500-v1.dtb \ -+ qcom-ipq8064-ea8500.dtb \ -+ qcom-ipq8064-g10.dtb \ -+ qcom-ipq8064-r7500.dtb \ -+ qcom-ipq8064-r7500v2.dtb \ -+ qcom-ipq8064-unifi-ac-hd.dtb \ -+ qcom-ipq8064-wg2600hp.dtb \ -+ qcom-ipq8064-wpq864.dtb \ -+ qcom-ipq8064-wxr-2533dhp.dtb \ -+ qcom-ipq8065-nbg6817.dtb \ -+ qcom-ipq8065-r7800.dtb \ -+ qcom-ipq8065-rt4230w-rev6.dtb \ -+ qcom-ipq8065-tr4400-v2.dtb \ -+ qcom-ipq8065-xr500.dtb \ -+ qcom-ipq8068-ecw5410.dtb \ -+ qcom-ipq8068-mr42.dtb \ -+ qcom-ipq8068-mr52.dtb \ - qcom-msm8226-samsung-s3ve3g.dtb \ - qcom-msm8660-surf.dtb \ - qcom-msm8960-cdp.dtb \ From 108ed0e1c7c801b174bec5d4b16ebf3411acfe51 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 12 Jan 2023 21:32:18 -0800 Subject: [PATCH 006/104] ipq806x: config-5.15: Normalize Refresh target config with `make kernel_menuconfig`, then save the result. This drops missing symbols or otherwise accounts for defaults. It should not change any functionality. Signed-off-by: Brian Norris --- target/linux/ipq806x/config-5.15 | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/target/linux/ipq806x/config-5.15 b/target/linux/ipq806x/config-5.15 index 72017e7528f..0bd6dde11cb 100644 --- a/target/linux/ipq806x/config-5.15 +++ b/target/linux/ipq806x/config-5.15 @@ -34,13 +34,14 @@ CONFIG_ARM_CPU_SUSPEND=y # CONFIG_ARM_CPU_TOPOLOGY is not set CONFIG_ARM_GIC=y CONFIG_ARM_HAS_SG_CHAIN=y +# CONFIG_ARM_IPQ806X_FAB_DEVFREQ is not set +# CONFIG_ARM_KRAIT_CACHE_DEVFREQ is not set CONFIG_ARM_L1_CACHE_SHIFT=6 CONFIG_ARM_L1_CACHE_SHIFT_6=y CONFIG_ARM_MODULE_PLTS=y CONFIG_ARM_PATCH_IDIV=y CONFIG_ARM_PATCH_PHYS_VIRT=y # CONFIG_ARM_QCOM_CPUFREQ_HW is not set -CONFIG_ARM_QCOM_CPUFREQ_KRAIT=y CONFIG_ARM_QCOM_CPUFREQ_NVMEM=y CONFIG_ARM_QCOM_SPM_CPUIDLE=y # CONFIG_ARM_SMMU is not set @@ -98,13 +99,11 @@ CONFIG_CRC16=y # CONFIG_CRC32_SARWATE is not set CONFIG_CRC32_SLICEBY8=y CONFIG_CRC8=y -CONFIG_CRYPTO_BLAKE2S=y CONFIG_CRYPTO_DEFLATE=y CONFIG_CRYPTO_DEV_QCOM_RNG=y CONFIG_CRYPTO_DRBG=y CONFIG_CRYPTO_DRBG_HMAC=y CONFIG_CRYPTO_DRBG_MENU=y -CONFIG_CRYPTO_GF128MUL=y CONFIG_CRYPTO_HASH_INFO=y CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_HW=y @@ -112,7 +111,6 @@ CONFIG_CRYPTO_JITTERENTROPY=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y CONFIG_CRYPTO_LIB_SHA256=y CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_NULL2=y CONFIG_CRYPTO_RNG=y CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_SHA256=y @@ -127,8 +125,6 @@ CONFIG_DEVFREQ_GOV_PASSIVE=y # CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND is not set # CONFIG_DEVFREQ_GOV_USERSPACE is not set # CONFIG_DEVFREQ_THERMAL is not set -# CONFIG_ARM_KRAIT_CACHE_DEVFREQ is not set -# CONFIG_ARM_IPQ806X_FAB_DEVFREQ is not set CONFIG_DMADEVICES=y CONFIG_DMA_ENGINE=y CONFIG_DMA_OF=y @@ -143,6 +139,7 @@ CONFIG_DWMAC_IPQ806X=y CONFIG_DYNAMIC_DEBUG=y CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y +CONFIG_ETHERNET_PACKET_MANGLE=y CONFIG_FIXED_PHY=y CONFIG_FIX_EARLYCON_MEM=y CONFIG_FWNODE_MDIO=y @@ -152,10 +149,12 @@ CONFIG_GENERIC_BUG=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_CPU_VULNERABILITIES=y CONFIG_GENERIC_EARLY_IOREMAP=y CONFIG_GENERIC_GETTIMEOFDAY=y CONFIG_GENERIC_IDLE_POLL_SETUP=y CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GENERIC_IRQ_MIGRATION=y CONFIG_GENERIC_IRQ_MULTI_HANDLER=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_IRQ_SHOW_LEVEL=y @@ -173,6 +172,7 @@ CONFIG_GENERIC_STRNCPY_FROM_USER=y CONFIG_GENERIC_STRNLEN_USER=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GENERIC_VDSO_32=y +CONFIG_GLOB=y CONFIG_GPIOLIB_IRQCHIP=y CONFIG_GPIO_CDEV=y CONFIG_GRO_CELLS=y @@ -185,6 +185,7 @@ CONFIG_HAS_IOPORT_MAP=y CONFIG_HAVE_SMP=y CONFIG_HIGHMEM=y # CONFIG_HIGHPTE is not set +CONFIG_HOTPLUG_CPU=y CONFIG_HWMON=y CONFIG_HWSPINLOCK=y CONFIG_HWSPINLOCK_QCOM=y @@ -214,12 +215,12 @@ CONFIG_IRQ_FASTEOI_HIERARCHY_HANDLERS=y CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_WORK=y CONFIG_KMAP_LOCAL=y +CONFIG_KMAP_LOCAL_NON_LINEAR_PTE_ARRAY=y CONFIG_KPSS_XCC=y CONFIG_KRAITCC=y CONFIG_KRAIT_CLOCKS=y CONFIG_KRAIT_L2_ACCESSORS=y CONFIG_LIBFDT=y -CONFIG_LLD_VERSION=0 CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_LOCK_SPIN_ON_OWNER=y CONFIG_LZO_COMPRESS=y @@ -300,6 +301,7 @@ CONFIG_NR_CPUS=2 CONFIG_NVMEM=y CONFIG_NVMEM_QCOM_QFPROM=y # CONFIG_NVMEM_SPMI_SDAM is not set +CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y @@ -308,7 +310,6 @@ CONFIG_OF_GPIO=y CONFIG_OF_IRQ=y CONFIG_OF_KOBJ=y CONFIG_OF_MDIO=y -CONFIG_OF_NET=y CONFIG_OLD_SIGACTION=y CONFIG_OLD_SIGSUSPEND3=y CONFIG_PADATA=y @@ -397,7 +398,7 @@ CONFIG_QCOM_SCM=y # CONFIG_QCOM_SCM_DOWNLOAD_MODE_DEFAULT is not set CONFIG_QCOM_SMEM=y # CONFIG_QCOM_SMSM is not set -# CONFIG_QCOM_SOCINFO is not set +CONFIG_QCOM_SOCINFO=y CONFIG_QCOM_TCSR=y CONFIG_QCOM_TSENS=y CONFIG_QCOM_WDT=y @@ -452,6 +453,7 @@ CONFIG_SMP_ON_UP=y # CONFIG_SM_VIDEOCC_8150 is not set # CONFIG_SM_VIDEOCC_8250 is not set CONFIG_SOCK_RX_QUEUE_MAPPING=y +CONFIG_SOC_BUS=y CONFIG_SPARSE_IRQ=y CONFIG_SPI=y CONFIG_SPI_MASTER=y From c20915e8414c02cff24b9938944c63862176d2c2 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 12 Jan 2023 21:32:19 -0800 Subject: [PATCH 007/104] ipq806x: ASoC: qcom: lpass-cpu: Fix fallback SD line index handling This fixes device tree registration for 'qcom,lpass-cpu' as used by qcom-ipq8064 SoCs, and allows speaker audio to function. This patch has been submitted (and merged, for -next; likely v6.3) upstream. Signed-off-by: Brian Norris --- ...cpu-Fix-fallback-SD-line-index-handl.patch | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 target/linux/ipq806x/patches-5.15/007-v6.3-ASoC-qcom-lpass-cpu-Fix-fallback-SD-line-index-handl.patch diff --git a/target/linux/ipq806x/patches-5.15/007-v6.3-ASoC-qcom-lpass-cpu-Fix-fallback-SD-line-index-handl.patch b/target/linux/ipq806x/patches-5.15/007-v6.3-ASoC-qcom-lpass-cpu-Fix-fallback-SD-line-index-handl.patch new file mode 100644 index 00000000000..099dc606114 --- /dev/null +++ b/target/linux/ipq806x/patches-5.15/007-v6.3-ASoC-qcom-lpass-cpu-Fix-fallback-SD-line-index-handl.patch @@ -0,0 +1,42 @@ +From: Brian Norris +Date: Thu, 15 Dec 2022 01:33:45 -0800 +Subject: [PATCH] ASoC: qcom: lpass-cpu: Fix fallback SD line index handling + +[[ Submitted upstream as: + https://lore.kernel.org/all/20221231061545.2110253-1-computersforpeace@gmail.com/ + Currently queued for -next (v6.3?) as: + 000bca8d706d ASoC: qcom: lpass-cpu: Fix fallback SD line index handling +]] + +These indices should reference the ID placed within the dai_driver +array, not the indices of the array itself. + +This fixes commit 4ff028f6c108 ("ASoC: qcom: lpass-cpu: Make I2S SD +lines configurable"), which among others, broke IPQ8064 audio +(sound/soc/qcom/lpass-ipq806x.c) because it uses ID 4 but we'd stop +initializing the mi2s_playback_sd_mode and mi2s_capture_sd_mode arrays +at ID 0. + +Fixes: 4ff028f6c108 ("ASoC: qcom: lpass-cpu: Make I2S SD lines configurable") +Cc: +Signed-off-by: Brian Norris +--- + sound/soc/qcom/lpass-cpu.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/sound/soc/qcom/lpass-cpu.c ++++ b/sound/soc/qcom/lpass-cpu.c +@@ -851,10 +851,11 @@ static void of_lpass_cpu_parse_dai_data( + struct lpass_data *data) + { + struct device_node *node; +- int ret, id; ++ int ret, i, id; + + /* Allow all channels by default for backwards compatibility */ +- for (id = 0; id < data->variant->num_dai; id++) { ++ for (i = 0; i < data->variant->num_dai; i++) { ++ id = data->variant->dai_driver[i].id; + data->mi2s_playback_sd_mode[id] = LPAIF_I2SCTL_MODE_8CH; + data->mi2s_capture_sd_mode[id] = LPAIF_I2SCTL_MODE_8CH; + } From 69d1b289b02a4a01bf0801f1000d59978fe5ecfe Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 12 Jan 2023 21:32:20 -0800 Subject: [PATCH 008/104] ipq806x: Add kmod-sound-soc-ipq8064-storm For IPQ8064 systems based off the "Google Storm" reference platform, such as the TP-Link OnHub. Signed-off-by: Brian Norris --- target/linux/ipq806x/modules.mk | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/target/linux/ipq806x/modules.mk b/target/linux/ipq806x/modules.mk index 605504b0c33..a2b844d0f03 100644 --- a/target/linux/ipq806x/modules.mk +++ b/target/linux/ipq806x/modules.mk @@ -14,3 +14,32 @@ define KernelPackage/phy-qcom-ipq806x-usb/description endef $(eval $(call KernelPackage,phy-qcom-ipq806x-usb)) + + +define KernelPackage/sound-soc-ipq8064-storm + TITLE:=Qualcomm IPQ8064 SoC support for Google Storm + DEPENDS:=@TARGET_ipq806x +kmod-sound-soc-core + KCONFIG:=\ + CONFIG_IPQ_LCC_806X \ + CONFIG_SND_SOC_QCOM \ + CONFIG_SND_SOC_STORM \ + CONFIG_SND_SOC_APQ8016_SBC=n \ + CONFIG_SND_SOC_SC7180=n + FILES:=\ + $(LINUX_DIR)/drivers/clk/qcom/lcc-ipq806x.ko \ + $(LINUX_DIR)/sound/soc/codecs/snd-soc-max98357a.ko \ + $(LINUX_DIR)/sound/soc/qcom/snd-soc-lpass-cpu.ko \ + $(LINUX_DIR)/sound/soc/qcom/snd-soc-lpass-ipq806x.ko \ + $(LINUX_DIR)/sound/soc/qcom/snd-soc-lpass-platform.ko \ + $(LINUX_DIR)/sound/soc/qcom/snd-soc-storm.ko + AUTOLOAD:=$(call AutoProbe,lcc-ipq806x \ + snd-soc-max98357a snd-soc-lpass-ipq806x snd-soc-storm) + $(call AddDepends/sound) +endef + +define KernelPackage/sound-soc-ipq8064-storm/description + Provides sound support for the Google Storm platform, with a Qualcomm IPQ8064 + SoC. +endef + +$(eval $(call KernelPackage,sound-soc-ipq8064-storm)) From bd0f9d8ffcd1dc169fb66f9d7ddb335abbe49d37 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 20 Jan 2023 15:06:11 +0100 Subject: [PATCH 009/104] fstools: bump to latest Git HEAD e9b59f0 partname: Ignore root=PARTUUID... Signed-off-by: Christian Marangi --- package/system/fstools/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/fstools/Makefile b/package/system/fstools/Makefile index f716f26c056..8892ec2dd60 100644 --- a/package/system/fstools/Makefile +++ b/package/system/fstools/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git -PKG_MIRROR_HASH:=28be14a1e28fc62e80681e1b5e7f2435692ee326b66afcc1f3d158764df686d5 -PKG_SOURCE_DATE:=2022-11-10 -PKG_SOURCE_VERSION:=3affe9ea5098c8bb90111ce97d50ad976ef0c034 +PKG_MIRROR_HASH:=03abdf55e2ea32e4e82784c82bb357ab93d62a09966ef1ccacc3de9e45d44614 +PKG_SOURCE_DATE:=2023-01-20 +PKG_SOURCE_VERSION:=e9b59f063bb333df6d58bf434554753d123a713f CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From ef649b0b14814a84a480e9b7805e4a401e9e06b6 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 12 Jan 2023 21:32:22 -0800 Subject: [PATCH 010/104] ipq806x: Initial TP-Link and ASUS OnHub support TP-Link and ASUS OnHub devices are very similar, sharing many of the same characteristics and much of their Device Tree. They both run a version of ChromeOS for their factory firmware, and so installation instructions look very similar to Google Wifi [1]. Things I've tested, and are working: * Ethernet * WiFi (2.4 and 5 GHz) * LEDs * USB * eMMC * Serial console (if you wire it up yourself) * 2x CPU * Speaker == Installation instructions summary == 1. Flash *-factory.bin to a USB drive (e.g., with `dd`) 2. Insert USB drive, to boot OpenWrt from USB 3. Copy the same *-factory.bin over to device, and flash it to eMMC to make OpenWrt permanent == Developer mode, booting from USB (Step 2) == To enter Developer Mode and boot OpenWrt from a USB stick: 1. Unplug power 2. Gain access to the "developer switch" through the bottom of the device 3. Hold down the "reset switch" (near the USB port / power plug) 4. Plug power back in 5. The LED on the device should turn white, then blink orange, then red. Release the reset switch. 6. Insert USB drive with OpenWrt factory.bin 7. Press the hidden developer switch under the device to boot to USB; you should see some activity lights (if you have any) on your USB drive 8. Depending on your configuration, the router's LED(s) should come on. You're now running OpenWrt off a USB stick. These instructions are derived from: https://www.exploitee.rs/index.php/Rooting_The_Google_OnHub#Enabling_%22Developer_Mode%22_on_the_OnHub https://www.exploitee.rs/index.php/Asus_OnHub#Enabling_%22Developer_Mode%22_on_the_OnHub ~~Finding the developer switch:~~ for TP-Link, the developer switch is on the bottom of the device, underneath some of the rubber padding and a screw. For ASUS, remove the entire base, via 4 screws under the rubber feet. See the Exploitee instructions for more info and photos. == Making OpenWrt permanent (on eMMC) (Step 3) == Once you're running OpenWrt via USB: 1. Connect Ethernet to the LAN port; router's LAN address should be at 192.168.1.1 2. Connect another system to the router's LAN, and copy the factory.bin image over, via SCP and SSH: scp -O openwrt-ipq806x-chromium-tplink_onhub-squashfs-factory.bin root@192.168.1.1: ssh root@192.168.1.1 -C "dd if=/dev/zero bs=512 seek=7552991 of=/dev/mmcblk0 count=33 && \ dd if=/root/openwrt-ipq806x-chromium-tplink_onhub-squashfs-factory.bin of=/dev/mmcblk0" 3. Reboot and remove the USB drive. == Developer mode beep == Note that every time you boot the OnHub in developer mode, the device will play a loud "beep" after a few seconds. This is described in the Chromium docs [2], and is intended to make it clear that the device is not running Google software. It is nontrivial to completely disable this beep, although it's possible to "acknowledge" developer mode (and skip the beep) by using a USB keyboard to press CTRL+D every time you boot. [1] https://openwrt.org/toh/google/wifi [2] https://chromium.googlesource.com/chromiumos/docs/+/HEAD/developer_mode.md Signed-off-by: Brian Norris --- target/linux/ipq806x/Makefile | 4 +- .../ipq806x/base-files/etc/board.d/02_network | 6 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 35 ++ .../base-files/lib/upgrade/platform.sh | 19 + .../base-files/usr/bin/base64decode.uc | 23 + target/linux/ipq806x/chromium/config-default | 13 + target/linux/ipq806x/chromium/target.mk | 2 + .../arm/boot/dts/qcom-ipq8064-asus-onhub.dts | 96 ++++ .../arch/arm/boot/dts/qcom-ipq8064-onhub.dtsi | 463 ++++++++++++++++++ .../boot/dts/qcom-ipq8064-tplink-onhub.dts | 213 ++++++++ target/linux/ipq806x/generic/target.mk | 1 + target/linux/ipq806x/image/chromium.mk | 58 +++ 12 files changed, 931 insertions(+), 2 deletions(-) create mode 100755 target/linux/ipq806x/base-files/usr/bin/base64decode.uc create mode 100644 target/linux/ipq806x/chromium/config-default create mode 100644 target/linux/ipq806x/chromium/target.mk create mode 100644 target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8064-asus-onhub.dts create mode 100644 target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8064-onhub.dtsi create mode 100644 target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8064-tplink-onhub.dts create mode 100644 target/linux/ipq806x/image/chromium.mk diff --git a/target/linux/ipq806x/Makefile b/target/linux/ipq806x/Makefile index 862ad7da004..5c89d413c0d 100644 --- a/target/linux/ipq806x/Makefile +++ b/target/linux/ipq806x/Makefile @@ -5,10 +5,10 @@ include $(TOPDIR)/rules.mk ARCH:=arm BOARD:=ipq806x BOARDNAME:=Qualcomm Atheros IPQ806X -FEATURES:=squashfs nand fpu ramdisk +FEATURES:=squashfs fpu ramdisk CPU_TYPE:=cortex-a15 CPU_SUBTYPE:=neon-vfpv4 -SUBTARGETS:=generic +SUBTARGETS:=generic chromium KERNEL_PATCHVER:=5.15 diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network index dbff854731a..f38876b69f0 100644 --- a/target/linux/ipq806x/base-files/etc/board.d/02_network +++ b/target/linux/ipq806x/base-files/etc/board.d/02_network @@ -79,6 +79,12 @@ tplink,ad7200) ucidef_add_switch "switch0" \ "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0" ;; +asus,onhub |\ +tplink,onhub) + ucidef_set_interfaces_lan_wan "eth1" "eth0" + ucidef_add_switch "switch0" \ + "1:lan" "6@eth1" "2:wan" "0@eth0" + ;; ubnt,unifi-ac-hd) ucidef_set_interface_lan "eth0 eth1" ;; diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 398ddf9a290..a0e2e9d1237 100644 --- a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -6,9 +6,32 @@ board=$(board_name) +dt_base64_extract() { + local target_dir="/sys$DEVPATH" + local source="$target_dir/../../of_node/qcom,ath10k-calibration-data-base64" + + [ -e "$source" ] || caldata_die "cannot find base64 calibration data: $source" + [ -d "$target_dir" ] || \ + caldata_die "no sysfs dir to write: $target" + + echo 1 > "$target_dir/loading" + base64decode.uc "$source" > "$target_dir/data" + if [ $? != 0 ]; then + echo 1 > "$target_dir/loading" + caldata_die \ + "failed to write calibration data to $target_dir/data" + else + echo 0 > "$target_dir/loading" + fi +} + case "$FIRMWARE" in "ath10k/cal-pci-0000:01:00.0.bin") case "$board" in + asus,onhub |\ + tplink,onhub) + dt_base64_extract + ;; meraki,mr52) CI_UBIPART=art caldata_extract_ubi "ART" 0x1000 0x844 @@ -35,6 +58,14 @@ case "$FIRMWARE" in ;; esac ;; +"ath10k/cal-pci-0001:01:00.0.bin") + case "$board" in + asus,onhub |\ + tplink,onhub) + dt_base64_extract + ;; + esac + ;; "ath10k/pre-cal-pci-0001:01:00.0.bin") case $board in asrock,g10) @@ -61,6 +92,10 @@ case "$FIRMWARE" in ;; "ath10k/cal-pci-0002:01:00.0.bin") case "$board" in + asus,onhub |\ + tplink,onhub) + dt_base64_extract + ;; meraki,mr42) CI_UBIPART=art caldata_extract_ubi "ART" 0x9000 0x844 diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh index f9e592f4bd8..67ceaab24fb 100644 --- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh @@ -57,6 +57,15 @@ platform_do_upgrade() { MTD_CONFIG_ARGS="-s 0x200000" default_do_upgrade "$1" ;; + asus,onhub |\ + tplink,onhub) + export_bootdevice + export_partdevice CI_ROOTDEV 0 + CI_KERNPART="kernel" + CI_ROOTPART="rootfs" + CI_DATAPART="rootfs_data" + emmc_do_upgrade "$1" + ;; tplink,vr2600v) MTD_CONFIG_ARGS="-s 0x200000" default_do_upgrade "$1" @@ -69,3 +78,13 @@ platform_do_upgrade() { ;; esac } + +platform_copy_config() { + case "${board_name}" in + asus,onhub |\ + tplink,onhub) + emmc_copy_config + ;; + esac + return 0 +} diff --git a/target/linux/ipq806x/base-files/usr/bin/base64decode.uc b/target/linux/ipq806x/base-files/usr/bin/base64decode.uc new file mode 100755 index 00000000000..7dcf30986c0 --- /dev/null +++ b/target/linux/ipq806x/base-files/usr/bin/base64decode.uc @@ -0,0 +1,23 @@ +#!/usr/bin/ucode + +import { stdin, open, error } from 'fs'; + +if (length(ARGV) == 0 && stdin.isatty()) { + warn("usage: b64decode [stdin|path]\n"); + exit(1); +} + +let fp = stdin; +let source = ARGV[0]; + +if (source) { + fp = open(source); + if (!fp) { + warn('b64decode: unable to open ${source}: ${error()}\n'); + exit(1); + } +} + +print(b64dec(fp.read("all"))); +fp.close(); +exit(0); diff --git a/target/linux/ipq806x/chromium/config-default b/target/linux/ipq806x/chromium/config-default new file mode 100644 index 00000000000..d7db9f7db35 --- /dev/null +++ b/target/linux/ipq806x/chromium/config-default @@ -0,0 +1,13 @@ +CONFIG_BLK_DEV_SD=y +CONFIG_LEDS_LP5523=y +CONFIG_LEDS_LP55XX_COMMON=y +CONFIG_PHY_QCOM_IPQ806X_USB=y +CONFIG_SCSI=y +CONFIG_SCSI_COMMON=y +CONFIG_SG_POOL=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_HOST=y +CONFIG_USB_DWC3_QCOM=y +CONFIG_USB_STORAGE=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_PLATFORM=y diff --git a/target/linux/ipq806x/chromium/target.mk b/target/linux/ipq806x/chromium/target.mk new file mode 100644 index 00000000000..3983a9281a5 --- /dev/null +++ b/target/linux/ipq806x/chromium/target.mk @@ -0,0 +1,2 @@ +BOARDNAME:=Google Chromium +FEATURES += emmc boot-part rootfs-part diff --git a/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8064-asus-onhub.dts b/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8064-asus-onhub.dts new file mode 100644 index 00000000000..5b60ddb04b3 --- /dev/null +++ b/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8064-asus-onhub.dts @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2014 The ChromiumOS Authors + */ + +#include "qcom-ipq8064-onhub.dtsi" +#include +#include +#include + +/ { + model = "ASUS OnHub"; + compatible = "asus,onhub", "google,arkham", "qcom,ipq8064"; + + chosen { + bootargs-append = " rootwait"; + }; +}; + +&qcom_pinmux { + ap3223_pins: ap3223_pinmux { + pins = "gpio22"; + function = "gpio"; + bias-none; + }; + + i2c7_pins: i2c7_pinmux { + mux { + pins = "gpio8", "gpio9"; + function = "gsbi7"; + }; + data { + pins = "gpio8"; + bias-disable; + }; + clk { + pins = "gpio9"; + bias-disable; + }; + }; +}; + +&gsbi7 { + status = "okay"; + qcom,mode = ; +}; + +&gsbi7_i2c { + status = "okay"; + clock-frequency = <100000>; + pinctrl-0 = <&i2c7_pins>; + pinctrl-names = "default"; + + ap3223@1c { + compatible = "dynaimage,ap3223"; + reg = <0x1c>; + + pinctrl-0 = <&ap3223_pins>; + pinctrl-names = "default"; + + int-gpio = <&qcom_pinmux 22 GPIO_ACTIVE_LOW>; + }; + + led-controller@32 { + compatible = "national,lp5523"; + reg = <0x32>; + clock-mode = /bits/ 8 <1>; + #address-cells = <1>; + #size-cells = <0>; + + led@4 { + reg = <4>; + color = ; + chan-name = "green:status"; + linux,default-trigger = "default-on"; + led-cur = /bits/ 8 <0xfa>; + max-cur = /bits/ 8 <0xff>; + }; + + led@5 { + reg = <5>; + color = ; + chan-name = "blue:status"; + led-cur = /bits/ 8 <0xfa>; + max-cur = /bits/ 8 <0xff>; + }; + + led@8 { + reg = <8>; + color = ; + chan-name = "red:status"; + led-cur = /bits/ 8 <0xfa>; + max-cur = /bits/ 8 <0xff>; + }; + }; +}; diff --git a/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8064-onhub.dtsi b/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8064-onhub.dtsi new file mode 100644 index 00000000000..25ba71da00e --- /dev/null +++ b/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8064-onhub.dtsi @@ -0,0 +1,463 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2014 The ChromiumOS Authors + */ + +#include "qcom-ipq8064-smb208.dtsi" +#include +#include + +/ { + aliases { + ethernet0 = &gmac0; + ethernet1 = &gmac2; + mdio-gpio0 = &mdio; + serial0 = &gsbi4_serial; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + rsvd@41200000 { + reg = <0x41200000 0x300000>; + no-map; + }; + }; + + mdio: mdio { + compatible = "virtual,mdio-gpio"; + #address-cells = <1>; + #size-cells = <0>; + gpios = <&qcom_pinmux 1 GPIO_ACTIVE_HIGH>, + <&qcom_pinmux 0 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + + phy0: ethernet-phy@0 { + reg = <0>; + qca,ar8327-initvals = < + 0x00004 0x7600000 /* PAD0_MODE */ + 0x00008 0x1000000 /* PAD5_MODE */ + 0x0000c 0x80 /* PAD6_MODE */ + 0x000e4 0xaa545 /* MAC_POWER_SEL */ + 0x000e0 0xc74164de /* SGMII_CTRL */ + 0x0007c 0x4e /* PORT0_STATUS */ + 0x00094 0x4e /* PORT6_STATUS */ + >; + }; + + phy1: ethernet-phy@1 { + reg = <1>; + }; + }; + + soc { + rng@1a500000 { + status = "disabled"; + }; + + sound { + compatible = "google,storm-audio"; + qcom,model = "ipq806x-storm"; + cpu = <&lpass>; + codec = <&max98357a>; + }; + + lpass: lpass@28100000 { + status = "okay"; + pinctrl-names = "default", "idle"; + pinctrl-0 = <&mi2s_default>; + pinctrl-1 = <&mi2s_idle>; + }; + + max98357a: max98357a { + compatible = "maxim,max98357a"; + #sound-dai-cells = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmode_pins>; + sdmode-gpios = <&qcom_pinmux 25 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&qcom_pinmux { + rgmii0_pins: rgmii0_pins { + mux { + pins = "gpio2", "gpio66"; + drive-strength = <8>; + bias-disable; + }; + }; + mi2s_pins { + mi2s_default: mi2s_default { + dout { + pins = "gpio32"; + function = "mi2s"; + drive-strength = <16>; + bias-disable; + }; + sync { + pins = "gpio27"; + function = "mi2s"; + drive-strength = <16>; + bias-disable; + }; + clk { + pins = "gpio28"; + function = "mi2s"; + drive-strength = <16>; + bias-disable; + }; + }; + mi2s_idle: mi2s_idle { + dout { + pins = "gpio32"; + function = "mi2s"; + drive-strength = <2>; + bias-pull-down; + }; + sync { + pins = "gpio27"; + function = "mi2s"; + drive-strength = <2>; + bias-pull-down; + }; + clk { + pins = "gpio28"; + function = "mi2s"; + drive-strength = <2>; + bias-pull-down; + }; + }; + }; + + mdio_pins: mdio_pins { + mux { + pins = "gpio0", "gpio1"; + function = "gpio"; + drive-strength = <8>; + bias-disable; + }; + rst { + pins = "gpio26"; + output-low; + }; + }; + + sdmode_pins: sdmode_pinmux { + pins = "gpio25"; + function = "gpio"; + drive-strength = <16>; + bias-disable; + }; + + sdcc1_pins: sdcc1_pinmux { + mux { + pins = "gpio38", "gpio39", "gpio40", + "gpio41", "gpio42", "gpio43", + "gpio44", "gpio45", "gpio46", + "gpio47"; + function = "sdc1"; + }; + cmd { + pins = "gpio45"; + drive-strength = <10>; + bias-pull-up; + }; + data { + pins = "gpio38", "gpio39", "gpio40", + "gpio41", "gpio43", "gpio44", + "gpio46", "gpio47"; + drive-strength = <10>; + bias-pull-up; + }; + clk { + pins = "gpio42"; + drive-strength = <16>; + bias-pull-down; + }; + }; + + i2c1_pins: i2c1_pinmux { + pins = "gpio53", "gpio54"; + function = "gsbi1"; + bias-disable; + }; + + rpm_i2c_pinmux: rpm_i2c_pinmux { + mux { + pins = "gpio12", "gpio13"; + function = "gsbi4"; + drive-strength = <12>; + bias-disable; + }; + }; + + spi_pins: spi_pins { + mux { + pins = "gpio18", "gpio19", "gpio21"; + function = "gsbi5"; + bias-pull-down; + /delete-property/ bias-none; + /delete-property/ drive-strength; + }; + data { + pins = "gpio18", "gpio19"; + drive-strength = <10>; + }; + cs { + pins = "gpio20"; + drive-strength = <10>; + bias-pull-up; + }; + clk { + pins = "gpio21"; + drive-strength = <12>; + }; + }; + + fw_pinmux { + wp { + pins = "gpio17"; + output-low; + }; + recovery { + pins = "gpio16"; + bias-none; + }; + developer { + pins = "gpio15"; + bias-none; + }; + }; + + spi6_pins: spi6_pins { + mux { + pins = "gpio55", "gpio56", "gpio58"; + function = "gsbi6"; + bias-pull-down; + }; + data { + pins = "gpio55", "gpio56"; + drive-strength = <10>; + }; + cs { + pins = "gpio57"; + drive-strength = <10>; + bias-pull-up; + output-high; + }; + clk { + pins = "gpio58"; + drive-strength = <12>; + }; + }; +}; + +&gmac0 { + status = "okay"; + phy-mode = "rgmii"; + qcom,id = <0>; + phy-handle = <&phy1>; + + pinctrl-0 = <&rgmii0_pins>; + pinctrl-names = "default"; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&gmac2 { + status = "okay"; + phy-mode = "sgmii"; + qcom,id = <2>; + phy-handle = <&phy0>; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&gsbi1 { + status = "okay"; + qcom,mode = ; +}; + +&gsbi1_i2c { + status = "okay"; + + clock-frequency = <100000>; + + pinctrl-0 = <&i2c1_pins>; + pinctrl-names = "default"; + + tpm@20 { + compatible = "infineon,slb9645tt"; + reg = <0x20>; + powered-while-suspended; + }; +}; + +&gsbi4 { + status = "okay"; + qcom,mode = ; +}; + +&gsbi4_serial { + status = "okay"; +}; + +&gsbi5 { + status = "okay"; + qcom,mode = ; + + spi4: spi@1a280000 { + status = "okay"; + spi-max-frequency = <50000000>; + pinctrl-0 = <&spi_pins>; + pinctrl-names = "default"; + + cs-gpios = <&qcom_pinmux 20 0>; + + flash: flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <50000000>; + reg = <0>; + }; + }; +}; + +&gsbi6 { + status = "okay"; + qcom,mode = ; +}; + +&gsbi6_spi { + status = "okay"; + spi-max-frequency = <25000000>; + + pinctrl-0 = <&spi6_pins>; + pinctrl-names = "default"; + + cs-gpios = <&qcom_pinmux 57 GPIO_ACTIVE_HIGH>; + + dmas = <&adm_dma 8 0xb>, + <&adm_dma 7 0x14>; + dma-names = "rx", "tx"; + + /* + * This "spidev" was included in the manufacturer device tree. I suspect + * it's the (unused) Zigbee radio -- SiliconLabs EM3581 Zigbee? There's + * no driver or binding for this at the moment. + */ + spidev@0 { + compatible = "spidev"; + reg = <0>; + spi-max-frequency = <25000000>; + }; +}; + +&pcie0 { + status = "okay"; + + pcie@0 { + reg = <0 0 0 0 0>; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + device_type = "pci"; + + ath10k@0,0 { + reg = <0 0 0 0 0>; + device_type = "pci"; + qcom,ath10k-sa-gpio = <2 3 4 0>; + qcom,ath10k-sa-gpio-func = <5 5 5 0>; + }; + }; +}; + +&pcie1 { + status = "okay"; + + pcie@0 { + reg = <0 0 0 0 0>; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + device_type = "pci"; + + ath10k@0,0 { + reg = <0 0 0 0 0>; + device_type = "pci"; + qcom,ath10k-sa-gpio = <2 3 4 0>; + qcom,ath10k-sa-gpio-func = <5 5 5 0>; + }; + }; +}; + +&pcie2 { + status = "okay"; + + pcie@0 { + reg = <0 0 0 0 0>; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + device_type = "pci"; + + ath10k@0,0 { + reg = <0 0 0 0 0>; + device_type = "pci"; + }; + }; +}; + +&rpm { + pinctrl-0 = <&rpm_i2c_pinmux>; + pinctrl-names = "default"; +}; + +&sdcc1 { + status = "okay"; + pinctrl-0 = <&sdcc1_pins>; + pinctrl-names = "default"; + /delete-property/ mmc-ddr-1_8v; +}; + +&tcsr { + compatible = "qcom,tcsr-ipq8064", "qcom,tcsr", "syscon"; + qcom,usb-ctrl-select = ; +}; + +&hs_phy_0 { + status = "okay"; +}; + +&ss_phy_0 { + status = "okay"; +}; + +&usb3_0 { + status = "okay"; +}; + +&hs_phy_1 { + status = "okay"; +}; + +&ss_phy_1 { + status = "okay"; +}; + +&usb3_1 { + status = "okay"; +}; diff --git a/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8064-tplink-onhub.dts b/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8064-tplink-onhub.dts new file mode 100644 index 00000000000..6dd39f0d958 --- /dev/null +++ b/target/linux/ipq806x/files-5.15/arch/arm/boot/dts/qcom-ipq8064-tplink-onhub.dts @@ -0,0 +1,213 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2014 The ChromiumOS Authors + */ + +#include "qcom-ipq8064-onhub.dtsi" +#include +#include +#include + +/ { + model = "TP-Link OnHub"; + compatible = "tplink,onhub", "google,whirlwind-sp5", "qcom,ipq8064"; + + chosen { + bootargs-append = " rootwait"; + }; +}; + +&qcom_pinmux { + i2c7_pins: i2c7_pinmux { + mux { + pins = "gpio8", "gpio9"; + function = "gsbi7"; + }; + data { + pins = "gpio8"; + bias-disable; + }; + clk { + pins = "gpio9"; + bias-disable; + }; + }; +}; + +&gsbi7 { + status = "okay"; + qcom,mode = ; +}; + +&gsbi7_i2c { + status = "okay"; + clock-frequency = <100000>; + pinctrl-0 = <&i2c7_pins>; + pinctrl-names = "default"; + + led-controller@32 { + compatible = "national,lp5523"; + reg = <0x32>; + clock-mode = /bits/ 8 <1>; + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + chan-name = "red:status-0"; + linux,default-trigger = "default-on"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@1 { + reg = <1>; + color = ; + chan-name = "green:status-0"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@2 { + reg = <2>; + color = ; + chan-name = "blue:status-0"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@3 { + reg = <3>; + color = ; + chan-name = "red:status-1"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@4 { + reg = <4>; + color = ; + chan-name = "green:status-1"; + linux,default-trigger = "default-on"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@5 { + reg = <5>; + color = ; + chan-name = "blue:status-1"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@6 { + reg = <6>; + color = ; + chan-name = "red:status-2"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@7 { + reg = <7>; + color = ; + chan-name = "green:status-2"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@8 { + reg = <8>; + color = ; + chan-name = "blue:status-2"; + linux,default-trigger = "default-on"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + }; + + led-controller@33 { + compatible = "national,lp5523"; + reg = <0x33>; + clock-mode = /bits/ 8 <1>; + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = ; + chan-name = "red:status-3"; + linux,default-trigger = "default-on"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@1 { + reg = <1>; + color = ; + chan-name = "green:status-3"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@2 { + reg = <2>; + color = ; + chan-name = "blue:status-3"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@3 { + reg = <3>; + color = ; + chan-name = "red:status-4"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@4 { + reg = <4>; + color = ; + chan-name = "green:status-4"; + linux,default-trigger = "default-on"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@5 { + reg = <5>; + color = ; + chan-name = "blue:status-4"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@6 { + reg = <6>; + color = ; + chan-name = "red:status-5"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@7 { + reg = <7>; + color = ; + chan-name = "green:status-5"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + + led@8 { + reg = <8>; + color = ; + chan-name = "blue:status-5"; + linux,default-trigger = "default-on"; + led-cur = /bits/ 8 <0x64>; + max-cur = /bits/ 8 <0x78>; + }; + }; +}; diff --git a/target/linux/ipq806x/generic/target.mk b/target/linux/ipq806x/generic/target.mk index f5cb1fb19b9..4de636f0e0a 100644 --- a/target/linux/ipq806x/generic/target.mk +++ b/target/linux/ipq806x/generic/target.mk @@ -1 +1,2 @@ BOARDNAME:=Generic +FEATURES += nand diff --git a/target/linux/ipq806x/image/chromium.mk b/target/linux/ipq806x/image/chromium.mk new file mode 100644 index 00000000000..16af6b95ba6 --- /dev/null +++ b/target/linux/ipq806x/image/chromium.mk @@ -0,0 +1,58 @@ +define Build/cros-gpt + cp $@ $@.tmp 2>/dev/null || true + ptgen -o $@.tmp -g \ + -T cros_kernel -N kernel -p $(CONFIG_TARGET_KERNEL_PARTSIZE)m \ + -N rootfs -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)m \ + -N rootfs_data -p \ + $$((3687-$(CONFIG_TARGET_ROOTFS_PARTSIZE)-\ + $(CONFIG_TARGET_KERNEL_PARTSIZE)))m + cat $@.tmp >> $@ + rm $@.tmp +endef + +define Build/append-kernel-part + dd if=$(IMAGE_KERNEL) bs=$(CONFIG_TARGET_KERNEL_PARTSIZE)M conv=sync >> $@ +endef + +# NB: Chrome OS bootloaders replace the '%U' in command lines with the UUID of +# the kernel partition it chooses to boot from. This gives a flexible way to +# consistently build and sign kernels that always use the subsequent +# (PARTNROFF=1) partition as their rootfs. +define Build/cros-vboot + $(STAGING_DIR_HOST)/bin/cros-vbutil \ + -k $@ -c "root=PARTUUID=%U/PARTNROFF=1" -o $@.new + @mv $@.new $@ +endef + +define Device/OnhubImage + KERNEL_LOADADDR = 0x44208000 + SOC := qcom-ipq8064 + KERNEL_SUFFIX := -fit-zImage.itb.vboot + KERNEL_NAME := zImage + KERNEL = kernel-bin | fit none $$(KDIR)/image-$$(DEVICE_DTS).dtb | cros-vboot + IMAGES := factory.bin sysupgrade.bin + IMAGE/factory.bin := cros-gpt | append-kernel-part | append-rootfs + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + DEVICE_PACKAGES := ath10k-firmware-qca988x-ct e2fsprogs kmod-fs-ext4 losetup \ + partx-utils mkf2fs kmod-fs-f2fs \ + ucode kmod-google-firmware kmod-tpm-i2c-infineon \ + kmod-sound-soc-ipq8064-storm kmod-usb-storage +endef + +define Device/asus_onhub + $(call Device/OnhubImage) + DEVICE_VENDOR := ASUS + DEVICE_MODEL := OnHub SRT-AC1900 + DEVICE_DTS := $$(SOC)-asus-onhub + BOARD_NAME := asus-onhub +endef +TARGET_DEVICES += asus_onhub + +define Device/tplink_onhub + $(call Device/OnhubImage) + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := OnHub AC1900 Cloud Router + DEVICE_DTS := $$(SOC)-tplink-onhub + BOARD_NAME := tplink-onhub +endef +TARGET_DEVICES += tplink_onhub From f3d8de73988a79440d183050dc9711bb29d2a5e1 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 21 Jan 2023 01:23:22 +0100 Subject: [PATCH 011/104] iwinfo: update to latest Git HEAD Bump ABI to 20230121 due to struct changes f766138 cli: print the flags on the frequency list 8ee7971 lib: add IWINFO_FREQ_FLAG_NAMES 81184d2 nl80211: fix some comments 2c4ee84 nl80211: prefer non-supplicant-based devices 6194aaf nl80211: simplify iterating over phy's devices acbf4fe nl80211: remove redundant check in nl80211_phy2ifname() 0172c97 cli: print the frequency and band on the scan list bbe424f cli: print the band on the frequency list afa147c nl80211: add "mhz" and "band" to iwinfo_scanlist_entry 0d5ea34 nl80211: add "band" to iwinfo_freqlist_entry dba0f06 nl80211: add support for radiation and indoor chan restriction 7e3d7de iwinfo: reorganize iwinfo header to enum and defines 9b47b03 devices: add USB devices supported by the mt76 driver c0fda7c utils: skip comment lines when parsing devices.txt dbc0ee7 cli: describe USB devices as such 891acee devices: add MediaTek MT7628 card fac0787 devices: add support for declaring compatible matched devices Signed-off-by: Christian Marangi --- package/network/utils/iwinfo/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index 9d562fbaf97..214df45070d 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -11,13 +11,13 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git -PKG_SOURCE_DATE:=2023-01-06 -PKG_SOURCE_VERSION:=c7b420a2f33c6f1034c3e2191eba0cb0374af7b6 -PKG_MIRROR_HASH:=c5d188b2c7aa0fe987ffba8330c956670047ebf5be9a217ef647549c65002cd6 +PKG_SOURCE_DATE:=2023-01-21 +PKG_SOURCE_VERSION:=f766138662cb1d62bacd1087fab597bedcf708b9 +PKG_MIRROR_HASH:=e7e45ccc7baae2c17369bdd893e67274c3e0eefbd2b2f5319ce3d1f9fdc06d4f PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 -IWINFO_ABI_VERSION:=20210430 +IWINFO_ABI_VERSION:=20230121 include $(INCLUDE_DIR)/package.mk From 5d409062a30ce39c0f80252ca3f2bcecb1443de5 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sat, 21 Jan 2023 01:26:05 +0100 Subject: [PATCH 012/104] rpcd: update to latest Git HEAD c0df2a7 iwinfo: add "band" and "mhz" to the scan output 06ad60f iwinfo: add "band" to the freqlist output b32fd32 iwinfo: add flags to freqlist output Signed-off-by: Christian Marangi --- package/system/rpcd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index ab4589f88c1..478d911292b 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git -PKG_MIRROR_HASH:=87dab115512070d3ab566ebe47859bad3c148986271cdb2ac05a0952be262519 -PKG_SOURCE_DATE:=2022-12-15 -PKG_SOURCE_VERSION:=7de4820c87437033f6b7716018f3bfa60a3f7b12 +PKG_MIRROR_HASH:=7038ab08dc67f7440effbf04ab2f083915c819f758ab16b0fbdf846bd3b87773 +PKG_SOURCE_DATE:=2023-01-21 +PKG_SOURCE_VERSION:=c0df2a7af7d6284f4a446de15d0dab17124d9448 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC From f183ce35b8ea2fd991ac489fb223b09a1ecb4db0 Mon Sep 17 00:00:00 2001 From: Chuanhong Guo Date: Sat, 21 Jan 2023 10:47:59 +0800 Subject: [PATCH 013/104] kernel: mtk-bmt: fix usage of _oob_read _oob_read returns number of bitflips on success while bbt_nand_read should return 0. Fixes: 2d49e49b18 ("mediatek: bmt: use generic mtd api") Signed-off-by: Chuanhong Guo --- target/linux/generic/files/drivers/mtd/nand/mtk_bmt.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.h b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.h index dff1f28c817..517ff7414f3 100644 --- a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.h +++ b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.h @@ -95,8 +95,14 @@ bbt_nand_read(u32 page, unsigned char *dat, int dat_len, .datbuf = dat, .len = dat_len, }; + int ret; - return bmtd._read_oob(bmtd.mtd, page << bmtd.pg_shift, &ops); + ret = bmtd._read_oob(bmtd.mtd, page << bmtd.pg_shift, &ops); + if (ret < 0) + return ret; + if (ret) + pr_info("%s: %d bitflips\n", __func__, ret); + return 0; } static inline int bbt_nand_erase(u16 block) From a57796b137494fc20e984d0049e8e7430e9ebb25 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sun, 27 Nov 2022 22:27:06 +0200 Subject: [PATCH 014/104] dnsmasq: set an increased cachesize default value Dnsmasq DNS cache size is only 150 by default. Set the uci default value to 1000, so that cache gets used more and unnecessary DNS queries to upstream can be avoided. Signed-off-by: Hannu Nyman --- package/network/services/dnsmasq/files/dhcp.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/package/network/services/dnsmasq/files/dhcp.conf b/package/network/services/dnsmasq/files/dhcp.conf index ec8b1ae950f..d5b9dfa018c 100644 --- a/package/network/services/dnsmasq/files/dhcp.conf +++ b/package/network/services/dnsmasq/files/dhcp.conf @@ -10,6 +10,7 @@ config dnsmasq option domain 'lan' option expandhosts 1 option nonegcache 0 + option cachesize 1000 option authoritative 1 option readethers 1 option leasefile '/tmp/dhcp.leases' From 8dc6c1edc447820a24a358ae3706ada58c031b91 Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Sun, 15 Jan 2023 17:48:08 +0800 Subject: [PATCH 015/104] toolchain/binutils: remove old sha256sum Fixes: b3b0a25ee8cf5f508f06822d53af0b60e3116d8a Signed-off-by: Linhui Liu --- toolchain/binutils/Makefile | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index 2903f8a7917..5543882967b 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -15,22 +15,6 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz TAR_OPTIONS += --exclude='*.rej' -ifeq ($(PKG_VERSION),2.32) - PKG_HASH:=0ab6c55dd86a92ed561972ba15b9b70a8b9f75557f896446c82e8b36e473ee04 -endif - -ifeq ($(PKG_VERSION),2.34) - PKG_HASH:=f00b0e8803dc9bab1e2165bd568528135be734df3fabf8d0161828cd56028952 -endif - -ifeq ($(PKG_VERSION),2.35.2) - PKG_HASH:=dcd5b0416e7b0a9b24bed76cd8c6c132526805761863150a26d016415b8bdc7b -endif - -ifeq ($(PKG_VERSION),2.36.1) - PKG_HASH:=e81d9edf373f193af428a0f256674aea62a9d74dfe93f65192d4eae030b0f3b0 -endif - ifeq ($(PKG_VERSION),2.37) PKG_HASH:=820d9724f020a3e69cb337893a0b63c2db161dadcb0e06fc11dc29eb1e84a32c endif From c783c50d65966e7c3caa156e4df67e2fcc3aa168 Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Tue, 17 Jan 2023 09:27:38 +0800 Subject: [PATCH 016/104] trusted-firmware-a.mk: fix build with binutils 2.39+ Starting from version 2.39 binutils now warns about sections with rwx permissions. While this is generally desirable it breaks building ARM TrustedFirmware-A bl2 which treats warnings as errors. Disable the warning/error for now to fix build. Reference: 0579d9f5bc4b3a3d1b32526c71a6b77c4888bfcb Signed-off-by: Linhui Liu --- include/trusted-firmware-a.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trusted-firmware-a.mk b/include/trusted-firmware-a.mk index 082ada269c8..0c0118e092b 100644 --- a/include/trusted-firmware-a.mk +++ b/include/trusted-firmware-a.mk @@ -81,7 +81,7 @@ define Build/Compile/Trusted-Firmware-A $(if $(DTC),DTC="$(DTC)") \ PLAT=$(PLAT) \ BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \ - $(if $(CONFIG_BINUTILS_VERSION_2_39),LDFLAGS="-no-warn-rwx-segments") \ + $(if $(CONFIG_BINUTILS_VERSION_2_37)$(CONFIG_BINUTILS_VERSION_2_38),,LDFLAGS="-no-warn-rwx-segments") \ $(TFA_MAKE_FLAGS) endef From 6e3acebe35cfc584e145e495b175ae5308d2f2bc Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Sun, 15 Jan 2023 12:39:06 +0800 Subject: [PATCH 017/104] toolchain/binutils: add support for version 2.40 Release notes: https://sourceware.org/pipermail/binutils/2023-January/125671.html Signed-off-by: Linhui Liu --- toolchain/binutils/Config.in | 4 ++ toolchain/binutils/Config.version | 4 ++ toolchain/binutils/Makefile | 4 ++ .../2.40/300-001_ld_makefile_patch.patch | 22 +++++++++++ .../400-mips_no_dynamic_linking_sym.patch | 18 +++++++++ ...e-default-emulation-for-mips64-linux.patch | 38 +++++++++++++++++++ 6 files changed, 90 insertions(+) create mode 100644 toolchain/binutils/patches/2.40/300-001_ld_makefile_patch.patch create mode 100644 toolchain/binutils/patches/2.40/400-mips_no_dynamic_linking_sym.patch create mode 100644 toolchain/binutils/patches/2.40/500-Change-default-emulation-for-mips64-linux.patch diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in index 7fe797a5aa4..dbcaf4afcea 100644 --- a/toolchain/binutils/Config.in +++ b/toolchain/binutils/Config.in @@ -17,6 +17,10 @@ choice config BINUTILS_USE_VERSION_2_39 bool "Binutils 2.39" select BINUTILS_VERSION_2_39 + + config BINUTILS_USE_VERSION_2_40 + bool "Binutils 2.40" + select BINUTILS_VERSION_2_40 endchoice config EXTRA_BINUTILS_CONFIG_OPTIONS diff --git a/toolchain/binutils/Config.version b/toolchain/binutils/Config.version index eac97877fce..479a8459fe7 100644 --- a/toolchain/binutils/Config.version +++ b/toolchain/binutils/Config.version @@ -9,8 +9,12 @@ config BINUTILS_VERSION_2_39 default y if !TOOLCHAINOPTS bool +config BINUTILS_VERSION_2_40 + bool + config BINUTILS_VERSION string default "2.37" if BINUTILS_VERSION_2_37 default "2.38" if BINUTILS_VERSION_2_38 default "2.39" if BINUTILS_VERSION_2_39 + default "2.40" if BINUTILS_VERSION_2_40 diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index 5543882967b..cf65e83e6fd 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -27,6 +27,10 @@ ifeq ($(PKG_VERSION),2.39) PKG_HASH:=645c25f563b8adc0a81dbd6a41cffbf4d37083a382e02d5d3df4f65c09516d00 endif +ifeq ($(PKG_VERSION),2.40) + PKG_HASH:=0f8a4c272d7f17f369ded10a4aca28b8e304828e95526da482b0ccc4dfc9d8e1 +endif + HOST_BUILD_PARALLEL:=1 PATCH_DIR:=./patches/$(PKG_VERSION) diff --git a/toolchain/binutils/patches/2.40/300-001_ld_makefile_patch.patch b/toolchain/binutils/patches/2.40/300-001_ld_makefile_patch.patch new file mode 100644 index 00000000000..2dafd92a01d --- /dev/null +++ b/toolchain/binutils/patches/2.40/300-001_ld_makefile_patch.patch @@ -0,0 +1,22 @@ +--- a/ld/Makefile.am ++++ b/ld/Makefile.am +@@ -50,7 +50,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +--- a/ld/Makefile.in ++++ b/ld/Makefile.in +@@ -573,7 +573,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include diff --git a/toolchain/binutils/patches/2.40/400-mips_no_dynamic_linking_sym.patch b/toolchain/binutils/patches/2.40/400-mips_no_dynamic_linking_sym.patch new file mode 100644 index 00000000000..aeb5a993a63 --- /dev/null +++ b/toolchain/binutils/patches/2.40/400-mips_no_dynamic_linking_sym.patch @@ -0,0 +1,18 @@ +--- a/bfd/elfxx-mips.c ++++ b/bfd/elfxx-mips.c +@@ -8119,6 +8119,7 @@ _bfd_mips_elf_create_dynamic_sections (b + + name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING"; + bh = NULL; ++ if (0) { + if (!(_bfd_generic_link_add_one_symbol + (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, 0, + NULL, false, get_elf_backend_data (abfd)->collect, &bh))) +@@ -8131,6 +8132,7 @@ _bfd_mips_elf_create_dynamic_sections (b + + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return false; ++ } + + if (! mips_elf_hash_table (info)->use_rld_obj_head) + { diff --git a/toolchain/binutils/patches/2.40/500-Change-default-emulation-for-mips64-linux.patch b/toolchain/binutils/patches/2.40/500-Change-default-emulation-for-mips64-linux.patch new file mode 100644 index 00000000000..14a18a1d806 --- /dev/null +++ b/toolchain/binutils/patches/2.40/500-Change-default-emulation-for-mips64-linux.patch @@ -0,0 +1,38 @@ +--- a/bfd/config.bfd ++++ b/bfd/config.bfd +@@ -944,12 +944,12 @@ case "${targ}" in + targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" + ;; + mips64*el-*-linux*) +- targ_defvec=mips_elf32_ntrad_le_vec +- targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec" ++ targ_defvec=mips_elf64_trad_le_vec ++ targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_be_vec" + ;; + mips64*-*-linux*) +- targ_defvec=mips_elf32_ntrad_be_vec +- targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec" ++ targ_defvec=mips_elf64_trad_be_vec ++ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec" + ;; + mips*el-*-linux*) + targ_defvec=mips_elf32_trad_le_vec +--- a/ld/configure.tgt ++++ b/ld/configure.tgt +@@ -585,12 +585,12 @@ mips*-*-vxworks*) targ_emul=elf32ebmipvx + ;; + mips*-*-windiss) targ_emul=elf32mipswindiss + ;; +-mips64*el-*-linux-*) targ_emul=elf32ltsmipn32 +- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" ++mips64*el-*-linux-*) targ_emul=elf64ltsmip ++ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip" + targ_extra_libpath=$targ_extra_emuls + ;; +-mips64*-*-linux-*) targ_emul=elf32btsmipn32 +- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip" ++mips64*-*-linux-*) targ_emul=elf64btsmip ++ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip" + targ_extra_libpath=$targ_extra_emuls + ;; + mips*el-*-linux-*) targ_emul=elf32ltsmip From 614bba095845cb58f64f5cb82c1710d42a338b61 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sat, 24 Dec 2022 21:34:29 +0900 Subject: [PATCH 018/104] realtek: use irq_force_affinity on otto timer instead After commit e0d2c59ee995 ("genirq: Always limit the affinity to online CPUs", 5.10) on Linux, the cpumask passed to irq_set_affinity of irqchip driver is limited to online CPUs. When irq_do_set_affinity called from otto timer driver with only one secondary CPU, that CPU is not marked as online yet, filtered out by cpu_online_mask and fall to error path. Then, fail to set affinity for that CPU and it leads to instability of timer on secondary CPU(s). At least, RTL839x system will be affected. log: [ 37.560020] rcu: INFO: rcu_sched detected stalls on CPUs/tasks: [ 37.638025] rcu: 1-...!: (0 ticks this GP) idle=6ac/0/0x0 softirq=0/0 fqs=1 (false positive?) [ 37.752683] (detected by 0, t=6002 jiffies, g=-1179, q=26293) [ 37.829510] Sending NMI from CPU 0 to CPUs 1: [ 37.886857] NMI backtrace for cpu 1 skipped: idling at r4k_wait_irqoff+0x1c/0x24 [ 37.984801] rcu: rcu_sched kthread timer wakeup didn't happen for 5999 jiffies! g-1179 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402 [ 38.132743] rcu: Possible timer handling issue on cpu=1 timer-softirq=0 [ 38.221033] rcu: rcu_sched kthread starved for 6000 jiffies! g-1179 f0x0 RCU_GP_WAIT_FQS(5) ->state=0x402 ->cpu=1 [ 38.356336] rcu: Unless rcu_sched kthread gets sufficient CPU time, OOM is now expected behavior. [ 38.474440] rcu: RCU grace-period kthread stack dump: ... Replace to irq_force_affinity from irq_set_affinity and ignore cpu_online_mask to fix the issue. Signed-off-by: INAGAKI Hiroshi Tested-by: Olliver Schinagl --- .../realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c | 2 +- .../realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c b/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c index 14e28e50f40..c096d8742b4 100644 --- a/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c +++ b/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c @@ -244,7 +244,7 @@ static int rttm_cpu_starting(unsigned int cpu) RTTM_DEBUG(to->of_base.base); to->clkevt.cpumask = cpumask_of(cpu); - irq_set_affinity(to->of_irq.irq, to->clkevt.cpumask); + irq_force_affinity(to->of_irq.irq, to->clkevt.cpumask); clockevents_config_and_register(&to->clkevt, RTTM_TICKS_PER_SEC, RTTM_MIN_DELTA, RTTM_MAX_DELTA); rttm_enable_irq(to->of_base.base); diff --git a/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c b/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c index 14e28e50f40..c096d8742b4 100644 --- a/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c +++ b/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c @@ -244,7 +244,7 @@ static int rttm_cpu_starting(unsigned int cpu) RTTM_DEBUG(to->of_base.base); to->clkevt.cpumask = cpumask_of(cpu); - irq_set_affinity(to->of_irq.irq, to->clkevt.cpumask); + irq_force_affinity(to->of_irq.irq, to->clkevt.cpumask); clockevents_config_and_register(&to->clkevt, RTTM_TICKS_PER_SEC, RTTM_MIN_DELTA, RTTM_MAX_DELTA); rttm_enable_irq(to->of_base.base); From 2fc170cc21e5ae3cc5ffaf6d0522903a5cbe4f2a Mon Sep 17 00:00:00 2001 From: ValdikSS ValdikSS Date: Fri, 20 Jan 2023 14:41:35 +0300 Subject: [PATCH 019/104] openssl: fix VIA Padlock AES-192 and 256 encryption Byte swapping code incorrectly uses the number of AES rounds to swap expanded AES key, while swapping only a single dword in a loop, resulting in swapped key and partially swapped expanded keys, breaking AES encryption and decryption on VIA Padlock hardware. This commit correctly sets the number of swapping loops to be done. Upstream: https://github.com/openssl/openssl/commit/2bcf8e69bd92e33d84c48e7d108d3d46b22f8a6d Acked-by: Eneas U de Queiroz Signed-off-by: ValdikSS ValdikSS --- .../libs/openssl/patches/010-padlock.patch | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 package/libs/openssl/patches/010-padlock.patch diff --git a/package/libs/openssl/patches/010-padlock.patch b/package/libs/openssl/patches/010-padlock.patch new file mode 100644 index 00000000000..e859295cd6e --- /dev/null +++ b/package/libs/openssl/patches/010-padlock.patch @@ -0,0 +1,52 @@ +From 2bcf8e69bd92e33d84c48e7d108d3d46b22f8a6d Mon Sep 17 00:00:00 2001 +From: ValdikSS +Date: Wed, 18 Jan 2023 20:14:48 +0300 +Subject: [PATCH] Padlock: fix byte swapping assembly for AES-192 and 256 + +Byte swapping code incorrectly uses the number of AES rounds to swap expanded +AES key, while swapping only a single dword in a loop, resulting in swapped +key and partially swapped expanded keys, breaking AES encryption and +decryption on VIA Padlock hardware. + +This commit correctly sets the number of swapping loops to be done. + +Fixes #20073 + +CLA: trivial + +Reviewed-by: Hugo Landau +Reviewed-by: Tomas Mraz +(Merged from https://github.com/openssl/openssl/pull/20077) + +(cherry picked from commit 7331e7ef79fe4499d81cc92249e9c97e9ff9291a) +--- + engines/asm/e_padlock-x86.pl | 2 ++ + engines/asm/e_padlock-x86_64.pl | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/engines/asm/e_padlock-x86.pl b/engines/asm/e_padlock-x86.pl +index 5b097ce3ef9b..07f7000fd38a 100644 +--- a/engines/asm/e_padlock-x86.pl ++++ b/engines/asm/e_padlock-x86.pl +@@ -116,6 +116,8 @@ + &function_begin_B("padlock_key_bswap"); + &mov ("edx",&wparam(0)); + &mov ("ecx",&DWP(240,"edx")); ++ &inc ("ecx"); ++ &shl ("ecx",2); + &set_label("bswap_loop"); + &mov ("eax",&DWP(0,"edx")); + &bswap ("eax"); +diff --git a/engines/asm/e_padlock-x86_64.pl b/engines/asm/e_padlock-x86_64.pl +index 09b0aaa48dfe..dfd2ae656375 100644 +--- a/engines/asm/e_padlock-x86_64.pl ++++ b/engines/asm/e_padlock-x86_64.pl +@@ -92,6 +92,8 @@ + .align 16 + padlock_key_bswap: + mov 240($arg1),%edx ++ inc %edx ++ shl \$2,%edx + .Lbswap_loop: + mov ($arg1),%eax + bswap %eax From 6a3816efb736b4ff8b4c7ec725522d275afd7496 Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 18 Jan 2023 14:46:43 -0500 Subject: [PATCH 020/104] kernel: bump 5.15 to 5.15.89 Removed upstreamed: ipq806x/patches-5.15/007-v6.3-ASoC-qcom-lpass-cpu-Fix-fallback-SD-line-index-handl.patch[1] 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.89&id=d4fa65960a9d0cb87a1102d47145675ceed7a4e6 All other patches automatically rebased. Build system: x86_64 Build-tested: bcm2711/RPi4B, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: bcm2711/RPi4B, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia --- include/kernel-5.15 | 4 +- ...multigenerational-lru-mm_struct-list.patch | 2 +- .../hack-5.15/904-debloat_dma_buf.patch | 2 +- ...cpu-Fix-fallback-SD-line-index-handl.patch | 42 ------------------- 4 files changed, 4 insertions(+), 46 deletions(-) delete mode 100644 target/linux/ipq806x/patches-5.15/007-v6.3-ASoC-qcom-lpass-cpu-Fix-fallback-SD-line-index-handl.patch diff --git a/include/kernel-5.15 b/include/kernel-5.15 index f31669f8c03..82d1c5a7bcd 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .88 -LINUX_KERNEL_HASH-5.15.88 = 417539fdd96a3af97ef9ad2b51ca13967cb922f53970563b60290b935a81a181 +LINUX_VERSION-5.15 = .89 +LINUX_KERNEL_HASH-5.15.89 = e7311b874e014bb6d37c051319bd6a4a4e3d05a1c32546522deabbfd2d752fe8 diff --git a/target/linux/generic/backport-5.15/020-v6.1-05-mm-multigenerational-lru-mm_struct-list.patch b/target/linux/generic/backport-5.15/020-v6.1-05-mm-multigenerational-lru-mm_struct-list.patch index e0b95cb76bb..5b5cbe721e0 100644 --- a/target/linux/generic/backport-5.15/020-v6.1-05-mm-multigenerational-lru-mm_struct-list.patch +++ b/target/linux/generic/backport-5.15/020-v6.1-05-mm-multigenerational-lru-mm_struct-list.patch @@ -329,7 +329,7 @@ Change-Id: I25d9eda8c6bdc7c3653b9f210a159d6c247c81e8 /* forking complete and child started to run, tell ptracer */ --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -4978,6 +4978,7 @@ context_switch(struct rq *rq, struct tas +@@ -5007,6 +5007,7 @@ context_switch(struct rq *rq, struct tas * finish_task_switch()'s mmdrop(). */ switch_mm_irqs_off(prev->active_mm, next->mm, next); diff --git a/target/linux/generic/hack-5.15/904-debloat_dma_buf.patch b/target/linux/generic/hack-5.15/904-debloat_dma_buf.patch index 302c0007f2f..beb1e31d933 100644 --- a/target/linux/generic/hack-5.15/904-debloat_dma_buf.patch +++ b/target/linux/generic/hack-5.15/904-debloat_dma_buf.patch @@ -72,7 +72,7 @@ Signed-off-by: Felix Fietkau +MODULE_LICENSE("GPL"); --- a/kernel/sched/core.c +++ b/kernel/sched/core.c -@@ -4184,6 +4184,7 @@ int wake_up_state(struct task_struct *p, +@@ -4213,6 +4213,7 @@ int wake_up_state(struct task_struct *p, { return try_to_wake_up(p, state, 0); } diff --git a/target/linux/ipq806x/patches-5.15/007-v6.3-ASoC-qcom-lpass-cpu-Fix-fallback-SD-line-index-handl.patch b/target/linux/ipq806x/patches-5.15/007-v6.3-ASoC-qcom-lpass-cpu-Fix-fallback-SD-line-index-handl.patch deleted file mode 100644 index 099dc606114..00000000000 --- a/target/linux/ipq806x/patches-5.15/007-v6.3-ASoC-qcom-lpass-cpu-Fix-fallback-SD-line-index-handl.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: Brian Norris -Date: Thu, 15 Dec 2022 01:33:45 -0800 -Subject: [PATCH] ASoC: qcom: lpass-cpu: Fix fallback SD line index handling - -[[ Submitted upstream as: - https://lore.kernel.org/all/20221231061545.2110253-1-computersforpeace@gmail.com/ - Currently queued for -next (v6.3?) as: - 000bca8d706d ASoC: qcom: lpass-cpu: Fix fallback SD line index handling -]] - -These indices should reference the ID placed within the dai_driver -array, not the indices of the array itself. - -This fixes commit 4ff028f6c108 ("ASoC: qcom: lpass-cpu: Make I2S SD -lines configurable"), which among others, broke IPQ8064 audio -(sound/soc/qcom/lpass-ipq806x.c) because it uses ID 4 but we'd stop -initializing the mi2s_playback_sd_mode and mi2s_capture_sd_mode arrays -at ID 0. - -Fixes: 4ff028f6c108 ("ASoC: qcom: lpass-cpu: Make I2S SD lines configurable") -Cc: -Signed-off-by: Brian Norris ---- - sound/soc/qcom/lpass-cpu.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - ---- a/sound/soc/qcom/lpass-cpu.c -+++ b/sound/soc/qcom/lpass-cpu.c -@@ -851,10 +851,11 @@ static void of_lpass_cpu_parse_dai_data( - struct lpass_data *data) - { - struct device_node *node; -- int ret, id; -+ int ret, i, id; - - /* Allow all channels by default for backwards compatibility */ -- for (id = 0; id < data->variant->num_dai; id++) { -+ for (i = 0; i < data->variant->num_dai; i++) { -+ id = data->variant->dai_driver[i].id; - data->mi2s_playback_sd_mode[id] = LPAIF_I2SCTL_MODE_8CH; - data->mi2s_capture_sd_mode[id] = LPAIF_I2SCTL_MODE_8CH; - } From fcdd407e8e16b90e1995789ba217be5591a88d2f Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Tue, 10 Jan 2023 19:50:12 +0100 Subject: [PATCH 021/104] toolchain: musl: Fix symbol loading in gdb Fix DT_DEBUG handling on MIPS in musl libc. With this change gdb will load the symbol files for shared libraries on MIPS too. This patch was taken from this thread: https://www.openwall.com/lists/musl/2022/01/09/4 Signed-off-by: Hauke Mehrtens --- .../musl/patches/800-mips_pie_debug.patch | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 toolchain/musl/patches/800-mips_pie_debug.patch diff --git a/toolchain/musl/patches/800-mips_pie_debug.patch b/toolchain/musl/patches/800-mips_pie_debug.patch new file mode 100644 index 00000000000..80fe15e8418 --- /dev/null +++ b/toolchain/musl/patches/800-mips_pie_debug.patch @@ -0,0 +1,61 @@ +Fix DT_DEBUG handling on MIPS in musl libc. +With this change gdb will load the symbol files for shared libraries on MIPS too. + +This patch was taken from this thread: https://www.openwall.com/lists/musl/2022/01/09/4 + +--- a/arch/mips/reloc.h ++++ b/arch/mips/reloc.h +@@ -29,6 +29,7 @@ + + #define NEED_MIPS_GOT_RELOCS 1 + #define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP ++#define DT_DEBUG_INDIRECT_REL DT_MIPS_RLD_MAP_REL + #define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT)) + + #define CRTJMP(pc,sp) __asm__ __volatile__( \ +--- a/arch/mips64/reloc.h ++++ b/arch/mips64/reloc.h +@@ -38,6 +38,7 @@ + + #define NEED_MIPS_GOT_RELOCS 1 + #define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP ++#define DT_DEBUG_INDIRECT_REL DT_MIPS_RLD_MAP_REL + #define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT)) + + #define CRTJMP(pc,sp) __asm__ __volatile__( \ +--- a/arch/mipsn32/reloc.h ++++ b/arch/mipsn32/reloc.h +@@ -29,6 +29,7 @@ + + #define NEED_MIPS_GOT_RELOCS 1 + #define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP ++#define DT_DEBUG_INDIRECT_REL DT_MIPS_RLD_MAP_REL + #define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT)) + + #define CRTJMP(pc,sp) __asm__ __volatile__( \ +--- a/ldso/dynlink.c ++++ b/ldso/dynlink.c +@@ -1923,6 +1923,10 @@ void __dls3(size_t *sp, size_t *auxv) + size_t *ptr = (size_t *) app.dynv[i+1]; + *ptr = (size_t)&debug; + } ++ if (app.dynv[i]==DT_DEBUG_INDIRECT_REL) { ++ size_t *ptr = (size_t *)((size_t)&app.dynv[i] + app.dynv[i+1]); ++ *ptr = (size_t)&debug; ++ } + } + + /* This must be done before final relocations, since it calls +--- a/src/internal/dynlink.h ++++ b/src/internal/dynlink.h +@@ -92,6 +92,10 @@ struct fdpic_dummy_loadmap { + #define DT_DEBUG_INDIRECT 0 + #endif + ++#ifndef DT_DEBUG_INDIRECT_REL ++#define DT_DEBUG_INDIRECT_REL 0 ++#endif ++ + #define AUX_CNT 32 + #define DYN_CNT 32 + From 8a3a4c84d714dccb1b45029f5cfe3f12fb7bfde8 Mon Sep 17 00:00:00 2001 From: Alexey Smirnov Date: Mon, 16 Jan 2023 15:21:59 +0300 Subject: [PATCH 022/104] omap: enable cpuidle driver This enables generic cpuidle driver for ARM. Signed-off-by: Alexey Smirnov --- target/linux/omap/config-5.15 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/omap/config-5.15 b/target/linux/omap/config-5.15 index 7b0dd7c9086..e1615c5644e 100644 --- a/target/linux/omap/config-5.15 +++ b/target/linux/omap/config-5.15 @@ -25,6 +25,7 @@ CONFIG_ARM=y CONFIG_ARM_APPENDED_DTB=y CONFIG_ARM_ATAG_DTB_COMPAT=y CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y +CONFIG_ARM_CPUIDLE=y CONFIG_ARM_CPU_SUSPEND=y CONFIG_ARM_ERRATA_430973=y CONFIG_ARM_ERRATA_720789=y @@ -195,6 +196,7 @@ CONFIG_DRM_SIMPLE_BRIDGE=y CONFIG_DRM_TI_TFP410=y CONFIG_DRM_TI_TPD12S015=y CONFIG_DTC=y +CONFIG_DT_IDLE_STATES=y CONFIG_EDAC_ATOMIC_SCRUB=y CONFIG_EDAC_SUPPORT=y CONFIG_EEPROM_93CX6=y From c2f0419a123bc7a44fa998c19952a2a3b46b15d6 Mon Sep 17 00:00:00 2001 From: Alexey Smirnov Date: Mon, 16 Jan 2023 15:34:48 +0300 Subject: [PATCH 023/104] omap: enable ARM Accelerated Cryptographic Algorithms This selects cryptographic algorithms implemented using ARM specific CPU features. Signed-off-by: Alexey Smirnov --- target/linux/omap/config-5.15 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/target/linux/omap/config-5.15 b/target/linux/omap/config-5.15 index e1615c5644e..f30188fbf6d 100644 --- a/target/linux/omap/config-5.15 +++ b/target/linux/omap/config-5.15 @@ -27,6 +27,7 @@ CONFIG_ARM_ATAG_DTB_COMPAT=y CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y CONFIG_ARM_CPUIDLE=y CONFIG_ARM_CPU_SUSPEND=y +CONFIG_ARM_CRYPTO=y CONFIG_ARM_ERRATA_430973=y CONFIG_ARM_ERRATA_720789=y CONFIG_ARM_ERRATA_754322=y @@ -129,10 +130,15 @@ CONFIG_CRC_CCITT=y CONFIG_CRC_ITU_T=y CONFIG_CRC_T10DIF=y CONFIG_CRYPTO_BLAKE2S=y +CONFIG_CRYPTO_AES_ARM=y +CONFIG_CRYPTO_AES_ARM_BS=y +CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=y CONFIG_CRYPTO_CBC=y +CONFIG_CRYPTO_CHACHA20_NEON=y CONFIG_CRYPTO_CRC32=y CONFIG_CRYPTO_CRC32C=y CONFIG_CRYPTO_CRCT10DIF=y +CONFIG_CRYPTO_CRYPTD=y CONFIG_CRYPTO_DEFLATE=y CONFIG_CRYPTO_DES=y CONFIG_CRYPTO_DEV_OMAP=y @@ -144,6 +150,7 @@ CONFIG_CRYPTO_DRBG_HMAC=y CONFIG_CRYPTO_DRBG_MENU=y CONFIG_CRYPTO_ECB=y CONFIG_CRYPTO_ENGINE=y +CONFIG_CRYPTO_GHASH_ARM_CE=y CONFIG_CRYPTO_HASH_INFO=y CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_HW=y @@ -158,8 +165,13 @@ CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_RNG_DEFAULT=y CONFIG_CRYPTO_SEQIV=y CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA1_ARM=y +CONFIG_CRYPTO_SHA1_ARM_NEON=y CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA256_ARM=y CONFIG_CRYPTO_SHA512=y +CONFIG_CRYPTO_SHA512_ARM=y +CONFIG_CRYPTO_SIMD=y CONFIG_CRYPTO_ZSTD=y CONFIG_DCACHE_WORD_ACCESS=y CONFIG_DDR=y From f86658e2691ffe1dea21095a56659002470b71f6 Mon Sep 17 00:00:00 2001 From: Alexey Smirnov Date: Tue, 17 Jan 2023 07:37:59 +0300 Subject: [PATCH 024/104] omap: refresh config Refresh target config by running: make kernel_nconfig CONFIG_TARGET=target Signed-off-by: Alexey Smirnov --- target/linux/omap/config-5.15 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/linux/omap/config-5.15 b/target/linux/omap/config-5.15 index f30188fbf6d..888345c75a8 100644 --- a/target/linux/omap/config-5.15 +++ b/target/linux/omap/config-5.15 @@ -83,6 +83,7 @@ CONFIG_CMA_SIZE_SEL_MBYTES=y # CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set # CONFIG_CMA_SYSFS is not set CONFIG_CMDLINE="root=/dev/mmcblk0p2 rootwait console=ttyO2,115200" +CONFIG_CMDLINE_FROM_BOOTLOADER=y CONFIG_COMMON_CLK=y # CONFIG_COMMON_CLK_PALMAS is not set # CONFIG_COMMON_CLK_TI_ADPLL is not set @@ -115,6 +116,7 @@ CONFIG_CPU_HAS_ASID=y CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_GOV_LADDER=y CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_IDLE_MULTIPLE_DRIVERS=y CONFIG_CPU_PABRT_V7=y CONFIG_CPU_PM=y CONFIG_CPU_RMAP=y @@ -129,7 +131,6 @@ CONFIG_CRC7=y CONFIG_CRC_CCITT=y CONFIG_CRC_ITU_T=y CONFIG_CRC_T10DIF=y -CONFIG_CRYPTO_BLAKE2S=y CONFIG_CRYPTO_AES_ARM=y CONFIG_CRYPTO_AES_ARM_BS=y CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=y @@ -331,9 +332,11 @@ CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y CONFIG_MACH_OMAP_GENERIC=y CONFIG_MAGIC_SYSRQ=y +CONFIG_MDIO_BITBANG=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVRES=y +# CONFIG_MDIO_GPIO is not set CONFIG_MEMFD_CREATE=y CONFIG_MEMORY=y CONFIG_MEMORY_ISOLATION=y From 62dbcb8305d7d28393e1d7157680f9c6dbfbed63 Mon Sep 17 00:00:00 2001 From: Nikolay Martynov Date: Fri, 6 Jan 2023 22:44:10 -0500 Subject: [PATCH 025/104] ramips: Fix root volume for tplink-er605-v2 This device has two sets of volumes: main ones (`kernel`, `rootfs`, etc) and 'backup' (`kernel.b`, `rootfs.b`, etc). Bootloader tries to determine which set of volumes to use by looking at contens of `extra-para` and `extra-para.b` volumes. These volumes contain JSON that looks like this: ``` { "dbootFlag": "1", "integerFlag": "1", "fwFlag": "GOOD", "score":1 } ``` It looks like the bootloader looks for `"fwFlag": "GOOD"` (as opposed to `BAD`) then it compares `score` field - whichever 'good' volume has bigger score wins. This determines which set of volumes to use to boot. So for example if `extra-para` is good and has bigger score then `kernel`, `rootfs`, etc volumes are used. This means bootloader needs to explain to the kernel which volume to use for the rootfs. After looking at bootloader code with disassembler I think it contains a bug. Relevant part of code looks something like this: ``` if (image_id == 0) { rootfs_volume_id = 8; rootfs_volume_name = "rootfs"; } else { rootfs_volume_id = 0xf; rootfs_volume_name = "rootfs.b"; } sprintf( &buffer, 0x800, "console=ttyS0,115200 noinitrd ubi.mtd=3,2048 ubi.block=0,%s root=/dev/ubiblock0_%d DKMGT_IMAGE_ID=%d DKMGT_IMAGE_TYPE=ubi", rootfs_volume_name, rootfs_volume_id, image_id ); ``` Where `image_id == 0` if 'normal' (not '*.b' set of volumes is used). However from device dumps we know that from the factory `rootfs.b` has id 8 and `rootfs` has id 15. So from above we can see that ids and names of rootfs volumes do not match. More over - they are hardcoded in the bootloader. Both things are problematic for OpwnWRT which completely removes volumes on update meaning that volume ids may actually change. So instead of relying on bootloader to provide the kernel with root device this patch forces kernel to determine root automatically - and it defaults to `rootfs` volume which is correct for our purposes. Overall this makes image boot fine from flash after sysupgrade from inirams. assuming `extra-para*` volumes make bootloader use non-'*.b' set of volumes. Signed-off-by: Nikolay Martynov --- target/linux/ramips/dts/mt7621_tplink_er605-v2.dts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts b/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts index 3381e598bd8..04935e3e99b 100644 --- a/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts +++ b/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts @@ -12,6 +12,9 @@ chosen { bootargs = "console=ttyS0,115200 noinitrd"; + // Override bootargs because u-boot passes wrong root parameter. + // Instead allow kernel determine root automatically by looking for rootfs volume + bootargs-override = "console=ttyS0,115200 noinitrd ubi.mtd=3,2048"; }; aliases { From fb7f4d4b549f5c6e9191293fbfcbb47ae26b8484 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 22 Jan 2023 17:27:04 +0100 Subject: [PATCH 026/104] fstool: bump to latest Git HEAD 1ea5855 partname: Introduce fstools_partname_fallback_scan option While at it also drop AUTORELEASE from PKG_RELEASE. Signed-off-by: Christian Marangi --- package/system/fstools/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/system/fstools/Makefile b/package/system/fstools/Makefile index 8892ec2dd60..8a17f169459 100644 --- a/package/system/fstools/Makefile +++ b/package/system/fstools/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fstools -PKG_RELEASE:=$(AUTORELEASE) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git -PKG_MIRROR_HASH:=03abdf55e2ea32e4e82784c82bb357ab93d62a09966ef1ccacc3de9e45d44614 -PKG_SOURCE_DATE:=2023-01-20 -PKG_SOURCE_VERSION:=e9b59f063bb333df6d58bf434554753d123a713f +PKG_MIRROR_HASH:=edda9151c73c1adfe369f5e315347344727a540ad57d3e2b41b9f57f9d4313fe +PKG_SOURCE_DATE:=2023-01-22 +PKG_SOURCE_VERSION:=1ea5855e980cd88766dd9f615e78e7dd6edfbb74 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 From 57586ddd71fc134888678cbceeba212cb88290f9 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 23 Jan 2023 13:51:43 +0100 Subject: [PATCH 027/104] iwinfo: update to latest Git HEAD 1e4e709 iwinfo: readd missing define for IWINFO_AUTH in header Fixes: #11860 Signed-off-by: Christian Marangi --- package/network/utils/iwinfo/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index 214df45070d..bf258ef4555 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git -PKG_SOURCE_DATE:=2023-01-21 -PKG_SOURCE_VERSION:=f766138662cb1d62bacd1087fab597bedcf708b9 -PKG_MIRROR_HASH:=e7e45ccc7baae2c17369bdd893e67274c3e0eefbd2b2f5319ce3d1f9fdc06d4f +PKG_SOURCE_DATE:=2023-01-23 +PKG_SOURCE_VERSION:=1e4e709d6f26cc38411ca189bab04f857b444ef3 +PKG_MIRROR_HASH:=851ca5c724f01260770ac7f4c98bc4f32b03fde635d06c797896ff2c4658c753 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 From 114c16852253b28504a233ac42d683e97b12b651 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 22 Jan 2023 19:50:04 +0100 Subject: [PATCH 028/104] rpcd: bump libiwinfo abi requirement to >= 2023-01-21 Bump libiwinfo abi requirement to >= 2023-01-21 for rpcd. Signed-off-by: Christian Marangi --- package/system/rpcd/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index 478d911292b..70d61fa9ad2 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rpcd -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git @@ -103,5 +103,5 @@ endef $(eval $(call BuildPackage,rpcd)) $(eval $(call BuildPlugin,file,,Provides ubus calls for file and directory operations.)) $(eval $(call BuildPlugin,rpcsys,,Provides ubus calls for sysupgrade and password changing.)) -$(eval $(call BuildPlugin,iwinfo,+libiwinfo,Provides ubus calls for accessing iwinfo data.,libiwinfo (>= 2022-12-15))) +$(eval $(call BuildPlugin,iwinfo,+libiwinfo,Provides ubus calls for accessing iwinfo data.,libiwinfo (>= 2023-01-21))) $(eval $(call BuildPlugin,ucode,+libucode,Allows implementing plugins using ucode scripts.)) From b61404a6ad100b1e8305a84dbeacc2cae9d66ccf Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Sun, 22 Jan 2023 19:51:39 +0100 Subject: [PATCH 029/104] rssileds: bump PKG_RELEASE due to libiwinfo ABI change Bump PKG_RELEASE due to libiwinfo ABI change to trigger a package rebuild. Signed-off-by: Christian Marangi --- package/network/utils/rssileds/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/network/utils/rssileds/Makefile b/package/network/utils/rssileds/Makefile index 2282d8c5b1a..5adc25e8d80 100644 --- a/package/network/utils/rssileds/Makefile +++ b/package/network/utils/rssileds/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rssileds -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_LICNESE:=GPL-2.0+ include $(INCLUDE_DIR)/package.mk From 183bad664167f73a6798980faab5d9b5bba06b5a Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 21 Jan 2023 14:59:27 -0800 Subject: [PATCH 030/104] CI: tools: add gnu-getopt to macOS CI This used to be implicit. No longer for some reason. Signed-off-by: Rosen Penev --- .github/workflows/tools.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml index b315346ed6f..b9d712c2a69 100644 --- a/.github/workflows/tools.yml +++ b/.github/workflows/tools.yml @@ -47,6 +47,7 @@ jobs: findutils \ gawk \ git-extras \ + gnu-getopt \ gnu-sed \ grep \ make From e3082dc555750d91e0d3e2237652ade5306b3347 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Sun, 22 Jan 2023 11:47:23 +0100 Subject: [PATCH 031/104] generic: backport fix for #nvmem-cell-cells false warning Recent backport of NVMEM layout support as well as acommpanying OF changes introduced a false #nvmem-cell-cells warning as #nvmem-cell-cells are fully optional. So, backport an upstream fix for this. Fixes: 11759a5bf3c6 ("kernel: backport of changes & helpers") Signed-off-by: Robert Marko --- ...roperty-fix-nvmem-cell-cells-parsing.patch | 44 +++++++++++++++++++ ...roperty-fix-nvmem-cell-cells-parsing.patch | 44 +++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 target/linux/generic/backport-5.10/828-v6.3-of-property-fix-nvmem-cell-cells-parsing.patch create mode 100644 target/linux/generic/backport-5.15/828-v6.3-of-property-fix-nvmem-cell-cells-parsing.patch diff --git a/target/linux/generic/backport-5.10/828-v6.3-of-property-fix-nvmem-cell-cells-parsing.patch b/target/linux/generic/backport-5.10/828-v6.3-of-property-fix-nvmem-cell-cells-parsing.patch new file mode 100644 index 00000000000..848ec3731ba --- /dev/null +++ b/target/linux/generic/backport-5.10/828-v6.3-of-property-fix-nvmem-cell-cells-parsing.patch @@ -0,0 +1,44 @@ +From ef26c0349eb5a615dab2272d08d1d5de4ac9cd4c Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Wed, 11 Jan 2023 00:30:56 +0100 +Subject: [PATCH] of: property: fix #nvmem-cell-cells parsing + +Commit 67b8497f005f ("of: property: make #.*-cells optional for simple +props") claims to make the cells-name property optional for simple +properties, but changed the code for the wrong property, i.e. for +DEFINE_SUFFIX_PROP(). Fix that. + +Fixes: 67b8497f005f ("of: property: make #.*-cells optional for simple props") +Reported-by: Peng Fan +Signed-off-by: Michael Walle +Acked-by: Rob Herring +Tested-by: Robert Marko +Signed-off-by: Srinivas Kandagatla +--- + drivers/of/property.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -1213,8 +1213,8 @@ static struct device_node *parse_prop_ce + if (strcmp(prop_name, list_name)) + return NULL; + +- if (of_parse_phandle_with_args(np, list_name, cells_name, index, +- &sup_args)) ++ if (__of_parse_phandle_with_args(np, list_name, cells_name, 0, index, ++ &sup_args)) + return NULL; + + return sup_args.np; +@@ -1267,8 +1267,8 @@ static struct device_node *parse_suffix_ + if (strcmp_suffix(prop_name, suffix)) + return NULL; + +- if (__of_parse_phandle_with_args(np, prop_name, cells_name, 0, index, +- &sup_args)) ++ if (of_parse_phandle_with_args(np, prop_name, cells_name, index, ++ &sup_args)) + return NULL; + + return sup_args.np; diff --git a/target/linux/generic/backport-5.15/828-v6.3-of-property-fix-nvmem-cell-cells-parsing.patch b/target/linux/generic/backport-5.15/828-v6.3-of-property-fix-nvmem-cell-cells-parsing.patch new file mode 100644 index 00000000000..f17cc1f4fa1 --- /dev/null +++ b/target/linux/generic/backport-5.15/828-v6.3-of-property-fix-nvmem-cell-cells-parsing.patch @@ -0,0 +1,44 @@ +From ef26c0349eb5a615dab2272d08d1d5de4ac9cd4c Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Wed, 11 Jan 2023 00:30:56 +0100 +Subject: [PATCH] of: property: fix #nvmem-cell-cells parsing + +Commit 67b8497f005f ("of: property: make #.*-cells optional for simple +props") claims to make the cells-name property optional for simple +properties, but changed the code for the wrong property, i.e. for +DEFINE_SUFFIX_PROP(). Fix that. + +Fixes: 67b8497f005f ("of: property: make #.*-cells optional for simple props") +Reported-by: Peng Fan +Signed-off-by: Michael Walle +Acked-by: Rob Herring +Tested-by: Robert Marko +Signed-off-by: Srinivas Kandagatla +--- + drivers/of/property.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -1173,8 +1173,8 @@ static struct device_node *parse_prop_ce + if (strcmp(prop_name, list_name)) + return NULL; + +- if (of_parse_phandle_with_args(np, list_name, cells_name, index, +- &sup_args)) ++ if (__of_parse_phandle_with_args(np, list_name, cells_name, 0, index, ++ &sup_args)) + return NULL; + + return sup_args.np; +@@ -1227,8 +1227,8 @@ static struct device_node *parse_suffix_ + if (strcmp_suffix(prop_name, suffix)) + return NULL; + +- if (__of_parse_phandle_with_args(np, prop_name, cells_name, 0, index, +- &sup_args)) ++ if (of_parse_phandle_with_args(np, prop_name, cells_name, index, ++ &sup_args)) + return NULL; + + return sup_args.np; From 1506f8c322c6f198d1903c62b19b9cbc12472b4e Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 11 Nov 2022 02:32:15 +0100 Subject: [PATCH 032/104] scripts: ext-tools: follow links for host tools path Host tools path may be a symbolic link. Use -H with find to follow path links passed from command line to find command. Signed-off-by: Christian Marangi --- scripts/ext-tools.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ext-tools.sh b/scripts/ext-tools.sh index bf56f4d9edf..13fbd43018b 100755 --- a/scripts/ext-tools.sh +++ b/scripts/ext-tools.sh @@ -5,7 +5,7 @@ HOST_BUILD_DIR=$(pwd)/"build_dir/host" HOST_STAGING_DIR_STAMP=$(pwd)/"staging_dir/host/stamp" refresh_timestamps() { - find "$1" -not -type l -print0 | xargs -0 touch + find -H "$1" -not -type l -print0 | xargs -0 touch } extract_prebuilt_tar() { From 26bb4b409da1fe45c578ce985a429af663a8501a Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 10 Nov 2022 19:50:39 +0100 Subject: [PATCH 033/104] scripts: ext-tools: add option to only refresh timestamps It's possible to have prebuilt tools already extracted. Add option to just refresh the timestamps. Signed-off-by: Christian Marangi --- scripts/ext-tools.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/scripts/ext-tools.sh b/scripts/ext-tools.sh index 13fbd43018b..b58296be101 100755 --- a/scripts/ext-tools.sh +++ b/scripts/ext-tools.sh @@ -12,9 +12,7 @@ extract_prebuilt_tar() { tar -xf "$1" } -install_prebuilt_tools() { - extract_prebuilt_tar "$TOOLS_TAR" - +refresh_prebuilt_tools() { if [ ! -d "$HOST_BUILD_DIR" ]; then echo "Can't find Host Build Dir "$HOST_BUILD_DIR"" >&2 exit 1 @@ -33,6 +31,14 @@ install_prebuilt_tools() { return 0 } +install_prebuilt_tools() { + extract_prebuilt_tar "$TOOLS_TAR" + + refresh_prebuilt_tools + + return 0 +} + while [ -n "$1" ]; do arg="$1"; shift case "$arg" in @@ -63,6 +69,12 @@ while [ -n "$1" ]; do exit $? ;; + --refresh) + refresh_prebuilt_tools + + exit $? + ;; + -h|--help) me="$(basename "$0")" echo -e "\nUsage:\n" >&2 @@ -81,8 +93,12 @@ while [ -n "$1" ]; do echo -e " $me --tools {tar}" >&2 echo -e " Install the prebuilt tools present in the passed" >&2 echo -e " tar and prepare them." >&2 - echo -e " To correctly use them it's needed to update the." >&2 + echo -e " To correctly use them it's needed to update the" >&2 echo -e " timestamp of each tools to skip recompilation.\n" >&2 + echo -e " $me --refresh" >&2 + echo -e " Refresh timestamps of already extracted prebuilt" >&2 + echo -e " tools to correctly use them and skip" >&2 + echo -e " recompilation.\n" >&2 echo -e " $me --help" >&2 echo -e " Display this help text and exit.\n\n" >&2 exit 1 From 37b8b315e158312246798221c79f0dd5a640e898 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 11 Nov 2022 16:40:45 +0100 Subject: [PATCH 034/104] build: skip download for host build with AUTOREMOVE if already compiled Packages in general use 4 check to trigger a recompile: - timestamp for the build_dir - timestamp for the staging stamp dir - depends hash for the build_dir prepared file - presence of package archieve in dl If host tools are prebuilt and shipped in a container or manually installed from an archieve, it would be ideal to skip including the package archieve and just provide the build_dir prepared files and the staging stamp file (and the actualy prebuilt tools). Add some logic to skip dl download for host tools if AUTOREMOVE is selected and checks for the presence of staging dir stamp file and build dir stamp file. If one of these requirements are not met, the package is redownloaded and rebuilt. Signed-off-by: Christian Marangi --- include/host-build.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/host-build.mk b/include/host-build.mk index 22fcc31f15c..2cc1ec5842f 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -206,5 +206,9 @@ endif define HostBuild $(HostBuild/Core) - $(if $(if $(PKG_HOST_ONLY),,$(if $(and $(filter host-%,$(MAKECMDGOALS)),$(PKG_SKIP_DOWNLOAD)),,$(STAMP_PREPARED))),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))) + $(if $(if $(PKG_HOST_ONLY),,$(if $(and $(filter host-%,$(MAKECMDGOALS)),$(PKG_SKIP_DOWNLOAD)),,$(STAMP_PREPARED))),, + $(if $(and $(CONFIG_AUTOREMOVE), $(wildcard $(HOST_STAMP_INSTALLED), $(wildcard $(HOST_STAMP_BUILT)))),, + $(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)) + ) + ) endef From 7fe3d3670b7057ba793b606cfe85c53930b49057 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 11 Nov 2022 16:50:27 +0100 Subject: [PATCH 035/104] CI: tools: skip including dl dir in prebuilt tools tar We can now drop the dl dir in the prebuilt tools tar as package archieve is not a requirement anymore and won't trigger a package recompile. Signed-off-by: Christian Marangi --- .github/workflows/build-tools.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-tools.yml b/.github/workflows/build-tools.yml index ca415489c5a..ba19e12330b 100644 --- a/.github/workflows/build-tools.yml +++ b/.github/workflows/build-tools.yml @@ -61,7 +61,7 @@ jobs: if: inputs.generate_prebuilt_artifacts == true shell: su buildbot -c "sh -e {0}" working-directory: openwrt - run: tar --mtime=now -cf tools.tar staging_dir/host build_dir/host dl + run: tar --mtime=now -cf tools.tar staging_dir/host build_dir/host - name: Upload prebuilt tools if: inputs.generate_prebuilt_artifacts == true From d40f59825a7abc0fe6f1116d599db39fcfc0f489 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Thu, 10 Nov 2022 19:53:15 +0100 Subject: [PATCH 036/104] CI: tools: directly copy prebuilt tools in container Directly copy prebuilt tools in container instead of creating an archieve and extracting it later in other workflows. Update build workflow to support this new implementation. Signed-off-by: Christian Marangi --- .github/workflows/Dockerfile.tools | 3 ++- .github/workflows/build-tools.yml | 2 +- .github/workflows/build.yml | 15 ++++++++++----- .github/workflows/check-kernel-patches.yml | 9 +++++++-- .github/workflows/push-containers.yml | 4 ++++ 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.github/workflows/Dockerfile.tools b/.github/workflows/Dockerfile.tools index c2ae7dc8965..a3804750445 100644 --- a/.github/workflows/Dockerfile.tools +++ b/.github/workflows/Dockerfile.tools @@ -1,3 +1,4 @@ FROM registry.gitlab.com/openwrt/buildbot/buildworker-3.4.1 -COPY --chown=buildbot:buildbot tools.tar /tools.tar +COPY --chown=buildbot staging_dir/host /prebuilt_tools/staging_dir/host +COPY --chown=buildbot build_dir/host /prebuilt_tools/build_dir/host diff --git a/.github/workflows/build-tools.yml b/.github/workflows/build-tools.yml index ba19e12330b..1507b0b056b 100644 --- a/.github/workflows/build-tools.yml +++ b/.github/workflows/build-tools.yml @@ -61,7 +61,7 @@ jobs: if: inputs.generate_prebuilt_artifacts == true shell: su buildbot -c "sh -e {0}" working-directory: openwrt - run: tar --mtime=now -cf tools.tar staging_dir/host build_dir/host + run: tar -cf tools.tar staging_dir/host build_dir/host - name: Upload prebuilt tools if: inputs.generate_prebuilt_artifacts == true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de168c0cb90..62a4441a3b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -137,6 +137,16 @@ jobs: echo "TARGET=$TARGET" >> "$GITHUB_ENV" echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV" + - name: Prepare prebuilt tools + shell: su buildbot -c "sh -e {0}" + working-directory: openwrt + run: | + mkdir -p staging_dir build_dir + ln -s /prebuilt_tools/staging_dir/host staging_dir/host + ln -s /prebuilt_tools/build_dir/host build_dir/host + + ./scripts/ext-tools.sh --refresh + - name: Update & Install feeds if: inputs.include_feeds == true shell: su buildbot -c "sh -e {0}" @@ -221,11 +231,6 @@ jobs: wget -O - https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${{ env.TOOLCHAIN_FILE }}.tar.xz \ | tar --xz -xf - - - name: Extract prebuilt tools - shell: su buildbot -c "sh -e {0}" - working-directory: openwrt - run: ./scripts/ext-tools.sh --tools /tools.tar - - name: Configure testing kernel if: inputs.testing == true shell: su buildbot -c "sh -e {0}" diff --git a/.github/workflows/check-kernel-patches.yml b/.github/workflows/check-kernel-patches.yml index e5b619064f6..7e0fe5071a5 100644 --- a/.github/workflows/check-kernel-patches.yml +++ b/.github/workflows/check-kernel-patches.yml @@ -84,10 +84,15 @@ jobs: echo "TARGET=$TARGET" >> "$GITHUB_ENV" echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV" - - name: Extract prebuilt tools + - name: Prepare prebuilt tools shell: su buildbot -c "sh -e {0}" working-directory: openwrt - run: ./scripts/ext-tools.sh --tools /tools.tar + run: | + mkdir -p staging_dir build_dir + ln -sf /prebuilt_tools/staging_dir/host staging_dir/host + ln -sf /prebuilt_tools/build_dir/host build_dir/host + + ./scripts/ext-tools.sh --refresh - name: Configure testing kernel if: inputs.testing == true diff --git a/.github/workflows/push-containers.yml b/.github/workflows/push-containers.yml index 56e0daa611b..4045dfaa294 100644 --- a/.github/workflows/push-containers.yml +++ b/.github/workflows/push-containers.yml @@ -70,6 +70,10 @@ jobs: name: linux-buildbot-prebuilt-tools path: openwrt + - name: Extract prebuild tools + working-directory: openwrt + run: tar -xf tools.tar + - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: From 94059ce86412b0ed5589d79661bceb1d2ea443af Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 28 Sep 2022 14:12:13 +0200 Subject: [PATCH 037/104] pistachio: 5:15: copy config and patch from 5.10 Copy config and patch from kernel 5.10 to kernel 5.15. Signed-off-by: Nick Hainke [Updated the copy] Signed-off-by: Hauke Mehrtens --- target/linux/pistachio/config-5.15 | 313 ++++++++++++++++++ ...ine-img-mdc-Handle-early-status-read.patch | 68 ++++ ...mg-spfi-Implement-dual-and-quad-mode.patch | 198 +++++++++++ ...-device-0-configuration-for-all-devi.patch | 64 ++++ ...i-RX-maximum-burst-size-for-DMA-is-8.patch | 59 ++++ ...g-spfi-finish-every-transfer-cleanly.patch | 120 +++++++ ...istachio-Fix-wrong-SDHost-card-speed.patch | 49 +++ ...-img-marduk-switch-mmc-to-1-bit-mode.patch | 47 +++ ...or-support-mtd-name-from-device-tree.patch | 54 +++ ...PS-DTS-img-marduk-Add-SPI-NAND-flash.patch | 30 ++ ...mg-marduk-Add-Cascoda-CA8210-6LoWPAN.patch | 43 +++ ...-DTS-img-marduk-Add-NXP-SC16IS752IPW.patch | 81 +++++ ...PS-DTS-img-marduk-Add-partition-name.patch | 27 ++ ...-MIPS-DTS-img-marduk-Add-led-aliases.patch | 27 ++ 14 files changed, 1180 insertions(+) create mode 100644 target/linux/pistachio/config-5.15 create mode 100644 target/linux/pistachio/patches-5.15/101-dmaengine-img-mdc-Handle-early-status-read.patch create mode 100644 target/linux/pistachio/patches-5.15/102-spi-img-spfi-Implement-dual-and-quad-mode.patch create mode 100644 target/linux/pistachio/patches-5.15/104-spi-img-spfi-use-device-0-configuration-for-all-devi.patch create mode 100644 target/linux/pistachio/patches-5.15/105-spi-img-spfi-RX-maximum-burst-size-for-DMA-is-8.patch create mode 100644 target/linux/pistachio/patches-5.15/106-spi-img-spfi-finish-every-transfer-cleanly.patch create mode 100644 target/linux/pistachio/patches-5.15/108-clk-pistachio-Fix-wrong-SDHost-card-speed.patch create mode 100644 target/linux/pistachio/patches-5.15/109-MIPS-DTS-img-marduk-switch-mmc-to-1-bit-mode.patch create mode 100644 target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch create mode 100644 target/linux/pistachio/patches-5.15/901-MIPS-DTS-img-marduk-Add-SPI-NAND-flash.patch create mode 100644 target/linux/pistachio/patches-5.15/902-MIPS-DTS-img-marduk-Add-Cascoda-CA8210-6LoWPAN.patch create mode 100644 target/linux/pistachio/patches-5.15/903-MIPS-DTS-img-marduk-Add-NXP-SC16IS752IPW.patch create mode 100644 target/linux/pistachio/patches-5.15/904-MIPS-DTS-img-marduk-Add-partition-name.patch create mode 100644 target/linux/pistachio/patches-5.15/905-MIPS-DTS-img-marduk-Add-led-aliases.patch diff --git a/target/linux/pistachio/config-5.15 b/target/linux/pistachio/config-5.15 new file mode 100644 index 00000000000..681607f65c3 --- /dev/null +++ b/target/linux/pistachio/config-5.15 @@ -0,0 +1,313 @@ +CONFIG_ARCH_32BIT_OFF_T=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MMAP_RND_BITS_MAX=15 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_SCSI_REQUEST=y +CONFIG_BOARD_SCACHE=y +CONFIG_BOOT_ELF32=y +CONFIG_CEVT_R4K=y +CONFIG_CLKDEV_LOOKUP=y +CONFIG_CLKSRC_MIPS_GIC=y +CONFIG_CLKSRC_PISTACHIO=y +CONFIG_CLOCKSOURCE_WATCHDOG=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_COMMON_CLK=y +# CONFIG_COMMON_CLK_BOSTON is not set +CONFIG_COMPAT_32BIT_TIME=y +CONFIG_CONNECTOR=y +CONFIG_CPU_GENERIC_DUMP_TLB=y +CONFIG_CPU_HAS_DIEI=y +CONFIG_CPU_HAS_PREFETCH=y +CONFIG_CPU_HAS_RIXI=y +CONFIG_CPU_HAS_SYNC=y +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MIPS32=y +CONFIG_CPU_MIPS32_R2=y +CONFIG_CPU_MIPSR2=y +CONFIG_CPU_MIPSR2_IRQ_EI=y +CONFIG_CPU_MIPSR2_IRQ_VI=y +CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y +CONFIG_CPU_PM=y +CONFIG_CPU_R4K_CACHE_TLB=y +CONFIG_CPU_RMAP=y +CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y +CONFIG_CPU_SUPPORTS_HIGHMEM=y +CONFIG_CPU_SUPPORTS_MSA=y +CONFIG_CRC16=y +CONFIG_CRC_CCITT=y +CONFIG_CRYPTO_BLAKE2S=y +CONFIG_CRYPTO_CBC=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_HASH_INFO=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2 +CONFIG_CRYPTO_LIB_SHA256=y +CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_MD5=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_ZSTD=y +CONFIG_CSRC_R4K=y +CONFIG_DMADEVICES=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_NONCOHERENT=y +CONFIG_DMA_OF=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DTC=y +CONFIG_DWMAC_GENERIC=y +CONFIG_EARLY_PRINTK=y +CONFIG_EARLY_PRINTK_8250=y +CONFIG_EXT4_FS=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +CONFIG_FIXED_PHY=y +CONFIG_FS_IOMAP=y +CONFIG_FS_MBCACHE=y +CONFIG_FS_POSIX_ACL=y +CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_LIB_ASHLDI3=y +CONFIG_GENERIC_LIB_ASHRDI3=y +CONFIG_GENERIC_LIB_CMPDI2=y +CONFIG_GENERIC_LIB_LSHRDI3=y +CONFIG_GENERIC_LIB_UCMPDI2=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_PHY=y +CONFIG_GENERIC_PINCONF=y +CONFIG_GENERIC_PINCTRL_GROUPS=y +CONFIG_GENERIC_PINMUX_FUNCTIONS=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_HANDLE_DOMAIN_IRQ=y +CONFIG_HARDWARE_WATCHPOINTS=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HOTPLUG_CPU=y +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_IMG=y +CONFIG_IMGPDC_WDT=y +CONFIG_IMG_MDC_DMA=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_MIPS_CPU=y +CONFIG_IRQ_WORK=y +CONFIG_JBD2=y +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_PWM=y +CONFIG_LIBFDT=y +CONFIG_LKDTM=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LOG_BUF_SHIFT=18 +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_MACH_PISTACHIO=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0 +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_DEVRES=y +CONFIG_MEMFD_CREATE=y +CONFIG_MFD_SYSCON=y +CONFIG_MICREL_PHY=y +CONFIG_MIGRATION=y +CONFIG_MIPS=y +CONFIG_MIPS_ASID_BITS=8 +CONFIG_MIPS_ASID_SHIFT=0 +CONFIG_MIPS_CLOCK_VSYSCALL=y +CONFIG_MIPS_CM=y +CONFIG_MIPS_CMDLINE_DTB_EXTEND=y +# CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set +# CONFIG_MIPS_CMDLINE_FROM_DTB is not set +CONFIG_MIPS_CPC=y +CONFIG_MIPS_CPS=y +# CONFIG_MIPS_CPS_CPUIDLE is not set +# CONFIG_MIPS_CPS_NS16550_BOOL is not set +CONFIG_MIPS_CPS_PM=y +CONFIG_MIPS_CPU_SCACHE=y +CONFIG_MIPS_EBPF_JIT=y +# CONFIG_MIPS_ELF_APPENDED_DTB is not set +CONFIG_MIPS_EXTERNAL_TIMER=y +CONFIG_MIPS_GIC=y +CONFIG_MIPS_L1_CACHE_SHIFT=5 +CONFIG_MIPS_LD_CAN_LINK_VDSO=y +CONFIG_MIPS_MT=y +CONFIG_MIPS_MT_FPAFF=y +CONFIG_MIPS_MT_SMP=y +CONFIG_MIPS_NO_APPENDED_DTB=y +CONFIG_MIPS_NR_CPU_NR_MAP=4 +CONFIG_MIPS_PERF_SHARED_TC_COUNTERS=y +# CONFIG_MIPS_RAW_APPENDED_DTB is not set +CONFIG_MIPS_SPRAM=y +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_DW=y +# CONFIG_MMC_DW_BLUEFIELD is not set +# CONFIG_MMC_DW_EXYNOS is not set +# CONFIG_MMC_DW_HI3798CV200 is not set +# CONFIG_MMC_DW_K3 is not set +CONFIG_MMC_DW_PLTFM=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_NAND_CORE=y +CONFIG_MTD_SPI_NAND=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_BEB_LIMIT=20 +CONFIG_MTD_UBI_BLOCK=y +CONFIG_MTD_UBI_FASTMAP=y +CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_NAMESPACES=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_NS=y +CONFIG_NET_PTP_CLASSIFY=y +CONFIG_NLS=y +CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y +CONFIG_NO_HZ=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_IDLE=y +CONFIG_NR_CPUS=4 +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_KOBJ=y +CONFIG_OF_MDIO=y +CONFIG_OF_NET=y +CONFIG_PADATA=y +CONFIG_PAGE_POOL=y +CONFIG_PCI_DRIVERS_LEGACY=y +CONFIG_PCS_XPCS=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PHYLIB=y +CONFIG_PHYLINK=y +CONFIG_PHY_PISTACHIO_USB=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_PISTACHIO=y +CONFIG_PISTACHIO_GPTIMER_CLKSRC=y +CONFIG_POWER_SUPPLY=y +CONFIG_PPS=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_PRINTK_TIME=y +CONFIG_PROC_EVENTS=y +CONFIG_PROFILING=y +CONFIG_PTP_1588_CLOCK=y +CONFIG_PWM=y +CONFIG_PWM_IMG=y +CONFIG_PWM_SYSFS=y +CONFIG_QUEUED_RWLOCKS=y +CONFIG_QUEUED_SPINLOCKS=y +CONFIG_RATIONAL=y +CONFIG_REGMAP=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_SPI=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_REGULATOR_GPIO=y +CONFIG_RESET_CONTROLLER=y +CONFIG_RESET_PISTACHIO=y +CONFIG_RFS_ACCEL=y +CONFIG_RPS=y +CONFIG_SCHEDSTATS=y +CONFIG_SCHED_INFO=y +CONFIG_SCSI=y +CONFIG_SCSI_SPI_ATTRS=y +CONFIG_SERIAL_8250_DW=y +CONFIG_SERIAL_8250_DWLIB=y +CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SERIAL_SC16IS7XX=y +CONFIG_SERIAL_SC16IS7XX_CORE=y +# CONFIG_SERIAL_SC16IS7XX_I2C is not set +CONFIG_SERIAL_SC16IS7XX_SPI=y +CONFIG_SGL_ALLOC=y +CONFIG_SG_POOL=y +CONFIG_SMP=y +CONFIG_SMP_UP=y +CONFIG_SPI=y +CONFIG_SPI_IMG_SPFI=y +CONFIG_SPI_MASTER=y +CONFIG_SPI_MEM=y +CONFIG_SRAM=y +CONFIG_SRCU=y +CONFIG_STMMAC_ETH=y +CONFIG_STMMAC_PLATFORM=y +# CONFIG_STMMAC_SELFTESTS is not set +CONFIG_SWPHY=y +CONFIG_SYNC_R4K=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_SYS_HAS_CPU_MIPS32_R2=y +CONFIG_SYS_HAS_EARLY_PRINTK=y +CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y +CONFIG_SYS_SUPPORTS_ARBIT_HZ=y +CONFIG_SYS_SUPPORTS_HOTPLUG_CPU=y +CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y +CONFIG_SYS_SUPPORTS_MIPS_CPS=y +CONFIG_SYS_SUPPORTS_MULTITHREADING=y +CONFIG_SYS_SUPPORTS_RELOCATABLE=y +CONFIG_SYS_SUPPORTS_SCHED_SMT=y +CONFIG_SYS_SUPPORTS_SMP=y +CONFIG_SYS_SUPPORTS_ZBOOT=y +CONFIG_TARGET_ISA_REV=2 +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TREE_RCU=y +CONFIG_TREE_SRCU=y +CONFIG_UBIFS_FS=y +CONFIG_USB=y +CONFIG_USB_ANNOUNCE_NEW_DEVICES=y +CONFIG_USB_COMMON=y +CONFIG_USB_DWC2=y +CONFIG_USB_DWC2_DUAL_ROLE=y +CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_EHCI_HCD_PLATFORM is not set +CONFIG_USB_GADGET=y +CONFIG_USB_ROLE_SWITCH=y +CONFIG_USB_STORAGE=y +CONFIG_USB_SUPPORT=y +CONFIG_USER_NS=y +CONFIG_USE_GENERIC_EARLY_PRINTK_8250=y +CONFIG_USE_OF=y +CONFIG_WATCHDOG_CORE=y +CONFIG_WEAK_ORDERING=y +CONFIG_XPS=y +CONFIG_XXHASH=y +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZSMALLOC=y +# CONFIG_ZSMALLOC_STAT is not set +CONFIG_ZSTD_COMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y diff --git a/target/linux/pistachio/patches-5.15/101-dmaengine-img-mdc-Handle-early-status-read.patch b/target/linux/pistachio/patches-5.15/101-dmaengine-img-mdc-Handle-early-status-read.patch new file mode 100644 index 00000000000..031a4e3e5ee --- /dev/null +++ b/target/linux/pistachio/patches-5.15/101-dmaengine-img-mdc-Handle-early-status-read.patch @@ -0,0 +1,68 @@ +From a2dd154377c9aa6ddda00d39b8c7c334e4fa16ff Mon Sep 17 00:00:00 2001 +From: Damien Horsley +Date: Tue, 22 Mar 2016 12:46:09 +0000 +Subject: dmaengine: img-mdc: Handle early status read + +It is possible that mdc_tx_status may be called before the first +node has been read from memory. + +In this case, the residue value stored in the register is undefined. +Return the transfer size instead. + +Signed-off-by: Damien Horsley +--- + drivers/dma/img-mdc-dma.c | 40 ++++++++++++++++++++++++---------------- + 1 file changed, 24 insertions(+), 16 deletions(-) + +--- a/drivers/dma/img-mdc-dma.c ++++ b/drivers/dma/img-mdc-dma.c +@@ -618,25 +618,33 @@ static enum dma_status mdc_tx_status(str + (MDC_CMDS_PROCESSED_CMDS_DONE_MASK + 1); + + /* +- * If the command loaded event hasn't been processed yet, then +- * the difference above includes an extra command. ++ * If the first node has not yet been read from memory, ++ * the residue register value is undefined + */ +- if (!mdesc->cmd_loaded) +- cmds--; +- else +- cmds += mdesc->list_cmds_done; +- +- bytes = mdesc->list_xfer_size; +- ldesc = mdesc->list; +- for (i = 0; i < cmds; i++) { +- bytes -= ldesc->xfer_size + 1; +- ldesc = ldesc->next_desc; +- } +- if (ldesc) { +- if (residue != MDC_TRANSFER_SIZE_MASK) +- bytes -= ldesc->xfer_size - residue; ++ if (!mdesc->cmd_loaded && !cmds) { ++ bytes = mdesc->list_xfer_size; ++ } else { ++ /* ++ * If the command loaded event hasn't been processed yet, then ++ * the difference above includes an extra command. ++ */ ++ if (!mdesc->cmd_loaded) ++ cmds--; + else ++ cmds += mdesc->list_cmds_done; ++ ++ bytes = mdesc->list_xfer_size; ++ ldesc = mdesc->list; ++ for (i = 0; i < cmds; i++) { + bytes -= ldesc->xfer_size + 1; ++ ldesc = ldesc->next_desc; ++ } ++ if (ldesc) { ++ if (residue != MDC_TRANSFER_SIZE_MASK) ++ bytes -= ldesc->xfer_size - residue; ++ else ++ bytes -= ldesc->xfer_size + 1; ++ } + } + } + spin_unlock_irqrestore(&mchan->vc.lock, flags); diff --git a/target/linux/pistachio/patches-5.15/102-spi-img-spfi-Implement-dual-and-quad-mode.patch b/target/linux/pistachio/patches-5.15/102-spi-img-spfi-Implement-dual-and-quad-mode.patch new file mode 100644 index 00000000000..83f21a5c0a5 --- /dev/null +++ b/target/linux/pistachio/patches-5.15/102-spi-img-spfi-Implement-dual-and-quad-mode.patch @@ -0,0 +1,198 @@ +From cd2a6af51553d38072cd31699b58d16ca6176ef5 Mon Sep 17 00:00:00 2001 +From: Ionela Voinescu +Date: Thu, 2 Feb 2017 16:46:14 +0000 +Subject: spi: img-spfi: Implement dual and quad mode + +For dual and quad modes to work the SPFI controller needs +to have information about command/address/dummy bytes in the +transaction register. This information is not relevant for +single mode, and therefore it can have any value in the +allowed range. Therefore, for any read or write transfers of less +than 8 bytes (cmd = 1 byte, addr up to 7 bytes), SPFI will be +configured, but not enabled (unless it is the last transfer in +the queue). The transfer will be enabled by the subsequent tranfer. +A pending transfer is determined by the content of the transaction +register: if command part is set and tsize is not. + +This way we ensure that for dual and quad transactions +the command request size will apear in the command/address part +of the transaction register, while the data size will be in +tsize, all data being sent/received in the same transaction (as +set up in the transaction register). + +Signed-off-by: Ionela Voinescu +Signed-off-by: Ezequiel Garcia +--- + drivers/spi/spi-img-spfi.c | 96 ++++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 85 insertions(+), 11 deletions(-) + +--- a/drivers/spi/spi-img-spfi.c ++++ b/drivers/spi/spi-img-spfi.c +@@ -36,7 +36,8 @@ + #define SPFI_CONTROL_SOFT_RESET BIT(11) + #define SPFI_CONTROL_SEND_DMA BIT(10) + #define SPFI_CONTROL_GET_DMA BIT(9) +-#define SPFI_CONTROL_SE BIT(8) ++#define SPFI_CONTROL_SE BIT(8) ++#define SPFI_CONTROL_TX_RX BIT(1) + #define SPFI_CONTROL_TMODE_SHIFT 5 + #define SPFI_CONTROL_TMODE_MASK 0x7 + #define SPFI_CONTROL_TMODE_SINGLE 0 +@@ -47,6 +48,10 @@ + #define SPFI_TRANSACTION 0x18 + #define SPFI_TRANSACTION_TSIZE_SHIFT 16 + #define SPFI_TRANSACTION_TSIZE_MASK 0xffff ++#define SPFI_TRANSACTION_CMD_SHIFT 13 ++#define SPFI_TRANSACTION_CMD_MASK 0x7 ++#define SPFI_TRANSACTION_ADDR_SHIFT 10 ++#define SPFI_TRANSACTION_ADDR_MASK 0x7 + + #define SPFI_PORT_STATE 0x1c + #define SPFI_PORT_STATE_DEV_SEL_SHIFT 20 +@@ -83,6 +88,7 @@ + */ + #define SPFI_32BIT_FIFO_SIZE 64 + #define SPFI_8BIT_FIFO_SIZE 16 ++#define SPFI_DATA_REQUEST_MAX_SIZE 8 + + struct img_spfi { + struct device *dev; +@@ -99,6 +105,8 @@ struct img_spfi { + struct dma_chan *tx_ch; + bool tx_dma_busy; + bool rx_dma_busy; ++ ++ bool complete; + }; + + static inline u32 spfi_readl(struct img_spfi *spfi, u32 reg) +@@ -115,9 +123,11 @@ static inline void spfi_start(struct img + { + u32 val; + +- val = spfi_readl(spfi, SPFI_CONTROL); +- val |= SPFI_CONTROL_SPFI_EN; +- spfi_writel(spfi, val, SPFI_CONTROL); ++ if (spfi->complete) { ++ val = spfi_readl(spfi, SPFI_CONTROL); ++ val |= SPFI_CONTROL_SPFI_EN; ++ spfi_writel(spfi, val, SPFI_CONTROL); ++ } + } + + static inline void spfi_reset(struct img_spfi *spfi) +@@ -130,12 +140,21 @@ static int spfi_wait_all_done(struct img + { + unsigned long timeout = jiffies + msecs_to_jiffies(50); + ++ if (!(spfi->complete)) ++ return 0; ++ + while (time_before(jiffies, timeout)) { + u32 status = spfi_readl(spfi, SPFI_INTERRUPT_STATUS); + + if (status & SPFI_INTERRUPT_ALLDONETRIG) { + spfi_writel(spfi, SPFI_INTERRUPT_ALLDONETRIG, + SPFI_INTERRUPT_CLEAR); ++ /* ++ * Disable SPFI for it not to interfere with ++ * pending transactions ++ */ ++ spfi_writel(spfi, spfi_readl(spfi, SPFI_CONTROL) ++ & ~SPFI_CONTROL_SPFI_EN, SPFI_CONTROL); + return 0; + } + cpu_relax(); +@@ -441,9 +460,32 @@ static void img_spfi_config(struct spi_m + struct spi_transfer *xfer) + { + struct img_spfi *spfi = spi_master_get_devdata(spi->master); +- u32 val, div; ++ u32 val, div, transact; ++ bool is_pending; + + /* ++ * For read or write transfers of less than 8 bytes (cmd = 1 byte, ++ * addr up to 7 bytes), SPFI will be configured, but not enabled ++ * (unless it is the last transfer in the queue).The transfer will ++ * be enabled by the subsequent transfer. ++ * A pending transfer is determined by the content of the ++ * transaction register: if command part is set and tsize ++ * is not ++ */ ++ transact = spfi_readl(spfi, SPFI_TRANSACTION); ++ is_pending = ((transact >> SPFI_TRANSACTION_CMD_SHIFT) & ++ SPFI_TRANSACTION_CMD_MASK) && ++ (!((transact >> SPFI_TRANSACTION_TSIZE_SHIFT) & ++ SPFI_TRANSACTION_TSIZE_MASK)); ++ ++ /* If there are no pending transactions it's OK to soft reset */ ++ if (!is_pending) { ++ /* Start the transaction from a known (reset) state */ ++ spfi_reset(spfi); ++ } ++ ++ /* ++ * Before anything else, set up parameters. + * output = spfi_clk * (BITCLK / 512), where BITCLK must be a + * power of 2 up to 128 + */ +@@ -456,20 +498,52 @@ static void img_spfi_config(struct spi_m + val |= div << SPFI_DEVICE_PARAMETER_BITCLK_SHIFT; + spfi_writel(spfi, val, SPFI_DEVICE_PARAMETER(spi->chip_select)); + +- spfi_writel(spfi, xfer->len << SPFI_TRANSACTION_TSIZE_SHIFT, +- SPFI_TRANSACTION); ++ if (!list_is_last(&xfer->transfer_list, &master->cur_msg->transfers) && ++ /* ++ * For duplex mode (both the tx and rx buffers are !NULL) the ++ * CMD, ADDR, and DUMMY byte parts of the transaction register ++ * should always be 0 and therefore the pending transfer ++ * technique cannot be used. ++ */ ++ (xfer->tx_buf) && (!xfer->rx_buf) && ++ (xfer->len <= SPFI_DATA_REQUEST_MAX_SIZE) && !is_pending) { ++ transact = (1 & SPFI_TRANSACTION_CMD_MASK) << ++ SPFI_TRANSACTION_CMD_SHIFT; ++ transact |= ((xfer->len - 1) & SPFI_TRANSACTION_ADDR_MASK) << ++ SPFI_TRANSACTION_ADDR_SHIFT; ++ spfi->complete = false; ++ } else { ++ spfi->complete = true; ++ if (is_pending) { ++ /* Keep setup from pending transfer */ ++ transact |= ((xfer->len & SPFI_TRANSACTION_TSIZE_MASK) << ++ SPFI_TRANSACTION_TSIZE_SHIFT); ++ } else { ++ transact = ((xfer->len & SPFI_TRANSACTION_TSIZE_MASK) << ++ SPFI_TRANSACTION_TSIZE_SHIFT); ++ } ++ } ++ spfi_writel(spfi, transact, SPFI_TRANSACTION); + + val = spfi_readl(spfi, SPFI_CONTROL); + val &= ~(SPFI_CONTROL_SEND_DMA | SPFI_CONTROL_GET_DMA); +- if (xfer->tx_buf) ++ /* ++ * We set up send DMA for pending transfers also, as ++ * those are always send transfers ++ */ ++ if ((xfer->tx_buf) || is_pending) + val |= SPFI_CONTROL_SEND_DMA; +- if (xfer->rx_buf) ++ if (xfer->tx_buf) ++ val |= SPFI_CONTROL_TX_RX; ++ if (xfer->rx_buf) { + val |= SPFI_CONTROL_GET_DMA; ++ val &= ~SPFI_CONTROL_TX_RX; ++ } + val &= ~(SPFI_CONTROL_TMODE_MASK << SPFI_CONTROL_TMODE_SHIFT); +- if (xfer->tx_nbits == SPI_NBITS_DUAL && ++ if (xfer->tx_nbits == SPI_NBITS_DUAL || + xfer->rx_nbits == SPI_NBITS_DUAL) + val |= SPFI_CONTROL_TMODE_DUAL << SPFI_CONTROL_TMODE_SHIFT; +- else if (xfer->tx_nbits == SPI_NBITS_QUAD && ++ else if (xfer->tx_nbits == SPI_NBITS_QUAD || + xfer->rx_nbits == SPI_NBITS_QUAD) + val |= SPFI_CONTROL_TMODE_QUAD << SPFI_CONTROL_TMODE_SHIFT; + val |= SPFI_CONTROL_SE; diff --git a/target/linux/pistachio/patches-5.15/104-spi-img-spfi-use-device-0-configuration-for-all-devi.patch b/target/linux/pistachio/patches-5.15/104-spi-img-spfi-use-device-0-configuration-for-all-devi.patch new file mode 100644 index 00000000000..2995b7dd88c --- /dev/null +++ b/target/linux/pistachio/patches-5.15/104-spi-img-spfi-use-device-0-configuration-for-all-devi.patch @@ -0,0 +1,64 @@ +From 905ee06a9966113fe51d6bad1819759cb30fd0bd Mon Sep 17 00:00:00 2001 +From: Ionela Voinescu +Date: Tue, 9 Feb 2016 10:18:31 +0000 +Subject: spi: img-spfi: use device 0 configuration for all devices + +Given that we control the chip select line externally +we can use only one parameter register (device 0 parameter +register) and one set of configuration bits (port configuration +bits for device 0) for all devices (all chip select lines). + +Signed-off-by: Ionela Voinescu +--- + drivers/spi/spi-img-spfi.c | 23 ++++++++++++++++------- + 1 file changed, 16 insertions(+), 7 deletions(-) + +--- a/drivers/spi/spi-img-spfi.c ++++ b/drivers/spi/spi-img-spfi.c +@@ -429,18 +429,23 @@ static int img_spfi_prepare(struct spi_m + struct img_spfi *spfi = spi_master_get_devdata(master); + u32 val; + ++ /* ++ * The chip select line is controlled externally so ++ * we can use the CS0 configuration for all devices ++ */ + val = spfi_readl(spfi, SPFI_PORT_STATE); ++ ++ /* 0 for device selection */ + val &= ~(SPFI_PORT_STATE_DEV_SEL_MASK << + SPFI_PORT_STATE_DEV_SEL_SHIFT); +- val |= msg->spi->chip_select << SPFI_PORT_STATE_DEV_SEL_SHIFT; + if (msg->spi->mode & SPI_CPHA) +- val |= SPFI_PORT_STATE_CK_PHASE(msg->spi->chip_select); ++ val |= SPFI_PORT_STATE_CK_PHASE(0); + else +- val &= ~SPFI_PORT_STATE_CK_PHASE(msg->spi->chip_select); ++ val &= ~SPFI_PORT_STATE_CK_PHASE(0); + if (msg->spi->mode & SPI_CPOL) +- val |= SPFI_PORT_STATE_CK_POL(msg->spi->chip_select); ++ val |= SPFI_PORT_STATE_CK_POL(0); + else +- val &= ~SPFI_PORT_STATE_CK_POL(msg->spi->chip_select); ++ val &= ~SPFI_PORT_STATE_CK_POL(0); + spfi_writel(spfi, val, SPFI_PORT_STATE); + + return 0; +@@ -492,11 +497,15 @@ static void img_spfi_config(struct spi_m + div = DIV_ROUND_UP(clk_get_rate(spfi->spfi_clk), xfer->speed_hz); + div = clamp(512 / (1 << get_count_order(div)), 1, 128); + +- val = spfi_readl(spfi, SPFI_DEVICE_PARAMETER(spi->chip_select)); ++ /* ++ * The chip select line is controlled externally so ++ * we can use the CS0 parameters for all devices ++ */ ++ val = spfi_readl(spfi, SPFI_DEVICE_PARAMETER(0)); + val &= ~(SPFI_DEVICE_PARAMETER_BITCLK_MASK << + SPFI_DEVICE_PARAMETER_BITCLK_SHIFT); + val |= div << SPFI_DEVICE_PARAMETER_BITCLK_SHIFT; +- spfi_writel(spfi, val, SPFI_DEVICE_PARAMETER(spi->chip_select)); ++ spfi_writel(spfi, val, SPFI_DEVICE_PARAMETER(0)); + + if (!list_is_last(&xfer->transfer_list, &master->cur_msg->transfers) && + /* diff --git a/target/linux/pistachio/patches-5.15/105-spi-img-spfi-RX-maximum-burst-size-for-DMA-is-8.patch b/target/linux/pistachio/patches-5.15/105-spi-img-spfi-RX-maximum-burst-size-for-DMA-is-8.patch new file mode 100644 index 00000000000..54185038162 --- /dev/null +++ b/target/linux/pistachio/patches-5.15/105-spi-img-spfi-RX-maximum-burst-size-for-DMA-is-8.patch @@ -0,0 +1,59 @@ +From 56466f505f58f44b69feb7eaed3b506842800456 Mon Sep 17 00:00:00 2001 +From: Ionela Voinescu +Date: Tue, 1 Mar 2016 17:49:45 +0000 +Subject: spi: img-spfi: RX maximum burst size for DMA is 8 + +The depth of the FIFOs is 16 bytes. The DMA request line is tied +to the half full/empty (depending on the use of the TX or RX FIFO) +threshold. For the TX FIFO, if you set a burst size of 8 (equal to +half the depth) the first burst goes into FIFO without any issues, +but due the latency involved (the time the data leaves the DMA +engine to the time it arrives at the FIFO), the DMA might trigger +another burst of 8. But given that there is no space for 2 additonal +bursts of 8, this would result in a failure. Therefore, we have to +keep the burst size for TX to 4 to accomodate for an extra burst. + +For the read (RX) scenario, the DMA request line goes high when +there is at least 8 entries in the FIFO (half full), and we can +program the burst size to be 8 because the risk of accidental burst +does not exist. The DMA engine will not trigger another read until +the read data for all the burst it has sent out has been received. + +While here, move the burst size setting outside of the if/else branches +as they have the same value for both 8 and 32 bit data widths. + +Signed-off-by: Ionela Voinescu +--- + drivers/spi/spi-img-spfi.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/spi/spi-img-spfi.c ++++ b/drivers/spi/spi-img-spfi.c +@@ -338,12 +338,11 @@ static int img_spfi_start_dma(struct spi + if (xfer->len % 4 == 0) { + rxconf.src_addr = spfi->phys + SPFI_RX_32BIT_VALID_DATA; + rxconf.src_addr_width = 4; +- rxconf.src_maxburst = 4; + } else { + rxconf.src_addr = spfi->phys + SPFI_RX_8BIT_VALID_DATA; + rxconf.src_addr_width = 1; +- rxconf.src_maxburst = 4; + } ++ rxconf.src_maxburst = 8; + dmaengine_slave_config(spfi->rx_ch, &rxconf); + + rxdesc = dmaengine_prep_slave_sg(spfi->rx_ch, xfer->rx_sg.sgl, +@@ -362,12 +361,11 @@ static int img_spfi_start_dma(struct spi + if (xfer->len % 4 == 0) { + txconf.dst_addr = spfi->phys + SPFI_TX_32BIT_VALID_DATA; + txconf.dst_addr_width = 4; +- txconf.dst_maxburst = 4; + } else { + txconf.dst_addr = spfi->phys + SPFI_TX_8BIT_VALID_DATA; + txconf.dst_addr_width = 1; +- txconf.dst_maxburst = 4; + } ++ txconf.dst_maxburst = 4; + dmaengine_slave_config(spfi->tx_ch, &txconf); + + txdesc = dmaengine_prep_slave_sg(spfi->tx_ch, xfer->tx_sg.sgl, diff --git a/target/linux/pistachio/patches-5.15/106-spi-img-spfi-finish-every-transfer-cleanly.patch b/target/linux/pistachio/patches-5.15/106-spi-img-spfi-finish-every-transfer-cleanly.patch new file mode 100644 index 00000000000..ea1f9f28cc7 --- /dev/null +++ b/target/linux/pistachio/patches-5.15/106-spi-img-spfi-finish-every-transfer-cleanly.patch @@ -0,0 +1,120 @@ +From 5fcca3fd4b621d7b5bdeca18d36dfc6ca6cfe383 Mon Sep 17 00:00:00 2001 +From: Ionela Voinescu +Date: Wed, 10 Aug 2016 11:42:26 +0100 +Subject: spi: img-spfi: finish every transfer cleanly + +Before this change, the interrupt status bit that signaled +the end of a tranfers was cleared in the wait_all_done +function. That functionality triggered issues for DMA +duplex transactions where the wait function was called +twice, in both the TX and RX callbacks. + +In order to fix the issue, clear all interrupt data bits +at the end of a PIO transfer or at the end of both TX and RX +duplex transfers, if the transfer is not a pending tranfer +(command waiting for data). After that, the status register +is checked for new incoming data or new data requests to be +signaled. If SPFI finished cleanly, no new interrupt data +bits should be set. + +Signed-off-by: Ionela Voinescu +--- + drivers/spi/spi-img-spfi.c | 49 +++++++++++++++++++++++++++++++++------------- + 1 file changed, 35 insertions(+), 14 deletions(-) + +--- a/drivers/spi/spi-img-spfi.c ++++ b/drivers/spi/spi-img-spfi.c +@@ -79,6 +79,14 @@ + #define SPFI_INTERRUPT_SDE BIT(1) + #define SPFI_INTERRUPT_SDTRIG BIT(0) + ++#define SPFI_INTERRUPT_DATA_BITS (SPFI_INTERRUPT_SDHF |\ ++ SPFI_INTERRUPT_SDFUL |\ ++ SPFI_INTERRUPT_GDEX32BIT |\ ++ SPFI_INTERRUPT_GDHF |\ ++ SPFI_INTERRUPT_GDFUL |\ ++ SPFI_INTERRUPT_ALLDONETRIG |\ ++ SPFI_INTERRUPT_GDEX8BIT) ++ + /* + * There are four parallel FIFOs of 16 bytes each. The word buffer + * (*_32BIT_VALID_DATA) accesses all four FIFOs at once, resulting in an +@@ -136,6 +144,23 @@ static inline void spfi_reset(struct img + spfi_writel(spfi, 0, SPFI_CONTROL); + } + ++static inline void spfi_finish(struct img_spfi *spfi) ++{ ++ if (!(spfi->complete)) ++ return; ++ ++ /* Clear data bits as all transfers(TX and RX) have finished */ ++ spfi_writel(spfi, SPFI_INTERRUPT_DATA_BITS, SPFI_INTERRUPT_CLEAR); ++ if (spfi_readl(spfi, SPFI_INTERRUPT_STATUS) & SPFI_INTERRUPT_DATA_BITS) { ++ dev_err(spfi->dev, "SPFI did not finish transfer cleanly.\n"); ++ spfi_reset(spfi); ++ } ++ /* Disable SPFI for it not to interfere with pending transactions */ ++ spfi_writel(spfi, ++ spfi_readl(spfi, SPFI_CONTROL) & ~SPFI_CONTROL_SPFI_EN, ++ SPFI_CONTROL); ++} ++ + static int spfi_wait_all_done(struct img_spfi *spfi) + { + unsigned long timeout = jiffies + msecs_to_jiffies(50); +@@ -144,19 +169,9 @@ static int spfi_wait_all_done(struct img + return 0; + + while (time_before(jiffies, timeout)) { +- u32 status = spfi_readl(spfi, SPFI_INTERRUPT_STATUS); +- +- if (status & SPFI_INTERRUPT_ALLDONETRIG) { +- spfi_writel(spfi, SPFI_INTERRUPT_ALLDONETRIG, +- SPFI_INTERRUPT_CLEAR); +- /* +- * Disable SPFI for it not to interfere with +- * pending transactions +- */ +- spfi_writel(spfi, spfi_readl(spfi, SPFI_CONTROL) +- & ~SPFI_CONTROL_SPFI_EN, SPFI_CONTROL); ++ if (spfi_readl(spfi, SPFI_INTERRUPT_STATUS) & ++ SPFI_INTERRUPT_ALLDONETRIG) + return 0; +- } + cpu_relax(); + } + +@@ -288,6 +303,8 @@ static int img_spfi_start_pio(struct spi + } + + ret = spfi_wait_all_done(spfi); ++ spfi_finish(spfi); ++ + if (ret < 0) + return ret; + +@@ -303,8 +320,10 @@ static void img_spfi_dma_rx_cb(void *dat + + spin_lock_irqsave(&spfi->lock, flags); + spfi->rx_dma_busy = false; +- if (!spfi->tx_dma_busy) ++ if (!spfi->tx_dma_busy) { ++ spfi_finish(spfi); + spi_finalize_current_transfer(spfi->master); ++ } + spin_unlock_irqrestore(&spfi->lock, flags); + } + +@@ -317,8 +336,10 @@ static void img_spfi_dma_tx_cb(void *dat + + spin_lock_irqsave(&spfi->lock, flags); + spfi->tx_dma_busy = false; +- if (!spfi->rx_dma_busy) ++ if (!spfi->rx_dma_busy) { ++ spfi_finish(spfi); + spi_finalize_current_transfer(spfi->master); ++ } + spin_unlock_irqrestore(&spfi->lock, flags); + } + diff --git a/target/linux/pistachio/patches-5.15/108-clk-pistachio-Fix-wrong-SDHost-card-speed.patch b/target/linux/pistachio/patches-5.15/108-clk-pistachio-Fix-wrong-SDHost-card-speed.patch new file mode 100644 index 00000000000..6fddbe269af --- /dev/null +++ b/target/linux/pistachio/patches-5.15/108-clk-pistachio-Fix-wrong-SDHost-card-speed.patch @@ -0,0 +1,49 @@ +From 3642843a06025ec333d7e92580cf52cb8db2a652 Mon Sep 17 00:00:00 2001 +From: Govindraj Raja +Date: Fri, 8 Jan 2016 16:36:07 +0000 +Subject: clk: pistachio: Fix wrong SDHost card speed + +The SDHost currently clocks the card 4x slower than it +should do, because there is fixed divide by 4 in the +sdhost wrapper that is not present in the clock tree. +To model this add a fixed divide by 4 clock node in +the SDHost clock path. + +This will ensure the right clock frequency is selected when +the mmc driver tries to configure frequency on card insert. + +Signed-off-by: Govindraj Raja +--- + drivers/clk/pistachio/clk-pistachio.c | 3 ++- + include/dt-bindings/clock/pistachio-clk.h | 1 + + 2 files changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/clk/pistachio/clk-pistachio.c ++++ b/drivers/clk/pistachio/clk-pistachio.c +@@ -41,7 +41,7 @@ static struct pistachio_gate pistachio_g + GATE(CLK_AUX_ADC_INTERNAL, "aux_adc_internal", "sys_internal_div", + 0x104, 22), + GATE(CLK_AUX_ADC, "aux_adc", "aux_adc_div", 0x104, 23), +- GATE(CLK_SD_HOST, "sd_host", "sd_host_div", 0x104, 24), ++ GATE(CLK_SD_HOST, "sd_host", "sd_host_div4", 0x104, 24), + GATE(CLK_BT, "bt", "bt_div", 0x104, 25), + GATE(CLK_BT_DIV4, "bt_div4", "bt_div4_div", 0x104, 26), + GATE(CLK_BT_DIV8, "bt_div8", "bt_div8_div", 0x104, 27), +@@ -51,6 +51,7 @@ static struct pistachio_gate pistachio_g + static struct pistachio_fixed_factor pistachio_ffs[] __initdata = { + FIXED_FACTOR(CLK_WIFI_DIV4, "wifi_div4", "wifi_pll", 4), + FIXED_FACTOR(CLK_WIFI_DIV8, "wifi_div8", "wifi_pll", 8), ++ FIXED_FACTOR(CLK_SDHOST_DIV4, "sd_host_div4", "sd_host_div", 4), + }; + + static struct pistachio_div pistachio_divs[] __initdata = { +--- a/include/dt-bindings/clock/pistachio-clk.h ++++ b/include/dt-bindings/clock/pistachio-clk.h +@@ -18,6 +18,7 @@ + /* Fixed-factor clocks */ + #define CLK_WIFI_DIV4 16 + #define CLK_WIFI_DIV8 17 ++#define CLK_SDHOST_DIV4 18 + + /* Gate clocks */ + #define CLK_MIPS 32 diff --git a/target/linux/pistachio/patches-5.15/109-MIPS-DTS-img-marduk-switch-mmc-to-1-bit-mode.patch b/target/linux/pistachio/patches-5.15/109-MIPS-DTS-img-marduk-switch-mmc-to-1-bit-mode.patch new file mode 100644 index 00000000000..cec424a0cec --- /dev/null +++ b/target/linux/pistachio/patches-5.15/109-MIPS-DTS-img-marduk-switch-mmc-to-1-bit-mode.patch @@ -0,0 +1,47 @@ +From 981c1d416af45eff207227aec106381ac23aac99 Mon Sep 17 00:00:00 2001 +From: Ian Pozella +Date: Mon, 20 Feb 2017 10:00:52 +0000 +Subject: MIPS: DTS: img: marduk: switch mmc to 1 bit mode + +The mmc block in Pistachio allows 1 to 8 data bits to be used. +Marduk uses 4 bits allowing the upper 4 bits to be allocated +to the Mikrobus ports. However these bits are still connected +internally meaning the mmc block recieves signals on all data lines +and seems the internal HW CRC checks get corrupted by this erroneous +data. + +We cannot control what data is sent on these lines because they go +to external ports. 1 bit mode does not exhibit the issue hence the +safe default is to use this. If a user knows that in their use case +they will not use the upper bits then they can set to 4 bit mode in +order to improve performance. + +Also make sure that the upper 4 bits don't get allocated to the mmc +driver (the default is to assign all 8 pins) so they can be allocated +to other drivers. Allocating all 4 despite setting 1 bit mode as this +matches what is there in hardware. + +Signed-off-by: Ian Pozella +--- + arch/mips/boot/dts/img/pistachio_marduk.dts | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/arch/mips/boot/dts/img/pistachio_marduk.dts ++++ b/arch/mips/boot/dts/img/pistachio_marduk.dts +@@ -117,7 +117,7 @@ + + &sdhost { + status = "okay"; +- bus-width = <4>; ++ bus-width = <1>; + disable-wp; + }; + +@@ -127,6 +127,7 @@ + + &pin_sdhost_data { + drive-strength = <2>; ++ pins = "mfio17", "mfio18", "mfio19", "mfio20"; + }; + + &pwm { diff --git a/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch new file mode 100644 index 00000000000..c6569c81ce3 --- /dev/null +++ b/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -0,0 +1,54 @@ +From f32bc2aa01edcba2f2ed5db151cf183eac9ef919 Mon Sep 17 00:00:00 2001 +From: Abhimanyu Vishwakarma +Date: Sat, 25 Feb 2017 16:42:50 +0000 +Subject: mtd: nor: support mtd name from device tree + +Signed-off-by: Abhimanyu Vishwakarma +--- + drivers/mtd/spi-nor/spi-nor.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +--- a/drivers/mtd/spi-nor/core.c ++++ b/drivers/mtd/spi-nor/core.c +@@ -3143,6 +3143,7 @@ int spi_nor_scan(struct spi_nor *nor, co + struct device *dev = nor->dev; + struct mtd_info *mtd = &nor->mtd; + struct device_node *np = spi_nor_get_flash_node(nor); ++ const char __maybe_unused *of_mtd_name = NULL; + int ret; + int i; + +@@ -3197,7 +3198,12 @@ int spi_nor_scan(struct spi_nor *nor, co + if (ret) + return ret; + +- if (!mtd->name) ++#ifdef CONFIG_MTD_OF_PARTS ++ of_property_read_string(np, "linux,mtd-name", &of_mtd_name); ++#endif ++ if (of_mtd_name) ++ mtd->name = of_mtd_name; ++ else if (!mtd->name) + mtd->name = dev_name(dev); + mtd->priv = nor; + mtd->type = MTD_NORFLASH; +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -850,6 +850,17 @@ out_error: + */ + static void mtd_set_dev_defaults(struct mtd_info *mtd) + { ++#ifdef CONFIG_MTD_OF_PARTS ++ const char __maybe_unused *of_mtd_name = NULL; ++ struct device_node *np; ++ ++ np = mtd_get_of_node(mtd); ++ if (np && !mtd->name) { ++ of_property_read_string(np, "linux,mtd-name", &of_mtd_name); ++ if (of_mtd_name) ++ mtd->name = of_mtd_name; ++ } else ++#endif + if (mtd->dev.parent) { + if (!mtd->owner && mtd->dev.parent->driver) + mtd->owner = mtd->dev.parent->driver->owner; diff --git a/target/linux/pistachio/patches-5.15/901-MIPS-DTS-img-marduk-Add-SPI-NAND-flash.patch b/target/linux/pistachio/patches-5.15/901-MIPS-DTS-img-marduk-Add-SPI-NAND-flash.patch new file mode 100644 index 00000000000..cd97e38e00b --- /dev/null +++ b/target/linux/pistachio/patches-5.15/901-MIPS-DTS-img-marduk-Add-SPI-NAND-flash.patch @@ -0,0 +1,30 @@ +From 0023c706f7e0f0f02bd48a63a2f3c04c839532ae Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sat, 15 Aug 2020 16:04:53 +0200 +Subject: [PATCH 901/904] MIPS: DTS: img: marduk: Add SPI NAND flash + +Add Gigadevice GD5F4GQ4UCYIGT SPI NAND flash to the device tree. + +The NAND flash chip is connected with quad SPI, but reading currently +fails in quad SPI mode. + +Signed-off-by: Hauke Mehrtens +--- + arch/mips/boot/dts/img/pistachio_marduk.dts | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/arch/mips/boot/dts/img/pistachio_marduk.dts ++++ b/arch/mips/boot/dts/img/pistachio_marduk.dts +@@ -88,6 +88,12 @@ + reg = <0>; + spi-max-frequency = <50000000>; + }; ++ ++ flash@1 { ++ compatible = "spi-nand"; ++ reg = <1>; ++ spi-max-frequency = <50000000>; ++ }; + }; + + &uart0 { diff --git a/target/linux/pistachio/patches-5.15/902-MIPS-DTS-img-marduk-Add-Cascoda-CA8210-6LoWPAN.patch b/target/linux/pistachio/patches-5.15/902-MIPS-DTS-img-marduk-Add-Cascoda-CA8210-6LoWPAN.patch new file mode 100644 index 00000000000..af1882e2873 --- /dev/null +++ b/target/linux/pistachio/patches-5.15/902-MIPS-DTS-img-marduk-Add-Cascoda-CA8210-6LoWPAN.patch @@ -0,0 +1,43 @@ +From b7700154d75e8d7c9a2022f09c2d5430137606fa Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sat, 15 Aug 2020 16:05:25 +0200 +Subject: [PATCH 902/904] MIPS: DTS: img: marduk: Add Cascoda CA8210 6LoWPAN + +Add Cascoda CA8210 6LoWPAN controller to device tree. + +Signed-off-by: Hauke Mehrtens +--- + arch/mips/boot/dts/img/pistachio_marduk.dts | 22 +++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +--- a/arch/mips/boot/dts/img/pistachio_marduk.dts ++++ b/arch/mips/boot/dts/img/pistachio_marduk.dts +@@ -75,6 +75,28 @@ + VDD-supply = <&internal_dac_supply>; + }; + ++&spfi0 { ++ status = "okay"; ++ pinctrl-0 = <&spim0_pins>, <&spim0_cs0_alt_pin>, <&spim0_cs2_alt_pin>, <&spim0_cs3_alt_pin>, <&spim0_cs4_alt_pin>; ++ pinctrl-names = "default"; ++ ++ cs-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>, <&gpio0 2 GPIO_ACTIVE_HIGH>, ++ <&gpio1 12 GPIO_ACTIVE_HIGH>, <&gpio1 13 GPIO_ACTIVE_HIGH>; ++ ++ ca8210: ca8210@0 { ++ status = "okay"; ++ compatible = "cascoda,ca8210"; ++ reg = <0>; ++ spi-max-frequency = <4000000>; ++ spi-cpol; ++ reset-gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>; ++ irq-gpio = <&gpio2 12 GPIO_ACTIVE_HIGH>; ++ extclock-enable; ++ extclock-freq = <16000000>; ++ extclock-gpio = <2>; ++ }; ++}; ++ + &spfi1 { + status = "okay"; + diff --git a/target/linux/pistachio/patches-5.15/903-MIPS-DTS-img-marduk-Add-NXP-SC16IS752IPW.patch b/target/linux/pistachio/patches-5.15/903-MIPS-DTS-img-marduk-Add-NXP-SC16IS752IPW.patch new file mode 100644 index 00000000000..08146589981 --- /dev/null +++ b/target/linux/pistachio/patches-5.15/903-MIPS-DTS-img-marduk-Add-NXP-SC16IS752IPW.patch @@ -0,0 +1,81 @@ +From ad4eba0c36ce8af6ab9ea1bc163e4c1ac7c271c3 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sat, 15 Aug 2020 16:09:02 +0200 +Subject: [PATCH 903/904] MIPS: DTS: img: marduk: Add NXP SC16IS752IPW + +Add NXP SC16IS752IPW SPI-UART controller to device tree. + +This controller drives 2 UARTs and 7 LEDs on the board. + +Signed-off-by: Hauke Mehrtens +--- + arch/mips/boot/dts/img/pistachio_marduk.dts | 51 +++++++++++++++++++++ + 1 file changed, 51 insertions(+) + +--- a/arch/mips/boot/dts/img/pistachio_marduk.dts ++++ b/arch/mips/boot/dts/img/pistachio_marduk.dts +@@ -46,6 +46,46 @@ + regulator-max-microvolt = <1800000>; + }; + ++ /* EXT clock from ca8210 is fed to sc16is752 */ ++ ca8210_ext_clk: ca8210-ext-clk { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ clock-output-names = "ca8210_ext_clock"; ++ }; ++ ++ gpioleds { ++ compatible = "gpio-leds"; ++ user1 { ++ label = "marduk:red:user1"; ++ gpios = <&sc16is752 0 GPIO_ACTIVE_LOW>; ++ }; ++ user2 { ++ label = "marduk:red:user2"; ++ gpios = <&sc16is752 1 GPIO_ACTIVE_LOW>; ++ }; ++ user3 { ++ label = "marduk:red:user3"; ++ gpios = <&sc16is752 2 GPIO_ACTIVE_LOW>; ++ }; ++ user4 { ++ label = "marduk:red:user4"; ++ gpios = <&sc16is752 3 GPIO_ACTIVE_LOW>; ++ }; ++ user5 { ++ label = "marduk:red:user5"; ++ gpios = <&sc16is752 4 GPIO_ACTIVE_LOW>; ++ }; ++ user6 { ++ label = "marduk:red:user6"; ++ gpios = <&sc16is752 5 GPIO_ACTIVE_LOW>; ++ }; ++ user7 { ++ label = "marduk:red:user7"; ++ gpios = <&sc16is752 6 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ + leds { + compatible = "pwm-leds"; + heartbeat { +@@ -95,6 +135,17 @@ + extclock-freq = <16000000>; + extclock-gpio = <2>; + }; ++ ++ sc16is752: sc16is752@1 { ++ compatible = "nxp,sc16is752"; ++ reg = <1>; ++ clocks = <&ca8210_ext_clk>; ++ spi-max-frequency = <4000000>; ++ interrupt-parent = <&gpio0>; ++ interrupts = <11 IRQ_TYPE_EDGE_FALLING>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ }; + }; + + &spfi1 { diff --git a/target/linux/pistachio/patches-5.15/904-MIPS-DTS-img-marduk-Add-partition-name.patch b/target/linux/pistachio/patches-5.15/904-MIPS-DTS-img-marduk-Add-partition-name.patch new file mode 100644 index 00000000000..ce41c67461b --- /dev/null +++ b/target/linux/pistachio/patches-5.15/904-MIPS-DTS-img-marduk-Add-partition-name.patch @@ -0,0 +1,27 @@ +From ff0e950b605047bf50d470023e0fb2fc2003a0f0 Mon Sep 17 00:00:00 2001 +From: Ian Pozella +Date: Mon, 20 Feb 2017 10:38:07 +0000 +Subject: [PATCH 904/904] MIPS: DTS: img: marduk: Add partition name + +Signed-off-by: Ian Pozella +--- + arch/mips/boot/dts/img/pistachio_marduk.dts | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/mips/boot/dts/img/pistachio_marduk.dts ++++ b/arch/mips/boot/dts/img/pistachio_marduk.dts +@@ -160,12 +160,14 @@ + compatible = "spansion,s25fl016k", "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; ++ linux,mtd-name = "spi-nor"; + }; + + flash@1 { + compatible = "spi-nand"; + reg = <1>; + spi-max-frequency = <50000000>; ++ linux,mtd-name = "spi-nand"; + }; + }; + diff --git a/target/linux/pistachio/patches-5.15/905-MIPS-DTS-img-marduk-Add-led-aliases.patch b/target/linux/pistachio/patches-5.15/905-MIPS-DTS-img-marduk-Add-led-aliases.patch new file mode 100644 index 00000000000..c6cf5acbb8e --- /dev/null +++ b/target/linux/pistachio/patches-5.15/905-MIPS-DTS-img-marduk-Add-led-aliases.patch @@ -0,0 +1,27 @@ +--- a/arch/mips/boot/dts/img/pistachio_marduk.dts ++++ b/arch/mips/boot/dts/img/pistachio_marduk.dts +@@ -19,6 +19,11 @@ + ethernet0 = &enet; + spi0 = &spfi0; + spi1 = &spfi1; ++ ++ led-boot = &led_heartbeat; ++ led-failsafe = &led_heartbeat; ++ led-running = &led_heartbeat; ++ led-upgrade = &led_heartbeat; + }; + + chosen { +@@ -88,11 +93,10 @@ + + leds { + compatible = "pwm-leds"; +- heartbeat { ++ led_heartbeat: heartbeat { + label = "marduk:red:heartbeat"; + pwms = <&pwm 3 300000>; + max-brightness = <255>; +- linux,default-trigger = "heartbeat"; + }; + }; + From 496d32cb7827e12c0432d5310dc52220d7aed390 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 28 Sep 2022 14:14:13 +0200 Subject: [PATCH 038/104] pistachio: add 5.15 testing kernel Manually refreshed: - 903-MIPS-DTS-img-marduk-Add-NXP-SC16IS752IPW.patch - 905-MIPS-DTS-img-marduk-Add-led-aliases.patch (led node was renamed to led-1) Automatically refreshed: - 109-MIPS-DTS-img-marduk-switch-mmc-to-1-bit-mode.patch - 401-mtd-nor-support-mtd-name-from-device-tree.patch - 901-MIPS-DTS-img-marduk-Add-SPI-NAND-flash.patch - 902-MIPS-DTS-img-marduk-Add-Cascoda-CA8210-6LoWPAN.patch - 904-MIPS-DTS-img-marduk-Add-partition-name.patch Enable testing kernel. Co-Developed-by: Hauke Mehrtens Tested-by: Hauke Mehrtens Signed-off-by: Nick Hainke --- target/linux/pistachio/Makefile | 1 + target/linux/pistachio/config-5.15 | 71 +++++++++++++------ target/linux/pistachio/image/Makefile | 6 +- ...-img-marduk-switch-mmc-to-1-bit-mode.patch | 4 +- ...or-support-mtd-name-from-device-tree.patch | 6 +- ...PS-DTS-img-marduk-Add-SPI-NAND-flash.patch | 2 +- ...mg-marduk-Add-Cascoda-CA8210-6LoWPAN.patch | 2 +- ...-DTS-img-marduk-Add-NXP-SC16IS752IPW.patch | 6 +- ...PS-DTS-img-marduk-Add-partition-name.patch | 2 +- ...-MIPS-DTS-img-marduk-Add-led-aliases.patch | 8 +-- 10 files changed, 72 insertions(+), 36 deletions(-) diff --git a/target/linux/pistachio/Makefile b/target/linux/pistachio/Makefile index cec8614a139..ba3764305b4 100644 --- a/target/linux/pistachio/Makefile +++ b/target/linux/pistachio/Makefile @@ -13,6 +13,7 @@ CPU_SUBTYPE:=24kf SUBTARGETS:=generic KERNEL_PATCHVER:=5.10 +KERNEL_TESTING_PATCHVER:=5.15 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/pistachio/config-5.15 b/target/linux/pistachio/config-5.15 index 681607f65c3..c303e99987a 100644 --- a/target/linux/pistachio/config-5.15 +++ b/target/linux/pistachio/config-5.15 @@ -1,34 +1,41 @@ CONFIG_ARCH_32BIT_OFF_T=y CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_KEEP_MEMBLOCK=y CONFIG_ARCH_MMAP_RND_BITS_MAX=15 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 CONFIG_ARCH_SUSPEND_POSSIBLE=y CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_SD=y -CONFIG_BLK_SCSI_REQUEST=y +# CONFIG_BOARD_INGENIC is not set CONFIG_BOARD_SCACHE=y -CONFIG_BOOT_ELF32=y +CONFIG_BUILTIN_DTB=y CONFIG_CEVT_R4K=y -CONFIG_CLKDEV_LOOKUP=y CONFIG_CLKSRC_MIPS_GIC=y CONFIG_CLKSRC_PISTACHIO=y CONFIG_CLOCKSOURCE_WATCHDOG=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y -# CONFIG_COMMON_CLK_BOSTON is not set +CONFIG_COMMON_CLK_PISTACHIO=y CONFIG_COMPAT_32BIT_TIME=y CONFIG_CONNECTOR=y CONFIG_CPU_GENERIC_DUMP_TLB=y CONFIG_CPU_HAS_DIEI=y CONFIG_CPU_HAS_PREFETCH=y CONFIG_CPU_HAS_RIXI=y +# CONFIG_CPU_HAS_SMARTMIPS is not set CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_GOV_LADDER=y CONFIG_CPU_IDLE_GOV_MENU=y CONFIG_CPU_LITTLE_ENDIAN=y +# CONFIG_CPU_MICROMIPS is not set CONFIG_CPU_MIPS32=y +# CONFIG_CPU_MIPS32_R1 is not set CONFIG_CPU_MIPS32_R2=y +# CONFIG_CPU_MIPS32_R6 is not set +# CONFIG_CPU_MIPS64_R1 is not set +# CONFIG_CPU_MIPS64_R2 is not set +# CONFIG_CPU_MIPS64_R6 is not set CONFIG_CPU_MIPSR2=y CONFIG_CPU_MIPSR2_IRQ_EI=y CONFIG_CPU_MIPSR2_IRQ_VI=y @@ -41,7 +48,6 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y CONFIG_CPU_SUPPORTS_MSA=y CONFIG_CRC16=y CONFIG_CRC_CCITT=y -CONFIG_CRYPTO_BLAKE2S=y CONFIG_CRYPTO_CBC=y CONFIG_CRYPTO_CRC32C=y CONFIG_CRYPTO_DEFLATE=y @@ -64,25 +70,34 @@ CONFIG_DMA_OF=y CONFIG_DMA_VIRTUAL_CHANNELS=y CONFIG_DTC=y CONFIG_DWMAC_GENERIC=y -CONFIG_EARLY_PRINTK=y -CONFIG_EARLY_PRINTK_8250=y CONFIG_EXT4_FS=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_EXT4_FS_SECURITY=y +# CONFIG_FIT_IMAGE_FDT_BOSTON is not set +# CONFIG_FIT_IMAGE_FDT_JAGUAR2 is not set +# CONFIG_FIT_IMAGE_FDT_LUTON is not set +CONFIG_FIT_IMAGE_FDT_MARDUK=y +# CONFIG_FIT_IMAGE_FDT_NI169445 is not set +# CONFIG_FIT_IMAGE_FDT_OCELOT is not set +# CONFIG_FIT_IMAGE_FDT_SERVAL is not set +# CONFIG_FIT_IMAGE_FDT_XILFPGA is not set CONFIG_FIXED_PHY=y CONFIG_FS_IOMAP=y CONFIG_FS_MBCACHE=y CONFIG_FS_POSIX_ACL=y +CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_GENERIC_ALLOCATOR=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_FIND_FIRST_BIT=y CONFIG_GENERIC_GETTIMEOFDAY=y CONFIG_GENERIC_IOMAP=y CONFIG_GENERIC_IRQ_CHIP=y CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GENERIC_IRQ_MIGRATION=y CONFIG_GENERIC_IRQ_SHOW=y CONFIG_GENERIC_LIB_ASHLDI3=y CONFIG_GENERIC_LIB_ASHRDI3=y @@ -98,6 +113,7 @@ CONFIG_GENERIC_SCHED_CLOCK=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_GENERIC_TIME_VSYSCALL=y CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_CDEV=y CONFIG_HANDLE_DOMAIN_IRQ=y CONFIG_HARDWARE_WATCHPOINTS=y CONFIG_HAS_DMA=y @@ -119,13 +135,14 @@ CONFIG_IRQ_WORK=y CONFIG_JBD2=y CONFIG_LEDS_GPIO=y CONFIG_LEDS_PWM=y +# CONFIG_LEGACY_BOARD_OCELOT is not set +# CONFIG_LEGACY_BOARD_SEAD3 is not set CONFIG_LIBFDT=y CONFIG_LKDTM=y CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_LOG_BUF_SHIFT=18 CONFIG_LZO_COMPRESS=y CONFIG_LZO_DECOMPRESS=y -CONFIG_MACH_PISTACHIO=y CONFIG_MAGIC_SYSRQ=y CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0 CONFIG_MDIO_BUS=y @@ -138,11 +155,11 @@ CONFIG_MIGRATION=y CONFIG_MIPS=y CONFIG_MIPS_ASID_BITS=8 CONFIG_MIPS_ASID_SHIFT=0 +CONFIG_MIPS_AUTO_PFN_OFFSET=y CONFIG_MIPS_CLOCK_VSYSCALL=y CONFIG_MIPS_CM=y CONFIG_MIPS_CMDLINE_DTB_EXTEND=y # CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set -# CONFIG_MIPS_CMDLINE_FROM_DTB is not set CONFIG_MIPS_CPC=y CONFIG_MIPS_CPS=y # CONFIG_MIPS_CPS_CPUIDLE is not set @@ -150,10 +167,11 @@ CONFIG_MIPS_CPS=y CONFIG_MIPS_CPS_PM=y CONFIG_MIPS_CPU_SCACHE=y CONFIG_MIPS_EBPF_JIT=y -# CONFIG_MIPS_ELF_APPENDED_DTB is not set -CONFIG_MIPS_EXTERNAL_TIMER=y +CONFIG_MIPS_GENERIC=y +CONFIG_MIPS_GENERIC_KERNEL=y CONFIG_MIPS_GIC=y -CONFIG_MIPS_L1_CACHE_SHIFT=5 +CONFIG_MIPS_L1_CACHE_SHIFT=7 +CONFIG_MIPS_L1_CACHE_SHIFT_7=y CONFIG_MIPS_LD_CAN_LINK_VDSO=y CONFIG_MIPS_MT=y CONFIG_MIPS_MT_FPAFF=y @@ -161,7 +179,6 @@ CONFIG_MIPS_MT_SMP=y CONFIG_MIPS_NO_APPENDED_DTB=y CONFIG_MIPS_NR_CPU_NR_MAP=4 CONFIG_MIPS_PERF_SHARED_TC_COUNTERS=y -# CONFIG_MIPS_RAW_APPENDED_DTB is not set CONFIG_MIPS_SPRAM=y CONFIG_MMC=y CONFIG_MMC_BLOCK=y @@ -175,6 +192,7 @@ CONFIG_MODULES_USE_ELF_REL=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_NAND_CORE=y +CONFIG_MTD_NAND_ECC=y CONFIG_MTD_SPI_NAND=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y @@ -188,8 +206,9 @@ CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_NS=y CONFIG_NET_PTP_CLASSIFY=y +CONFIG_NET_SELFTESTS=y CONFIG_NLS=y -CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y +CONFIG_NO_EXCEPT_FILL=y CONFIG_NO_HZ=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y @@ -202,10 +221,9 @@ CONFIG_OF_GPIO=y CONFIG_OF_IRQ=y CONFIG_OF_KOBJ=y CONFIG_OF_MDIO=y -CONFIG_OF_NET=y CONFIG_PADATA=y CONFIG_PAGE_POOL=y -CONFIG_PCI_DRIVERS_LEGACY=y +CONFIG_PCI_DRIVERS_GENERIC=y CONFIG_PCS_XPCS=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 @@ -214,7 +232,6 @@ CONFIG_PHYLINK=y CONFIG_PHY_PISTACHIO_USB=y CONFIG_PINCTRL=y CONFIG_PINCTRL_PISTACHIO=y -CONFIG_PISTACHIO_GPTIMER_CLKSRC=y CONFIG_POWER_SUPPLY=y CONFIG_PPS=y # CONFIG_PREEMPT_NONE is not set @@ -223,6 +240,7 @@ CONFIG_PRINTK_TIME=y CONFIG_PROC_EVENTS=y CONFIG_PROFILING=y CONFIG_PTP_1588_CLOCK=y +CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_PWM=y CONFIG_PWM_IMG=y CONFIG_PWM_SYSFS=y @@ -242,6 +260,7 @@ CONFIG_RPS=y CONFIG_SCHEDSTATS=y CONFIG_SCHED_INFO=y CONFIG_SCSI=y +CONFIG_SCSI_COMMON=y CONFIG_SCSI_SPI_ATTRS=y CONFIG_SERIAL_8250_DW=y CONFIG_SERIAL_8250_DWLIB=y @@ -255,6 +274,7 @@ CONFIG_SGL_ALLOC=y CONFIG_SG_POOL=y CONFIG_SMP=y CONFIG_SMP_UP=y +CONFIG_SOCK_RX_QUEUE_MAPPING=y CONFIG_SPI=y CONFIG_SPI_IMG_SPFI=y CONFIG_SPI_MASTER=y @@ -263,20 +283,30 @@ CONFIG_SRAM=y CONFIG_SRCU=y CONFIG_STMMAC_ETH=y CONFIG_STMMAC_PLATFORM=y -# CONFIG_STMMAC_SELFTESTS is not set +CONFIG_SWAP_IO_SPACE=y CONFIG_SWPHY=y CONFIG_SYNC_R4K=y CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_SYS_HAS_CPU_MIPS32_R1=y CONFIG_SYS_HAS_CPU_MIPS32_R2=y -CONFIG_SYS_HAS_EARLY_PRINTK=y +CONFIG_SYS_HAS_CPU_MIPS32_R6=y +CONFIG_SYS_HAS_CPU_MIPS64_R1=y +CONFIG_SYS_HAS_CPU_MIPS64_R2=y +CONFIG_SYS_HAS_CPU_MIPS64_R6=y CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y +CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y CONFIG_SYS_SUPPORTS_ARBIT_HZ=y +CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y +CONFIG_SYS_SUPPORTS_HIGHMEM=y CONFIG_SYS_SUPPORTS_HOTPLUG_CPU=y CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y +CONFIG_SYS_SUPPORTS_MICROMIPS=y +CONFIG_SYS_SUPPORTS_MIPS16=y CONFIG_SYS_SUPPORTS_MIPS_CPS=y CONFIG_SYS_SUPPORTS_MULTITHREADING=y CONFIG_SYS_SUPPORTS_RELOCATABLE=y CONFIG_SYS_SUPPORTS_SCHED_SMT=y +CONFIG_SYS_SUPPORTS_SMARTMIPS=y CONFIG_SYS_SUPPORTS_SMP=y CONFIG_SYS_SUPPORTS_ZBOOT=y CONFIG_TARGET_ISA_REV=2 @@ -287,6 +317,7 @@ CONFIG_TMPFS_POSIX_ACL=y CONFIG_TREE_RCU=y CONFIG_TREE_SRCU=y CONFIG_UBIFS_FS=y +CONFIG_UHI_BOOT=y CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_COMMON=y @@ -299,8 +330,8 @@ CONFIG_USB_ROLE_SWITCH=y CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y CONFIG_USER_NS=y -CONFIG_USE_GENERIC_EARLY_PRINTK_8250=y CONFIG_USE_OF=y +# CONFIG_VIRT_BOARD_RANCHU is not set CONFIG_WATCHDOG_CORE=y CONFIG_WEAK_ORDERING=y CONFIG_XPS=y diff --git a/target/linux/pistachio/image/Makefile b/target/linux/pistachio/image/Makefile index 2e15005ac23..9c0e9da91f5 100644 --- a/target/linux/pistachio/image/Makefile +++ b/target/linux/pistachio/image/Makefile @@ -5,7 +5,11 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk -KERNEL_LOADADDR := 0x80400000 +ifdef CONFIG_LINUX_5_10 + KERNEL_LOADADDR := 0x80400000 +else + KERNEL_LOADADDR := 0x80100000 +endif define Device/Default PROFILES := Default diff --git a/target/linux/pistachio/patches-5.15/109-MIPS-DTS-img-marduk-switch-mmc-to-1-bit-mode.patch b/target/linux/pistachio/patches-5.15/109-MIPS-DTS-img-marduk-switch-mmc-to-1-bit-mode.patch index cec424a0cec..faba23c5f1b 100644 --- a/target/linux/pistachio/patches-5.15/109-MIPS-DTS-img-marduk-switch-mmc-to-1-bit-mode.patch +++ b/target/linux/pistachio/patches-5.15/109-MIPS-DTS-img-marduk-switch-mmc-to-1-bit-mode.patch @@ -28,7 +28,7 @@ Signed-off-by: Ian Pozella --- a/arch/mips/boot/dts/img/pistachio_marduk.dts +++ b/arch/mips/boot/dts/img/pistachio_marduk.dts -@@ -117,7 +117,7 @@ +@@ -118,7 +118,7 @@ &sdhost { status = "okay"; @@ -37,7 +37,7 @@ Signed-off-by: Ian Pozella disable-wp; }; -@@ -127,6 +127,7 @@ +@@ -128,6 +128,7 @@ &pin_sdhost_data { drive-strength = <2>; diff --git a/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch index c6569c81ce3..da3ca270fa4 100644 --- a/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch +++ b/target/linux/pistachio/patches-5.15/401-mtd-nor-support-mtd-name-from-device-tree.patch @@ -10,7 +10,7 @@ Signed-off-by: Abhimanyu Vishwakarma --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c -@@ -3143,6 +3143,7 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -3098,6 +3098,7 @@ int spi_nor_scan(struct spi_nor *nor, co struct device *dev = nor->dev; struct mtd_info *mtd = &nor->mtd; struct device_node *np = spi_nor_get_flash_node(nor); @@ -18,7 +18,7 @@ Signed-off-by: Abhimanyu Vishwakarma int ret; int i; -@@ -3197,7 +3198,12 @@ int spi_nor_scan(struct spi_nor *nor, co +@@ -3152,7 +3153,12 @@ int spi_nor_scan(struct spi_nor *nor, co if (ret) return ret; @@ -34,7 +34,7 @@ Signed-off-by: Abhimanyu Vishwakarma mtd->type = MTD_NORFLASH; --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c -@@ -850,6 +850,17 @@ out_error: +@@ -847,6 +847,17 @@ out_error: */ static void mtd_set_dev_defaults(struct mtd_info *mtd) { diff --git a/target/linux/pistachio/patches-5.15/901-MIPS-DTS-img-marduk-Add-SPI-NAND-flash.patch b/target/linux/pistachio/patches-5.15/901-MIPS-DTS-img-marduk-Add-SPI-NAND-flash.patch index cd97e38e00b..4b28f468333 100644 --- a/target/linux/pistachio/patches-5.15/901-MIPS-DTS-img-marduk-Add-SPI-NAND-flash.patch +++ b/target/linux/pistachio/patches-5.15/901-MIPS-DTS-img-marduk-Add-SPI-NAND-flash.patch @@ -15,7 +15,7 @@ Signed-off-by: Hauke Mehrtens --- a/arch/mips/boot/dts/img/pistachio_marduk.dts +++ b/arch/mips/boot/dts/img/pistachio_marduk.dts -@@ -88,6 +88,12 @@ +@@ -89,6 +89,12 @@ reg = <0>; spi-max-frequency = <50000000>; }; diff --git a/target/linux/pistachio/patches-5.15/902-MIPS-DTS-img-marduk-Add-Cascoda-CA8210-6LoWPAN.patch b/target/linux/pistachio/patches-5.15/902-MIPS-DTS-img-marduk-Add-Cascoda-CA8210-6LoWPAN.patch index af1882e2873..d4c4ccac53d 100644 --- a/target/linux/pistachio/patches-5.15/902-MIPS-DTS-img-marduk-Add-Cascoda-CA8210-6LoWPAN.patch +++ b/target/linux/pistachio/patches-5.15/902-MIPS-DTS-img-marduk-Add-Cascoda-CA8210-6LoWPAN.patch @@ -12,7 +12,7 @@ Signed-off-by: Hauke Mehrtens --- a/arch/mips/boot/dts/img/pistachio_marduk.dts +++ b/arch/mips/boot/dts/img/pistachio_marduk.dts -@@ -75,6 +75,28 @@ +@@ -76,6 +76,28 @@ VDD-supply = <&internal_dac_supply>; }; diff --git a/target/linux/pistachio/patches-5.15/903-MIPS-DTS-img-marduk-Add-NXP-SC16IS752IPW.patch b/target/linux/pistachio/patches-5.15/903-MIPS-DTS-img-marduk-Add-NXP-SC16IS752IPW.patch index 08146589981..b1070c3d309 100644 --- a/target/linux/pistachio/patches-5.15/903-MIPS-DTS-img-marduk-Add-NXP-SC16IS752IPW.patch +++ b/target/linux/pistachio/patches-5.15/903-MIPS-DTS-img-marduk-Add-NXP-SC16IS752IPW.patch @@ -58,10 +58,10 @@ Signed-off-by: Hauke Mehrtens + }; + }; + - leds { + led-controller { compatible = "pwm-leds"; - heartbeat { -@@ -95,6 +135,17 @@ + +@@ -96,6 +136,17 @@ extclock-freq = <16000000>; extclock-gpio = <2>; }; diff --git a/target/linux/pistachio/patches-5.15/904-MIPS-DTS-img-marduk-Add-partition-name.patch b/target/linux/pistachio/patches-5.15/904-MIPS-DTS-img-marduk-Add-partition-name.patch index ce41c67461b..490027a7021 100644 --- a/target/linux/pistachio/patches-5.15/904-MIPS-DTS-img-marduk-Add-partition-name.patch +++ b/target/linux/pistachio/patches-5.15/904-MIPS-DTS-img-marduk-Add-partition-name.patch @@ -10,7 +10,7 @@ Signed-off-by: Ian Pozella --- a/arch/mips/boot/dts/img/pistachio_marduk.dts +++ b/arch/mips/boot/dts/img/pistachio_marduk.dts -@@ -160,12 +160,14 @@ +@@ -161,12 +161,14 @@ compatible = "spansion,s25fl016k", "jedec,spi-nor"; reg = <0>; spi-max-frequency = <50000000>; diff --git a/target/linux/pistachio/patches-5.15/905-MIPS-DTS-img-marduk-Add-led-aliases.patch b/target/linux/pistachio/patches-5.15/905-MIPS-DTS-img-marduk-Add-led-aliases.patch index c6cf5acbb8e..8c03ddeea27 100644 --- a/target/linux/pistachio/patches-5.15/905-MIPS-DTS-img-marduk-Add-led-aliases.patch +++ b/target/linux/pistachio/patches-5.15/905-MIPS-DTS-img-marduk-Add-led-aliases.patch @@ -12,11 +12,11 @@ }; chosen { -@@ -88,11 +93,10 @@ - - leds { +@@ -89,11 +94,10 @@ + led-controller { compatible = "pwm-leds"; -- heartbeat { + +- led-1 { + led_heartbeat: heartbeat { label = "marduk:red:heartbeat"; pwms = <&pwm 3 300000>; From ac21dff5b67698c09f54a4b98d6f9f12af17edd4 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 22 Jan 2023 21:09:21 +0100 Subject: [PATCH 039/104] pistachio: switch to 5.15 by default It appears that only a few users are using the pistachio SoC. The most active user of the target has already approved the testing kernel and so it is very unlikely bugs will be reported in the near future. Therefore, the target should be directly bumped to 5.15. Acked-by: Hauke Mehrtens Signed-off-by: Nick Hainke --- target/linux/pistachio/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/pistachio/Makefile b/target/linux/pistachio/Makefile index ba3764305b4..6ccf63142ec 100644 --- a/target/linux/pistachio/Makefile +++ b/target/linux/pistachio/Makefile @@ -12,8 +12,7 @@ CPU_TYPE:=24kc CPU_SUBTYPE:=24kf SUBTARGETS:=generic -KERNEL_PATCHVER:=5.10 -KERNEL_TESTING_PATCHVER:=5.15 +KERNEL_PATCHVER:=5.15 include $(INCLUDE_DIR)/target.mk From 4db8598e4296054c7ca500fc7efe67fbabda69ca Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Sun, 8 Jan 2023 17:30:07 +0100 Subject: [PATCH 040/104] realtek: Do not set KERNEL_ENTRY just to avoid NO_EXCEPT_FILL It seems like we are offsetting the KERNEL_ENTRY to +0x400, which is also accomplished by the NO_EXCEPT_FILL configuration option. Since this is the default for MIPS_GENERIC_KERNEL, lets push a little bit closer to that one by doing the same thing. Signed-off-by: Olliver Schinagl --- target/linux/realtek/image/Makefile | 1 - .../realtek/patches-5.10/300-mips-add-rtl838x-platform.patch | 3 ++- .../realtek/patches-5.15/300-mips-add-rtl838x-platform.patch | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/target/linux/realtek/image/Makefile b/target/linux/realtek/image/Makefile index 3dfbcf67c16..a2afb39d406 100644 --- a/target/linux/realtek/image/Makefile +++ b/target/linux/realtek/image/Makefile @@ -4,7 +4,6 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk KERNEL_LOADADDR = 0x80100000 -KERNEL_ENTRY = 0x80100400 DEVICE_VARS += \ CAMEO_BOARD_VERSION \ diff --git a/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch index 3834ba7c619..f54bd28242c 100644 --- a/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch @@ -25,7 +25,7 @@ Submitted-by: Birger Koblitz platform-$(CONFIG_SGI_IP28) += sgi-ip22/ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1037,8 +1037,58 @@ config NLM_XLP_BOARD +@@ -1037,8 +1037,59 @@ config NLM_XLP_BOARD This board is based on Netlogic XLP Processor. Say Y here if you have a XLP based board. @@ -33,6 +33,7 @@ Submitted-by: Birger Koblitz + bool "Realtek based platforms" + select DMA_NONCOHERENT + select IRQ_MIPS_CPU ++ select NO_EXCEPT_FILL + select SYS_HAS_CPU_MIPS32_R1 + select SYS_HAS_CPU_MIPS32_R2 + select SYS_SUPPORTS_BIG_ENDIAN diff --git a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch index 3929096888b..8428c32e4e0 100644 --- a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch @@ -25,7 +25,7 @@ Submitted-by: Birger Koblitz platform-$(CONFIG_SGI_IP28) += sgi-ip22/ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1053,8 +1053,58 @@ config NLM_XLP_BOARD +@@ -1053,8 +1053,59 @@ config NLM_XLP_BOARD This board is based on Netlogic XLP Processor. Say Y here if you have a XLP based board. @@ -33,6 +33,7 @@ Submitted-by: Birger Koblitz + bool "Realtek based platforms" + select DMA_NONCOHERENT + select IRQ_MIPS_CPU ++ select NO_EXCEPT_FILL + select SYS_HAS_CPU_MIPS32_R1 + select SYS_HAS_CPU_MIPS32_R2 + select SYS_SUPPORTS_BIG_ENDIAN From 1bf39d91d5d928724d335abe12509f629d8685c7 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Mon, 9 Jan 2023 14:39:45 +0100 Subject: [PATCH 041/104] realtek: Refresh kernel config with no_except_fill Update the config files with the previous commit. Signed-off-by: Olliver Schinagl --- target/linux/realtek/rtl838x/config-5.10 | 1 + target/linux/realtek/rtl838x/config-5.15 | 1 + target/linux/realtek/rtl839x/config-5.10 | 1 + target/linux/realtek/rtl839x/config-5.15 | 1 + target/linux/realtek/rtl930x/config-5.10 | 1 + target/linux/realtek/rtl930x/config-5.15 | 1 + target/linux/realtek/rtl931x/config-5.10 | 1 + target/linux/realtek/rtl931x/config-5.15 | 1 + 8 files changed, 8 insertions(+) diff --git a/target/linux/realtek/rtl838x/config-5.10 b/target/linux/realtek/rtl838x/config-5.10 index 982dd6cb8f2..9749eec27be 100644 --- a/target/linux/realtek/rtl838x/config-5.10 +++ b/target/linux/realtek/rtl838x/config-5.10 @@ -164,6 +164,7 @@ CONFIG_NET_DSA_RTL83XX=y CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_RTL838X=y CONFIG_NET_SWITCHDEV=y +CONFIG_NO_EXCEPT_FILL=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NVMEM=y CONFIG_OF=y diff --git a/target/linux/realtek/rtl838x/config-5.15 b/target/linux/realtek/rtl838x/config-5.15 index 326fee1651d..4e4ed9f44b7 100644 --- a/target/linux/realtek/rtl838x/config-5.15 +++ b/target/linux/realtek/rtl838x/config-5.15 @@ -161,6 +161,7 @@ CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_RTL838X=y CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y +CONFIG_NO_EXCEPT_FILL=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NVMEM=y CONFIG_OF=y diff --git a/target/linux/realtek/rtl839x/config-5.10 b/target/linux/realtek/rtl839x/config-5.10 index ad2ed1e590d..9377d482d7e 100644 --- a/target/linux/realtek/rtl839x/config-5.10 +++ b/target/linux/realtek/rtl839x/config-5.10 @@ -160,6 +160,7 @@ CONFIG_NET_DSA_RTL83XX=y CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_RTL838X=y CONFIG_NET_SWITCHDEV=y +CONFIG_NO_EXCEPT_FILL=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NVMEM=y CONFIG_OF=y diff --git a/target/linux/realtek/rtl839x/config-5.15 b/target/linux/realtek/rtl839x/config-5.15 index b16476c3c60..17edb2b3bb1 100644 --- a/target/linux/realtek/rtl839x/config-5.15 +++ b/target/linux/realtek/rtl839x/config-5.15 @@ -164,6 +164,7 @@ CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_RTL838X=y CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y +CONFIG_NO_EXCEPT_FILL=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y diff --git a/target/linux/realtek/rtl930x/config-5.10 b/target/linux/realtek/rtl930x/config-5.10 index 4c1a4ffaf25..bd275a28ba7 100644 --- a/target/linux/realtek/rtl930x/config-5.10 +++ b/target/linux/realtek/rtl930x/config-5.10 @@ -150,6 +150,7 @@ CONFIG_NET_DSA_RTL83XX=y CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_RTL838X=y CONFIG_NET_SWITCHDEV=y +CONFIG_NO_EXCEPT_FILL=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NVMEM=y CONFIG_OF=y diff --git a/target/linux/realtek/rtl930x/config-5.15 b/target/linux/realtek/rtl930x/config-5.15 index 7804bcc83df..5e036166787 100644 --- a/target/linux/realtek/rtl930x/config-5.15 +++ b/target/linux/realtek/rtl930x/config-5.15 @@ -144,6 +144,7 @@ CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_RTL838X=y CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y +CONFIG_NO_EXCEPT_FILL=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NVMEM=y CONFIG_OF=y diff --git a/target/linux/realtek/rtl931x/config-5.10 b/target/linux/realtek/rtl931x/config-5.10 index fb7443a8658..1a6546c0313 100644 --- a/target/linux/realtek/rtl931x/config-5.10 +++ b/target/linux/realtek/rtl931x/config-5.10 @@ -149,6 +149,7 @@ CONFIG_NET_DSA_TAG_RTL83XX=y CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_RTL838X=y CONFIG_NET_SWITCHDEV=y +CONFIG_NO_EXCEPT_FILL=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NVMEM=y CONFIG_OF=y diff --git a/target/linux/realtek/rtl931x/config-5.15 b/target/linux/realtek/rtl931x/config-5.15 index 0c149bdf6d9..3abc49a4e95 100644 --- a/target/linux/realtek/rtl931x/config-5.15 +++ b/target/linux/realtek/rtl931x/config-5.15 @@ -159,6 +159,7 @@ CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_RTL838X=y CONFIG_NET_SELFTESTS=y CONFIG_NET_SWITCHDEV=y +CONFIG_NO_EXCEPT_FILL=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y From d84dc5d4d7b28cf4132448130d3beb4352539f4f Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Tue, 24 Jan 2023 21:34:58 +0100 Subject: [PATCH 042/104] realtek: rtl931x: drop CONFIG_NO_EXCEPT_FILL hack On RTL931x builds, CONFIG_RTL931X was used as a stand-in for CONFIG_NO_EXCEPT_FILL. Now that the latter is always selected for devices in the realtek target, this hack can be removed. Resulting device images are binary identical. Signed-off-by: Sander Vanheule --- .../patches-5.10/312-rt9313-support.patch | 17 ----------------- .../patches-5.15/312-rt9313-support.patch | 17 ----------------- 2 files changed, 34 deletions(-) diff --git a/target/linux/realtek/patches-5.10/312-rt9313-support.patch b/target/linux/realtek/patches-5.10/312-rt9313-support.patch index 516bca2b6ef..7626cc9c25c 100644 --- a/target/linux/realtek/patches-5.10/312-rt9313-support.patch +++ b/target/linux/realtek/patches-5.10/312-rt9313-support.patch @@ -43,23 +43,6 @@ Submitted-by: Birger Koblitz ifdef CONFIG_32BIT bootvars-y += ADDR_BITS=32 endif ---- a/arch/mips/kernel/head.S -+++ b/arch/mips/kernel/head.S -@@ -60,12 +60,14 @@ - .endm - - #ifndef CONFIG_NO_EXCEPT_FILL -+#ifndef CONFIG_RTL931X - /* - * Reserved space for exception handlers. - * Necessary for machines which link their kernels at KSEG0. - */ - .fill 0x400 - #endif -+#endif - - EXPORT(_stext) - --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S @@ -55,7 +55,11 @@ SECTIONS diff --git a/target/linux/realtek/patches-5.15/312-rt9313-support.patch b/target/linux/realtek/patches-5.15/312-rt9313-support.patch index 67f5580cd64..e8edc996f3d 100644 --- a/target/linux/realtek/patches-5.15/312-rt9313-support.patch +++ b/target/linux/realtek/patches-5.15/312-rt9313-support.patch @@ -43,23 +43,6 @@ Submitted-by: Birger Koblitz ifdef CONFIG_32BIT bootvars-y += ADDR_BITS=32 endif ---- a/arch/mips/kernel/head.S -+++ b/arch/mips/kernel/head.S -@@ -60,12 +60,14 @@ - .endm - - #ifndef CONFIG_NO_EXCEPT_FILL -+#ifndef CONFIG_RTL931X - /* - * Reserved space for exception handlers. - * Necessary for machines which link their kernels at KSEG0. - */ - .fill 0x400 - #endif -+#endif - - EXPORT(_stext) - --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S @@ -55,7 +55,11 @@ SECTIONS From bec9e79a99adee64dcc9559e6f008a2ffd5b3f4e Mon Sep 17 00:00:00 2001 From: Lorenz Brun Date: Wed, 28 Dec 2022 20:54:21 +0100 Subject: [PATCH 043/104] realtek: dsa: support active-high LEDs The TP-LINK TL-ST1008F has active-high LEDs, so we need a device tree property to express this. Signed-off-by: Lorenz Brun [Tidy up code, restrict changes to 5.15] Signed-off-by: Sander Vanheule --- .../linux/realtek/dts-5.15/rtl9302_zyxel_xgs1250-12.dts | 2 ++ .../realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/target/linux/realtek/dts-5.15/rtl9302_zyxel_xgs1250-12.dts b/target/linux/realtek/dts-5.15/rtl9302_zyxel_xgs1250-12.dts index a57fc00c6e9..a9821b2cc62 100644 --- a/target/linux/realtek/dts-5.15/rtl9302_zyxel_xgs1250-12.dts +++ b/target/linux/realtek/dts-5.15/rtl9302_zyxel_xgs1250-12.dts @@ -64,6 +64,8 @@ led_set: led_set@0 { compatible = "realtek,rtl9300-leds"; + active-low; + led_set0 = <0x0000 0xffff 0x0a20 0x0b80>; // LED set 0: 1000Mbps, 10/100Mbps led_set1 = <0x0a0b 0x0a28 0x0a82 0x0a0b>; // LED set 1: (10G, 5G, 2.5G) (2.5G, 1G) // (5G, 10/100) (10G, 5G, 2.5G) diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c index 7e4f13fbad7..5a899f32bab 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl930x.c @@ -21,6 +21,8 @@ #define RTL930X_VLAN_PORT_TAG_STS_CTRL_IGR_P_OTAG_KEEP_MASK GENMASK(1,1) #define RTL930X_VLAN_PORT_TAG_STS_CTRL_IGR_P_ITAG_KEEP_MASK GENMASK(0,0) +#define RTL930X_LED_GLB_ACTIVE_LOW BIT(22) + extern struct mutex smi_lock; extern struct rtl83xx_soc_info soc_info; @@ -2431,6 +2433,12 @@ static void rtl930x_led_init(struct rtl838x_switch_priv *priv) /* Set LED mode to serial (0x1) */ sw_w32_mask(0x3, 0x1, RTL930X_LED_GLB_CTRL); + /* Set LED active state */ + if (of_property_read_bool(node, "active-low")) + sw_w32_mask(RTL930X_LED_GLB_ACTIVE_LOW, 0, RTL930X_LED_GLB_CTRL); + else + sw_w32_mask(0, RTL930X_LED_GLB_ACTIVE_LOW, RTL930X_LED_GLB_CTRL); + /* Set port type masks */ sw_w32(pm, RTL930X_LED_PORT_COPR_MASK_CTRL); sw_w32(pm, RTL930X_LED_PORT_FIB_MASK_CTRL); From 9c3954bc46fce58a0f2dbe8bf6d3f507cfcd1dfb Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 18 Jan 2023 14:45:07 -0500 Subject: [PATCH 044/104] kernel: bump 5.10 to 5.10.164 All patches automatically rebased Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia --- include/kernel-5.10 | 4 ++-- .../patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch | 2 +- ...80-usb-xhci-add-support-for-performing-fake-doorbell.patch | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/kernel-5.10 b/include/kernel-5.10 index df67985cca7..a11908aaeb7 100644 --- a/include/kernel-5.10 +++ b/include/kernel-5.10 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.10 = .163 -LINUX_KERNEL_HASH-5.10.163 = 96e226e2d388abc0600434e0f4f365a8829ef901f4d8e761e7ffe2799dc09b20 +LINUX_VERSION-5.10 = .164 +LINUX_KERNEL_HASH-5.10.164 = 0c7eaaa87b012c6662440f4ce2ea6e1bb961c1845cafd102eab08a57efeb8278 diff --git a/target/linux/apm821xx/patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch b/target/linux/apm821xx/patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch index 00ca3fbade7..9748814c292 100644 --- a/target/linux/apm821xx/patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch +++ b/target/linux/apm821xx/patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch @@ -43,7 +43,7 @@ produce a noisy warning. hcd->msi_enabled = 1; --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1897,6 +1897,7 @@ struct xhci_hcd { +@@ -1901,6 +1901,7 @@ struct xhci_hcd { struct xhci_hub usb2_rhub; struct xhci_hub usb3_rhub; /* support xHCI 1.0 spec USB2 hardware LPM */ diff --git a/target/linux/bcm53xx/patches-5.10/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-5.10/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index 022b2945ad4..7e45c8f48a2 100644 --- a/target/linux/bcm53xx/patches-5.10/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-5.10/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -127,7 +127,7 @@ it on BCM4708 family. /* --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1890,6 +1890,7 @@ struct xhci_hcd { +@@ -1894,6 +1894,7 @@ struct xhci_hcd { #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) #define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) From 257e9fc57cf2c0391f8d99c25e82d75b73695c8a Mon Sep 17 00:00:00 2001 From: John Audia Date: Tue, 24 Jan 2023 07:36:07 -0500 Subject: [PATCH 045/104] kernel: bump 5.10 to 5.10.165 All patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia --- include/kernel-5.10 | 4 ++-- .../patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch | 4 ++-- ...80-usb-xhci-add-support-for-performing-fake-doorbell.patch | 2 +- .../hack-5.10/780-usb-net-MeigLink_modem_support.patch | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/kernel-5.10 b/include/kernel-5.10 index a11908aaeb7..7a91cd12fa2 100644 --- a/include/kernel-5.10 +++ b/include/kernel-5.10 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.10 = .164 -LINUX_KERNEL_HASH-5.10.164 = 0c7eaaa87b012c6662440f4ce2ea6e1bb961c1845cafd102eab08a57efeb8278 +LINUX_VERSION-5.10 = .165 +LINUX_KERNEL_HASH-5.10.165 = 971defc48f19ed0a2a7ffd4b48234619cac28895c985c6d747f5b707ba47af0d diff --git a/target/linux/apm821xx/patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch b/target/linux/apm821xx/patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch index 9748814c292..8aee7c0bc47 100644 --- a/target/linux/apm821xx/patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch +++ b/target/linux/apm821xx/patches-5.10/802-usb-xhci-force-msi-renesas-xhci.patch @@ -13,7 +13,7 @@ produce a noisy warning. --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -276,6 +276,7 @@ static void xhci_pci_quirks(struct devic +@@ -279,6 +279,7 @@ static void xhci_pci_quirks(struct devic pdev->device == 0x0015) { xhci->quirks |= XHCI_RESET_ON_RESUME; xhci->quirks |= XHCI_ZERO_64B_REGS; @@ -43,7 +43,7 @@ produce a noisy warning. hcd->msi_enabled = 1; --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1901,6 +1901,7 @@ struct xhci_hcd { +@@ -1902,6 +1902,7 @@ struct xhci_hcd { struct xhci_hub usb2_rhub; struct xhci_hub usb3_rhub; /* support xHCI 1.0 spec USB2 hardware LPM */ diff --git a/target/linux/bcm53xx/patches-5.10/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-5.10/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index 7e45c8f48a2..6b7897c41b1 100644 --- a/target/linux/bcm53xx/patches-5.10/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-5.10/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -127,7 +127,7 @@ it on BCM4708 family. /* --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1894,6 +1894,7 @@ struct xhci_hcd { +@@ -1895,6 +1895,7 @@ struct xhci_hcd { #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) #define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) diff --git a/target/linux/generic/hack-5.10/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.10/780-usb-net-MeigLink_modem_support.patch index 6d499b88fe8..e006221a977 100644 --- a/target/linux/generic/hack-5.10/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-5.10/780-usb-net-MeigLink_modem_support.patch @@ -33,7 +33,7 @@ Submitted-by: Daniel Golle #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1156,6 +1158,11 @@ static const struct usb_device_id option +@@ -1162,6 +1164,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, From 58a8ad38016cd8a27ab3c95ab38cff7b417c0cff Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sat, 29 Oct 2022 10:22:36 +0200 Subject: [PATCH 046/104] tools/ninja: update to 1.11.1 Release Notes: https://github.com/ninja-build/ninja/releases/tag/v1.11.1 Sync the "100-make_jobserver_support.patch" with the PR: https://github.com/ninja-build/ninja/pull/1140 Signed-off-by: Nick Hainke --- tools/ninja/Makefile | 4 +- .../patches/100-make_jobserver_support.patch | 4090 ++++------------- 2 files changed, 988 insertions(+), 3106 deletions(-) diff --git a/tools/ninja/Makefile b/tools/ninja/Makefile index c5c83d9b14e..4763e759d8a 100644 --- a/tools/ninja/Makefile +++ b/tools/ninja/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ninja -PKG_VERSION:=1.11.0 +PKG_VERSION:=1.11.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/ninja-build/ninja/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=3c6ba2e66400fe3f1ae83deb4b235faf3137ec20bd5b08c29bfc368db143e4c6 +PKG_HASH:=31747ae633213f1eda3842686f83c2aa1412e0f5691d1c14dbbcc67fe7400cea include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/ninja/patches/100-make_jobserver_support.patch b/tools/ninja/patches/100-make_jobserver_support.patch index 7dac8ef8149..34d2b6c4317 100644 --- a/tools/ninja/patches/100-make_jobserver_support.patch +++ b/tools/ninja/patches/100-make_jobserver_support.patch @@ -1,4 +1,4 @@ -From 17d13fd7881fd3ce9f9b9d44ce435d6caf4b8f28 Mon Sep 17 00:00:00 2001 +From afec30f5caf4b051827ffdd822ebd27c58219fee Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Tue, 22 Mar 2016 13:48:07 +0200 Subject: [PATCH 01/11] Add GNU make jobserver client support @@ -31,28 +31,41 @@ Fixes https://github.com/ninja-build/ninja/issues/1139 create mode 100644 src/tokenpool-none.cc create mode 100644 src/tokenpool.h -diff --git a/configure.py b/configure.py -index 43904349a8..db3492c93c 100755 --- a/configure.py +++ b/configure.py -@@ -522,6 +522,7 @@ def has_re2c(): +@@ -517,11 +517,13 @@ for name in ['build', + 'state', + 'status', + 'string_piece_util', ++ 'tokenpool-gnu-make', + 'util', + 'version']: objs += cxx(name, variables=cxxvariables) if platform.is_windows(): for name in ['subprocess-win32', -+ 'tokenpool-none', ++ 'tokenpool-gnu-make-win32', 'includes_normalize-win32', 'msvc_helper-win32', 'msvc_helper_main-win32']: -@@ -531,6 +532,7 @@ def has_re2c(): +@@ -530,7 +532,9 @@ if platform.is_windows(): + objs += cxx('minidump-win32', variables=cxxvariables) objs += cc('getopt') else: - objs += cxx('subprocess-posix') -+ objs += cxx('tokenpool-gnu-make') +- objs += cxx('subprocess-posix') ++ for name in ['subprocess-posix', ++ 'tokenpool-gnu-make-posix']: ++ objs += cxx(name) if platform.is_aix(): objs += cc('getopt') if platform.is_msvc(): -diff --git a/src/build.cc b/src/build.cc -index 6f11ed7a3c..fa096eac33 100644 +@@ -588,6 +592,7 @@ for name in ['build_log_test', + 'string_piece_util_test', + 'subprocess_test', + 'test', ++ 'tokenpool_test', + 'util_test']: + objs += cxx(name, variables=cxxvariables) + if platform.is_windows(): --- a/src/build.cc +++ b/src/build.cc @@ -35,6 +35,7 @@ @@ -63,7 +76,36 @@ index 6f11ed7a3c..fa096eac33 100644 #include "util.h" using namespace std; -@@ -149,7 +150,7 @@ void Plan::EdgeWanted(const Edge* edge) { +@@ -47,8 +48,9 @@ struct DryRunCommandRunner : public Comm + + // Overridden from CommandRunner: + virtual bool CanRunMore() const; ++ virtual bool AcquireToken(); + virtual bool StartCommand(Edge* edge); +- virtual bool WaitForCommand(Result* result); ++ virtual bool WaitForCommand(Result* result, bool more_ready); + + private: + queue finished_; +@@ -58,12 +60,16 @@ bool DryRunCommandRunner::CanRunMore() c + return true; + } + ++bool DryRunCommandRunner::AcquireToken() { ++ return true; ++} ++ + bool DryRunCommandRunner::StartCommand(Edge* edge) { + finished_.push(edge); + return true; + } + +-bool DryRunCommandRunner::WaitForCommand(Result* result) { ++bool DryRunCommandRunner::WaitForCommand(Result* result, bool more_ready) { + if (finished_.empty()) + return false; + +@@ -149,7 +155,7 @@ void Plan::EdgeWanted(const Edge* edge) } Edge* Plan::FindWork() { @@ -72,7 +114,7 @@ index 6f11ed7a3c..fa096eac33 100644 return NULL; EdgeSet::iterator e = ready_.begin(); Edge* edge = *e; -@@ -448,8 +449,8 @@ void Plan::Dump() const { +@@ -448,19 +454,39 @@ void Plan::Dump() const { } struct RealCommandRunner : public CommandRunner { @@ -81,18 +123,31 @@ index 6f11ed7a3c..fa096eac33 100644 + explicit RealCommandRunner(const BuildConfig& config); + virtual ~RealCommandRunner(); virtual bool CanRunMore() const; ++ virtual bool AcquireToken(); virtual bool StartCommand(Edge* edge); - virtual bool WaitForCommand(Result* result); -@@ -458,9 +459,18 @@ struct RealCommandRunner : public CommandRunner { +- virtual bool WaitForCommand(Result* result); ++ virtual bool WaitForCommand(Result* result, bool more_ready); + virtual vector GetActiveEdges(); + virtual void Abort(); const BuildConfig& config_; ++ // copy of config_.max_load_average; can be modified by TokenPool setup ++ double max_load_average_; SubprocessSet subprocs_; -+ TokenPool *tokens_; ++ TokenPool* tokens_; map subproc_to_edge_; }; +RealCommandRunner::RealCommandRunner(const BuildConfig& config) : config_(config) { -+ tokens_ = TokenPool::Get(); ++ max_load_average_ = config.max_load_average; ++ if ((tokens_ = TokenPool::Get()) != NULL) { ++ if (!tokens_->Setup(config_.parallelism_from_cmdline, ++ config_.verbosity == BuildConfig::VERBOSE, ++ max_load_average_)) { ++ delete tokens_; ++ tokens_ = NULL; ++ } ++ } +} + +RealCommandRunner::~RealCommandRunner() { @@ -102,7 +157,7 @@ index 6f11ed7a3c..fa096eac33 100644 vector RealCommandRunner::GetActiveEdges() { vector edges; for (map::iterator e = subproc_to_edge_.begin(); -@@ -471,14 +481,18 @@ vector RealCommandRunner::GetActiveEdges() { +@@ -471,14 +497,23 @@ vector RealCommandRunner::GetActi void RealCommandRunner::Abort() { subprocs_.Clear(); @@ -111,19 +166,27 @@ index 6f11ed7a3c..fa096eac33 100644 } bool RealCommandRunner::CanRunMore() const { - size_t subproc_number = - subprocs_.running_.size() + subprocs_.finished_.size(); - return (int)subproc_number < config_.parallelism +- size_t subproc_number = +- subprocs_.running_.size() + subprocs_.finished_.size(); +- return (int)subproc_number < config_.parallelism - && ((subprocs_.running_.empty() || config_.max_load_average <= 0.0f) - || GetLoadAverage() < config_.max_load_average); ++ bool parallelism_limit_not_reached = ++ tokens_ || // ignore config_.parallelism ++ ((int) (subprocs_.running_.size() + ++ subprocs_.finished_.size()) < config_.parallelism); ++ return parallelism_limit_not_reached + && (subprocs_.running_.empty() || -+ ((config_.max_load_average <= 0.0f || -+ GetLoadAverage() < config_.max_load_average) -+ && (!tokens_ || tokens_->Acquire()))); ++ (max_load_average_ <= 0.0f || ++ GetLoadAverage() < max_load_average_)); ++} ++ ++bool RealCommandRunner::AcquireToken() { ++ return (!tokens_ || tokens_->Acquire()); } bool RealCommandRunner::StartCommand(Edge* edge) { -@@ -486,6 +500,8 @@ bool RealCommandRunner::StartCommand(Edge* edge) { +@@ -486,19 +521,33 @@ bool RealCommandRunner::StartCommand(Edg Subprocess* subproc = subprocs_.Add(command, edge->use_console()); if (!subproc) return false; @@ -132,25 +195,50 @@ index 6f11ed7a3c..fa096eac33 100644 subproc_to_edge_.insert(make_pair(subproc, edge)); return true; -@@ -499,6 +515,9 @@ bool RealCommandRunner::WaitForCommand(Result* result) { + } + +-bool RealCommandRunner::WaitForCommand(Result* result) { ++bool RealCommandRunner::WaitForCommand(Result* result, bool more_ready) { + Subprocess* subproc; +- while ((subproc = subprocs_.NextFinished()) == NULL) { +- bool interrupted = subprocs_.DoWork(); ++ subprocs_.ResetTokenAvailable(); ++ while (((subproc = subprocs_.NextFinished()) == NULL) && ++ !subprocs_.IsTokenAvailable()) { ++ bool interrupted = subprocs_.DoWork(more_ready ? tokens_ : NULL); + if (interrupted) return false; } ++ // token became available ++ if (subproc == NULL) { ++ result->status = ExitTokenAvailable; ++ return true; ++ } ++ ++ // command completed + if (tokens_) + tokens_->Release(); + result->status = subproc->Finish(); result->output = subproc->GetOutput(); -@@ -621,31 +640,31 @@ bool Builder::Build(string* err) { +@@ -620,38 +669,43 @@ bool Builder::Build(string* err) { + // command runner. // Second, we attempt to wait for / reap the next finished command. while (plan_.more_to_do()) { - // See if we can start any more commands. +- // See if we can start any more commands. - if (failures_allowed && command_runner_->CanRunMore()) { - if (Edge* edge = plan_.FindWork()) { - if (edge->GetBindingBool("generator")) { -+ if (failures_allowed && plan_.more_ready() && -+ command_runner_->CanRunMore()) { ++ // See if we can start any more commands... ++ bool can_run_more = ++ failures_allowed && ++ plan_.more_ready() && ++ command_runner_->CanRunMore(); ++ ++ // ... but we also need a token to do that. ++ if (can_run_more && command_runner_->AcquireToken()) { + Edge* edge = plan_.FindWork(); + if (edge->GetBindingBool("generator")) { scan_.build_log()->Close(); @@ -191,8 +279,24 @@ index 6f11ed7a3c..fa096eac33 100644 } // See if we can reap any finished commands. -diff --git a/src/build.h b/src/build.h -index d697dfb89e..7dcd111e61 100644 + if (pending_commands) { + CommandRunner::Result result; +- if (!command_runner_->WaitForCommand(&result) || ++ if (!command_runner_->WaitForCommand(&result, can_run_more) || + result.status == ExitInterrupted) { + Cleanup(); + status_->BuildFinished(); +@@ -659,6 +713,10 @@ bool Builder::Build(string* err) { + return false; + } + ++ // We might be able to start another command; start the main loop over. ++ if (result.status == ExitTokenAvailable) ++ continue; ++ + --pending_commands; + if (!FinishCommand(&result, err)) { + Cleanup(); --- a/src/build.h +++ b/src/build.h @@ -52,6 +52,9 @@ struct Plan { @@ -205,13 +309,47 @@ index d697dfb89e..7dcd111e61 100644 /// Dumps the current state of the plan. void Dump() const; -diff --git a/src/tokenpool-gnu-make.cc b/src/tokenpool-gnu-make.cc -new file mode 100644 -index 0000000000..a8f9b7139d +@@ -136,6 +139,7 @@ private: + struct CommandRunner { + virtual ~CommandRunner() {} + virtual bool CanRunMore() const = 0; ++ virtual bool AcquireToken() = 0; + virtual bool StartCommand(Edge* edge) = 0; + + /// The result of waiting for a command. +@@ -147,7 +151,9 @@ struct CommandRunner { + bool success() const { return status == ExitSuccess; } + }; + /// Wait for a command to complete, or return false if interrupted. +- virtual bool WaitForCommand(Result* result) = 0; ++ /// If more_ready is true then the optional TokenPool is monitored too ++ /// and we return when a token becomes available. ++ virtual bool WaitForCommand(Result* result, bool more_ready) = 0; + + virtual std::vector GetActiveEdges() { return std::vector(); } + virtual void Abort() {} +@@ -155,7 +161,8 @@ struct CommandRunner { + + /// Options (e.g. verbosity, parallelism) passed to a build. + struct BuildConfig { +- BuildConfig() : verbosity(NORMAL), dry_run(false), parallelism(1), ++ BuildConfig() : verbosity(NORMAL), dry_run(false), ++ parallelism(1), parallelism_from_cmdline(false), + failures_allowed(1), max_load_average(-0.0f) {} + + enum Verbosity { +@@ -167,6 +174,7 @@ struct BuildConfig { + Verbosity verbosity; + bool dry_run; + int parallelism; ++ bool parallelism_from_cmdline; + int failures_allowed; + /// The maximum load average we must not exceed. A negative value + /// means that we do not have any limit. --- /dev/null +++ b/src/tokenpool-gnu-make.cc -@@ -0,0 +1,211 @@ -+// Copyright 2016 Google Inc. All Rights Reserved. +@@ -0,0 +1,108 @@ ++// Copyright 2016-2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. @@ -225,111 +363,55 @@ index 0000000000..a8f9b7139d +// See the License for the specific language governing permissions and +// limitations under the License. + -+#include "tokenpool.h" ++#include "tokenpool-gnu-make.h" + -+#include -+#include -+#include -+#include -+#include ++#include +#include +#include -+#include + -+// TokenPool implementation for GNU make jobserver -+// (http://make.mad-scientist.net/papers/jobserver-implementation/) -+struct GNUmakeTokenPool : public TokenPool { -+ GNUmakeTokenPool(); -+ virtual ~GNUmakeTokenPool(); -+ -+ virtual bool Acquire(); -+ virtual void Reserve(); -+ virtual void Release(); -+ virtual void Clear(); -+ -+ bool Setup(); -+ -+ private: -+ int available_; -+ int used_; -+ -+#ifdef _WIN32 -+ // @TODO -+#else -+ int rfd_; -+ int wfd_; -+ -+ struct sigaction old_act_; -+ bool restore_; -+ -+ static int dup_rfd_; -+ static void CloseDupRfd(int signum); -+ -+ bool CheckFd(int fd); -+ bool SetAlarmHandler(); -+#endif -+ -+ void Return(); -+}; ++#include "line_printer.h" + ++// TokenPool implementation for GNU make jobserver - common bits +// every instance owns an implicit token -> available_ == 1 -+GNUmakeTokenPool::GNUmakeTokenPool() : available_(1), used_(0), -+ rfd_(-1), wfd_(-1), restore_(false) { ++GNUmakeTokenPool::GNUmakeTokenPool() : available_(1), used_(0) { +} + +GNUmakeTokenPool::~GNUmakeTokenPool() { -+ Clear(); -+ if (restore_) -+ sigaction(SIGALRM, &old_act_, NULL); +} + -+bool GNUmakeTokenPool::CheckFd(int fd) { -+ if (fd < 0) ++bool GNUmakeTokenPool::Setup(bool ignore, ++ bool verbose, ++ double& max_load_average) { ++ const char* value = GetEnv("MAKEFLAGS"); ++ if (!value) + return false; -+ int ret = fcntl(fd, F_GETFD); -+ if (ret < 0) -+ return false; -+ return true; -+} + -+int GNUmakeTokenPool::dup_rfd_ = -1; -+ -+void GNUmakeTokenPool::CloseDupRfd(int signum) { -+ close(dup_rfd_); -+ dup_rfd_ = -1; -+} -+ -+bool GNUmakeTokenPool::SetAlarmHandler() { -+ struct sigaction act; -+ memset(&act, 0, sizeof(act)); -+ act.sa_handler = CloseDupRfd; -+ if (sigaction(SIGALRM, &act, &old_act_) < 0) { -+ perror("sigaction:"); -+ return(false); -+ } else { -+ restore_ = true; -+ return(true); -+ } -+} -+ -+bool GNUmakeTokenPool::Setup() { -+ const char *value = getenv("MAKEFLAGS"); -+ if (value) { -+ // GNU make <= 4.1 -+ const char *jobserver = strstr(value, "--jobserver-fds="); ++ // GNU make <= 4.1 ++ const char* jobserver = strstr(value, "--jobserver-fds="); ++ if (!jobserver) + // GNU make => 4.2 -+ if (!jobserver) -+ jobserver = strstr(value, "--jobserver-auth="); -+ if (jobserver) { -+ int rfd = -1; -+ int wfd = -1; -+ if ((sscanf(jobserver, "%*[^=]=%d,%d", &rfd, &wfd) == 2) && -+ CheckFd(rfd) && -+ CheckFd(wfd) && -+ SetAlarmHandler()) { -+ printf("ninja: using GNU make jobserver.\n"); -+ rfd_ = rfd; -+ wfd_ = wfd; ++ jobserver = strstr(value, "--jobserver-auth="); ++ if (jobserver) { ++ LinePrinter printer; ++ ++ if (ignore) { ++ printer.PrintOnNewLine("ninja: warning: -jN forced on command line; ignoring GNU make jobserver.\n"); ++ } else { ++ if (ParseAuth(jobserver)) { ++ const char* l_arg = strstr(value, " -l"); ++ int load_limit = -1; ++ ++ if (verbose) { ++ printer.PrintOnNewLine("ninja: using GNU make jobserver.\n"); ++ } ++ ++ // translate GNU make -lN to ninja -lN ++ if (l_arg && ++ (sscanf(l_arg + 3, "%d ", &load_limit) == 1) && ++ (load_limit > 0)) { ++ max_load_average = load_limit; ++ } ++ + return true; + } + } @@ -342,44 +424,13 @@ index 0000000000..a8f9b7139d + if (available_ > 0) + return true; + -+#ifdef USE_PPOLL -+ pollfd pollfds[] = {{rfd_, POLLIN, 0}}; -+ int ret = poll(pollfds, 1, 0); -+#else -+ fd_set set; -+ struct timeval timeout = { 0, 0 }; -+ FD_ZERO(&set); -+ FD_SET(rfd_, &set); -+ int ret = select(rfd_ + 1, &set, NULL, NULL, &timeout); -+#endif -+ if (ret > 0) { -+ dup_rfd_ = dup(rfd_); -+ -+ if (dup_rfd_ != -1) { -+ struct sigaction act, old_act; -+ int ret = 0; -+ -+ memset(&act, 0, sizeof(act)); -+ act.sa_handler = CloseDupRfd; -+ if (sigaction(SIGCHLD, &act, &old_act) == 0) { -+ char buf; -+ -+ // block until token read, child exits or timeout -+ alarm(1); -+ ret = read(dup_rfd_, &buf, 1); -+ alarm(0); -+ -+ sigaction(SIGCHLD, &old_act, NULL); -+ } -+ -+ CloseDupRfd(0); -+ -+ if (ret > 0) { -+ available_++; -+ return true; -+ } -+ } ++ if (AcquireToken()) { ++ // token acquired ++ available_++; ++ return true; + } ++ ++ // no token available + return false; +} + @@ -389,15 +440,8 @@ index 0000000000..a8f9b7139d +} + +void GNUmakeTokenPool::Return() { -+ const char buf = '+'; -+ while (1) { -+ int ret = write(wfd_, &buf, 1); -+ if (ret > 0) -+ available_--; -+ if ((ret != -1) || (errno != EINTR)) -+ return; -+ // write got interrupted - retry -+ } ++ if (ReturnToken()) ++ available_--; +} + +void GNUmakeTokenPool::Release() { @@ -413,55 +457,10 @@ index 0000000000..a8f9b7139d + while (available_ > 1) + Return(); +} -+ -+struct TokenPool *TokenPool::Get(void) { -+ GNUmakeTokenPool *tokenpool = new GNUmakeTokenPool; -+ if (tokenpool->Setup()) -+ return tokenpool; -+ else -+ delete tokenpool; -+ return NULL; -+} -diff --git a/src/tokenpool-none.cc b/src/tokenpool-none.cc -new file mode 100644 -index 0000000000..602b3316f5 ---- /dev/null -+++ b/src/tokenpool-none.cc -@@ -0,0 +1,27 @@ -+// Copyright 2016 Google Inc. All Rights Reserved. -+// -+// Licensed under the Apache License, Version 2.0 (the "License"); -+// you may not use this file except in compliance with the License. -+// You may obtain a copy of the License at -+// -+// http://www.apache.org/licenses/LICENSE-2.0 -+// -+// Unless required by applicable law or agreed to in writing, software -+// distributed under the License is distributed on an "AS IS" BASIS, -+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+// See the License for the specific language governing permissions and -+// limitations under the License. -+ -+#include "tokenpool.h" -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+// No-op TokenPool implementation -+struct TokenPool *TokenPool::Get(void) { -+ return NULL; -+} -diff --git a/src/tokenpool.h b/src/tokenpool.h -new file mode 100644 -index 0000000000..f560b1083b --- /dev/null +++ b/src/tokenpool.h -@@ -0,0 +1,26 @@ -+// Copyright 2016 Google Inc. All Rights Reserved. +@@ -0,0 +1,42 @@ ++// Copyright 2016-2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. @@ -475,6 +474,10 @@ index 0000000000..f560b1083b +// See the License for the specific language governing permissions and +// limitations under the License. + ++#ifdef _WIN32 ++#include ++#endif ++ +// interface to token pool +struct TokenPool { + virtual ~TokenPool() {} @@ -484,1532 +487,21 @@ index 0000000000..f560b1083b + virtual void Release() = 0; + virtual void Clear() = 0; + -+ // returns NULL if token pool is not available -+ static struct TokenPool *Get(void); -+}; - -From ccaccc610cd456f6068758f82e72006364c7380b Mon Sep 17 00:00:00 2001 -From: Stefan Becker -Date: Fri, 27 May 2016 16:47:10 +0300 -Subject: [PATCH 02/11] Add TokenPool monitoring to SubprocessSet::DoWork() - -Improve on the original jobserver client implementation. This makes -ninja a more aggressive GNU make jobserver client. - -- add monitor interface to TokenPool -- TokenPool is passed down when main loop indicates that more work is - ready and would be allowed to start if a token becomes available -- posix: update DoWork() to monitor TokenPool read file descriptor -- WaitForCommand() exits when DoWork() sets token flag -- Main loop starts over when WaitForCommand() sets token exit status ---- - src/build.cc | 53 +++++++++++++++++++++++++++++---------- - src/build.h | 3 ++- - src/build_test.cc | 9 +++++-- - src/exit_status.h | 3 ++- - src/subprocess-posix.cc | 33 ++++++++++++++++++++++-- - src/subprocess-win32.cc | 2 +- - src/subprocess.h | 8 +++++- - src/subprocess_test.cc | 47 +++++++++++++++++++++++----------- - src/tokenpool-gnu-make.cc | 5 ++++ - src/tokenpool.h | 6 +++++ - 10 files changed, 134 insertions(+), 35 deletions(-) - -diff --git a/src/build.cc b/src/build.cc -index fa096eac33..a25c349050 100644 ---- a/src/build.cc -+++ b/src/build.cc -@@ -48,8 +48,9 @@ struct DryRunCommandRunner : public CommandRunner { - - // Overridden from CommandRunner: - virtual bool CanRunMore() const; -+ virtual bool AcquireToken(); - virtual bool StartCommand(Edge* edge); -- virtual bool WaitForCommand(Result* result); -+ virtual bool WaitForCommand(Result* result, bool more_ready); - - private: - queue finished_; -@@ -59,12 +60,16 @@ bool DryRunCommandRunner::CanRunMore() const { - return true; - } - -+bool DryRunCommandRunner::AcquireToken() { -+ return true; -+} ++ // returns false if token pool setup failed ++ virtual bool Setup(bool ignore, bool verbose, double& max_load_average) = 0; + - bool DryRunCommandRunner::StartCommand(Edge* edge) { - finished_.push(edge); - return true; - } - --bool DryRunCommandRunner::WaitForCommand(Result* result) { -+bool DryRunCommandRunner::WaitForCommand(Result* result, bool more_ready) { - if (finished_.empty()) - return false; - -@@ -452,8 +457,9 @@ struct RealCommandRunner : public CommandRunner { - explicit RealCommandRunner(const BuildConfig& config); - virtual ~RealCommandRunner(); - virtual bool CanRunMore() const; -+ virtual bool AcquireToken(); - virtual bool StartCommand(Edge* edge); -- virtual bool WaitForCommand(Result* result); -+ virtual bool WaitForCommand(Result* result, bool more_ready); - virtual vector GetActiveEdges(); - virtual void Abort(); - -@@ -490,9 +496,12 @@ bool RealCommandRunner::CanRunMore() const { - subprocs_.running_.size() + subprocs_.finished_.size(); - return (int)subproc_number < config_.parallelism - && (subprocs_.running_.empty() || -- ((config_.max_load_average <= 0.0f || -- GetLoadAverage() < config_.max_load_average) -- && (!tokens_ || tokens_->Acquire()))); -+ (config_.max_load_average <= 0.0f || -+ GetLoadAverage() < config_.max_load_average)); -+} -+ -+bool RealCommandRunner::AcquireToken() { -+ return (!tokens_ || tokens_->Acquire()); - } - - bool RealCommandRunner::StartCommand(Edge* edge) { -@@ -507,14 +516,23 @@ bool RealCommandRunner::StartCommand(Edge* edge) { - return true; - } - --bool RealCommandRunner::WaitForCommand(Result* result) { -+bool RealCommandRunner::WaitForCommand(Result* result, bool more_ready) { - Subprocess* subproc; -- while ((subproc = subprocs_.NextFinished()) == NULL) { -- bool interrupted = subprocs_.DoWork(); -+ subprocs_.ResetTokenAvailable(); -+ while (((subproc = subprocs_.NextFinished()) == NULL) && -+ !subprocs_.IsTokenAvailable()) { -+ bool interrupted = subprocs_.DoWork(more_ready ? tokens_ : NULL); - if (interrupted) - return false; - } - -+ // token became available -+ if (subproc == NULL) { -+ result->status = ExitTokenAvailable; -+ return true; -+ } -+ -+ // command completed - if (tokens_) - tokens_->Release(); - -@@ -639,9 +657,14 @@ bool Builder::Build(string* err) { - // command runner. - // Second, we attempt to wait for / reap the next finished command. - while (plan_.more_to_do()) { -- // See if we can start any more commands. -- if (failures_allowed && plan_.more_ready() && -- command_runner_->CanRunMore()) { -+ // See if we can start any more commands... -+ bool can_run_more = -+ failures_allowed && -+ plan_.more_ready() && -+ command_runner_->CanRunMore(); -+ -+ // ... but we also need a token to do that. -+ if (can_run_more && command_runner_->AcquireToken()) { - Edge* edge = plan_.FindWork(); - if (edge->GetBindingBool("generator")) { - scan_.build_log()->Close(); -@@ -670,7 +693,7 @@ bool Builder::Build(string* err) { - // See if we can reap any finished commands. - if (pending_commands) { - CommandRunner::Result result; -- if (!command_runner_->WaitForCommand(&result) || -+ if (!command_runner_->WaitForCommand(&result, can_run_more) || - result.status == ExitInterrupted) { - Cleanup(); - status_->BuildFinished(); -@@ -678,6 +701,10 @@ bool Builder::Build(string* err) { - return false; - } - -+ // We might be able to start another command; start the main loop over. -+ if (result.status == ExitTokenAvailable) -+ continue; -+ - --pending_commands; - if (!FinishCommand(&result, err)) { - Cleanup(); -diff --git a/src/build.h b/src/build.h -index 7dcd111e61..35c7b97d12 100644 ---- a/src/build.h -+++ b/src/build.h -@@ -139,6 +139,7 @@ struct Plan { - struct CommandRunner { - virtual ~CommandRunner() {} - virtual bool CanRunMore() const = 0; -+ virtual bool AcquireToken() = 0; - virtual bool StartCommand(Edge* edge) = 0; - - /// The result of waiting for a command. -@@ -150,7 +151,7 @@ struct CommandRunner { - bool success() const { return status == ExitSuccess; } - }; - /// Wait for a command to complete, or return false if interrupted. -- virtual bool WaitForCommand(Result* result) = 0; -+ virtual bool WaitForCommand(Result* result, bool more_ready) = 0; - - virtual std::vector GetActiveEdges() { return std::vector(); } - virtual void Abort() {} -diff --git a/src/build_test.cc b/src/build_test.cc -index 4ef62b2113..7a5ff4015a 100644 ---- a/src/build_test.cc -+++ b/src/build_test.cc -@@ -474,8 +474,9 @@ struct FakeCommandRunner : public CommandRunner { - - // CommandRunner impl - virtual bool CanRunMore() const; -+ virtual bool AcquireToken(); - virtual bool StartCommand(Edge* edge); -- virtual bool WaitForCommand(Result* result); -+ virtual bool WaitForCommand(Result* result, bool more_ready); - virtual vector GetActiveEdges(); - virtual void Abort(); - -@@ -578,6 +579,10 @@ bool FakeCommandRunner::CanRunMore() const { - return active_edges_.size() < max_active_edges_; - } - -+bool FakeCommandRunner::AcquireToken() { -+ return true; -+} -+ - bool FakeCommandRunner::StartCommand(Edge* edge) { - assert(active_edges_.size() < max_active_edges_); - assert(find(active_edges_.begin(), active_edges_.end(), edge) -@@ -649,7 +654,7 @@ bool FakeCommandRunner::StartCommand(Edge* edge) { - return true; - } - --bool FakeCommandRunner::WaitForCommand(Result* result) { -+bool FakeCommandRunner::WaitForCommand(Result* result, bool more_ready) { - if (active_edges_.empty()) - return false; - -diff --git a/src/exit_status.h b/src/exit_status.h -index a714ece791..75ebf6a7a0 100644 ---- a/src/exit_status.h -+++ b/src/exit_status.h -@@ -18,7 +18,8 @@ - enum ExitStatus { - ExitSuccess, - ExitFailure, -- ExitInterrupted -+ ExitTokenAvailable, -+ ExitInterrupted, - }; - - #endif // NINJA_EXIT_STATUS_H_ -diff --git a/src/subprocess-posix.cc b/src/subprocess-posix.cc -index 8e785406c9..74451b0be2 100644 ---- a/src/subprocess-posix.cc -+++ b/src/subprocess-posix.cc -@@ -13,6 +13,7 @@ - // limitations under the License. - - #include "subprocess.h" -+#include "tokenpool.h" - - #include - #include -@@ -249,7 +250,7 @@ Subprocess *SubprocessSet::Add(const string& command, bool use_console) { - } - - #ifdef USE_PPOLL --bool SubprocessSet::DoWork() { -+bool SubprocessSet::DoWork(struct TokenPool* tokens) { - vector fds; - nfds_t nfds = 0; - -@@ -263,6 +264,12 @@ bool SubprocessSet::DoWork() { - ++nfds; - } - -+ if (tokens) { -+ pollfd pfd = { tokens->GetMonitorFd(), POLLIN | POLLPRI, 0 }; -+ fds.push_back(pfd); -+ ++nfds; -+ } -+ - interrupted_ = 0; - int ret = ppoll(&fds.front(), nfds, NULL, &old_mask_); - if (ret == -1) { -@@ -295,11 +302,20 @@ bool SubprocessSet::DoWork() { - ++i; - } - -+ if (tokens) { -+ pollfd *pfd = &fds[nfds - 1]; -+ if (pfd->fd >= 0) { -+ assert(pfd->fd == tokens->GetMonitorFd()); -+ if (pfd->revents != 0) -+ token_available_ = true; -+ } -+ } -+ - return IsInterrupted(); - } - - #else // !defined(USE_PPOLL) --bool SubprocessSet::DoWork() { -+bool SubprocessSet::DoWork(struct TokenPool* tokens) { - fd_set set; - int nfds = 0; - FD_ZERO(&set); -@@ -314,6 +330,13 @@ bool SubprocessSet::DoWork() { - } - } - -+ if (tokens) { -+ int fd = tokens->GetMonitorFd(); -+ FD_SET(fd, &set); -+ if (nfds < fd+1) -+ nfds = fd+1; -+ } -+ - interrupted_ = 0; - int ret = pselect(nfds, &set, 0, 0, 0, &old_mask_); - if (ret == -1) { -@@ -342,6 +365,12 @@ bool SubprocessSet::DoWork() { - ++i; - } - -+ if (tokens) { -+ int fd = tokens->GetMonitorFd(); -+ if ((fd >= 0) && FD_ISSET(fd, &set)) -+ token_available_ = true; -+ } -+ - return IsInterrupted(); - } - #endif // !defined(USE_PPOLL) -diff --git a/src/subprocess-win32.cc b/src/subprocess-win32.cc -index ff3baaca7f..66d2c2c430 100644 ---- a/src/subprocess-win32.cc -+++ b/src/subprocess-win32.cc -@@ -251,7 +251,7 @@ Subprocess *SubprocessSet::Add(const string& command, bool use_console) { - return subprocess; - } - --bool SubprocessSet::DoWork() { -+bool SubprocessSet::DoWork(struct TokenPool* tokens) { - DWORD bytes_read; - Subprocess* subproc; - OVERLAPPED* overlapped; -diff --git a/src/subprocess.h b/src/subprocess.h -index 9e3d2ee98f..9ea67ea477 100644 ---- a/src/subprocess.h -+++ b/src/subprocess.h -@@ -76,6 +76,8 @@ struct Subprocess { - friend struct SubprocessSet; - }; - -+struct TokenPool; -+ - /// SubprocessSet runs a ppoll/pselect() loop around a set of Subprocesses. - /// DoWork() waits for any state change in subprocesses; finished_ - /// is a queue of subprocesses as they finish. -@@ -84,13 +86,17 @@ struct SubprocessSet { - ~SubprocessSet(); - - Subprocess* Add(const std::string& command, bool use_console = false); -- bool DoWork(); -+ bool DoWork(struct TokenPool* tokens); - Subprocess* NextFinished(); - void Clear(); - - std::vector running_; - std::queue finished_; - -+ bool token_available_; -+ bool IsTokenAvailable() { return token_available_; } -+ void ResetTokenAvailable() { token_available_ = false; } -+ - #ifdef _WIN32 - static BOOL WINAPI NotifyInterrupted(DWORD dwCtrlType); - static HANDLE ioport_; -diff --git a/src/subprocess_test.cc b/src/subprocess_test.cc -index 073fe86931..4bc8083e26 100644 ---- a/src/subprocess_test.cc -+++ b/src/subprocess_test.cc -@@ -45,10 +45,12 @@ TEST_F(SubprocessTest, BadCommandStderr) { - Subprocess* subproc = subprocs_.Add("cmd /c ninja_no_such_command"); - ASSERT_NE((Subprocess *) 0, subproc); - -+ subprocs_.ResetTokenAvailable(); - while (!subproc->Done()) { - // Pretend we discovered that stderr was ready for writing. -- subprocs_.DoWork(); -+ subprocs_.DoWork(NULL); - } -+ ASSERT_EQ(false, subprocs_.IsTokenAvailable()); - - EXPECT_EQ(ExitFailure, subproc->Finish()); - EXPECT_NE("", subproc->GetOutput()); -@@ -59,10 +61,12 @@ TEST_F(SubprocessTest, NoSuchCommand) { - Subprocess* subproc = subprocs_.Add("ninja_no_such_command"); - ASSERT_NE((Subprocess *) 0, subproc); - -+ subprocs_.ResetTokenAvailable(); - while (!subproc->Done()) { - // Pretend we discovered that stderr was ready for writing. -- subprocs_.DoWork(); -+ subprocs_.DoWork(NULL); - } -+ ASSERT_EQ(false, subprocs_.IsTokenAvailable()); - - EXPECT_EQ(ExitFailure, subproc->Finish()); - EXPECT_NE("", subproc->GetOutput()); -@@ -78,9 +82,11 @@ TEST_F(SubprocessTest, InterruptChild) { - Subprocess* subproc = subprocs_.Add("kill -INT $$"); - ASSERT_NE((Subprocess *) 0, subproc); - -+ subprocs_.ResetTokenAvailable(); - while (!subproc->Done()) { -- subprocs_.DoWork(); -+ subprocs_.DoWork(NULL); - } -+ ASSERT_EQ(false, subprocs_.IsTokenAvailable()); - - EXPECT_EQ(ExitInterrupted, subproc->Finish()); - } -@@ -90,7 +96,7 @@ TEST_F(SubprocessTest, InterruptParent) { - ASSERT_NE((Subprocess *) 0, subproc); - - while (!subproc->Done()) { -- bool interrupted = subprocs_.DoWork(); -+ bool interrupted = subprocs_.DoWork(NULL); - if (interrupted) - return; - } -@@ -102,9 +108,11 @@ TEST_F(SubprocessTest, InterruptChildWithSigTerm) { - Subprocess* subproc = subprocs_.Add("kill -TERM $$"); - ASSERT_NE((Subprocess *) 0, subproc); - -+ subprocs_.ResetTokenAvailable(); - while (!subproc->Done()) { -- subprocs_.DoWork(); -+ subprocs_.DoWork(NULL); - } -+ ASSERT_EQ(false, subprocs_.IsTokenAvailable()); - - EXPECT_EQ(ExitInterrupted, subproc->Finish()); - } -@@ -114,7 +122,7 @@ TEST_F(SubprocessTest, InterruptParentWithSigTerm) { - ASSERT_NE((Subprocess *) 0, subproc); - - while (!subproc->Done()) { -- bool interrupted = subprocs_.DoWork(); -+ bool interrupted = subprocs_.DoWork(NULL); - if (interrupted) - return; - } -@@ -126,9 +134,11 @@ TEST_F(SubprocessTest, InterruptChildWithSigHup) { - Subprocess* subproc = subprocs_.Add("kill -HUP $$"); - ASSERT_NE((Subprocess *) 0, subproc); - -+ subprocs_.ResetTokenAvailable(); - while (!subproc->Done()) { -- subprocs_.DoWork(); -+ subprocs_.DoWork(NULL); - } -+ ASSERT_EQ(false, subprocs_.IsTokenAvailable()); - - EXPECT_EQ(ExitInterrupted, subproc->Finish()); - } -@@ -138,7 +148,7 @@ TEST_F(SubprocessTest, InterruptParentWithSigHup) { - ASSERT_NE((Subprocess *) 0, subproc); - - while (!subproc->Done()) { -- bool interrupted = subprocs_.DoWork(); -+ bool interrupted = subprocs_.DoWork(NULL); - if (interrupted) - return; - } -@@ -153,9 +163,11 @@ TEST_F(SubprocessTest, Console) { - subprocs_.Add("test -t 0 -a -t 1 -a -t 2", /*use_console=*/true); - ASSERT_NE((Subprocess*)0, subproc); - -+ subprocs_.ResetTokenAvailable(); - while (!subproc->Done()) { -- subprocs_.DoWork(); -+ subprocs_.DoWork(NULL); - } -+ ASSERT_EQ(false, subprocs_.IsTokenAvailable()); - - EXPECT_EQ(ExitSuccess, subproc->Finish()); - } -@@ -167,9 +179,11 @@ TEST_F(SubprocessTest, SetWithSingle) { - Subprocess* subproc = subprocs_.Add(kSimpleCommand); - ASSERT_NE((Subprocess *) 0, subproc); - -+ subprocs_.ResetTokenAvailable(); - while (!subproc->Done()) { -- subprocs_.DoWork(); -+ subprocs_.DoWork(NULL); - } -+ ASSERT_EQ(false, subprocs_.IsTokenAvailable()); - ASSERT_EQ(ExitSuccess, subproc->Finish()); - ASSERT_NE("", subproc->GetOutput()); - -@@ -200,12 +214,13 @@ TEST_F(SubprocessTest, SetWithMulti) { - ASSERT_EQ("", processes[i]->GetOutput()); - } - -+ subprocs_.ResetTokenAvailable(); - while (!processes[0]->Done() || !processes[1]->Done() || - !processes[2]->Done()) { - ASSERT_GT(subprocs_.running_.size(), 0u); -- subprocs_.DoWork(); -+ subprocs_.DoWork(NULL); - } -- -+ ASSERT_EQ(false, subprocs_.IsTokenAvailable()); - ASSERT_EQ(0u, subprocs_.running_.size()); - ASSERT_EQ(3u, subprocs_.finished_.size()); - -@@ -237,8 +252,10 @@ TEST_F(SubprocessTest, SetWithLots) { - ASSERT_NE((Subprocess *) 0, subproc); - procs.push_back(subproc); - } -+ subprocs_.ResetTokenAvailable(); - while (!subprocs_.running_.empty()) -- subprocs_.DoWork(); -+ subprocs_.DoWork(NULL); -+ ASSERT_EQ(false, subprocs_.IsTokenAvailable()); - for (size_t i = 0; i < procs.size(); ++i) { - ASSERT_EQ(ExitSuccess, procs[i]->Finish()); - ASSERT_NE("", procs[i]->GetOutput()); -@@ -254,9 +271,11 @@ TEST_F(SubprocessTest, SetWithLots) { - // that stdin is closed. - TEST_F(SubprocessTest, ReadStdin) { - Subprocess* subproc = subprocs_.Add("cat -"); -+ subprocs_.ResetTokenAvailable(); - while (!subproc->Done()) { -- subprocs_.DoWork(); -+ subprocs_.DoWork(NULL); - } -+ ASSERT_EQ(false, subprocs_.IsTokenAvailable()); - ASSERT_EQ(ExitSuccess, subproc->Finish()); - ASSERT_EQ(1u, subprocs_.finished_.size()); - } -diff --git a/src/tokenpool-gnu-make.cc b/src/tokenpool-gnu-make.cc -index a8f9b7139d..396bb7d874 100644 ---- a/src/tokenpool-gnu-make.cc -+++ b/src/tokenpool-gnu-make.cc -@@ -33,6 +33,7 @@ struct GNUmakeTokenPool : public TokenPool { - virtual void Reserve(); - virtual void Release(); - virtual void Clear(); -+ virtual int GetMonitorFd(); - - bool Setup(); - -@@ -201,6 +202,10 @@ void GNUmakeTokenPool::Clear() { - Return(); - } - -+int GNUmakeTokenPool::GetMonitorFd() { -+ return(rfd_); -+} -+ - struct TokenPool *TokenPool::Get(void) { - GNUmakeTokenPool *tokenpool = new GNUmakeTokenPool; - if (tokenpool->Setup()) -diff --git a/src/tokenpool.h b/src/tokenpool.h -index f560b1083b..301e1998ee 100644 ---- a/src/tokenpool.h -+++ b/src/tokenpool.h -@@ -21,6 +21,12 @@ struct TokenPool { - virtual void Release() = 0; - virtual void Clear() = 0; - +#ifdef _WIN32 -+ // @TODO ++ virtual void WaitForTokenAvailability(HANDLE ioport) = 0; ++ // returns true if a token has become available ++ // key is result from GetQueuedCompletionStatus() ++ virtual bool TokenIsAvailable(ULONG_PTR key) = 0; +#else + virtual int GetMonitorFd() = 0; +#endif + - // returns NULL if token pool is not available - static struct TokenPool *Get(void); - }; - -From d09f3d77821b3b1fdf09fc0ef8e814907675eafb Mon Sep 17 00:00:00 2001 -From: Stefan Becker -Date: Sun, 12 Nov 2017 16:58:55 +0200 -Subject: [PATCH 03/11] Ignore jobserver when -jN is forced on command line - -This emulates the behaviour of GNU make. - -- add parallelism_from_cmdline flag to build configuration -- set the flag when -jN is given on command line -- pass the flag to TokenPool::Get() -- GNUmakeTokenPool::Setup() - * prints a warning when the flag is true and jobserver was detected - * returns false, i.e. jobserver will be ignored -- ignore config.parallelism in CanRunMore() when we have a valid - TokenPool, because it gets always initialized to a default when not - given on the command line ---- - src/build.cc | 10 ++++++---- - src/build.h | 4 +++- - src/ninja.cc | 1 + - src/tokenpool-gnu-make.cc | 34 +++++++++++++++++++--------------- - src/tokenpool-none.cc | 4 ++-- - src/tokenpool.h | 4 ++-- - 6 files changed, 33 insertions(+), 24 deletions(-) - -diff --git a/src/build.cc b/src/build.cc -index a25c349050..406a84ec39 100644 ---- a/src/build.cc -+++ b/src/build.cc -@@ -470,7 +470,7 @@ struct RealCommandRunner : public CommandRunner { - }; - - RealCommandRunner::RealCommandRunner(const BuildConfig& config) : config_(config) { -- tokens_ = TokenPool::Get(); -+ tokens_ = TokenPool::Get(config_.parallelism_from_cmdline); - } - - RealCommandRunner::~RealCommandRunner() { -@@ -492,9 +492,11 @@ void RealCommandRunner::Abort() { - } - - bool RealCommandRunner::CanRunMore() const { -- size_t subproc_number = -- subprocs_.running_.size() + subprocs_.finished_.size(); -- return (int)subproc_number < config_.parallelism -+ bool parallelism_limit_not_reached = -+ tokens_ || // ignore config_.parallelism -+ ((int) (subprocs_.running_.size() + -+ subprocs_.finished_.size()) < config_.parallelism); -+ return parallelism_limit_not_reached - && (subprocs_.running_.empty() || - (config_.max_load_average <= 0.0f || - GetLoadAverage() < config_.max_load_average)); -diff --git a/src/build.h b/src/build.h -index 35c7b97d12..dfde576573 100644 ---- a/src/build.h -+++ b/src/build.h -@@ -159,7 +159,8 @@ struct CommandRunner { - - /// Options (e.g. verbosity, parallelism) passed to a build. - struct BuildConfig { -- BuildConfig() : verbosity(NORMAL), dry_run(false), parallelism(1), -+ BuildConfig() : verbosity(NORMAL), dry_run(false), -+ parallelism(1), parallelism_from_cmdline(false), - failures_allowed(1), max_load_average(-0.0f) {} - - enum Verbosity { -@@ -171,6 +172,7 @@ struct BuildConfig { - Verbosity verbosity; - bool dry_run; - int parallelism; -+ bool parallelism_from_cmdline; - int failures_allowed; - /// The maximum load average we must not exceed. A negative value - /// means that we do not have any limit. -diff --git a/src/ninja.cc b/src/ninja.cc -index df39ba92d1..d904c56c4e 100644 ---- a/src/ninja.cc -+++ b/src/ninja.cc -@@ -1447,6 +1447,7 @@ int ReadFlags(int* argc, char*** argv, - // We want to run N jobs in parallel. For N = 0, INT_MAX - // is close enough to infinite for most sane builds. - config->parallelism = value > 0 ? value : INT_MAX; -+ config->parallelism_from_cmdline = true; - deferGuessParallelism.needGuess = false; - break; - } -diff --git a/src/tokenpool-gnu-make.cc b/src/tokenpool-gnu-make.cc -index 396bb7d874..af4be05a31 100644 ---- a/src/tokenpool-gnu-make.cc -+++ b/src/tokenpool-gnu-make.cc -@@ -1,4 +1,4 @@ --// Copyright 2016 Google Inc. All Rights Reserved. -+// Copyright 2016-2017 Google Inc. All Rights Reserved. - // - // Licensed under the Apache License, Version 2.0 (the "License"); - // you may not use this file except in compliance with the License. -@@ -35,7 +35,7 @@ struct GNUmakeTokenPool : public TokenPool { - virtual void Clear(); - virtual int GetMonitorFd(); - -- bool Setup(); -+ bool Setup(bool ignore); - - private: - int available_; -@@ -100,7 +100,7 @@ bool GNUmakeTokenPool::SetAlarmHandler() { - } - } - --bool GNUmakeTokenPool::Setup() { -+bool GNUmakeTokenPool::Setup(bool ignore) { - const char *value = getenv("MAKEFLAGS"); - if (value) { - // GNU make <= 4.1 -@@ -109,16 +109,20 @@ bool GNUmakeTokenPool::Setup() { - if (!jobserver) - jobserver = strstr(value, "--jobserver-auth="); - if (jobserver) { -- int rfd = -1; -- int wfd = -1; -- if ((sscanf(jobserver, "%*[^=]=%d,%d", &rfd, &wfd) == 2) && -- CheckFd(rfd) && -- CheckFd(wfd) && -- SetAlarmHandler()) { -- printf("ninja: using GNU make jobserver.\n"); -- rfd_ = rfd; -- wfd_ = wfd; -- return true; -+ if (ignore) { -+ printf("ninja: warning: -jN forced on command line; ignoring GNU make jobserver.\n"); -+ } else { -+ int rfd = -1; -+ int wfd = -1; -+ if ((sscanf(jobserver, "%*[^=]=%d,%d", &rfd, &wfd) == 2) && -+ CheckFd(rfd) && -+ CheckFd(wfd) && -+ SetAlarmHandler()) { -+ printf("ninja: using GNU make jobserver.\n"); -+ rfd_ = rfd; -+ wfd_ = wfd; -+ return true; -+ } - } - } - } -@@ -206,9 +210,9 @@ int GNUmakeTokenPool::GetMonitorFd() { - return(rfd_); - } - --struct TokenPool *TokenPool::Get(void) { -+struct TokenPool *TokenPool::Get(bool ignore) { - GNUmakeTokenPool *tokenpool = new GNUmakeTokenPool; -- if (tokenpool->Setup()) -+ if (tokenpool->Setup(ignore)) - return tokenpool; - else - delete tokenpool; -diff --git a/src/tokenpool-none.cc b/src/tokenpool-none.cc -index 602b3316f5..199b22264b 100644 ---- a/src/tokenpool-none.cc -+++ b/src/tokenpool-none.cc -@@ -1,4 +1,4 @@ --// Copyright 2016 Google Inc. All Rights Reserved. -+// Copyright 2016-2017 Google Inc. All Rights Reserved. - // - // Licensed under the Apache License, Version 2.0 (the "License"); - // you may not use this file except in compliance with the License. -@@ -22,6 +22,6 @@ - #include - - // No-op TokenPool implementation --struct TokenPool *TokenPool::Get(void) { -+struct TokenPool *TokenPool::Get(bool ignore) { - return NULL; - } -diff --git a/src/tokenpool.h b/src/tokenpool.h -index 301e1998ee..878a0933c2 100644 ---- a/src/tokenpool.h -+++ b/src/tokenpool.h -@@ -1,4 +1,4 @@ --// Copyright 2016 Google Inc. All Rights Reserved. -+// Copyright 2016-2017 Google Inc. All Rights Reserved. - // - // Licensed under the Apache License, Version 2.0 (the "License"); - // you may not use this file except in compliance with the License. -@@ -28,5 +28,5 @@ struct TokenPool { - #endif - - // returns NULL if token pool is not available -- static struct TokenPool *Get(void); -+ static struct TokenPool *Get(bool ignore); - }; - -From dfe4ca753caee65bf9041e2b4e883dfa172a5c6a Mon Sep 17 00:00:00 2001 -From: Stefan Becker -Date: Sun, 12 Nov 2017 18:04:12 +0200 -Subject: [PATCH 04/11] Honor -lN from MAKEFLAGS - -This emulates the behaviour of GNU make. - -- build: make a copy of max_load_average and pass it to TokenPool. -- GNUmakeTokenPool: if we detect a jobserver and a valid -lN argument in - MAKEFLAGS then set max_load_average to N. ---- - src/build.cc | 10 +++++++--- - src/tokenpool-gnu-make.cc | 19 +++++++++++++++---- - src/tokenpool-none.cc | 2 +- - src/tokenpool.h | 2 +- - 4 files changed, 24 insertions(+), 9 deletions(-) - -diff --git a/src/build.cc b/src/build.cc -index 406a84ec39..9e6272d035 100644 ---- a/src/build.cc -+++ b/src/build.cc -@@ -464,13 +464,17 @@ struct RealCommandRunner : public CommandRunner { - virtual void Abort(); - - const BuildConfig& config_; -+ // copy of config_.max_load_average; can be modified by TokenPool setup -+ double max_load_average_; - SubprocessSet subprocs_; - TokenPool *tokens_; - map subproc_to_edge_; - }; - - RealCommandRunner::RealCommandRunner(const BuildConfig& config) : config_(config) { -- tokens_ = TokenPool::Get(config_.parallelism_from_cmdline); -+ max_load_average_ = config.max_load_average; -+ tokens_ = TokenPool::Get(config_.parallelism_from_cmdline, -+ max_load_average_); - } - - RealCommandRunner::~RealCommandRunner() { -@@ -498,8 +502,8 @@ bool RealCommandRunner::CanRunMore() const { - subprocs_.finished_.size()) < config_.parallelism); - return parallelism_limit_not_reached - && (subprocs_.running_.empty() || -- (config_.max_load_average <= 0.0f || -- GetLoadAverage() < config_.max_load_average)); -+ (max_load_average_ <= 0.0f || -+ GetLoadAverage() < max_load_average_)); - } - - bool RealCommandRunner::AcquireToken() { -diff --git a/src/tokenpool-gnu-make.cc b/src/tokenpool-gnu-make.cc -index af4be05a31..fb654c4d88 100644 ---- a/src/tokenpool-gnu-make.cc -+++ b/src/tokenpool-gnu-make.cc -@@ -35,7 +35,7 @@ struct GNUmakeTokenPool : public TokenPool { - virtual void Clear(); - virtual int GetMonitorFd(); - -- bool Setup(bool ignore); -+ bool Setup(bool ignore, double& max_load_average); - - private: - int available_; -@@ -100,7 +100,7 @@ bool GNUmakeTokenPool::SetAlarmHandler() { - } - } - --bool GNUmakeTokenPool::Setup(bool ignore) { -+bool GNUmakeTokenPool::Setup(bool ignore, double& max_load_average) { - const char *value = getenv("MAKEFLAGS"); - if (value) { - // GNU make <= 4.1 -@@ -118,9 +118,20 @@ bool GNUmakeTokenPool::Setup(bool ignore) { - CheckFd(rfd) && - CheckFd(wfd) && - SetAlarmHandler()) { -+ const char *l_arg = strstr(value, " -l"); -+ int load_limit = -1; -+ - printf("ninja: using GNU make jobserver.\n"); - rfd_ = rfd; - wfd_ = wfd; -+ -+ // translate GNU make -lN to ninja -lN -+ if (l_arg && -+ (sscanf(l_arg + 3, "%d ", &load_limit) == 1) && -+ (load_limit > 0)) { -+ max_load_average = load_limit; -+ } -+ - return true; - } - } -@@ -210,9 +221,9 @@ int GNUmakeTokenPool::GetMonitorFd() { - return(rfd_); - } - --struct TokenPool *TokenPool::Get(bool ignore) { -+struct TokenPool *TokenPool::Get(bool ignore, double& max_load_average) { - GNUmakeTokenPool *tokenpool = new GNUmakeTokenPool; -- if (tokenpool->Setup(ignore)) -+ if (tokenpool->Setup(ignore, max_load_average)) - return tokenpool; - else - delete tokenpool; -diff --git a/src/tokenpool-none.cc b/src/tokenpool-none.cc -index 199b22264b..e8e25426c3 100644 ---- a/src/tokenpool-none.cc -+++ b/src/tokenpool-none.cc -@@ -22,6 +22,6 @@ - #include - - // No-op TokenPool implementation --struct TokenPool *TokenPool::Get(bool ignore) { -+struct TokenPool *TokenPool::Get(bool ignore, double& max_load_average) { - return NULL; - } -diff --git a/src/tokenpool.h b/src/tokenpool.h -index 878a0933c2..f9e8cc2ee0 100644 ---- a/src/tokenpool.h -+++ b/src/tokenpool.h -@@ -28,5 +28,5 @@ struct TokenPool { - #endif - - // returns NULL if token pool is not available -- static struct TokenPool *Get(bool ignore); -+ static struct TokenPool *Get(bool ignore, double& max_load_average); - }; - -From 1c10047fc6a3269ba42839da19361e09cbc06ff0 Mon Sep 17 00:00:00 2001 -From: Stefan Becker -Date: Wed, 6 Dec 2017 22:14:21 +0200 -Subject: [PATCH 05/11] Use LinePrinter for TokenPool messages - -- replace printf() with calls to LinePrinter -- print GNU make jobserver message only when verbose build is requested ---- - src/build.cc | 1 + - src/tokenpool-gnu-make.cc | 22 ++++++++++++++++------ - src/tokenpool-none.cc | 4 +++- - src/tokenpool.h | 4 +++- - 4 files changed, 23 insertions(+), 8 deletions(-) - -diff --git a/src/build.cc b/src/build.cc -index 9e6272d035..662e4bd7be 100644 ---- a/src/build.cc -+++ b/src/build.cc -@@ -474,6 +474,7 @@ struct RealCommandRunner : public CommandRunner { - RealCommandRunner::RealCommandRunner(const BuildConfig& config) : config_(config) { - max_load_average_ = config.max_load_average; - tokens_ = TokenPool::Get(config_.parallelism_from_cmdline, -+ config_.verbosity == BuildConfig::VERBOSE, - max_load_average_); - } - -diff --git a/src/tokenpool-gnu-make.cc b/src/tokenpool-gnu-make.cc -index fb654c4d88..b0d3e6ebc4 100644 ---- a/src/tokenpool-gnu-make.cc -+++ b/src/tokenpool-gnu-make.cc -@@ -23,6 +23,8 @@ - #include - #include - -+#include "line_printer.h" -+ - // TokenPool implementation for GNU make jobserver - // (http://make.mad-scientist.net/papers/jobserver-implementation/) - struct GNUmakeTokenPool : public TokenPool { -@@ -35,7 +37,7 @@ struct GNUmakeTokenPool : public TokenPool { - virtual void Clear(); - virtual int GetMonitorFd(); - -- bool Setup(bool ignore, double& max_load_average); -+ bool Setup(bool ignore, bool verbose, double& max_load_average); - - private: - int available_; -@@ -100,7 +102,9 @@ bool GNUmakeTokenPool::SetAlarmHandler() { - } - } - --bool GNUmakeTokenPool::Setup(bool ignore, double& max_load_average) { -+bool GNUmakeTokenPool::Setup(bool ignore, -+ bool verbose, -+ double& max_load_average) { - const char *value = getenv("MAKEFLAGS"); - if (value) { - // GNU make <= 4.1 -@@ -109,8 +113,10 @@ bool GNUmakeTokenPool::Setup(bool ignore, double& max_load_average) { - if (!jobserver) - jobserver = strstr(value, "--jobserver-auth="); - if (jobserver) { -+ LinePrinter printer; -+ - if (ignore) { -- printf("ninja: warning: -jN forced on command line; ignoring GNU make jobserver.\n"); -+ printer.PrintOnNewLine("ninja: warning: -jN forced on command line; ignoring GNU make jobserver.\n"); - } else { - int rfd = -1; - int wfd = -1; -@@ -121,7 +127,9 @@ bool GNUmakeTokenPool::Setup(bool ignore, double& max_load_average) { - const char *l_arg = strstr(value, " -l"); - int load_limit = -1; - -- printf("ninja: using GNU make jobserver.\n"); -+ if (verbose) { -+ printer.PrintOnNewLine("ninja: using GNU make jobserver.\n"); -+ } - rfd_ = rfd; - wfd_ = wfd; - -@@ -221,9 +229,11 @@ int GNUmakeTokenPool::GetMonitorFd() { - return(rfd_); - } - --struct TokenPool *TokenPool::Get(bool ignore, double& max_load_average) { -+struct TokenPool *TokenPool::Get(bool ignore, -+ bool verbose, -+ double& max_load_average) { - GNUmakeTokenPool *tokenpool = new GNUmakeTokenPool; -- if (tokenpool->Setup(ignore, max_load_average)) -+ if (tokenpool->Setup(ignore, verbose, max_load_average)) - return tokenpool; - else - delete tokenpool; -diff --git a/src/tokenpool-none.cc b/src/tokenpool-none.cc -index e8e25426c3..1c1c499c8d 100644 ---- a/src/tokenpool-none.cc -+++ b/src/tokenpool-none.cc -@@ -22,6 +22,8 @@ - #include - - // No-op TokenPool implementation --struct TokenPool *TokenPool::Get(bool ignore, double& max_load_average) { -+struct TokenPool *TokenPool::Get(bool ignore, -+ bool verbose, -+ double& max_load_average) { - return NULL; - } -diff --git a/src/tokenpool.h b/src/tokenpool.h -index f9e8cc2ee0..4bf477f20c 100644 ---- a/src/tokenpool.h -+++ b/src/tokenpool.h -@@ -28,5 +28,7 @@ struct TokenPool { - #endif - - // returns NULL if token pool is not available -- static struct TokenPool *Get(bool ignore, double& max_load_average); -+ static struct TokenPool *Get(bool ignore, -+ bool verbose, -+ double& max_load_average); - }; - -From fdbf68416e3574add3bffd0b637d0694fbaba320 Mon Sep 17 00:00:00 2001 -From: Stefan Becker -Date: Sat, 7 Apr 2018 17:11:21 +0300 -Subject: [PATCH 06/11] Prepare PR for merging - -- fix Windows build error in no-op TokenPool implementation -- improve Acquire() to block for a maximum of 100ms -- address review comments ---- - src/build.h | 2 ++ - src/tokenpool-gnu-make.cc | 53 +++++++++++++++++++++++++++++++++------ - src/tokenpool-none.cc | 7 +----- - 3 files changed, 49 insertions(+), 13 deletions(-) - -diff --git a/src/build.h b/src/build.h -index dfde576573..66ddefb888 100644 ---- a/src/build.h -+++ b/src/build.h -@@ -151,6 +151,8 @@ struct CommandRunner { - bool success() const { return status == ExitSuccess; } - }; - /// Wait for a command to complete, or return false if interrupted. -+ /// If more_ready is true then the optional TokenPool is monitored too -+ /// and we return when a token becomes available. - virtual bool WaitForCommand(Result* result, bool more_ready) = 0; - - virtual std::vector GetActiveEdges() { return std::vector(); } -diff --git a/src/tokenpool-gnu-make.cc b/src/tokenpool-gnu-make.cc -index b0d3e6ebc4..4132bb06d9 100644 ---- a/src/tokenpool-gnu-make.cc -+++ b/src/tokenpool-gnu-make.cc -@@ -1,4 +1,4 @@ --// Copyright 2016-2017 Google Inc. All Rights Reserved. -+// Copyright 2016-2018 Google Inc. All Rights Reserved. - // - // Licensed under the Apache License, Version 2.0 (the "License"); - // you may not use this file except in compliance with the License. -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -153,6 +154,15 @@ bool GNUmakeTokenPool::Acquire() { - if (available_ > 0) - return true; - -+ // Please read -+ // -+ // http://make.mad-scientist.net/papers/jobserver-implementation/ -+ // -+ // for the reasoning behind the following code. -+ // -+ // Try to read one character from the pipe. Returns true on success. -+ // -+ // First check if read() would succeed without blocking. - #ifdef USE_PPOLL - pollfd pollfds[] = {{rfd_, POLLIN, 0}}; - int ret = poll(pollfds, 1, 0); -@@ -164,33 +174,62 @@ bool GNUmakeTokenPool::Acquire() { - int ret = select(rfd_ + 1, &set, NULL, NULL, &timeout); - #endif - if (ret > 0) { -+ // Handle potential race condition: -+ // - the above check succeeded, i.e. read() should not block -+ // - the character disappears before we call read() -+ // -+ // Create a duplicate of rfd_. The duplicate file descriptor dup_rfd_ -+ // can safely be closed by signal handlers without affecting rfd_. - dup_rfd_ = dup(rfd_); - - if (dup_rfd_ != -1) { - struct sigaction act, old_act; - int ret = 0; - -+ // Temporarily replace SIGCHLD handler with our own - memset(&act, 0, sizeof(act)); - act.sa_handler = CloseDupRfd; - if (sigaction(SIGCHLD, &act, &old_act) == 0) { -- char buf; -- -- // block until token read, child exits or timeout -- alarm(1); -- ret = read(dup_rfd_, &buf, 1); -- alarm(0); -+ struct itimerval timeout; -+ -+ // install a 100ms timeout that generates SIGALARM on expiration -+ memset(&timeout, 0, sizeof(timeout)); -+ timeout.it_value.tv_usec = 100 * 1000; // [ms] -> [usec] -+ if (setitimer(ITIMER_REAL, &timeout, NULL) == 0) { -+ char buf; -+ -+ // Now try to read() from dup_rfd_. Return values from read(): -+ // -+ // 1. token read -> 1 -+ // 2. pipe closed -> 0 -+ // 3. alarm expires -> -1 (EINTR) -+ // 4. child exits -> -1 (EINTR) -+ // 5. alarm expired before entering read() -> -1 (EBADF) -+ // 6. child exited before entering read() -> -1 (EBADF) -+ // 7. child exited before handler is installed -> go to 1 - 3 -+ ret = read(dup_rfd_, &buf, 1); -+ -+ // disarm timer -+ memset(&timeout, 0, sizeof(timeout)); -+ setitimer(ITIMER_REAL, &timeout, NULL); -+ } - - sigaction(SIGCHLD, &old_act, NULL); - } - - CloseDupRfd(0); - -+ // Case 1 from above list - if (ret > 0) { - available_++; - return true; - } - } - } -+ -+ // read() would block, i.e. no token available, -+ // cases 2-6 from above list or -+ // select() / poll() / dup() / sigaction() / setitimer() failed - return false; - } - -diff --git a/src/tokenpool-none.cc b/src/tokenpool-none.cc -index 1c1c499c8d..4c592875b4 100644 ---- a/src/tokenpool-none.cc -+++ b/src/tokenpool-none.cc -@@ -1,4 +1,4 @@ --// Copyright 2016-2017 Google Inc. All Rights Reserved. -+// Copyright 2016-2018 Google Inc. All Rights Reserved. - // - // Licensed under the Apache License, Version 2.0 (the "License"); - // you may not use this file except in compliance with the License. -@@ -14,11 +14,6 @@ - - #include "tokenpool.h" - --#include --#include --#include --#include --#include - #include - - // No-op TokenPool implementation - -From ec6220a0baf7d3a6eaf1a2b75bf8960ddfe24c2f Mon Sep 17 00:00:00 2001 -From: Stefan Becker -Date: Fri, 25 May 2018 00:17:07 +0300 -Subject: [PATCH 07/11] Add tests for TokenPool - -- TokenPool setup -- GetMonitorFd() API -- implicit token and tokens in jobserver pipe -- Acquire() / Reserve() / Release() protocol -- Clear() API ---- - configure.py | 1 + - src/tokenpool_test.cc | 198 ++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 199 insertions(+) - create mode 100644 src/tokenpool_test.cc - -diff --git a/configure.py b/configure.py -index db3492c93c..dc8a0066b7 100755 ---- a/configure.py -+++ b/configure.py -@@ -590,6 +590,7 @@ def has_re2c(): - 'string_piece_util_test', - 'subprocess_test', - 'test', -+ 'tokenpool_test', - 'util_test']: - objs += cxx(name, variables=cxxvariables) - if platform.is_windows(): -diff --git a/src/tokenpool_test.cc b/src/tokenpool_test.cc -new file mode 100644 -index 0000000000..6c89064ca4 ---- /dev/null -+++ b/src/tokenpool_test.cc -@@ -0,0 +1,198 @@ -+// Copyright 2018 Google Inc. All Rights Reserved. -+// -+// Licensed under the Apache License, Version 2.0 (the "License"); -+// you may not use this file except in compliance with the License. -+// You may obtain a copy of the License at -+// -+// http://www.apache.org/licenses/LICENSE-2.0 -+// -+// Unless required by applicable law or agreed to in writing, software -+// distributed under the License is distributed on an "AS IS" BASIS, -+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+// See the License for the specific language governing permissions and -+// limitations under the License. -+ -+#include "tokenpool.h" -+ -+#include "test.h" -+ -+#ifndef _WIN32 -+#include -+#include -+#include -+ -+#define ENVIRONMENT_CLEAR() unsetenv("MAKEFLAGS") -+#define ENVIRONMENT_INIT(v) setenv("MAKEFLAGS", v, true); -+#endif -+ -+namespace { -+ -+const double kLoadAverageDefault = -1.23456789; -+ -+struct TokenPoolTest : public testing::Test { -+ double load_avg_; -+ TokenPool *tokens_; -+#ifndef _WIN32 -+ char buf_[1024]; -+ int fds_[2]; -+#endif -+ -+ virtual void SetUp() { -+ load_avg_ = kLoadAverageDefault; -+ tokens_ = NULL; -+#ifndef _WIN32 -+ ENVIRONMENT_CLEAR(); -+ if (pipe(fds_) < 0) -+ ASSERT_TRUE(false); -+#endif -+ } -+ -+ void CreatePool(const char *format, bool ignore_jobserver) { -+#ifndef _WIN32 -+ if (format) { -+ sprintf(buf_, format, fds_[0], fds_[1]); -+ ENVIRONMENT_INIT(buf_); -+ } -+#endif -+ tokens_ = TokenPool::Get(ignore_jobserver, false, load_avg_); -+ } -+ -+ void CreateDefaultPool() { -+ CreatePool("foo --jobserver-auth=%d,%d bar", false); -+ } -+ -+ virtual void TearDown() { -+ if (tokens_) -+ delete tokens_; -+#ifndef _WIN32 -+ close(fds_[0]); -+ close(fds_[1]); -+ ENVIRONMENT_CLEAR(); -+#endif -+ } ++ // returns NULL if token pool is not available ++ static TokenPool* Get(); +}; -+ -+} // anonymous namespace -+ -+// verifies none implementation -+TEST_F(TokenPoolTest, NoTokenPool) { -+ CreatePool(NULL, false); -+ -+ EXPECT_EQ(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+} -+ -+#ifndef _WIN32 -+TEST_F(TokenPoolTest, SuccessfulOldSetup) { -+ // GNUmake <= 4.1 -+ CreatePool("foo --jobserver-fds=%d,%d bar", false); -+ -+ EXPECT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+} -+ -+TEST_F(TokenPoolTest, SuccessfulNewSetup) { -+ // GNUmake => 4.2 -+ CreateDefaultPool(); -+ -+ EXPECT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+} -+ -+TEST_F(TokenPoolTest, IgnoreWithJN) { -+ CreatePool("foo --jobserver-auth=%d,%d bar", true); -+ -+ EXPECT_EQ(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+} -+ -+TEST_F(TokenPoolTest, HonorLN) { -+ CreatePool("foo -l9 --jobserver-auth=%d,%d bar", false); -+ -+ EXPECT_NE(NULL, tokens_); -+ EXPECT_EQ(9.0, load_avg_); -+} -+ -+TEST_F(TokenPoolTest, MonitorFD) { -+ CreateDefaultPool(); -+ -+ ASSERT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+ -+ EXPECT_EQ(fds_[0], tokens_->GetMonitorFd()); -+} -+ -+TEST_F(TokenPoolTest, ImplicitToken) { -+ CreateDefaultPool(); -+ -+ ASSERT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+ -+ EXPECT_TRUE(tokens_->Acquire()); -+ tokens_->Reserve(); -+ EXPECT_FALSE(tokens_->Acquire()); -+ tokens_->Release(); -+ EXPECT_TRUE(tokens_->Acquire()); -+} -+ -+TEST_F(TokenPoolTest, TwoTokens) { -+ CreateDefaultPool(); -+ -+ ASSERT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+ -+ // implicit token -+ EXPECT_TRUE(tokens_->Acquire()); -+ tokens_->Reserve(); -+ EXPECT_FALSE(tokens_->Acquire()); -+ -+ // jobserver offers 2nd token -+ ASSERT_EQ(1u, write(fds_[1], "T", 1)); -+ EXPECT_TRUE(tokens_->Acquire()); -+ tokens_->Reserve(); -+ EXPECT_FALSE(tokens_->Acquire()); -+ -+ // release 2nd token -+ tokens_->Release(); -+ EXPECT_TRUE(tokens_->Acquire()); -+ -+ // release implict token - must return 2nd token back to jobserver -+ tokens_->Release(); -+ EXPECT_TRUE(tokens_->Acquire()); -+ -+ // there must be one token in the pipe -+ EXPECT_EQ(1u, read(fds_[0], buf_, sizeof(buf_))); -+ -+ // implicit token -+ EXPECT_TRUE(tokens_->Acquire()); -+} -+ -+TEST_F(TokenPoolTest, Clear) { -+ CreateDefaultPool(); -+ -+ ASSERT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+ -+ // implicit token -+ EXPECT_TRUE(tokens_->Acquire()); -+ tokens_->Reserve(); -+ EXPECT_FALSE(tokens_->Acquire()); -+ -+ // jobserver offers 2nd & 3rd token -+ ASSERT_EQ(2u, write(fds_[1], "TT", 2)); -+ EXPECT_TRUE(tokens_->Acquire()); -+ tokens_->Reserve(); -+ EXPECT_TRUE(tokens_->Acquire()); -+ tokens_->Reserve(); -+ EXPECT_FALSE(tokens_->Acquire()); -+ -+ tokens_->Clear(); -+ EXPECT_TRUE(tokens_->Acquire()); -+ -+ // there must be two tokens in the pipe -+ EXPECT_EQ(2u, read(fds_[0], buf_, sizeof(buf_))); -+ -+ // implicit token -+ EXPECT_TRUE(tokens_->Acquire()); -+} -+#endif - -From e59d8858327126d1593fd0b8e607975a79072e92 Mon Sep 17 00:00:00 2001 -From: Stefan Becker -Date: Thu, 24 May 2018 18:52:45 +0300 -Subject: [PATCH 08/11] Add tests for subprocess module - -- add TokenPoolTest stub to provide TokenPool::GetMonitorFd() -- add two tests - * both tests set up a dummy GNUmake jobserver pipe - * both tests call DoWork() with TokenPoolTest - * test 1: verify that DoWork() detects when a token is available - * test 2: verify that DoWork() works as before without a token -- the tests are not compiled in under Windows ---- - src/subprocess_test.cc | 76 ++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 76 insertions(+) - -diff --git a/src/subprocess_test.cc b/src/subprocess_test.cc -index 4bc8083e26..6264c8bf11 100644 ---- a/src/subprocess_test.cc -+++ b/src/subprocess_test.cc -@@ -13,6 +13,7 @@ - // limitations under the License. - - #include "subprocess.h" -+#include "tokenpool.h" - - #include "test.h" - -@@ -34,8 +35,23 @@ const char* kSimpleCommand = "cmd /c dir \\"; - const char* kSimpleCommand = "ls /"; - #endif - -+struct TokenPoolTest : public TokenPool { -+ bool Acquire() { return false; } -+ void Reserve() {} -+ void Release() {} -+ void Clear() {} -+ -+#ifdef _WIN32 -+ // @TODO -+#else -+ int _fd; -+ int GetMonitorFd() { return _fd; } -+#endif -+}; -+ - struct SubprocessTest : public testing::Test { - SubprocessSet subprocs_; -+ TokenPoolTest tokens_; - }; - - } // anonymous namespace -@@ -280,3 +296,63 @@ TEST_F(SubprocessTest, ReadStdin) { - ASSERT_EQ(1u, subprocs_.finished_.size()); - } - #endif // _WIN32 -+ -+// @TODO: remove once TokenPool implementation for Windows is available -+#ifndef _WIN32 -+TEST_F(SubprocessTest, TokenAvailable) { -+ Subprocess* subproc = subprocs_.Add(kSimpleCommand); -+ ASSERT_NE((Subprocess *) 0, subproc); -+ -+ // simulate GNUmake jobserver pipe with 1 token -+ int fds[2]; -+ ASSERT_EQ(0u, pipe(fds)); -+ tokens_._fd = fds[0]; -+ ASSERT_EQ(1u, write(fds[1], "T", 1)); -+ -+ subprocs_.ResetTokenAvailable(); -+ subprocs_.DoWork(&tokens_); -+ -+ EXPECT_TRUE(subprocs_.IsTokenAvailable()); -+ EXPECT_EQ(0u, subprocs_.finished_.size()); -+ -+ // remove token to let DoWork() wait for command again -+ char token; -+ ASSERT_EQ(1u, read(fds[0], &token, 1)); -+ -+ while (!subproc->Done()) { -+ subprocs_.DoWork(&tokens_); -+ } -+ -+ close(fds[1]); -+ close(fds[0]); -+ -+ EXPECT_EQ(ExitSuccess, subproc->Finish()); -+ EXPECT_NE("", subproc->GetOutput()); -+ -+ EXPECT_EQ(1u, subprocs_.finished_.size()); -+} -+ -+TEST_F(SubprocessTest, TokenNotAvailable) { -+ Subprocess* subproc = subprocs_.Add(kSimpleCommand); -+ ASSERT_NE((Subprocess *) 0, subproc); -+ -+ // simulate GNUmake jobserver pipe with 0 tokens -+ int fds[2]; -+ ASSERT_EQ(0u, pipe(fds)); -+ tokens_._fd = fds[0]; -+ -+ subprocs_.ResetTokenAvailable(); -+ while (!subproc->Done()) { -+ subprocs_.DoWork(&tokens_); -+ } -+ -+ close(fds[1]); -+ close(fds[0]); -+ -+ EXPECT_FALSE(subprocs_.IsTokenAvailable()); -+ EXPECT_EQ(ExitSuccess, subproc->Finish()); -+ EXPECT_NE("", subproc->GetOutput()); -+ -+ EXPECT_EQ(1u, subprocs_.finished_.size()); -+} -+#endif // _WIN32 - -From 0145e2d4db64ea6c21aeb371928e4071f65164eb Mon Sep 17 00:00:00 2001 -From: Stefan Becker -Date: Sat, 26 May 2018 23:17:51 +0300 -Subject: [PATCH 09/11] Add tests for build module - -Add tests that verify the token functionality of the builder main loop. -We replace the default fake command runner with a special version where -the tests can control each call to AcquireToken(), CanRunMore() and -WaitForCommand(). ---- - src/build_test.cc | 364 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 364 insertions(+) - -diff --git a/src/build_test.cc b/src/build_test.cc -index 7a5ff4015a..dd41dfbe1d 100644 --- a/src/build_test.cc +++ b/src/build_test.cc @@ -15,6 +15,7 @@ @@ -2020,7 +512,38 @@ index 7a5ff4015a..dd41dfbe1d 100644 #include "build_log.h" #include "deps_log.h" -@@ -3990,3 +3991,366 @@ TEST_F(BuildTest, ValidationWithCircularDependency) { +@@ -474,8 +475,9 @@ struct FakeCommandRunner : public Comman + + // CommandRunner impl + virtual bool CanRunMore() const; ++ virtual bool AcquireToken(); + virtual bool StartCommand(Edge* edge); +- virtual bool WaitForCommand(Result* result); ++ virtual bool WaitForCommand(Result* result, bool more_ready); + virtual vector GetActiveEdges(); + virtual void Abort(); + +@@ -578,6 +580,10 @@ bool FakeCommandRunner::CanRunMore() con + return active_edges_.size() < max_active_edges_; + } + ++bool FakeCommandRunner::AcquireToken() { ++ return true; ++} ++ + bool FakeCommandRunner::StartCommand(Edge* edge) { + assert(active_edges_.size() < max_active_edges_); + assert(find(active_edges_.begin(), active_edges_.end(), edge) +@@ -649,7 +655,7 @@ bool FakeCommandRunner::StartCommand(Edg + return true; + } + +-bool FakeCommandRunner::WaitForCommand(Result* result) { ++bool FakeCommandRunner::WaitForCommand(Result* result, bool more_ready) { + if (active_edges_.empty()) + return false; + +@@ -3985,3 +3991,356 @@ TEST_F(BuildTest, ValidationWithCircular EXPECT_FALSE(builder_.AddTarget("out", &err)); EXPECT_EQ("dependency cycle: validate -> validate_in -> validate", err); } @@ -2131,7 +654,7 @@ index 7a5ff4015a..dd41dfbe1d 100644 + void ExpectWaitForCommand(int count, ...); + +private: -+ void EnqueueBooleans(vector& booleans, int count, va_list ao); ++ void EnqueueBooleans(vector& booleans, int count, va_list ap); +}; + +void BuildTokenTest::SetUp() { @@ -2177,16 +700,6 @@ index 7a5ff4015a..dd41dfbe1d 100644 + } +} + -+TEST_F(BuildTokenTest, CompleteNoWork) { -+ // plan should not execute anything -+ string err; -+ -+ EXPECT_TRUE(builder_.Build(&err)); -+ EXPECT_EQ("", err); -+ -+ EXPECT_EQ(0u, token_command_runner_.commands_ran_.size()); -+} -+ +TEST_F(BuildTokenTest, DoNotAquireToken) { + // plan should execute one command + string err; @@ -2387,106 +900,99 @@ index 7a5ff4015a..dd41dfbe1d 100644 + token_command_runner_.commands_ran_[1] == "cat in1 > out1")); + EXPECT_TRUE(token_command_runner_.commands_ran_[2] == "cat out1 out2 > out12"); +} - -From f016e5430c9123d34a73ea7ad28693b20ee59d6d Mon Sep 17 00:00:00 2001 -From: Stefan Becker -Date: Mon, 8 Oct 2018 17:47:50 +0300 -Subject: [PATCH 10/11] Add Win32 implementation for GNUmakeTokenPool - -GNU make uses a semaphore as jobserver protocol on Win32. See also - - https://www.gnu.org/software/make/manual/html_node/Windows-Jobserver.html - -Usage is pretty simple and straightforward, i.e. WaitForSingleObject() -to obtain a token and ReleaseSemaphore() to return it. - -Unfortunately subprocess-win32.cc uses an I/O completion port (IOCP). -IOCPs aren't waitable objects, i.e. we can't use WaitForMultipleObjects() -to wait on the IOCP and the token semaphore at the same time. - -Therefore GNUmakeTokenPoolWin32 creates a child thread that waits on the -token semaphore and posts a dummy I/O completion status on the IOCP when -it was able to obtain a token. That unblocks SubprocessSet::DoWork() and -it can then check if a token became available or not. - -- split existing GNUmakeTokenPool into common and platform bits -- add GNUmakeTokenPool interface -- move the Posix bits to GNUmakeTokenPoolPosix -- add the Win32 bits as GNUmakeTokenPoolWin32 -- move Setup() method up to TokenPool interface -- update Subprocess & TokenPool tests accordingly ---- - configure.py | 8 +- - src/build.cc | 11 +- - src/subprocess-win32.cc | 9 ++ - src/subprocess_test.cc | 34 ++++- - src/tokenpool-gnu-make-posix.cc | 203 +++++++++++++++++++++++++++ - src/tokenpool-gnu-make-win32.cc | 237 ++++++++++++++++++++++++++++++++ - src/tokenpool-gnu-make.cc | 203 ++------------------------- - src/tokenpool-gnu-make.h | 40 ++++++ - src/tokenpool-none.cc | 4 +- - src/tokenpool.h | 18 ++- - src/tokenpool_test.cc | 113 ++++++++++++--- - 11 files changed, 653 insertions(+), 227 deletions(-) - create mode 100644 src/tokenpool-gnu-make-posix.cc - create mode 100644 src/tokenpool-gnu-make-win32.cc - create mode 100644 src/tokenpool-gnu-make.h - -diff --git a/configure.py b/configure.py -index dc8a0066b7..a239b90eef 100755 ---- a/configure.py -+++ b/configure.py -@@ -517,12 +517,13 @@ def has_re2c(): - 'state', - 'status', - 'string_piece_util', -+ 'tokenpool-gnu-make', - 'util', - 'version']: - objs += cxx(name, variables=cxxvariables) - if platform.is_windows(): - for name in ['subprocess-win32', -- 'tokenpool-none', -+ 'tokenpool-gnu-make-win32', - 'includes_normalize-win32', - 'msvc_helper-win32', - 'msvc_helper_main-win32']: -@@ -531,8 +532,9 @@ def has_re2c(): - objs += cxx('minidump-win32', variables=cxxvariables) - objs += cc('getopt') - else: -- objs += cxx('subprocess-posix') -- objs += cxx('tokenpool-gnu-make') -+ for name in ['subprocess-posix', -+ 'tokenpool-gnu-make-posix']: -+ objs += cxx(name) - if platform.is_aix(): - objs += cc('getopt') - if platform.is_msvc(): -diff --git a/src/build.cc b/src/build.cc -index 662e4bd7be..20c3bdc2a0 100644 ---- a/src/build.cc -+++ b/src/build.cc -@@ -473,9 +473,14 @@ struct RealCommandRunner : public CommandRunner { +--- a/src/exit_status.h ++++ b/src/exit_status.h +@@ -18,7 +18,8 @@ + enum ExitStatus { + ExitSuccess, + ExitFailure, +- ExitInterrupted ++ ExitTokenAvailable, ++ ExitInterrupted, + }; - RealCommandRunner::RealCommandRunner(const BuildConfig& config) : config_(config) { - max_load_average_ = config.max_load_average; -- tokens_ = TokenPool::Get(config_.parallelism_from_cmdline, -- config_.verbosity == BuildConfig::VERBOSE, -- max_load_average_); -+ if ((tokens_ = TokenPool::Get()) != NULL) { -+ if (!tokens_->Setup(config_.parallelism_from_cmdline, -+ config_.verbosity == BuildConfig::VERBOSE, -+ max_load_average_)) { -+ delete tokens_; -+ tokens_ = NULL; -+ } -+ } + #endif // NINJA_EXIT_STATUS_H_ +--- a/src/subprocess-posix.cc ++++ b/src/subprocess-posix.cc +@@ -13,6 +13,7 @@ + // limitations under the License. + + #include "subprocess.h" ++#include "tokenpool.h" + + #include + #include +@@ -249,7 +250,7 @@ Subprocess *SubprocessSet::Add(const str } - RealCommandRunner::~RealCommandRunner() { -diff --git a/src/subprocess-win32.cc b/src/subprocess-win32.cc -index 66d2c2c430..ce3e2c20a4 100644 + #ifdef USE_PPOLL +-bool SubprocessSet::DoWork() { ++bool SubprocessSet::DoWork(TokenPool* tokens) { + vector fds; + nfds_t nfds = 0; + +@@ -263,6 +264,12 @@ bool SubprocessSet::DoWork() { + ++nfds; + } + ++ if (tokens) { ++ pollfd pfd = { tokens->GetMonitorFd(), POLLIN | POLLPRI, 0 }; ++ fds.push_back(pfd); ++ ++nfds; ++ } ++ + interrupted_ = 0; + int ret = ppoll(&fds.front(), nfds, NULL, &old_mask_); + if (ret == -1) { +@@ -295,11 +302,20 @@ bool SubprocessSet::DoWork() { + ++i; + } + ++ if (tokens) { ++ pollfd *pfd = &fds[nfds - 1]; ++ if (pfd->fd >= 0) { ++ assert(pfd->fd == tokens->GetMonitorFd()); ++ if (pfd->revents != 0) ++ token_available_ = true; ++ } ++ } ++ + return IsInterrupted(); + } + + #else // !defined(USE_PPOLL) +-bool SubprocessSet::DoWork() { ++bool SubprocessSet::DoWork(TokenPool* tokens) { + fd_set set; + int nfds = 0; + FD_ZERO(&set); +@@ -314,6 +330,13 @@ bool SubprocessSet::DoWork() { + } + } + ++ if (tokens) { ++ int fd = tokens->GetMonitorFd(); ++ FD_SET(fd, &set); ++ if (nfds < fd+1) ++ nfds = fd+1; ++ } ++ + interrupted_ = 0; + int ret = pselect(nfds, &set, 0, 0, 0, &old_mask_); + if (ret == -1) { +@@ -342,6 +365,12 @@ bool SubprocessSet::DoWork() { + ++i; + } + ++ if (tokens) { ++ int fd = tokens->GetMonitorFd(); ++ if ((fd >= 0) && FD_ISSET(fd, &set)) ++ token_available_ = true; ++ } ++ + return IsInterrupted(); + } + #endif // !defined(USE_PPOLL) --- a/src/subprocess-win32.cc +++ b/src/subprocess-win32.cc @@ -13,6 +13,7 @@ @@ -2497,7 +1003,13 @@ index 66d2c2c430..ce3e2c20a4 100644 #include #include -@@ -256,6 +257,9 @@ bool SubprocessSet::DoWork(struct TokenPool* tokens) { +@@ -251,11 +252,14 @@ Subprocess *SubprocessSet::Add(const str + return subprocess; + } + +-bool SubprocessSet::DoWork() { ++bool SubprocessSet::DoWork(TokenPool* tokens) { + DWORD bytes_read; Subprocess* subproc; OVERLAPPED* overlapped; @@ -2507,7 +1019,7 @@ index 66d2c2c430..ce3e2c20a4 100644 if (!GetQueuedCompletionStatus(ioport_, &bytes_read, (PULONG_PTR)&subproc, &overlapped, INFINITE)) { if (GetLastError() != ERROR_BROKEN_PIPE) -@@ -266,6 +270,11 @@ bool SubprocessSet::DoWork(struct TokenPool* tokens) { +@@ -266,6 +270,11 @@ bool SubprocessSet::DoWork() { // delivered by NotifyInterrupted above. return true; @@ -2519,18 +1031,58 @@ index 66d2c2c430..ce3e2c20a4 100644 subproc->OnPipeReady(); if (subproc->Done()) { -diff --git a/src/subprocess_test.cc b/src/subprocess_test.cc -index 6264c8bf11..f625963462 100644 +--- a/src/subprocess.h ++++ b/src/subprocess.h +@@ -76,6 +76,8 @@ struct Subprocess { + friend struct SubprocessSet; + }; + ++struct TokenPool; ++ + /// SubprocessSet runs a ppoll/pselect() loop around a set of Subprocesses. + /// DoWork() waits for any state change in subprocesses; finished_ + /// is a queue of subprocesses as they finish. +@@ -84,13 +86,17 @@ struct SubprocessSet { + ~SubprocessSet(); + + Subprocess* Add(const std::string& command, bool use_console = false); +- bool DoWork(); ++ bool DoWork(TokenPool* tokens); + Subprocess* NextFinished(); + void Clear(); + + std::vector running_; + std::queue finished_; + ++ bool token_available_; ++ bool IsTokenAvailable() { return token_available_; } ++ void ResetTokenAvailable() { token_available_ = false; } ++ + #ifdef _WIN32 + static BOOL WINAPI NotifyInterrupted(DWORD dwCtrlType); + static HANDLE ioport_; --- a/src/subprocess_test.cc +++ b/src/subprocess_test.cc -@@ -40,9 +40,16 @@ struct TokenPoolTest : public TokenPool { - void Reserve() {} - void Release() {} - void Clear() {} -+ bool Setup(bool ignore_unused, bool verbose, double& max_load_average) { return false; } +@@ -13,6 +13,7 @@ + // limitations under the License. - #ifdef _WIN32 -- // @TODO + #include "subprocess.h" ++#include "tokenpool.h" + + #include "test.h" + +@@ -34,8 +35,30 @@ const char* kSimpleCommand = "cmd /c dir + const char* kSimpleCommand = "ls /"; + #endif + ++struct TestTokenPool : public TokenPool { ++ bool Acquire() { return false; } ++ void Reserve() {} ++ void Release() {} ++ void Clear() {} ++ bool Setup(bool ignore_unused, bool verbose, double& max_load_average) { return false; } ++ ++#ifdef _WIN32 + bool _token_available; + void WaitForTokenAvailability(HANDLE ioport) { + if (_token_available) @@ -2538,95 +1090,554 @@ index 6264c8bf11..f625963462 100644 + PostQueuedCompletionStatus(ioport, 0, (ULONG_PTR) this, NULL); + } + bool TokenIsAvailable(ULONG_PTR key) { return key == (ULONG_PTR) this; } - #else - int _fd; - int GetMonitorFd() { return _fd; } -@@ -297,34 +304,48 @@ TEST_F(SubprocessTest, ReadStdin) { - } - #endif // _WIN32 ++#else ++ int _fd; ++ int GetMonitorFd() { return _fd; } ++#endif ++}; ++ + struct SubprocessTest : public testing::Test { + SubprocessSet subprocs_; ++ TestTokenPool tokens_; + }; --// @TODO: remove once TokenPool implementation for Windows is available --#ifndef _WIN32 - TEST_F(SubprocessTest, TokenAvailable) { + } // anonymous namespace +@@ -45,10 +68,12 @@ TEST_F(SubprocessTest, BadCommandStderr) + Subprocess* subproc = subprocs_.Add("cmd /c ninja_no_such_command"); + ASSERT_NE((Subprocess *) 0, subproc); + ++ subprocs_.ResetTokenAvailable(); + while (!subproc->Done()) { + // Pretend we discovered that stderr was ready for writing. +- subprocs_.DoWork(); ++ subprocs_.DoWork(NULL); + } ++ ASSERT_FALSE(subprocs_.IsTokenAvailable()); + + EXPECT_EQ(ExitFailure, subproc->Finish()); + EXPECT_NE("", subproc->GetOutput()); +@@ -59,10 +84,12 @@ TEST_F(SubprocessTest, NoSuchCommand) { + Subprocess* subproc = subprocs_.Add("ninja_no_such_command"); + ASSERT_NE((Subprocess *) 0, subproc); + ++ subprocs_.ResetTokenAvailable(); + while (!subproc->Done()) { + // Pretend we discovered that stderr was ready for writing. +- subprocs_.DoWork(); ++ subprocs_.DoWork(NULL); + } ++ ASSERT_FALSE(subprocs_.IsTokenAvailable()); + + EXPECT_EQ(ExitFailure, subproc->Finish()); + EXPECT_NE("", subproc->GetOutput()); +@@ -78,9 +105,11 @@ TEST_F(SubprocessTest, InterruptChild) { + Subprocess* subproc = subprocs_.Add("kill -INT $$"); + ASSERT_NE((Subprocess *) 0, subproc); + ++ subprocs_.ResetTokenAvailable(); + while (!subproc->Done()) { +- subprocs_.DoWork(); ++ subprocs_.DoWork(NULL); + } ++ ASSERT_FALSE(subprocs_.IsTokenAvailable()); + + EXPECT_EQ(ExitInterrupted, subproc->Finish()); + } +@@ -90,7 +119,7 @@ TEST_F(SubprocessTest, InterruptParent) + ASSERT_NE((Subprocess *) 0, subproc); + + while (!subproc->Done()) { +- bool interrupted = subprocs_.DoWork(); ++ bool interrupted = subprocs_.DoWork(NULL); + if (interrupted) + return; + } +@@ -102,9 +131,11 @@ TEST_F(SubprocessTest, InterruptChildWit + Subprocess* subproc = subprocs_.Add("kill -TERM $$"); + ASSERT_NE((Subprocess *) 0, subproc); + ++ subprocs_.ResetTokenAvailable(); + while (!subproc->Done()) { +- subprocs_.DoWork(); ++ subprocs_.DoWork(NULL); + } ++ ASSERT_FALSE(subprocs_.IsTokenAvailable()); + + EXPECT_EQ(ExitInterrupted, subproc->Finish()); + } +@@ -114,7 +145,7 @@ TEST_F(SubprocessTest, InterruptParentWi + ASSERT_NE((Subprocess *) 0, subproc); + + while (!subproc->Done()) { +- bool interrupted = subprocs_.DoWork(); ++ bool interrupted = subprocs_.DoWork(NULL); + if (interrupted) + return; + } +@@ -126,9 +157,11 @@ TEST_F(SubprocessTest, InterruptChildWit + Subprocess* subproc = subprocs_.Add("kill -HUP $$"); + ASSERT_NE((Subprocess *) 0, subproc); + ++ subprocs_.ResetTokenAvailable(); + while (!subproc->Done()) { +- subprocs_.DoWork(); ++ subprocs_.DoWork(NULL); + } ++ ASSERT_FALSE(subprocs_.IsTokenAvailable()); + + EXPECT_EQ(ExitInterrupted, subproc->Finish()); + } +@@ -138,7 +171,7 @@ TEST_F(SubprocessTest, InterruptParentWi + ASSERT_NE((Subprocess *) 0, subproc); + + while (!subproc->Done()) { +- bool interrupted = subprocs_.DoWork(); ++ bool interrupted = subprocs_.DoWork(NULL); + if (interrupted) + return; + } +@@ -153,9 +186,11 @@ TEST_F(SubprocessTest, Console) { + subprocs_.Add("test -t 0 -a -t 1 -a -t 2", /*use_console=*/true); + ASSERT_NE((Subprocess*)0, subproc); + ++ subprocs_.ResetTokenAvailable(); + while (!subproc->Done()) { +- subprocs_.DoWork(); ++ subprocs_.DoWork(NULL); + } ++ ASSERT_FALSE(subprocs_.IsTokenAvailable()); + + EXPECT_EQ(ExitSuccess, subproc->Finish()); + } +@@ -167,9 +202,11 @@ TEST_F(SubprocessTest, SetWithSingle) { Subprocess* subproc = subprocs_.Add(kSimpleCommand); ASSERT_NE((Subprocess *) 0, subproc); - // simulate GNUmake jobserver pipe with 1 token ++ subprocs_.ResetTokenAvailable(); + while (!subproc->Done()) { +- subprocs_.DoWork(); ++ subprocs_.DoWork(NULL); + } ++ ASSERT_FALSE(subprocs_.IsTokenAvailable()); + ASSERT_EQ(ExitSuccess, subproc->Finish()); + ASSERT_NE("", subproc->GetOutput()); + +@@ -200,12 +237,13 @@ TEST_F(SubprocessTest, SetWithMulti) { + ASSERT_EQ("", processes[i]->GetOutput()); + } + ++ subprocs_.ResetTokenAvailable(); + while (!processes[0]->Done() || !processes[1]->Done() || + !processes[2]->Done()) { + ASSERT_GT(subprocs_.running_.size(), 0u); +- subprocs_.DoWork(); ++ subprocs_.DoWork(NULL); + } +- ++ ASSERT_FALSE(subprocs_.IsTokenAvailable()); + ASSERT_EQ(0u, subprocs_.running_.size()); + ASSERT_EQ(3u, subprocs_.finished_.size()); + +@@ -237,8 +275,10 @@ TEST_F(SubprocessTest, SetWithLots) { + ASSERT_NE((Subprocess *) 0, subproc); + procs.push_back(subproc); + } ++ subprocs_.ResetTokenAvailable(); + while (!subprocs_.running_.empty()) +- subprocs_.DoWork(); ++ subprocs_.DoWork(NULL); ++ ASSERT_FALSE(subprocs_.IsTokenAvailable()); + for (size_t i = 0; i < procs.size(); ++i) { + ASSERT_EQ(ExitSuccess, procs[i]->Finish()); + ASSERT_NE("", procs[i]->GetOutput()); +@@ -254,10 +294,91 @@ TEST_F(SubprocessTest, SetWithLots) { + // that stdin is closed. + TEST_F(SubprocessTest, ReadStdin) { + Subprocess* subproc = subprocs_.Add("cat -"); ++ subprocs_.ResetTokenAvailable(); + while (!subproc->Done()) { +- subprocs_.DoWork(); ++ subprocs_.DoWork(NULL); + } ++ ASSERT_FALSE(subprocs_.IsTokenAvailable()); + ASSERT_EQ(ExitSuccess, subproc->Finish()); + ASSERT_EQ(1u, subprocs_.finished_.size()); + } + #endif // _WIN32 ++ ++TEST_F(SubprocessTest, TokenAvailable) { ++ Subprocess* subproc = subprocs_.Add(kSimpleCommand); ++ ASSERT_NE((Subprocess *) 0, subproc); ++ ++ // simulate GNUmake jobserver pipe with 1 token +#ifdef _WIN32 + tokens_._token_available = true; +#else - int fds[2]; - ASSERT_EQ(0u, pipe(fds)); - tokens_._fd = fds[0]; - ASSERT_EQ(1u, write(fds[1], "T", 1)); ++ int fds[2]; ++ ASSERT_EQ(0u, pipe(fds)); ++ tokens_._fd = fds[0]; ++ ASSERT_EQ(1u, write(fds[1], "T", 1)); +#endif - - subprocs_.ResetTokenAvailable(); - subprocs_.DoWork(&tokens_); ++ ++ subprocs_.ResetTokenAvailable(); ++ subprocs_.DoWork(&tokens_); +#ifdef _WIN32 + tokens_._token_available = false; -+ // we need to loop here as we have no conrol where the token ++ // we need to loop here as we have no control where the token + // I/O completion post ends up in the queue + while (!subproc->Done() && !subprocs_.IsTokenAvailable()) { + subprocs_.DoWork(&tokens_); + } +#endif - - EXPECT_TRUE(subprocs_.IsTokenAvailable()); - EXPECT_EQ(0u, subprocs_.finished_.size()); - - // remove token to let DoWork() wait for command again ++ ++ EXPECT_TRUE(subprocs_.IsTokenAvailable()); ++ EXPECT_EQ(0u, subprocs_.finished_.size()); ++ ++ // remove token to let DoWork() wait for command again +#ifndef _WIN32 - char token; - ASSERT_EQ(1u, read(fds[0], &token, 1)); ++ char token; ++ ASSERT_EQ(1u, read(fds[0], &token, 1)); +#endif - - while (!subproc->Done()) { - subprocs_.DoWork(&tokens_); - } - ++ ++ while (!subproc->Done()) { ++ subprocs_.DoWork(&tokens_); ++ } ++ +#ifndef _WIN32 - close(fds[1]); - close(fds[0]); ++ close(fds[1]); ++ close(fds[0]); +#endif - - EXPECT_EQ(ExitSuccess, subproc->Finish()); - EXPECT_NE("", subproc->GetOutput()); -@@ -337,17 +358,23 @@ TEST_F(SubprocessTest, TokenNotAvailable) { - ASSERT_NE((Subprocess *) 0, subproc); - - // simulate GNUmake jobserver pipe with 0 tokens ++ ++ EXPECT_EQ(ExitSuccess, subproc->Finish()); ++ EXPECT_NE("", subproc->GetOutput()); ++ ++ EXPECT_EQ(1u, subprocs_.finished_.size()); ++} ++ ++TEST_F(SubprocessTest, TokenNotAvailable) { ++ Subprocess* subproc = subprocs_.Add(kSimpleCommand); ++ ASSERT_NE((Subprocess *) 0, subproc); ++ ++ // simulate GNUmake jobserver pipe with 0 tokens +#ifdef _WIN32 + tokens_._token_available = false; +#else - int fds[2]; - ASSERT_EQ(0u, pipe(fds)); - tokens_._fd = fds[0]; ++ int fds[2]; ++ ASSERT_EQ(0u, pipe(fds)); ++ tokens_._fd = fds[0]; +#endif - - subprocs_.ResetTokenAvailable(); - while (!subproc->Done()) { - subprocs_.DoWork(&tokens_); - } - ++ ++ subprocs_.ResetTokenAvailable(); ++ while (!subproc->Done()) { ++ subprocs_.DoWork(&tokens_); ++ } ++ +#ifndef _WIN32 - close(fds[1]); - close(fds[0]); ++ close(fds[1]); ++ close(fds[0]); +#endif - - EXPECT_FALSE(subprocs_.IsTokenAvailable()); - EXPECT_EQ(ExitSuccess, subproc->Finish()); -@@ -355,4 +382,3 @@ TEST_F(SubprocessTest, TokenNotAvailable) { - - EXPECT_EQ(1u, subprocs_.finished_.size()); - } --#endif // _WIN32 -diff --git a/src/tokenpool-gnu-make-posix.cc b/src/tokenpool-gnu-make-posix.cc -new file mode 100644 -index 0000000000..70d84bfff7 ++ ++ EXPECT_FALSE(subprocs_.IsTokenAvailable()); ++ EXPECT_EQ(ExitSuccess, subproc->Finish()); ++ EXPECT_NE("", subproc->GetOutput()); ++ ++ EXPECT_EQ(1u, subprocs_.finished_.size()); ++} +--- a/src/ninja.cc ++++ b/src/ninja.cc +@@ -1447,6 +1447,7 @@ int ReadFlags(int* argc, char*** argv, + // We want to run N jobs in parallel. For N = 0, INT_MAX + // is close enough to infinite for most sane builds. + config->parallelism = value > 0 ? value : INT_MAX; ++ config->parallelism_from_cmdline = true; + deferGuessParallelism.needGuess = false; + break; + } +--- /dev/null ++++ b/src/tokenpool_test.cc +@@ -0,0 +1,279 @@ ++// Copyright 2018 Google Inc. All Rights Reserved. ++// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++ ++#include "tokenpool.h" ++ ++#include "test.h" ++ ++#ifdef _WIN32 ++#include ++#else ++#include ++#endif ++ ++#include ++#include ++ ++#ifdef _WIN32 ++// should contain all valid characters ++#define SEMAPHORE_NAME "abcdefghijklmnopqrstwxyz01234567890_" ++#define AUTH_FORMAT(tmpl) "foo " tmpl "=%s bar" ++#define ENVIRONMENT_CLEAR() SetEnvironmentVariable("MAKEFLAGS", NULL) ++#define ENVIRONMENT_INIT(v) SetEnvironmentVariable("MAKEFLAGS", v) ++#else ++#define AUTH_FORMAT(tmpl) "foo " tmpl "=%d,%d bar" ++#define ENVIRONMENT_CLEAR() unsetenv("MAKEFLAGS") ++#define ENVIRONMENT_INIT(v) setenv("MAKEFLAGS", v, true) ++#endif ++ ++namespace { ++ ++const double kLoadAverageDefault = -1.23456789; ++ ++struct TokenPoolTest : public testing::Test { ++ double load_avg_; ++ TokenPool* tokens_; ++ char buf_[1024]; ++#ifdef _WIN32 ++ const char* semaphore_name_; ++ HANDLE semaphore_; ++#else ++ int fds_[2]; ++ ++ char random() { ++ return int((rand() / double(RAND_MAX)) * 256); ++ } ++#endif ++ ++ virtual void SetUp() { ++ load_avg_ = kLoadAverageDefault; ++ tokens_ = NULL; ++ ENVIRONMENT_CLEAR(); ++#ifdef _WIN32 ++ semaphore_name_ = SEMAPHORE_NAME; ++ if ((semaphore_ = CreateSemaphore(0, 0, 2, SEMAPHORE_NAME)) == NULL) ++#else ++ if (pipe(fds_) < 0) ++#endif ++ ASSERT_TRUE(false); ++ } ++ ++ void CreatePool(const char* format, bool ignore_jobserver = false) { ++ if (format) { ++ sprintf(buf_, format, ++#ifdef _WIN32 ++ semaphore_name_ ++#else ++ fds_[0], fds_[1] ++#endif ++ ); ++ ENVIRONMENT_INIT(buf_); ++ } ++ if ((tokens_ = TokenPool::Get()) != NULL) { ++ if (!tokens_->Setup(ignore_jobserver, false, load_avg_)) { ++ delete tokens_; ++ tokens_ = NULL; ++ } ++ } ++ } ++ ++ void CreateDefaultPool() { ++ CreatePool(AUTH_FORMAT("--jobserver-auth")); ++ } ++ ++ virtual void TearDown() { ++ if (tokens_) ++ delete tokens_; ++#ifdef _WIN32 ++ CloseHandle(semaphore_); ++#else ++ close(fds_[0]); ++ close(fds_[1]); ++#endif ++ ENVIRONMENT_CLEAR(); ++ } ++}; ++ ++} // anonymous namespace ++ ++// verifies none implementation ++TEST_F(TokenPoolTest, NoTokenPool) { ++ CreatePool(NULL, false); ++ ++ EXPECT_EQ(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++} ++ ++TEST_F(TokenPoolTest, SuccessfulOldSetup) { ++ // GNUmake <= 4.1 ++ CreatePool(AUTH_FORMAT("--jobserver-fds")); ++ ++ EXPECT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++} ++ ++TEST_F(TokenPoolTest, SuccessfulNewSetup) { ++ // GNUmake => 4.2 ++ CreateDefaultPool(); ++ ++ EXPECT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++} ++ ++TEST_F(TokenPoolTest, IgnoreWithJN) { ++ CreatePool(AUTH_FORMAT("--jobserver-auth"), true); ++ ++ EXPECT_EQ(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++} ++ ++TEST_F(TokenPoolTest, HonorLN) { ++ CreatePool(AUTH_FORMAT("-l9 --jobserver-auth")); ++ ++ EXPECT_NE(NULL, tokens_); ++ EXPECT_EQ(9.0, load_avg_); ++} ++ ++#ifdef _WIN32 ++TEST_F(TokenPoolTest, SemaphoreNotFound) { ++ semaphore_name_ = SEMAPHORE_NAME "_foobar"; ++ CreateDefaultPool(); ++ ++ EXPECT_EQ(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++} ++ ++TEST_F(TokenPoolTest, TokenIsAvailable) { ++ CreateDefaultPool(); ++ ++ ASSERT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++ ++ EXPECT_TRUE(tokens_->TokenIsAvailable((ULONG_PTR)tokens_)); ++} ++#else ++TEST_F(TokenPoolTest, MonitorFD) { ++ CreateDefaultPool(); ++ ++ ASSERT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++ ++ EXPECT_EQ(fds_[0], tokens_->GetMonitorFd()); ++} ++#endif ++ ++TEST_F(TokenPoolTest, ImplicitToken) { ++ CreateDefaultPool(); ++ ++ ASSERT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++ ++ EXPECT_TRUE(tokens_->Acquire()); ++ tokens_->Reserve(); ++ EXPECT_FALSE(tokens_->Acquire()); ++ tokens_->Release(); ++ EXPECT_TRUE(tokens_->Acquire()); ++} ++ ++TEST_F(TokenPoolTest, TwoTokens) { ++ CreateDefaultPool(); ++ ++ ASSERT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++ ++ // implicit token ++ EXPECT_TRUE(tokens_->Acquire()); ++ tokens_->Reserve(); ++ EXPECT_FALSE(tokens_->Acquire()); ++ ++ // jobserver offers 2nd token ++#ifdef _WIN32 ++ LONG previous; ++ ASSERT_TRUE(ReleaseSemaphore(semaphore_, 1, &previous)); ++ ASSERT_EQ(0, previous); ++#else ++ char test_tokens[1] = { random() }; ++ ASSERT_EQ(1u, write(fds_[1], test_tokens, sizeof(test_tokens))); ++#endif ++ EXPECT_TRUE(tokens_->Acquire()); ++ tokens_->Reserve(); ++ EXPECT_FALSE(tokens_->Acquire()); ++ ++ // release 2nd token ++ tokens_->Release(); ++ EXPECT_TRUE(tokens_->Acquire()); ++ ++ // release implicit token - must return 2nd token back to jobserver ++ tokens_->Release(); ++ EXPECT_TRUE(tokens_->Acquire()); ++ ++ // there must be one token available ++#ifdef _WIN32 ++ EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(semaphore_, 0)); ++ EXPECT_TRUE(ReleaseSemaphore(semaphore_, 1, &previous)); ++ EXPECT_EQ(0, previous); ++#else ++ EXPECT_EQ(1u, read(fds_[0], buf_, sizeof(buf_))); ++ EXPECT_EQ(test_tokens[0], buf_[0]); ++#endif ++ ++ // implicit token ++ EXPECT_TRUE(tokens_->Acquire()); ++} ++ ++TEST_F(TokenPoolTest, Clear) { ++ CreateDefaultPool(); ++ ++ ASSERT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++ ++ // implicit token ++ EXPECT_TRUE(tokens_->Acquire()); ++ tokens_->Reserve(); ++ EXPECT_FALSE(tokens_->Acquire()); ++ ++ // jobserver offers 2nd & 3rd token ++#ifdef _WIN32 ++ LONG previous; ++ ASSERT_TRUE(ReleaseSemaphore(semaphore_, 2, &previous)); ++ ASSERT_EQ(0, previous); ++#else ++ char test_tokens[2] = { random(), random() }; ++ ASSERT_EQ(2u, write(fds_[1], test_tokens, sizeof(test_tokens))); ++#endif ++ EXPECT_TRUE(tokens_->Acquire()); ++ tokens_->Reserve(); ++ EXPECT_TRUE(tokens_->Acquire()); ++ tokens_->Reserve(); ++ EXPECT_FALSE(tokens_->Acquire()); ++ ++ tokens_->Clear(); ++ EXPECT_TRUE(tokens_->Acquire()); ++ ++ // there must be two tokens available ++#ifdef _WIN32 ++ EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(semaphore_, 0)); ++ EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(semaphore_, 0)); ++ EXPECT_TRUE(ReleaseSemaphore(semaphore_, 2, &previous)); ++ EXPECT_EQ(0, previous); ++#else ++ EXPECT_EQ(2u, read(fds_[0], buf_, sizeof(buf_))); ++ // tokens are pushed onto a stack, hence returned in reverse order ++ EXPECT_EQ(test_tokens[0], buf_[1]); ++ EXPECT_EQ(test_tokens[1], buf_[0]); ++#endif ++ ++ // implicit token ++ EXPECT_TRUE(tokens_->Acquire()); ++} --- /dev/null +++ b/src/tokenpool-gnu-make-posix.cc -@@ -0,0 +1,203 @@ +@@ -0,0 +1,214 @@ +// Copyright 2016-2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); @@ -2652,6 +1663,7 @@ index 0000000000..70d84bfff7 +#include +#include +#include ++#include + +// TokenPool implementation for GNU make jobserver - POSIX implementation +// (http://make.mad-scientist.net/papers/jobserver-implementation/) @@ -2661,8 +1673,8 @@ index 0000000000..70d84bfff7 + + virtual int GetMonitorFd(); + -+ virtual const char *GetEnv(const char *name) { return getenv(name); }; -+ virtual bool ParseAuth(const char *jobserver); ++ virtual const char* GetEnv(const char* name) { return getenv(name); }; ++ virtual bool ParseAuth(const char* jobserver); + virtual bool AcquireToken(); + virtual bool ReturnToken(); + @@ -2673,6 +1685,16 @@ index 0000000000..70d84bfff7 + struct sigaction old_act_; + bool restore_; + ++ // See https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html ++ // ++ // It’s important that when you release the job slot, you write back ++ // the same character you read. Don’t assume that all tokens are the ++ // same character different characters may have different meanings to ++ // GNU make. The order is not important, since make has no idea in ++ // what order jobs will complete anyway. ++ // ++ std::stack tokens_; ++ + static int dup_rfd_; + static void CloseDupRfd(int signum); + @@ -2693,9 +1715,7 @@ index 0000000000..70d84bfff7 + if (fd < 0) + return false; + int ret = fcntl(fd, F_GETFD); -+ if (ret < 0) -+ return false; -+ return true; ++ return ret >= 0; +} + +int GNUmakeTokenPoolPosix::dup_rfd_ = -1; @@ -2711,14 +1731,13 @@ index 0000000000..70d84bfff7 + act.sa_handler = CloseDupRfd; + if (sigaction(SIGALRM, &act, &old_act_) < 0) { + perror("sigaction:"); -+ return(false); -+ } else { -+ restore_ = true; -+ return(true); ++ return false; + } ++ restore_ = true; ++ return true; +} + -+bool GNUmakeTokenPoolPosix::ParseAuth(const char *jobserver) { ++bool GNUmakeTokenPoolPosix::ParseAuth(const char* jobserver) { + int rfd = -1; + int wfd = -1; + if ((sscanf(jobserver, "%*[^=]=%d,%d", &rfd, &wfd) == 2) && @@ -2765,6 +1784,7 @@ index 0000000000..70d84bfff7 + if (dup_rfd_ != -1) { + struct sigaction act, old_act; + int ret = 0; ++ char buf; + + // Temporarily replace SIGCHLD handler with our own + memset(&act, 0, sizeof(act)); @@ -2776,8 +1796,6 @@ index 0000000000..70d84bfff7 + memset(&timeout, 0, sizeof(timeout)); + timeout.it_value.tv_usec = 100 * 1000; // [ms] -> [usec] + if (setitimer(ITIMER_REAL, &timeout, NULL) == 0) { -+ char buf; -+ + // Now try to read() from dup_rfd_. Return values from read(): + // + // 1. token read -> 1 @@ -2800,8 +1818,10 @@ index 0000000000..70d84bfff7 + CloseDupRfd(0); + + // Case 1 from above list -+ if (ret > 0) ++ if (ret > 0) { ++ tokens_.push(buf); + return true; ++ } + } + } + @@ -2812,11 +1832,13 @@ index 0000000000..70d84bfff7 +} + +bool GNUmakeTokenPoolPosix::ReturnToken() { -+ const char buf = '+'; ++ const char buf = tokens_.top(); + while (1) { + int ret = write(wfd_, &buf, 1); -+ if (ret > 0) ++ if (ret > 0) { ++ tokens_.pop(); + return true; ++ } + if ((ret != -1) || (errno != EINTR)) + return false; + // write got interrupted - retry @@ -2824,18 +1846,15 @@ index 0000000000..70d84bfff7 +} + +int GNUmakeTokenPoolPosix::GetMonitorFd() { -+ return(rfd_); ++ return rfd_; +} + -+struct TokenPool *TokenPool::Get() { ++TokenPool* TokenPool::Get() { + return new GNUmakeTokenPoolPosix; +} -diff --git a/src/tokenpool-gnu-make-win32.cc b/src/tokenpool-gnu-make-win32.cc -new file mode 100644 -index 0000000000..2719f2c1fc --- /dev/null +++ b/src/tokenpool-gnu-make-win32.cc -@@ -0,0 +1,237 @@ +@@ -0,0 +1,239 @@ +// Copyright 2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); @@ -2852,7 +1871,8 @@ index 0000000000..2719f2c1fc + +#include "tokenpool-gnu-make.h" + -+// always include first to make sure other headers do the correct thing... ++// Always include this first. ++// Otherwise the other system headers don't work correctly under Win32 +#include + +#include @@ -2870,8 +1890,8 @@ index 0000000000..2719f2c1fc + virtual void WaitForTokenAvailability(HANDLE ioport); + virtual bool TokenIsAvailable(ULONG_PTR key); + -+ virtual const char *GetEnv(const char *name); -+ virtual bool ParseAuth(const char *jobserver); ++ virtual const char* GetEnv(const char* name); ++ virtual bool ParseAuth(const char* jobserver); + virtual bool AcquireToken(); + virtual bool ReturnToken(); + @@ -2936,19 +1956,19 @@ index 0000000000..2719f2c1fc + } +} + -+const char *GNUmakeTokenPoolWin32::GetEnv(const char *name) { ++const char* GNUmakeTokenPoolWin32::GetEnv(const char* name) { + // getenv() does not work correctly together with tokenpool_tests.cc + static char buffer[MAX_PATH + 1]; -+ if (GetEnvironmentVariable("MAKEFLAGS", buffer, sizeof(buffer)) == 0) ++ if (GetEnvironmentVariable(name, buffer, sizeof(buffer)) == 0) + return NULL; -+ return(buffer); ++ return buffer; +} + -+bool GNUmakeTokenPoolWin32::ParseAuth(const char *jobserver) { ++bool GNUmakeTokenPoolWin32::ParseAuth(const char* jobserver) { + // match "--jobserver-auth=gmake_semaphore_..." -+ const char *start = strchr(jobserver, '='); ++ const char* start = strchr(jobserver, '='); + if (start) { -+ const char *end = start; ++ const char* end = start; + unsigned int len; + char c, *auth; + @@ -2957,14 +1977,15 @@ index 0000000000..2719f2c1fc + break; + len = end - start; // includes string terminator in count + -+ if ((len > 1) && ((auth = (char *)malloc(len)) != NULL)) { ++ if ((len > 1) && ((auth = (char*)malloc(len)) != NULL)) { + strncpy(auth, start + 1, len - 1); + auth[len - 1] = '\0'; + -+ if ((semaphore_jobserver_ = OpenSemaphore(SEMAPHORE_ALL_ACCESS, /* Semaphore access setting */ -+ FALSE, /* Child processes DON'T inherit */ -+ auth /* Semaphore name */ -+ )) != NULL) { ++ if ((semaphore_jobserver_ = ++ OpenSemaphore(SEMAPHORE_ALL_ACCESS, /* Semaphore access setting */ ++ FALSE, /* Child processes DON'T inherit */ ++ auth /* Semaphore name */ ++ )) != NULL) { + free(auth); + return true; + } @@ -3009,7 +2030,7 @@ index 0000000000..2719f2c1fc +} + +DWORD WINAPI GNUmakeTokenPoolWin32::SemaphoreThreadWrapper(LPVOID param) { -+ GNUmakeTokenPoolWin32 *This = (GNUmakeTokenPoolWin32 *) param; ++ GNUmakeTokenPoolWin32* This = (GNUmakeTokenPoolWin32*) param; + return This->SemaphoreThread(); +} + @@ -3054,7 +2075,7 @@ index 0000000000..2719f2c1fc + +bool GNUmakeTokenPoolWin32::TokenIsAvailable(ULONG_PTR key) { + // alert child thread to break wait on token semaphore -+ QueueUserAPC(&NoopAPCFunc, child_, (ULONG_PTR)NULL); ++ QueueUserAPC((PAPCFUNC)&NoopAPCFunc, child_, (ULONG_PTR)NULL); + + // return true when GetQueuedCompletionStatus() returned our key + return key == (ULONG_PTR) this; @@ -3070,273 +2091,9 @@ index 0000000000..2719f2c1fc + Win32Fatal("WaitForSingleObject"); +} + -+struct TokenPool *TokenPool::Get() { ++TokenPool* TokenPool::Get() { + return new GNUmakeTokenPoolWin32; +} -diff --git a/src/tokenpool-gnu-make.cc b/src/tokenpool-gnu-make.cc -index 4132bb06d9..92ff611721 100644 ---- a/src/tokenpool-gnu-make.cc -+++ b/src/tokenpool-gnu-make.cc -@@ -12,101 +12,26 @@ - // See the License for the specific language governing permissions and - // limitations under the License. - --#include "tokenpool.h" -+#include "tokenpool-gnu-make.h" - --#include --#include --#include --#include --#include --#include -+#include - #include - #include --#include - - #include "line_printer.h" - --// TokenPool implementation for GNU make jobserver --// (http://make.mad-scientist.net/papers/jobserver-implementation/) --struct GNUmakeTokenPool : public TokenPool { -- GNUmakeTokenPool(); -- virtual ~GNUmakeTokenPool(); -- -- virtual bool Acquire(); -- virtual void Reserve(); -- virtual void Release(); -- virtual void Clear(); -- virtual int GetMonitorFd(); -- -- bool Setup(bool ignore, bool verbose, double& max_load_average); -- -- private: -- int available_; -- int used_; -- --#ifdef _WIN32 -- // @TODO --#else -- int rfd_; -- int wfd_; -- -- struct sigaction old_act_; -- bool restore_; -- -- static int dup_rfd_; -- static void CloseDupRfd(int signum); -- -- bool CheckFd(int fd); -- bool SetAlarmHandler(); --#endif -- -- void Return(); --}; -- -+// TokenPool implementation for GNU make jobserver - common bits - // every instance owns an implicit token -> available_ == 1 --GNUmakeTokenPool::GNUmakeTokenPool() : available_(1), used_(0), -- rfd_(-1), wfd_(-1), restore_(false) { -+GNUmakeTokenPool::GNUmakeTokenPool() : available_(1), used_(0) { - } - - GNUmakeTokenPool::~GNUmakeTokenPool() { -- Clear(); -- if (restore_) -- sigaction(SIGALRM, &old_act_, NULL); --} -- --bool GNUmakeTokenPool::CheckFd(int fd) { -- if (fd < 0) -- return false; -- int ret = fcntl(fd, F_GETFD); -- if (ret < 0) -- return false; -- return true; --} -- --int GNUmakeTokenPool::dup_rfd_ = -1; -- --void GNUmakeTokenPool::CloseDupRfd(int signum) { -- close(dup_rfd_); -- dup_rfd_ = -1; --} -- --bool GNUmakeTokenPool::SetAlarmHandler() { -- struct sigaction act; -- memset(&act, 0, sizeof(act)); -- act.sa_handler = CloseDupRfd; -- if (sigaction(SIGALRM, &act, &old_act_) < 0) { -- perror("sigaction:"); -- return(false); -- } else { -- restore_ = true; -- return(true); -- } - } - - bool GNUmakeTokenPool::Setup(bool ignore, - bool verbose, - double& max_load_average) { -- const char *value = getenv("MAKEFLAGS"); -+ const char *value = GetEnv("MAKEFLAGS"); - if (value) { - // GNU make <= 4.1 - const char *jobserver = strstr(value, "--jobserver-fds="); -@@ -119,20 +44,13 @@ bool GNUmakeTokenPool::Setup(bool ignore, - if (ignore) { - printer.PrintOnNewLine("ninja: warning: -jN forced on command line; ignoring GNU make jobserver.\n"); - } else { -- int rfd = -1; -- int wfd = -1; -- if ((sscanf(jobserver, "%*[^=]=%d,%d", &rfd, &wfd) == 2) && -- CheckFd(rfd) && -- CheckFd(wfd) && -- SetAlarmHandler()) { -+ if (ParseAuth(jobserver)) { - const char *l_arg = strstr(value, " -l"); - int load_limit = -1; - - if (verbose) { - printer.PrintOnNewLine("ninja: using GNU make jobserver.\n"); - } -- rfd_ = rfd; -- wfd_ = wfd; - - // translate GNU make -lN to ninja -lN - if (l_arg && -@@ -154,83 +72,14 @@ bool GNUmakeTokenPool::Acquire() { - if (available_ > 0) - return true; - -- // Please read -- // -- // http://make.mad-scientist.net/papers/jobserver-implementation/ -- // -- // for the reasoning behind the following code. -- // -- // Try to read one character from the pipe. Returns true on success. -- // -- // First check if read() would succeed without blocking. --#ifdef USE_PPOLL -- pollfd pollfds[] = {{rfd_, POLLIN, 0}}; -- int ret = poll(pollfds, 1, 0); --#else -- fd_set set; -- struct timeval timeout = { 0, 0 }; -- FD_ZERO(&set); -- FD_SET(rfd_, &set); -- int ret = select(rfd_ + 1, &set, NULL, NULL, &timeout); --#endif -- if (ret > 0) { -- // Handle potential race condition: -- // - the above check succeeded, i.e. read() should not block -- // - the character disappears before we call read() -- // -- // Create a duplicate of rfd_. The duplicate file descriptor dup_rfd_ -- // can safely be closed by signal handlers without affecting rfd_. -- dup_rfd_ = dup(rfd_); -- -- if (dup_rfd_ != -1) { -- struct sigaction act, old_act; -- int ret = 0; -- -- // Temporarily replace SIGCHLD handler with our own -- memset(&act, 0, sizeof(act)); -- act.sa_handler = CloseDupRfd; -- if (sigaction(SIGCHLD, &act, &old_act) == 0) { -- struct itimerval timeout; -- -- // install a 100ms timeout that generates SIGALARM on expiration -- memset(&timeout, 0, sizeof(timeout)); -- timeout.it_value.tv_usec = 100 * 1000; // [ms] -> [usec] -- if (setitimer(ITIMER_REAL, &timeout, NULL) == 0) { -- char buf; -- -- // Now try to read() from dup_rfd_. Return values from read(): -- // -- // 1. token read -> 1 -- // 2. pipe closed -> 0 -- // 3. alarm expires -> -1 (EINTR) -- // 4. child exits -> -1 (EINTR) -- // 5. alarm expired before entering read() -> -1 (EBADF) -- // 6. child exited before entering read() -> -1 (EBADF) -- // 7. child exited before handler is installed -> go to 1 - 3 -- ret = read(dup_rfd_, &buf, 1); -- -- // disarm timer -- memset(&timeout, 0, sizeof(timeout)); -- setitimer(ITIMER_REAL, &timeout, NULL); -- } -- -- sigaction(SIGCHLD, &old_act, NULL); -- } -- -- CloseDupRfd(0); -- -- // Case 1 from above list -- if (ret > 0) { -- available_++; -- return true; -- } -- } -+ if (AcquireToken()) { -+ // token acquired -+ available_++; -+ return true; -+ } else { -+ // no token available -+ return false; - } -- -- // read() would block, i.e. no token available, -- // cases 2-6 from above list or -- // select() / poll() / dup() / sigaction() / setitimer() failed -- return false; - } - - void GNUmakeTokenPool::Reserve() { -@@ -239,15 +88,8 @@ void GNUmakeTokenPool::Reserve() { - } - - void GNUmakeTokenPool::Return() { -- const char buf = '+'; -- while (1) { -- int ret = write(wfd_, &buf, 1); -- if (ret > 0) -- available_--; -- if ((ret != -1) || (errno != EINTR)) -- return; -- // write got interrupted - retry -- } -+ if (ReturnToken()) -+ available_--; - } - - void GNUmakeTokenPool::Release() { -@@ -263,18 +105,3 @@ void GNUmakeTokenPool::Clear() { - while (available_ > 1) - Return(); - } -- --int GNUmakeTokenPool::GetMonitorFd() { -- return(rfd_); --} -- --struct TokenPool *TokenPool::Get(bool ignore, -- bool verbose, -- double& max_load_average) { -- GNUmakeTokenPool *tokenpool = new GNUmakeTokenPool; -- if (tokenpool->Setup(ignore, verbose, max_load_average)) -- return tokenpool; -- else -- delete tokenpool; -- return NULL; --} -diff --git a/src/tokenpool-gnu-make.h b/src/tokenpool-gnu-make.h -new file mode 100644 -index 0000000000..d3852088e2 --- /dev/null +++ b/src/tokenpool-gnu-make.h @@ -0,0 +1,40 @@ @@ -3359,7 +2116,7 @@ index 0000000000..d3852088e2 +// interface to GNU make token pool +struct GNUmakeTokenPool : public TokenPool { + GNUmakeTokenPool(); -+ virtual ~GNUmakeTokenPool(); ++ ~GNUmakeTokenPool(); + + // token pool implementation + virtual bool Acquire(); @@ -3369,8 +2126,8 @@ index 0000000000..d3852088e2 + virtual bool Setup(bool ignore, bool verbose, double& max_load_average); + + // platform specific implementation -+ virtual const char *GetEnv(const char *name) = 0; -+ virtual bool ParseAuth(const char *jobserver) = 0; ++ virtual const char* GetEnv(const char* name) = 0; ++ virtual bool ParseAuth(const char* jobserver) = 0; + virtual bool AcquireToken() = 0; + virtual bool ReturnToken() = 0; + @@ -3380,332 +2137,6 @@ index 0000000000..d3852088e2 + + void Return(); +}; -diff --git a/src/tokenpool-none.cc b/src/tokenpool-none.cc -index 4c592875b4..613d16882d 100644 ---- a/src/tokenpool-none.cc -+++ b/src/tokenpool-none.cc -@@ -17,8 +17,6 @@ - #include - - // No-op TokenPool implementation --struct TokenPool *TokenPool::Get(bool ignore, -- bool verbose, -- double& max_load_average) { -+struct TokenPool *TokenPool::Get() { - return NULL; - } -diff --git a/src/tokenpool.h b/src/tokenpool.h -index 4bf477f20c..1be8e1d5ce 100644 ---- a/src/tokenpool.h -+++ b/src/tokenpool.h -@@ -1,4 +1,4 @@ --// Copyright 2016-2017 Google Inc. All Rights Reserved. -+// Copyright 2016-2018 Google Inc. All Rights Reserved. - // - // Licensed under the Apache License, Version 2.0 (the "License"); - // you may not use this file except in compliance with the License. -@@ -12,6 +12,10 @@ - // See the License for the specific language governing permissions and - // limitations under the License. - -+#ifdef _WIN32 -+#include -+#endif -+ - // interface to token pool - struct TokenPool { - virtual ~TokenPool() {} -@@ -21,14 +25,18 @@ struct TokenPool { - virtual void Release() = 0; - virtual void Clear() = 0; - -+ // returns false if token pool setup failed -+ virtual bool Setup(bool ignore, bool verbose, double& max_load_average) = 0; -+ - #ifdef _WIN32 -- // @TODO -+ virtual void WaitForTokenAvailability(HANDLE ioport) = 0; -+ // returns true if a token has become available -+ // key is result from GetQueuedCompletionStatus() -+ virtual bool TokenIsAvailable(ULONG_PTR key) = 0; - #else - virtual int GetMonitorFd() = 0; - #endif - - // returns NULL if token pool is not available -- static struct TokenPool *Get(bool ignore, -- bool verbose, -- double& max_load_average); -+ static struct TokenPool *Get(); - }; -diff --git a/src/tokenpool_test.cc b/src/tokenpool_test.cc -index 6c89064ca4..8d4fd7d33a 100644 ---- a/src/tokenpool_test.cc -+++ b/src/tokenpool_test.cc -@@ -16,13 +16,25 @@ - - #include "test.h" - --#ifndef _WIN32 -+#ifdef _WIN32 -+#include -+#else -+#include -+#endif -+ - #include - #include --#include - -+#ifdef _WIN32 -+// should contain all valid characters -+#define SEMAPHORE_NAME "abcdefghijklmnopqrstwxyz01234567890_" -+#define AUTH_FORMAT(tmpl) "foo " tmpl "=%s bar" -+#define ENVIRONMENT_CLEAR() SetEnvironmentVariable("MAKEFLAGS", NULL) -+#define ENVIRONMENT_INIT(v) SetEnvironmentVariable("MAKEFLAGS", v) -+#else -+#define AUTH_FORMAT(tmpl) "foo " tmpl "=%d,%d bar" - #define ENVIRONMENT_CLEAR() unsetenv("MAKEFLAGS") --#define ENVIRONMENT_INIT(v) setenv("MAKEFLAGS", v, true); -+#define ENVIRONMENT_INIT(v) setenv("MAKEFLAGS", v, true) - #endif - - namespace { -@@ -32,43 +44,60 @@ const double kLoadAverageDefault = -1.23456789; - struct TokenPoolTest : public testing::Test { - double load_avg_; - TokenPool *tokens_; --#ifndef _WIN32 - char buf_[1024]; -+#ifdef _WIN32 -+ const char *semaphore_name_; -+ HANDLE semaphore_; -+#else - int fds_[2]; - #endif - - virtual void SetUp() { - load_avg_ = kLoadAverageDefault; - tokens_ = NULL; --#ifndef _WIN32 - ENVIRONMENT_CLEAR(); -+#ifdef _WIN32 -+ semaphore_name_ = SEMAPHORE_NAME; -+ if ((semaphore_ = CreateSemaphore(0, 0, 2, SEMAPHORE_NAME)) == NULL) -+#else - if (pipe(fds_) < 0) -- ASSERT_TRUE(false); - #endif -+ ASSERT_TRUE(false); - } - -- void CreatePool(const char *format, bool ignore_jobserver) { --#ifndef _WIN32 -+ void CreatePool(const char *format, bool ignore_jobserver = false) { - if (format) { -- sprintf(buf_, format, fds_[0], fds_[1]); -+ sprintf(buf_, format, -+#ifdef _WIN32 -+ semaphore_name_ -+#else -+ fds_[0], fds_[1] -+#endif -+ ); - ENVIRONMENT_INIT(buf_); - } --#endif -- tokens_ = TokenPool::Get(ignore_jobserver, false, load_avg_); -+ if ((tokens_ = TokenPool::Get()) != NULL) { -+ if (!tokens_->Setup(ignore_jobserver, false, load_avg_)) { -+ delete tokens_; -+ tokens_ = NULL; -+ } -+ } - } - - void CreateDefaultPool() { -- CreatePool("foo --jobserver-auth=%d,%d bar", false); -+ CreatePool(AUTH_FORMAT("--jobserver-auth")); - } - - virtual void TearDown() { - if (tokens_) - delete tokens_; --#ifndef _WIN32 -+#ifdef _WIN32 -+ CloseHandle(semaphore_); -+#else - close(fds_[0]); - close(fds_[1]); -- ENVIRONMENT_CLEAR(); - #endif -+ ENVIRONMENT_CLEAR(); - } - }; - -@@ -82,10 +111,9 @@ TEST_F(TokenPoolTest, NoTokenPool) { - EXPECT_EQ(kLoadAverageDefault, load_avg_); - } - --#ifndef _WIN32 - TEST_F(TokenPoolTest, SuccessfulOldSetup) { - // GNUmake <= 4.1 -- CreatePool("foo --jobserver-fds=%d,%d bar", false); -+ CreatePool(AUTH_FORMAT("--jobserver-fds")); - - EXPECT_NE(NULL, tokens_); - EXPECT_EQ(kLoadAverageDefault, load_avg_); -@@ -100,19 +128,37 @@ TEST_F(TokenPoolTest, SuccessfulNewSetup) { - } - - TEST_F(TokenPoolTest, IgnoreWithJN) { -- CreatePool("foo --jobserver-auth=%d,%d bar", true); -+ CreatePool(AUTH_FORMAT("--jobserver-auth"), true); - - EXPECT_EQ(NULL, tokens_); - EXPECT_EQ(kLoadAverageDefault, load_avg_); - } - - TEST_F(TokenPoolTest, HonorLN) { -- CreatePool("foo -l9 --jobserver-auth=%d,%d bar", false); -+ CreatePool(AUTH_FORMAT("-l9 --jobserver-auth")); - - EXPECT_NE(NULL, tokens_); - EXPECT_EQ(9.0, load_avg_); - } - -+#ifdef _WIN32 -+TEST_F(TokenPoolTest, SemaphoreNotFound) { -+ semaphore_name_ = SEMAPHORE_NAME "_foobar"; -+ CreateDefaultPool(); -+ -+ EXPECT_EQ(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+} -+ -+TEST_F(TokenPoolTest, TokenIsAvailable) { -+ CreateDefaultPool(); -+ -+ ASSERT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+ -+ EXPECT_TRUE(tokens_->TokenIsAvailable((ULONG_PTR)tokens_)); -+} -+#else - TEST_F(TokenPoolTest, MonitorFD) { - CreateDefaultPool(); - -@@ -121,6 +167,7 @@ TEST_F(TokenPoolTest, MonitorFD) { - - EXPECT_EQ(fds_[0], tokens_->GetMonitorFd()); - } -+#endif - - TEST_F(TokenPoolTest, ImplicitToken) { - CreateDefaultPool(); -@@ -147,7 +194,13 @@ TEST_F(TokenPoolTest, TwoTokens) { - EXPECT_FALSE(tokens_->Acquire()); - - // jobserver offers 2nd token -+#ifdef _WIN32 -+ LONG previous; -+ ASSERT_TRUE(ReleaseSemaphore(semaphore_, 1, &previous)); -+ ASSERT_EQ(0, previous); -+#else - ASSERT_EQ(1u, write(fds_[1], "T", 1)); -+#endif - EXPECT_TRUE(tokens_->Acquire()); - tokens_->Reserve(); - EXPECT_FALSE(tokens_->Acquire()); -@@ -160,8 +213,14 @@ TEST_F(TokenPoolTest, TwoTokens) { - tokens_->Release(); - EXPECT_TRUE(tokens_->Acquire()); - -- // there must be one token in the pipe -+ // there must be one token available -+#ifdef _WIN32 -+ EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(semaphore_, 0)); -+ EXPECT_TRUE(ReleaseSemaphore(semaphore_, 1, &previous)); -+ EXPECT_EQ(0, previous); -+#else - EXPECT_EQ(1u, read(fds_[0], buf_, sizeof(buf_))); -+#endif - - // implicit token - EXPECT_TRUE(tokens_->Acquire()); -@@ -179,7 +238,13 @@ TEST_F(TokenPoolTest, Clear) { - EXPECT_FALSE(tokens_->Acquire()); - - // jobserver offers 2nd & 3rd token -+#ifdef _WIN32 -+ LONG previous; -+ ASSERT_TRUE(ReleaseSemaphore(semaphore_, 2, &previous)); -+ ASSERT_EQ(0, previous); -+#else - ASSERT_EQ(2u, write(fds_[1], "TT", 2)); -+#endif - EXPECT_TRUE(tokens_->Acquire()); - tokens_->Reserve(); - EXPECT_TRUE(tokens_->Acquire()); -@@ -189,10 +254,16 @@ TEST_F(TokenPoolTest, Clear) { - tokens_->Clear(); - EXPECT_TRUE(tokens_->Acquire()); - -- // there must be two tokens in the pipe -+ // there must be two tokens available -+#ifdef _WIN32 -+ EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(semaphore_, 0)); -+ EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(semaphore_, 0)); -+ EXPECT_TRUE(ReleaseSemaphore(semaphore_, 2, &previous)); -+ EXPECT_EQ(0, previous); -+#else - EXPECT_EQ(2u, read(fds_[0], buf_, sizeof(buf_))); -+#endif - - // implicit token - EXPECT_TRUE(tokens_->Acquire()); - } --#endif - -From 2b9c81c0ec1226d8795e7725529f13be41eaa385 Mon Sep 17 00:00:00 2001 -From: Stefan Becker -Date: Fri, 14 Dec 2018 13:27:11 +0200 -Subject: [PATCH 11/11] Prepare PR for merging - part II - -- remove unnecessary "struct" from TokenPool -- add PAPCFUNC cast to QueryUserAPC() -- remove hard-coded MAKEFLAGS string from win32 -- remove useless build test CompleteNoWork -- rename TokenPoolTest to TestTokenPool -- add tokenpool modules to CMake build -- remove unused no-op TokenPool implementation -- fix errors flagged by codespell & clang-tidy -- address review comments from - -https://github.com/ninja-build/ninja/pull/1140#pullrequestreview-195195803 -https://github.com/ninja-build/ninja/pull/1140#pullrequestreview-185089255 -https://github.com/ninja-build/ninja/pull/1140#issuecomment-473898963 -https://github.com/ninja-build/ninja/pull/1140#issuecomment-596624610 ---- - CMakeLists.txt | 8 ++++- - src/build.cc | 2 +- - src/build_test.cc | 12 +------ - src/subprocess-posix.cc | 4 +-- - src/subprocess-win32.cc | 2 +- - src/subprocess.h | 2 +- - src/subprocess_test.cc | 26 +++++++------- - src/tokenpool-gnu-make-posix.cc | 21 +++++------ - src/tokenpool-gnu-make-win32.cc | 36 ++++++++++--------- - src/tokenpool-gnu-make.cc | 63 +++++++++++++++++---------------- - src/tokenpool-gnu-make.h | 6 ++-- - src/tokenpool-none.cc | 22 ------------ - src/tokenpool.h | 2 +- - src/tokenpool_test.cc | 8 ++--- - 14 files changed, 94 insertions(+), 120 deletions(-) - delete mode 100644 src/tokenpool-none.cc - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 57ae548f5b..e2876fe413 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,6 +112,7 @@ add_library(libninja OBJECT @@ -3716,14 +2147,14 @@ index 57ae548f5b..e2876fe413 100644 src/util.cc src/version.cc ) -@@ -123,9 +124,13 @@ if(WIN32) +@@ -123,9 +124,14 @@ if(WIN32) src/msvc_helper_main-win32.cc src/getopt.c src/minidump-win32.cc + src/tokenpool-gnu-make-win32.cc ) else() -- target_sources(libninja PRIVATE src/subprocess-posix.cc) + target_sources(libninja PRIVATE src/subprocess-posix.cc) + target_sources(libninja PRIVATE + src/subprocess-posix.cc + src/tokenpool-gnu-make-posix.cc @@ -3731,7 +2162,7 @@ index 57ae548f5b..e2876fe413 100644 if(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR CMAKE_SYSTEM_NAME STREQUAL "AIX") target_sources(libninja PRIVATE src/getopt.c) endif() -@@ -204,6 +209,7 @@ if(BUILD_TESTING) +@@ -204,6 +210,7 @@ if(BUILD_TESTING) src/string_piece_util_test.cc src/subprocess_test.cc src/test.cc @@ -3739,552 +2170,3 @@ index 57ae548f5b..e2876fe413 100644 src/util_test.cc ) if(WIN32) -diff --git a/src/build.cc b/src/build.cc -index 20c3bdc2a0..854df08c2a 100644 ---- a/src/build.cc -+++ b/src/build.cc -@@ -467,7 +467,7 @@ struct RealCommandRunner : public CommandRunner { - // copy of config_.max_load_average; can be modified by TokenPool setup - double max_load_average_; - SubprocessSet subprocs_; -- TokenPool *tokens_; -+ TokenPool* tokens_; - map subproc_to_edge_; - }; - -diff --git a/src/build_test.cc b/src/build_test.cc -index dd41dfbe1d..8901c9518f 100644 ---- a/src/build_test.cc -+++ b/src/build_test.cc -@@ -4098,7 +4098,7 @@ struct BuildTokenTest : public BuildTest { - void ExpectWaitForCommand(int count, ...); - - private: -- void EnqueueBooleans(vector& booleans, int count, va_list ao); -+ void EnqueueBooleans(vector& booleans, int count, va_list ap); - }; - - void BuildTokenTest::SetUp() { -@@ -4144,16 +4144,6 @@ void BuildTokenTest::EnqueueBooleans(vector& booleans, int count, va_list - } - } - --TEST_F(BuildTokenTest, CompleteNoWork) { -- // plan should not execute anything -- string err; -- -- EXPECT_TRUE(builder_.Build(&err)); -- EXPECT_EQ("", err); -- -- EXPECT_EQ(0u, token_command_runner_.commands_ran_.size()); --} -- - TEST_F(BuildTokenTest, DoNotAquireToken) { - // plan should execute one command - string err; -diff --git a/src/subprocess-posix.cc b/src/subprocess-posix.cc -index 74451b0be2..31839276c4 100644 ---- a/src/subprocess-posix.cc -+++ b/src/subprocess-posix.cc -@@ -250,7 +250,7 @@ Subprocess *SubprocessSet::Add(const string& command, bool use_console) { - } - - #ifdef USE_PPOLL --bool SubprocessSet::DoWork(struct TokenPool* tokens) { -+bool SubprocessSet::DoWork(TokenPool* tokens) { - vector fds; - nfds_t nfds = 0; - -@@ -315,7 +315,7 @@ bool SubprocessSet::DoWork(struct TokenPool* tokens) { - } - - #else // !defined(USE_PPOLL) --bool SubprocessSet::DoWork(struct TokenPool* tokens) { -+bool SubprocessSet::DoWork(TokenPool* tokens) { - fd_set set; - int nfds = 0; - FD_ZERO(&set); -diff --git a/src/subprocess-win32.cc b/src/subprocess-win32.cc -index ce3e2c20a4..2926e9a221 100644 ---- a/src/subprocess-win32.cc -+++ b/src/subprocess-win32.cc -@@ -252,7 +252,7 @@ Subprocess *SubprocessSet::Add(const string& command, bool use_console) { - return subprocess; - } - --bool SubprocessSet::DoWork(struct TokenPool* tokens) { -+bool SubprocessSet::DoWork(TokenPool* tokens) { - DWORD bytes_read; - Subprocess* subproc; - OVERLAPPED* overlapped; -diff --git a/src/subprocess.h b/src/subprocess.h -index 9ea67ea477..1ec78171e8 100644 ---- a/src/subprocess.h -+++ b/src/subprocess.h -@@ -86,7 +86,7 @@ struct SubprocessSet { - ~SubprocessSet(); - - Subprocess* Add(const std::string& command, bool use_console = false); -- bool DoWork(struct TokenPool* tokens); -+ bool DoWork(TokenPool* tokens); - Subprocess* NextFinished(); - void Clear(); - -diff --git a/src/subprocess_test.cc b/src/subprocess_test.cc -index f625963462..7b146f31be 100644 ---- a/src/subprocess_test.cc -+++ b/src/subprocess_test.cc -@@ -35,7 +35,7 @@ const char* kSimpleCommand = "cmd /c dir \\"; - const char* kSimpleCommand = "ls /"; - #endif - --struct TokenPoolTest : public TokenPool { -+struct TestTokenPool : public TokenPool { - bool Acquire() { return false; } - void Reserve() {} - void Release() {} -@@ -58,7 +58,7 @@ struct TokenPoolTest : public TokenPool { - - struct SubprocessTest : public testing::Test { - SubprocessSet subprocs_; -- TokenPoolTest tokens_; -+ TestTokenPool tokens_; - }; - - } // anonymous namespace -@@ -73,7 +73,7 @@ TEST_F(SubprocessTest, BadCommandStderr) { - // Pretend we discovered that stderr was ready for writing. - subprocs_.DoWork(NULL); - } -- ASSERT_EQ(false, subprocs_.IsTokenAvailable()); -+ ASSERT_FALSE(subprocs_.IsTokenAvailable()); - - EXPECT_EQ(ExitFailure, subproc->Finish()); - EXPECT_NE("", subproc->GetOutput()); -@@ -89,7 +89,7 @@ TEST_F(SubprocessTest, NoSuchCommand) { - // Pretend we discovered that stderr was ready for writing. - subprocs_.DoWork(NULL); - } -- ASSERT_EQ(false, subprocs_.IsTokenAvailable()); -+ ASSERT_FALSE(subprocs_.IsTokenAvailable()); - - EXPECT_EQ(ExitFailure, subproc->Finish()); - EXPECT_NE("", subproc->GetOutput()); -@@ -109,7 +109,7 @@ TEST_F(SubprocessTest, InterruptChild) { - while (!subproc->Done()) { - subprocs_.DoWork(NULL); - } -- ASSERT_EQ(false, subprocs_.IsTokenAvailable()); -+ ASSERT_FALSE(subprocs_.IsTokenAvailable()); - - EXPECT_EQ(ExitInterrupted, subproc->Finish()); - } -@@ -135,7 +135,7 @@ TEST_F(SubprocessTest, InterruptChildWithSigTerm) { - while (!subproc->Done()) { - subprocs_.DoWork(NULL); - } -- ASSERT_EQ(false, subprocs_.IsTokenAvailable()); -+ ASSERT_FALSE(subprocs_.IsTokenAvailable()); - - EXPECT_EQ(ExitInterrupted, subproc->Finish()); - } -@@ -161,7 +161,7 @@ TEST_F(SubprocessTest, InterruptChildWithSigHup) { - while (!subproc->Done()) { - subprocs_.DoWork(NULL); - } -- ASSERT_EQ(false, subprocs_.IsTokenAvailable()); -+ ASSERT_FALSE(subprocs_.IsTokenAvailable()); - - EXPECT_EQ(ExitInterrupted, subproc->Finish()); - } -@@ -190,7 +190,7 @@ TEST_F(SubprocessTest, Console) { - while (!subproc->Done()) { - subprocs_.DoWork(NULL); - } -- ASSERT_EQ(false, subprocs_.IsTokenAvailable()); -+ ASSERT_FALSE(subprocs_.IsTokenAvailable()); - - EXPECT_EQ(ExitSuccess, subproc->Finish()); - } -@@ -206,7 +206,7 @@ TEST_F(SubprocessTest, SetWithSingle) { - while (!subproc->Done()) { - subprocs_.DoWork(NULL); - } -- ASSERT_EQ(false, subprocs_.IsTokenAvailable()); -+ ASSERT_FALSE(subprocs_.IsTokenAvailable()); - ASSERT_EQ(ExitSuccess, subproc->Finish()); - ASSERT_NE("", subproc->GetOutput()); - -@@ -243,7 +243,7 @@ TEST_F(SubprocessTest, SetWithMulti) { - ASSERT_GT(subprocs_.running_.size(), 0u); - subprocs_.DoWork(NULL); - } -- ASSERT_EQ(false, subprocs_.IsTokenAvailable()); -+ ASSERT_FALSE(subprocs_.IsTokenAvailable()); - ASSERT_EQ(0u, subprocs_.running_.size()); - ASSERT_EQ(3u, subprocs_.finished_.size()); - -@@ -278,7 +278,7 @@ TEST_F(SubprocessTest, SetWithLots) { - subprocs_.ResetTokenAvailable(); - while (!subprocs_.running_.empty()) - subprocs_.DoWork(NULL); -- ASSERT_EQ(false, subprocs_.IsTokenAvailable()); -+ ASSERT_FALSE(subprocs_.IsTokenAvailable()); - for (size_t i = 0; i < procs.size(); ++i) { - ASSERT_EQ(ExitSuccess, procs[i]->Finish()); - ASSERT_NE("", procs[i]->GetOutput()); -@@ -298,7 +298,7 @@ TEST_F(SubprocessTest, ReadStdin) { - while (!subproc->Done()) { - subprocs_.DoWork(NULL); - } -- ASSERT_EQ(false, subprocs_.IsTokenAvailable()); -+ ASSERT_FALSE(subprocs_.IsTokenAvailable()); - ASSERT_EQ(ExitSuccess, subproc->Finish()); - ASSERT_EQ(1u, subprocs_.finished_.size()); - } -@@ -322,7 +322,7 @@ TEST_F(SubprocessTest, TokenAvailable) { - subprocs_.DoWork(&tokens_); - #ifdef _WIN32 - tokens_._token_available = false; -- // we need to loop here as we have no conrol where the token -+ // we need to loop here as we have no control where the token - // I/O completion post ends up in the queue - while (!subproc->Done() && !subprocs_.IsTokenAvailable()) { - subprocs_.DoWork(&tokens_); -diff --git a/src/tokenpool-gnu-make-posix.cc b/src/tokenpool-gnu-make-posix.cc -index 70d84bfff7..353bda226a 100644 ---- a/src/tokenpool-gnu-make-posix.cc -+++ b/src/tokenpool-gnu-make-posix.cc -@@ -32,8 +32,8 @@ struct GNUmakeTokenPoolPosix : public GNUmakeTokenPool { - - virtual int GetMonitorFd(); - -- virtual const char *GetEnv(const char *name) { return getenv(name); }; -- virtual bool ParseAuth(const char *jobserver); -+ virtual const char* GetEnv(const char* name) { return getenv(name); }; -+ virtual bool ParseAuth(const char* jobserver); - virtual bool AcquireToken(); - virtual bool ReturnToken(); - -@@ -64,9 +64,7 @@ bool GNUmakeTokenPoolPosix::CheckFd(int fd) { - if (fd < 0) - return false; - int ret = fcntl(fd, F_GETFD); -- if (ret < 0) -- return false; -- return true; -+ return ret >= 0; - } - - int GNUmakeTokenPoolPosix::dup_rfd_ = -1; -@@ -82,14 +80,13 @@ bool GNUmakeTokenPoolPosix::SetAlarmHandler() { - act.sa_handler = CloseDupRfd; - if (sigaction(SIGALRM, &act, &old_act_) < 0) { - perror("sigaction:"); -- return(false); -- } else { -- restore_ = true; -- return(true); -+ return false; - } -+ restore_ = true; -+ return true; - } - --bool GNUmakeTokenPoolPosix::ParseAuth(const char *jobserver) { -+bool GNUmakeTokenPoolPosix::ParseAuth(const char* jobserver) { - int rfd = -1; - int wfd = -1; - if ((sscanf(jobserver, "%*[^=]=%d,%d", &rfd, &wfd) == 2) && -@@ -195,9 +192,9 @@ bool GNUmakeTokenPoolPosix::ReturnToken() { - } - - int GNUmakeTokenPoolPosix::GetMonitorFd() { -- return(rfd_); -+ return rfd_; - } - --struct TokenPool *TokenPool::Get() { -+TokenPool* TokenPool::Get() { - return new GNUmakeTokenPoolPosix; - } -diff --git a/src/tokenpool-gnu-make-win32.cc b/src/tokenpool-gnu-make-win32.cc -index 2719f2c1fc..b2bb52fadb 100644 ---- a/src/tokenpool-gnu-make-win32.cc -+++ b/src/tokenpool-gnu-make-win32.cc -@@ -14,7 +14,8 @@ - - #include "tokenpool-gnu-make.h" - --// always include first to make sure other headers do the correct thing... -+// Always include this first. -+// Otherwise the other system headers don't work correctly under Win32 - #include - - #include -@@ -32,8 +33,8 @@ struct GNUmakeTokenPoolWin32 : public GNUmakeTokenPool { - virtual void WaitForTokenAvailability(HANDLE ioport); - virtual bool TokenIsAvailable(ULONG_PTR key); - -- virtual const char *GetEnv(const char *name); -- virtual bool ParseAuth(const char *jobserver); -+ virtual const char* GetEnv(const char* name); -+ virtual bool ParseAuth(const char* jobserver); - virtual bool AcquireToken(); - virtual bool ReturnToken(); - -@@ -98,19 +99,19 @@ GNUmakeTokenPoolWin32::~GNUmakeTokenPoolWin32() { - } - } - --const char *GNUmakeTokenPoolWin32::GetEnv(const char *name) { -+const char* GNUmakeTokenPoolWin32::GetEnv(const char* name) { - // getenv() does not work correctly together with tokenpool_tests.cc - static char buffer[MAX_PATH + 1]; -- if (GetEnvironmentVariable("MAKEFLAGS", buffer, sizeof(buffer)) == 0) -+ if (GetEnvironmentVariable(name, buffer, sizeof(buffer)) == 0) - return NULL; -- return(buffer); -+ return buffer; - } - --bool GNUmakeTokenPoolWin32::ParseAuth(const char *jobserver) { -+bool GNUmakeTokenPoolWin32::ParseAuth(const char* jobserver) { - // match "--jobserver-auth=gmake_semaphore_..." -- const char *start = strchr(jobserver, '='); -+ const char* start = strchr(jobserver, '='); - if (start) { -- const char *end = start; -+ const char* end = start; - unsigned int len; - char c, *auth; - -@@ -119,14 +120,15 @@ bool GNUmakeTokenPoolWin32::ParseAuth(const char *jobserver) { - break; - len = end - start; // includes string terminator in count - -- if ((len > 1) && ((auth = (char *)malloc(len)) != NULL)) { -+ if ((len > 1) && ((auth = (char*)malloc(len)) != NULL)) { - strncpy(auth, start + 1, len - 1); - auth[len - 1] = '\0'; - -- if ((semaphore_jobserver_ = OpenSemaphore(SEMAPHORE_ALL_ACCESS, /* Semaphore access setting */ -- FALSE, /* Child processes DON'T inherit */ -- auth /* Semaphore name */ -- )) != NULL) { -+ if ((semaphore_jobserver_ = -+ OpenSemaphore(SEMAPHORE_ALL_ACCESS, /* Semaphore access setting */ -+ FALSE, /* Child processes DON'T inherit */ -+ auth /* Semaphore name */ -+ )) != NULL) { - free(auth); - return true; - } -@@ -171,7 +173,7 @@ DWORD GNUmakeTokenPoolWin32::SemaphoreThread() { - } - - DWORD WINAPI GNUmakeTokenPoolWin32::SemaphoreThreadWrapper(LPVOID param) { -- GNUmakeTokenPoolWin32 *This = (GNUmakeTokenPoolWin32 *) param; -+ GNUmakeTokenPoolWin32* This = (GNUmakeTokenPoolWin32*) param; - return This->SemaphoreThread(); - } - -@@ -216,7 +218,7 @@ void GNUmakeTokenPoolWin32::WaitForTokenAvailability(HANDLE ioport) { - - bool GNUmakeTokenPoolWin32::TokenIsAvailable(ULONG_PTR key) { - // alert child thread to break wait on token semaphore -- QueueUserAPC(&NoopAPCFunc, child_, (ULONG_PTR)NULL); -+ QueueUserAPC((PAPCFUNC)&NoopAPCFunc, child_, (ULONG_PTR)NULL); - - // return true when GetQueuedCompletionStatus() returned our key - return key == (ULONG_PTR) this; -@@ -232,6 +234,6 @@ void GNUmakeTokenPoolWin32::WaitForObject(HANDLE object) { - Win32Fatal("WaitForSingleObject"); - } - --struct TokenPool *TokenPool::Get() { -+TokenPool* TokenPool::Get() { - return new GNUmakeTokenPoolWin32; - } -diff --git a/src/tokenpool-gnu-make.cc b/src/tokenpool-gnu-make.cc -index 92ff611721..60e0552924 100644 ---- a/src/tokenpool-gnu-make.cc -+++ b/src/tokenpool-gnu-make.cc -@@ -31,36 +31,37 @@ GNUmakeTokenPool::~GNUmakeTokenPool() { - bool GNUmakeTokenPool::Setup(bool ignore, - bool verbose, - double& max_load_average) { -- const char *value = GetEnv("MAKEFLAGS"); -- if (value) { -- // GNU make <= 4.1 -- const char *jobserver = strstr(value, "--jobserver-fds="); -+ const char* value = GetEnv("MAKEFLAGS"); -+ if (!value) -+ return false; -+ -+ // GNU make <= 4.1 -+ const char* jobserver = strstr(value, "--jobserver-fds="); -+ if (!jobserver) - // GNU make => 4.2 -- if (!jobserver) -- jobserver = strstr(value, "--jobserver-auth="); -- if (jobserver) { -- LinePrinter printer; -- -- if (ignore) { -- printer.PrintOnNewLine("ninja: warning: -jN forced on command line; ignoring GNU make jobserver.\n"); -- } else { -- if (ParseAuth(jobserver)) { -- const char *l_arg = strstr(value, " -l"); -- int load_limit = -1; -- -- if (verbose) { -- printer.PrintOnNewLine("ninja: using GNU make jobserver.\n"); -- } -- -- // translate GNU make -lN to ninja -lN -- if (l_arg && -- (sscanf(l_arg + 3, "%d ", &load_limit) == 1) && -- (load_limit > 0)) { -- max_load_average = load_limit; -- } -- -- return true; -+ jobserver = strstr(value, "--jobserver-auth="); -+ if (jobserver) { -+ LinePrinter printer; -+ -+ if (ignore) { -+ printer.PrintOnNewLine("ninja: warning: -jN forced on command line; ignoring GNU make jobserver.\n"); -+ } else { -+ if (ParseAuth(jobserver)) { -+ const char* l_arg = strstr(value, " -l"); -+ int load_limit = -1; -+ -+ if (verbose) { -+ printer.PrintOnNewLine("ninja: using GNU make jobserver.\n"); -+ } -+ -+ // translate GNU make -lN to ninja -lN -+ if (l_arg && -+ (sscanf(l_arg + 3, "%d ", &load_limit) == 1) && -+ (load_limit > 0)) { -+ max_load_average = load_limit; - } -+ -+ return true; - } - } - } -@@ -76,10 +77,10 @@ bool GNUmakeTokenPool::Acquire() { - // token acquired - available_++; - return true; -- } else { -- // no token available -- return false; - } -+ -+ // no token available -+ return false; - } - - void GNUmakeTokenPool::Reserve() { -diff --git a/src/tokenpool-gnu-make.h b/src/tokenpool-gnu-make.h -index d3852088e2..c94cca5e2d 100644 ---- a/src/tokenpool-gnu-make.h -+++ b/src/tokenpool-gnu-make.h -@@ -17,7 +17,7 @@ - // interface to GNU make token pool - struct GNUmakeTokenPool : public TokenPool { - GNUmakeTokenPool(); -- virtual ~GNUmakeTokenPool(); -+ ~GNUmakeTokenPool(); - - // token pool implementation - virtual bool Acquire(); -@@ -27,8 +27,8 @@ struct GNUmakeTokenPool : public TokenPool { - virtual bool Setup(bool ignore, bool verbose, double& max_load_average); - - // platform specific implementation -- virtual const char *GetEnv(const char *name) = 0; -- virtual bool ParseAuth(const char *jobserver) = 0; -+ virtual const char* GetEnv(const char* name) = 0; -+ virtual bool ParseAuth(const char* jobserver) = 0; - virtual bool AcquireToken() = 0; - virtual bool ReturnToken() = 0; - -diff --git a/src/tokenpool-none.cc b/src/tokenpool-none.cc -deleted file mode 100644 -index 613d16882d..0000000000 ---- a/src/tokenpool-none.cc -+++ /dev/null -@@ -1,22 +0,0 @@ --// Copyright 2016-2018 Google Inc. All Rights Reserved. --// --// Licensed under the Apache License, Version 2.0 (the "License"); --// you may not use this file except in compliance with the License. --// You may obtain a copy of the License at --// --// http://www.apache.org/licenses/LICENSE-2.0 --// --// Unless required by applicable law or agreed to in writing, software --// distributed under the License is distributed on an "AS IS" BASIS, --// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --// See the License for the specific language governing permissions and --// limitations under the License. -- --#include "tokenpool.h" -- --#include -- --// No-op TokenPool implementation --struct TokenPool *TokenPool::Get() { -- return NULL; --} -diff --git a/src/tokenpool.h b/src/tokenpool.h -index 1be8e1d5ce..931c22754d 100644 ---- a/src/tokenpool.h -+++ b/src/tokenpool.h -@@ -38,5 +38,5 @@ struct TokenPool { - #endif - - // returns NULL if token pool is not available -- static struct TokenPool *Get(); -+ static TokenPool* Get(); - }; -diff --git a/src/tokenpool_test.cc b/src/tokenpool_test.cc -index 8d4fd7d33a..8d3061cb30 100644 ---- a/src/tokenpool_test.cc -+++ b/src/tokenpool_test.cc -@@ -43,10 +43,10 @@ const double kLoadAverageDefault = -1.23456789; - - struct TokenPoolTest : public testing::Test { - double load_avg_; -- TokenPool *tokens_; -+ TokenPool* tokens_; - char buf_[1024]; - #ifdef _WIN32 -- const char *semaphore_name_; -+ const char* semaphore_name_; - HANDLE semaphore_; - #else - int fds_[2]; -@@ -65,7 +65,7 @@ struct TokenPoolTest : public testing::Test { - ASSERT_TRUE(false); - } - -- void CreatePool(const char *format, bool ignore_jobserver = false) { -+ void CreatePool(const char* format, bool ignore_jobserver = false) { - if (format) { - sprintf(buf_, format, - #ifdef _WIN32 -@@ -209,7 +209,7 @@ TEST_F(TokenPoolTest, TwoTokens) { - tokens_->Release(); - EXPECT_TRUE(tokens_->Acquire()); - -- // release implict token - must return 2nd token back to jobserver -+ // release implicit token - must return 2nd token back to jobserver - tokens_->Release(); - EXPECT_TRUE(tokens_->Acquire()); - From 825250ec4b26da784de9662e1ca54897927afc67 Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Sun, 22 Jan 2023 15:23:00 +0800 Subject: [PATCH 047/104] tools/cmake: update to 3.25.2 Release Notes: https://cmake.org/cmake/help/latest/release/3.25.html#id2 Signed-off-by: Linhui Liu --- tools/cmake/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index b7dadee7335..ed2580fe4c8 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.25.1 +PKG_VERSION:=3.25.2 PKG_VERSION_MAJOR:=$(word 1,$(subst ., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION))) PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake @@ -15,7 +15,7 @@ PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ https://cmake.org/files/v$(PKG_VERSION_MAJOR)/ -PKG_HASH:=1c511d09516af493694ed9baf13c55947a36389674d657a2d5e0ccedc6b291d8 +PKG_HASH:=c026f22cb931dd532f648f087d587f07a1843c6e66a3dfca4fb0ea21944ed33c HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 From d5943ffed8e18e94ff71f0f1842b5137b5b795ed Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 24 Jan 2023 23:23:56 +0100 Subject: [PATCH 048/104] CI: push-containers: limit to one concurrent run We may find in a situation where due the queue an old run finish after the last run, resulting in the containers getting overwritten with an old version. Limit the push-containers workflow to one concurrent run and cancel any run in progress. Signed-off-by: Christian Marangi --- .github/workflows/push-containers.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/push-containers.yml b/.github/workflows/push-containers.yml index 4045dfaa294..cc13cda5725 100644 --- a/.github/workflows/push-containers.yml +++ b/.github/workflows/push-containers.yml @@ -11,6 +11,10 @@ on: permissions: contents: read +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + jobs: build-linux-buildbot: name: Build tools with buildbot container From f0e4595188db797446f7b3d29a6162ede90586a6 Mon Sep 17 00:00:00 2001 From: Wenli Looi Date: Tue, 22 Nov 2022 18:26:34 +0000 Subject: [PATCH 049/104] build: add ALT3 and ALT4 vendor/model/variant This is needed for the Netgear EX7300 series v2. Signed-off-by: Wenli Looi --- include/image.mk | 40 +++++++++++++++++++++++++++++++++- scripts/json_add_image_info.py | 2 +- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/include/image.mk b/include/image.mk index 87ba60d9541..b801ef993c3 100644 --- a/include/image.mk +++ b/include/image.mk @@ -333,6 +333,8 @@ define Device/InitProfile DEVICE_ALT0_TITLE = $$(DEVICE_ALT0_VENDOR) $$(DEVICE_ALT0_MODEL)$$(if $$(DEVICE_ALT0_VARIANT), $$(DEVICE_ALT0_VARIANT)) DEVICE_ALT1_TITLE = $$(DEVICE_ALT1_VENDOR) $$(DEVICE_ALT1_MODEL)$$(if $$(DEVICE_ALT1_VARIANT), $$(DEVICE_ALT1_VARIANT)) DEVICE_ALT2_TITLE = $$(DEVICE_ALT2_VENDOR) $$(DEVICE_ALT2_MODEL)$$(if $$(DEVICE_ALT2_VARIANT), $$(DEVICE_ALT2_VARIANT)) + DEVICE_ALT3_TITLE = $$(DEVICE_ALT3_VENDOR) $$(DEVICE_ALT3_MODEL)$$(if $$(DEVICE_ALT3_VARIANT), $$(DEVICE_ALT3_VARIANT)) + DEVICE_ALT4_TITLE = $$(DEVICE_ALT4_VENDOR) $$(DEVICE_ALT4_MODEL)$$(if $$(DEVICE_ALT4_VARIANT), $$(DEVICE_ALT4_VARIANT)) DEVICE_VENDOR := DEVICE_MODEL := DEVICE_VARIANT := @@ -345,6 +347,12 @@ define Device/InitProfile DEVICE_ALT2_VENDOR := DEVICE_ALT2_MODEL := DEVICE_ALT2_VARIANT := + DEVICE_ALT3_VENDOR := + DEVICE_ALT3_MODEL := + DEVICE_ALT3_VARIANT := + DEVICE_ALT4_VENDOR := + DEVICE_ALT4_MODEL := + DEVICE_ALT4_VARIANT := DEVICE_PACKAGES := DEVICE_DESCRIPTION = Build firmware images for $$(DEVICE_TITLE) endef @@ -424,7 +432,9 @@ DEFAULT_DEVICE_VARS := \ DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \ DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \ DEVICE_ALT1_VENDOR DEVICE_ALT1_MODEL DEVICE_ALT1_VARIANT \ - DEVICE_ALT2_VENDOR DEVICE_ALT2_MODEL DEVICE_ALT2_VARIANT + DEVICE_ALT2_VENDOR DEVICE_ALT2_MODEL DEVICE_ALT2_VARIANT \ + DEVICE_ALT3_VENDOR DEVICE_ALT3_MODEL DEVICE_ALT3_VARIANT \ + DEVICE_ALT4_VENDOR DEVICE_ALT4_MODEL DEVICE_ALT4_VARIANT define Device/ExportVar $(1) : $(2):=$$($(2)) @@ -507,6 +517,12 @@ define Device/Build/initramfs DEVICE_ALT2_VENDOR="$$(DEVICE_ALT2_VENDOR)" \ DEVICE_ALT2_MODEL="$$(DEVICE_ALT2_MODEL)" \ DEVICE_ALT2_VARIANT="$$(DEVICE_ALT2_VARIANT)" \ + DEVICE_ALT3_VENDOR="$$(DEVICE_ALT3_VENDOR)" \ + DEVICE_ALT3_MODEL="$$(DEVICE_ALT3_MODEL)" \ + DEVICE_ALT3_VARIANT="$$(DEVICE_ALT3_VARIANT)" \ + DEVICE_ALT4_VENDOR="$$(DEVICE_ALT4_VENDOR)" \ + DEVICE_ALT4_MODEL="$$(DEVICE_ALT4_MODEL)" \ + DEVICE_ALT4_VARIANT="$$(DEVICE_ALT4_VARIANT)" \ DEVICE_TITLE="$$(DEVICE_TITLE)" \ DEVICE_PACKAGES="$$(DEVICE_PACKAGES)" \ TARGET="$(BOARD)" \ @@ -615,6 +631,12 @@ define Device/Build/image DEVICE_ALT2_VENDOR="$(DEVICE_ALT2_VENDOR)" \ DEVICE_ALT2_MODEL="$(DEVICE_ALT2_MODEL)" \ DEVICE_ALT2_VARIANT="$(DEVICE_ALT2_VARIANT)" \ + DEVICE_ALT3_VENDOR="$(DEVICE_ALT3_VENDOR)" \ + DEVICE_ALT3_MODEL="$(DEVICE_ALT3_MODEL)" \ + DEVICE_ALT3_VARIANT="$(DEVICE_ALT3_VARIANT)" \ + DEVICE_ALT4_VENDOR="$(DEVICE_ALT4_VENDOR)" \ + DEVICE_ALT4_MODEL="$(DEVICE_ALT4_MODEL)" \ + DEVICE_ALT4_VARIANT="$(DEVICE_ALT4_VARIANT)" \ DEVICE_TITLE="$(DEVICE_TITLE)" \ DEVICE_PACKAGES="$(DEVICE_PACKAGES)" \ TARGET="$(BOARD)" \ @@ -660,6 +682,12 @@ define Device/Build/artifact DEVICE_ALT2_VENDOR="$(DEVICE_ALT2_VENDOR)" \ DEVICE_ALT2_MODEL="$(DEVICE_ALT2_MODEL)" \ DEVICE_ALT2_VARIANT="$(DEVICE_ALT2_VARIANT)" \ + DEVICE_ALT3_VENDOR="$(DEVICE_ALT3_VENDOR)" \ + DEVICE_ALT3_MODEL="$(DEVICE_ALT3_MODEL)" \ + DEVICE_ALT3_VARIANT="$(DEVICE_ALT3_VARIANT)" \ + DEVICE_ALT4_VENDOR="$(DEVICE_ALT4_VENDOR)" \ + DEVICE_ALT4_MODEL="$(DEVICE_ALT4_MODEL)" \ + DEVICE_ALT4_VARIANT="$(DEVICE_ALT4_VARIANT)" \ DEVICE_TITLE="$(DEVICE_TITLE)" \ DEVICE_PACKAGES="$(DEVICE_PACKAGES)" \ TARGET="$(BOARD)" \ @@ -701,6 +729,8 @@ $(if $(strip $(DEVICE_ALT0_TITLE)),Alternative device titles: - $(DEVICE_ALT0_TITLE)) $(if $(strip $(DEVICE_ALT1_TITLE)),- $(DEVICE_ALT1_TITLE)) $(if $(strip $(DEVICE_ALT2_TITLE)),- $(DEVICE_ALT2_TITLE)) +$(if $(strip $(DEVICE_ALT3_TITLE)),- $(DEVICE_ALT3_TITLE)) +$(if $(strip $(DEVICE_ALT4_TITLE)),- $(DEVICE_ALT4_TITLE)) @@ endef @@ -718,6 +748,14 @@ ifneq ($$(strip $$(DEVICE_ALT2_TITLE)),) DEVICE_DISPLAY = $$(DEVICE_ALT2_TITLE) ($$(DEVICE_TITLE)) $$(info $$(call Device/DumpInfo,$(1))) endif +ifneq ($$(strip $$(DEVICE_ALT3_TITLE)),) +DEVICE_DISPLAY = $$(DEVICE_ALT3_TITLE) ($$(DEVICE_TITLE)) +$$(info $$(call Device/DumpInfo,$(1))) +endif +ifneq ($$(strip $$(DEVICE_ALT4_TITLE)),) +DEVICE_DISPLAY = $$(DEVICE_ALT4_TITLE) ($$(DEVICE_TITLE)) +$$(info $$(call Device/DumpInfo,$(1))) +endif DEVICE_DISPLAY = $$(DEVICE_TITLE) $$(eval $$(if $$(DEVICE_TITLE),$$(info $$(call Device/DumpInfo,$(1))))) endef diff --git a/scripts/json_add_image_info.py b/scripts/json_add_image_info.py index 9aa2a19e45d..0c441b93344 100755 --- a/scripts/json_add_image_info.py +++ b/scripts/json_add_image_info.py @@ -21,7 +21,7 @@ if not file_path.is_file(): def get_titles(): titles = [] - for prefix in ["", "ALT0_", "ALT1_", "ALT2_"]: + for prefix in ["", "ALT0_", "ALT1_", "ALT2_", "ALT3_", "ALT4_"]: title = {} for var in ["vendor", "model", "variant"]: if getenv("DEVICE_{}{}".format(prefix, var.upper())): From f0eb73a888e2ed980b0943d4a2e4d19ad0af183a Mon Sep 17 00:00:00 2001 From: Wenli Looi Date: Tue, 22 Nov 2022 18:34:37 +0000 Subject: [PATCH 050/104] ath79: consolidate Netgear EX7300 series images This change consolidates Netgear EX7300 series devices into two images corresponding to devices that share the same manufacturer firmware image. Similar to the manufacturer firmware, the actual device model is detected at runtime. The logic is taken from the netgear GPL dumps in a file called generate_board_conf.sh. Hardware details for EX7300 v2 variants --------------------------------------- SoC: QCN5502 Flash: 16 MiB RAM: 128 MiB Ethernet: 1 gigabit port Wireless 2.4GHz (currently unsupported due to lack of ath9k support): - EX6250 / EX6400 v2 / EX6410 / EX6420: QCN5502 3x3 - EX7300 v2 / EX7320: QCN5502 4x4 Wireless 5GHz: - EX6250: QCA9986 3x3 (detected by ath10k as QCA9984 3x3) - EX6400 v2 / EX6410 / EX6420 / EX7300 v2 / EX7320: QCA9984 4x4 Signed-off-by: Wenli Looi --- package/boot/uboot-envtools/files/ath79 | 1 - .../ath79/dts/qca9558_netgear_ex6400.dts | 8 - .../ath79/dts/qca9558_netgear_ex7300.dts | 221 ++++++++++++++++- .../ath79/dts/qca9558_netgear_ex7300.dtsi | 224 ------------------ .../generic/base-files/etc/board.d/02_network | 1 - .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 - .../base-files/lib/preinit/02_sysinfo_fixup | 42 ++++ target/linux/ath79/image/generic.mk | 36 +-- 8 files changed, 282 insertions(+), 252 deletions(-) delete mode 100644 target/linux/ath79/dts/qca9558_netgear_ex6400.dts delete mode 100644 target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi create mode 100644 target/linux/ath79/generic/base-files/lib/preinit/02_sysinfo_fixup diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index cd94be66de2..71dd104f55f 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -42,7 +42,6 @@ etactica,eg200|\ glinet,gl-ar750s-nor|\ glinet,gl-ar750s-nor-nand|\ librerouter,librerouter-v1|\ -netgear,ex6400|\ netgear,ex7300|\ netgear,ex7300-v2|\ netgear,wndr4300-v2|\ diff --git a/target/linux/ath79/dts/qca9558_netgear_ex6400.dts b/target/linux/ath79/dts/qca9558_netgear_ex6400.dts deleted file mode 100644 index 273c872b6d2..00000000000 --- a/target/linux/ath79/dts/qca9558_netgear_ex6400.dts +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "qca9558_netgear_ex7300.dtsi" - -/ { - model = "Netgear EX6400"; - compatible = "netgear,ex6400", "qca,qca9558"; -}; diff --git a/target/linux/ath79/dts/qca9558_netgear_ex7300.dts b/target/linux/ath79/dts/qca9558_netgear_ex7300.dts index 9802210b32c..fc0b6de96ce 100644 --- a/target/linux/ath79/dts/qca9558_netgear_ex7300.dts +++ b/target/linux/ath79/dts/qca9558_netgear_ex7300.dts @@ -1,8 +1,227 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "qca9558_netgear_ex7300.dtsi" +#include "qca955x.dtsi" + +#include +#include / { model = "Netgear EX7300"; compatible = "netgear,ex7300", "qca,qca9558"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_amber; + led-running = &led_power_green; + led-upgrade = &led_power_amber; + label-mac-device = ð0; + }; + + led_spi { + compatible = "spi-gpio"; + #address-cells = <1>; + #size-cells = <0>; + + sck-gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; + mosi-gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + num-chipselects = <0>; + + led_gpio: led_gpio@0 { + compatible = "nxp,74lvc594"; + reg = <0>; + gpio-controller; + #gpio-cells = <2>; + registers-number = <1>; + spi-max-frequency = <500000>; + + gpio_latch_bit { + gpio-hog; + gpios = <4 GPIO_ACTIVE_HIGH>; + output-high; + line-name = "gpio-latch-bit"; + }; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power_green: power_green { + label = "green:power"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + }; + + led_power_amber: power_amber { + label = "amber:power"; + gpios = <&gpio 20 GPIO_ACTIVE_LOW>; + }; + + left_blue { + label = "blue:left"; + gpios = <&led_gpio 7 GPIO_ACTIVE_LOW>; + }; + + right_blue { + label = "blue:right"; + gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>; + }; + + wps_green { + label = "green:wps"; + gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>; + }; + + client_red { + label = "red:client"; + gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>; + }; + + client_green { + label = "green:client"; + gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>; + }; + + router_red { + label = "red:router"; + gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>; + }; + + router_green { + label = "green:router"; + gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + wps { + label = "WPS button"; + linux,code = ; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + extender_apmode { + label = "EXTENDER/APMODE switch"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + debounce-interval = <60>; + }; + }; +}; + +&pcie0 { + status = "okay"; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + uboot: partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x010000>; + }; + + caldata: partition@50000 { + label = "caldata"; + reg = <0x050000 0x010000>; + read-only; + }; + + partition@60000 { + label = "caldata-backup"; + reg = <0x060000 0x010000>; + read-only; + }; + + partition@70000 { + label = "config"; + reg = <0x070000 0x010000>; + }; + + partition@80000 { + label = "pot"; + reg = <0x080000 0x010000>; + }; + + partition@90000 { + label = "firmware"; + reg = <0x090000 0xf30000>; + compatible = "denx,uimage"; + }; + + partition@fc0000 { + label = "language"; + reg = <0xfc0000 0x040000>; + }; + }; + }; +}; + +&wmac { + status = "okay"; + + mtd-cal-data = <&caldata 0x1000>; + nvmem-cells = <&macaddr_caldata_6>; + nvmem-cell-names = "mac-address"; +}; + +&mdio0 { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; +}; + +ð0 { + status = "okay"; + + nvmem-cells = <&macaddr_caldata_0>; + nvmem-cell-names = "mac-address"; + + phy-handle = <&phy4>; + phy-mode = "rgmii-rxid"; + + pll-data = <0x86000000 0x80000101 0x80001313>; +}; + +&caldata { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_caldata_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_caldata_6: macaddr@6 { + reg = <0x6 0x6>; + }; }; diff --git a/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi b/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi deleted file mode 100644 index c266c52dad8..00000000000 --- a/target/linux/ath79/dts/qca9558_netgear_ex7300.dtsi +++ /dev/null @@ -1,224 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "qca955x.dtsi" - -#include -#include - -/ { - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_amber; - led-running = &led_power_green; - led-upgrade = &led_power_amber; - label-mac-device = ð0; - }; - - led_spi { - compatible = "spi-gpio"; - #address-cells = <1>; - #size-cells = <0>; - - sck-gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; - mosi-gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; - num-chipselects = <0>; - - led_gpio: led_gpio@0 { - compatible = "nxp,74lvc594"; - reg = <0>; - gpio-controller; - #gpio-cells = <2>; - registers-number = <1>; - spi-max-frequency = <500000>; - - gpio_latch_bit { - gpio-hog; - gpios = <4 GPIO_ACTIVE_HIGH>; - output-high; - line-name = "gpio-latch-bit"; - }; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_power_green: power_green { - label = "green:power"; - gpios = <&gpio 19 GPIO_ACTIVE_LOW>; - }; - - led_power_amber: power_amber { - label = "amber:power"; - gpios = <&gpio 20 GPIO_ACTIVE_LOW>; - }; - - left_blue { - label = "blue:left"; - gpios = <&led_gpio 7 GPIO_ACTIVE_LOW>; - }; - - right_blue { - label = "blue:right"; - gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>; - }; - - wps_green { - label = "green:wps"; - gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>; - }; - - client_red { - label = "red:client"; - gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>; - }; - - client_green { - label = "green:client"; - gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>; - }; - - router_red { - label = "red:router"; - gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>; - }; - - router_green { - label = "green:router"; - gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "Reset button"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - wps { - label = "WPS button"; - linux,code = ; - gpios = <&gpio 22 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - - extender_apmode { - label = "EXTENDER/APMODE switch"; - gpios = <&gpio 23 GPIO_ACTIVE_LOW>; - linux,code = ; - linux,input-type = ; - debounce-interval = <60>; - }; - }; -}; - -&pcie0 { - status = "okay"; -}; - -&spi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <25000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - uboot: partition@0 { - label = "u-boot"; - reg = <0x000000 0x040000>; - read-only; - }; - - partition@40000 { - label = "u-boot-env"; - reg = <0x040000 0x010000>; - }; - - caldata: partition@50000 { - label = "caldata"; - reg = <0x050000 0x010000>; - read-only; - }; - - partition@60000 { - label = "caldata-backup"; - reg = <0x060000 0x010000>; - read-only; - }; - - partition@70000 { - label = "config"; - reg = <0x070000 0x010000>; - }; - - partition@80000 { - label = "pot"; - reg = <0x080000 0x010000>; - }; - - partition@90000 { - label = "firmware"; - reg = <0x090000 0xf30000>; - compatible = "denx,uimage"; - }; - - partition@fc0000 { - label = "language"; - reg = <0xfc0000 0x040000>; - }; - }; - }; -}; - -&wmac { - status = "okay"; - - mtd-cal-data = <&caldata 0x1000>; - nvmem-cells = <&macaddr_caldata_6>; - nvmem-cell-names = "mac-address"; -}; - -&mdio0 { - status = "okay"; - - phy4: ethernet-phy@4 { - reg = <4>; - phy-mode = "rgmii"; - }; -}; - -ð0 { - status = "okay"; - - nvmem-cells = <&macaddr_caldata_0>; - nvmem-cell-names = "mac-address"; - - phy-handle = <&phy4>; - phy-mode = "rgmii-rxid"; - - pll-data = <0x86000000 0x80000101 0x80001313>; -}; - -&caldata { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_caldata_0: macaddr@0 { - reg = <0x0 0x6>; - }; - - macaddr_caldata_6: macaddr@6 { - reg = <0x6 0x6>; - }; -}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 8b0fba7c69f..20352095a4c 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -50,7 +50,6 @@ ath79_setup_interfaces() glinet,gl-usb150|\ hak5,wifi-pineapple-nano|\ meraki,mr16|\ - netgear,ex6400|\ netgear,ex7300|\ netgear,ex7300-v2|\ netgear,wndap360|\ diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 74e6738162f..b4a2209fdf0 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -216,7 +216,6 @@ case "$FIRMWARE" in ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin ;; - netgear,ex6400|\ netgear,ex7300) caldata_extract "caldata" 0x5000 0x2f20 ath10k_patch_mac $(mtd_get_mac_binary caldata 0xc) diff --git a/target/linux/ath79/generic/base-files/lib/preinit/02_sysinfo_fixup b/target/linux/ath79/generic/base-files/lib/preinit/02_sysinfo_fixup new file mode 100644 index 00000000000..e01469f0d99 --- /dev/null +++ b/target/linux/ath79/generic/base-files/lib/preinit/02_sysinfo_fixup @@ -0,0 +1,42 @@ +. /lib/functions.sh + +do_sysinfo_ath79_fixup() { + local model="" + + case $(board_name) in + netgear,ex7300) + local part=$(find_mtd_part caldata) + local board_hw_id=$(dd if=$part bs=1 skip=67 count=10 2>/dev/null) + case "$board_hw_id" in + 5508013406) + model="Netgear EX6400" + ;; + 5508013271) + model="Netgear EX7300" + ;; + esac + ;; + netgear,ex7300-v2) + local part=$(find_mtd_part artmtd) + local antenna_cfg=$(dd if=$part bs=1 skip=59 count=7 2>/dev/null) + local board_hw_id=$(dd if=$part bs=1 skip=67 count=6 2>/dev/null) + case "$antenna_cfg" in + 3X3+3X3) + model="Netgear EX6250" + ;; + 3X3+4X4) + # EX6400 v2, EX6410, EX6420 + model="Netgear ${board_hw_id:-EX6400 v2}" + ;; + 4X4+4X4) + # EX7300 v2, EX7320 + model="Netgear ${board_hw_id:-EX7300 v2}" + ;; + esac + ;; + esac + + [ -n "$model" ] && echo "$model" > /tmp/sysinfo/model +} + +boot_hook_add preinit_main do_sysinfo_ath79_fixup diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index ec7cbb950ae..7712247d39f 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1732,41 +1732,45 @@ define Device/nec_wg800hp endef TARGET_DEVICES += nec_wg800hp -define Device/netgear_ex6400_ex7300 - $(Device/netgear_generic) +define Device/netgear_ex7300 SOC := qca9558 - UIMAGE_MAGIC := 0x27051956 + DEVICE_VENDOR := NETGEAR + DEVICE_MODEL := EX7300 + DEVICE_ALT0_VENDOR := NETGEAR + DEVICE_ALT0_MODEL := EX6400 NETGEAR_BOARD_ID := EX7300series NETGEAR_HW_ID := 29765104+16+0+128 IMAGE_SIZE := 15552k + IMAGES += factory.img IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \ netgear-rootfs | pad-rootfs IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | check-size DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca99x0-ct -endef - -define Device/netgear_ex6400 - $(Device/netgear_ex6400_ex7300) - DEVICE_MODEL := EX6400 -endef -TARGET_DEVICES += netgear_ex6400 - -define Device/netgear_ex7300 - $(Device/netgear_ex6400_ex7300) - DEVICE_MODEL := EX7300 + SUPPORTED_DEVICES += netgear,ex6400 endef TARGET_DEVICES += netgear_ex7300 define Device/netgear_ex7300-v2 - $(Device/netgear_generic) SOC := qcn5502 + DEVICE_VENDOR := NETGEAR DEVICE_MODEL := EX7300 DEVICE_VARIANT := v2 - UIMAGE_MAGIC := 0x27051956 + DEVICE_ALT0_VENDOR := NETGEAR + DEVICE_ALT0_MODEL := EX6250 + DEVICE_ALT1_VENDOR := NETGEAR + DEVICE_ALT1_MODEL := EX6400 + DEVICE_ALT1_VARIANT := v2 + DEVICE_ALT2_VENDOR := NETGEAR + DEVICE_ALT2_MODEL := EX6410 + DEVICE_ALT3_VENDOR := NETGEAR + DEVICE_ALT3_MODEL := EX6420 + DEVICE_ALT4_VENDOR := NETGEAR + DEVICE_ALT4_MODEL := EX7320 NETGEAR_BOARD_ID := EX7300v2series NETGEAR_HW_ID := 29765907+16+0+128 IMAGE_SIZE := 14528k + IMAGES += factory.img IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \ netgear-rootfs | pad-rootfs IMAGE/sysupgrade.bin := $$(IMAGE/default) | check-size | append-metadata From 7396263680b951211f33f2aa266b11bdd0047adc Mon Sep 17 00:00:00 2001 From: Wenli Looi Date: Mon, 23 Jan 2023 18:37:07 +0000 Subject: [PATCH 051/104] ath79: convert Netgear EX7300 caldata to nvmem Transition to specify caldata in the DTS. Signed-off-by: Wenli Looi --- .../ath79/dts/qca9558_netgear_ex7300.dts | 25 ++++++++++++++++--- .../etc/hotplug.d/firmware/11-ath10k-caldata | 4 --- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/target/linux/ath79/dts/qca9558_netgear_ex7300.dts b/target/linux/ath79/dts/qca9558_netgear_ex7300.dts index fc0b6de96ce..b94ccd30b7d 100644 --- a/target/linux/ath79/dts/qca9558_netgear_ex7300.dts +++ b/target/linux/ath79/dts/qca9558_netgear_ex7300.dts @@ -121,6 +121,14 @@ &pcie0 { status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0 0 0 0 0>; + + nvmem-cells = <&macaddr_caldata_c>, <&precal_caldata_5000>; + nvmem-cell-names = "mac-address", "pre-calibration"; + }; }; &spi { @@ -186,9 +194,8 @@ &wmac { status = "okay"; - mtd-cal-data = <&caldata 0x1000>; - nvmem-cells = <&macaddr_caldata_6>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_caldata_6>, <&cal_caldata_1000>; + nvmem-cell-names = "mac-address", "calibration"; }; &mdio0 { @@ -224,4 +231,16 @@ macaddr_caldata_6: macaddr@6 { reg = <0x6 0x6>; }; + + macaddr_caldata_c: macaddr@c { + reg = <0xc 0x6>; + }; + + cal_caldata_1000: cal@1000 { + reg = <0x1000 0x440>; + }; + + precal_caldata_5000: precal@5000 { + reg = <0x5000 0x2f20>; + }; }; diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index b4a2209fdf0..b0b91f1c8ab 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -216,10 +216,6 @@ case "$FIRMWARE" in ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin ;; - netgear,ex7300) - caldata_extract "caldata" 0x5000 0x2f20 - ath10k_patch_mac $(mtd_get_mac_binary caldata 0xc) - ;; phicomm,k2t) caldata_extract "art" 0x5000 0x2f20 ath10k_patch_mac $(k2t_get_mac "5g_mac") From 8f47b87b0cc8178f73d280c98e571fe9f0ddfee8 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Wed, 25 Jan 2023 22:18:42 +0100 Subject: [PATCH 052/104] realtek: rtl931x: drop LINKER_LOAD_ADDRESS bypass RTL931x kernel builds were patched to bypass the LINKER_LOAD_ADDRESS parameter, and hardcode it to 0x80220000. This doesn't make much sense, since value of LINKER_LOAD_ADDRESS, load-ld, only appears to be a copy of load-y, adjusted to the linker's taste. Dropping the hacks for bypassing LINKER_LOAD_ADDRESS results in a kernel that actually starts booting on an RTL9313 (Netgear MS510TXM), but currently still hangs when the kernel switches timers. Signed-off-by: Sander Vanheule --- .../patches-5.10/312-rt9313-support.patch | 59 ------------------- .../patches-5.15/312-rt9313-support.patch | 59 ------------------- 2 files changed, 118 deletions(-) delete mode 100644 target/linux/realtek/patches-5.10/312-rt9313-support.patch delete mode 100644 target/linux/realtek/patches-5.15/312-rt9313-support.patch diff --git a/target/linux/realtek/patches-5.10/312-rt9313-support.patch b/target/linux/realtek/patches-5.10/312-rt9313-support.patch deleted file mode 100644 index 7626cc9c25c..00000000000 --- a/target/linux/realtek/patches-5.10/312-rt9313-support.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0b8dfe085180b58b81d2657c76b080168e3bc8df Mon Sep 17 00:00:00 2001 -From: Birger Koblitz -Date: Wed, 19 Jan 2022 18:14:02 +0100 -Subject: [PATCH] realtek: Add RTL931X sub-target - -We add the RTL931X sub-target with kernel configuration for -a dual core MIPS InterAptive CPU. - -Submitted-by: Sebastian Gottschall -Submitted-by: Birger Koblitz ---- - arch/mips/Makefile | 10 +++++++++++++-- - arch/mips/kernel/head.S | 4 ++++ - aarch/mips/kernel/vmlinux.lds.S | 4 ++++ - 3 files changed, 18 insertions(+), 2 deletions(-) - ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -307,14 +307,24 @@ endif - - KBUILD_AFLAGS += $(cflags-y) - KBUILD_CFLAGS += $(cflags-y) -+ifdef CONFIG_931X -+KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) -+bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \ -+ VMLINUX_ENTRY_ADDRESS=$(entry-y) \ -+ PLATFORM="$(platform-y)" \ -+ ITS_INPUTS="$(its-y)" -+else - KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) -DLINKER_LOAD_ADDRESS=$(load-ld) --KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0) -- - bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \ - LINKER_LOAD_ADDRESS=$(load-ld) \ - VMLINUX_ENTRY_ADDRESS=$(entry-y) \ - PLATFORM="$(platform-y)" \ - ITS_INPUTS="$(its-y)" -+endif -+KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0) -+ -+ -+ - ifdef CONFIG_32BIT - bootvars-y += ADDR_BITS=32 - endif ---- a/arch/mips/kernel/vmlinux.lds.S -+++ b/arch/mips/kernel/vmlinux.lds.S -@@ -55,7 +55,11 @@ SECTIONS - /* . = 0xa800000000300000; */ - . = 0xffffffff80300000; - #endif -+#ifdef CONFIG_RTL931X -+ . = 0x80220000; -+#else - . = LINKER_LOAD_ADDRESS; -+#endif - /* read-only */ - _text = .; /* Text and read-only data */ - .text : { diff --git a/target/linux/realtek/patches-5.15/312-rt9313-support.patch b/target/linux/realtek/patches-5.15/312-rt9313-support.patch deleted file mode 100644 index e8edc996f3d..00000000000 --- a/target/linux/realtek/patches-5.15/312-rt9313-support.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0b8dfe085180b58b81d2657c76b080168e3bc8df Mon Sep 17 00:00:00 2001 -From: Birger Koblitz -Date: Wed, 19 Jan 2022 18:14:02 +0100 -Subject: [PATCH] realtek: Add RTL931X sub-target - -We add the RTL931X sub-target with kernel configuration for -a dual core MIPS InterAptive CPU. - -Submitted-by: Sebastian Gottschall -Submitted-by: Birger Koblitz ---- - arch/mips/Makefile | 10 +++++++++++++-- - arch/mips/kernel/head.S | 4 ++++ - aarch/mips/kernel/vmlinux.lds.S | 4 ++++ - 3 files changed, 18 insertions(+), 2 deletions(-) - ---- a/arch/mips/Makefile -+++ b/arch/mips/Makefile -@@ -310,14 +310,24 @@ endif - - KBUILD_AFLAGS += $(cflags-y) - KBUILD_CFLAGS += $(cflags-y) -+ifdef CONFIG_931X -+KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) -+bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \ -+ VMLINUX_ENTRY_ADDRESS=$(entry-y) \ -+ PLATFORM="$(platform-y)" \ -+ ITS_INPUTS="$(its-y)" -+else - KBUILD_CPPFLAGS += -DVMLINUX_LOAD_ADDRESS=$(load-y) -DLINKER_LOAD_ADDRESS=$(load-ld) --KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0) -- - bootvars-y = VMLINUX_LOAD_ADDRESS=$(load-y) \ - LINKER_LOAD_ADDRESS=$(load-ld) \ - VMLINUX_ENTRY_ADDRESS=$(entry-y) \ - PLATFORM="$(platform-y)" \ - ITS_INPUTS="$(its-y)" -+endif -+KBUILD_CPPFLAGS += -DDATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0) -+ -+ -+ - ifdef CONFIG_32BIT - bootvars-y += ADDR_BITS=32 - endif ---- a/arch/mips/kernel/vmlinux.lds.S -+++ b/arch/mips/kernel/vmlinux.lds.S -@@ -55,7 +55,11 @@ SECTIONS - /* . = 0xa800000000300000; */ - . = 0xffffffff80300000; - #endif -+#ifdef CONFIG_RTL931X -+ . = 0x80220000; -+#else - . = LINKER_LOAD_ADDRESS; -+#endif - /* read-only */ - _text = .; /* Text and read-only data */ - .text : { From 4e9365a654fe33c1c140253de752bdea67d83d03 Mon Sep 17 00:00:00 2001 From: John Audia Date: Tue, 24 Jan 2023 07:43:03 -0500 Subject: [PATCH 053/104] kernel: bump 5.15 to 5.15.90 All patches automatically rebased. Build system: x86_64 Build-tested: bcm2711/RPi4B, filogic/xiaomi_redmi-router-ax6000-ubootmod Run-tested: bcm2711/RPi4B, filogic/xiaomi_redmi-router-ax6000-ubootmod Signed-off-by: John Audia --- include/kernel-5.15 | 4 ++-- .../patches-5.15/950-0064-Add-dwc_otg-driver.patch | 2 +- ...-plumbing-for-updating-interrupt-endpoint-int.patch | 2 +- ...plement-xhci_fixup_endpoint-for-interval-adju.patch | 2 +- ...0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch | 4 ++-- ...factor-out-TRBS_PER_SEGMENT-define-in-runtime.patch | 4 ++-- ...950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch | 4 ++-- ...i-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch | 10 +++++----- ...sb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch | 6 +++--- ...xhci-add-support-for-performing-fake-doorbell.patch | 2 +- .../hack-5.15/780-usb-net-MeigLink_modem_support.patch | 2 +- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/kernel-5.15 b/include/kernel-5.15 index 82d1c5a7bcd..ab1500f4b29 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .89 -LINUX_KERNEL_HASH-5.15.89 = e7311b874e014bb6d37c051319bd6a4a4e3d05a1c32546522deabbfd2d752fe8 +LINUX_VERSION-5.15 = .90 +LINUX_KERNEL_HASH-5.15.90 = e6fd430022686753af7516fe7544f96aab379509dc5b7829017bdcd92b393b42 diff --git a/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch b/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch index e3ac41496b0..33ff798471f 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0064-Add-dwc_otg-driver.patch @@ -1123,7 +1123,7 @@ Signed-off-by: Jonathan Bell } --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5582,7 +5582,7 @@ static void port_event(struct usb_hub *h +@@ -5585,7 +5585,7 @@ static void port_event(struct usb_hub *h port_dev->over_current_count++; port_over_current_notify(port_dev); diff --git a/target/linux/bcm27xx/patches-5.15/950-0151-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch b/target/linux/bcm27xx/patches-5.15/950-0151-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch index 12ddf91426f..857221d8b53 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0151-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0151-usb-add-plumbing-for-updating-interrupt-endpoint-int.patch @@ -70,7 +70,7 @@ Signed-off-by: Jonathan Bell * @dev: the device whose endpoint is being disabled --- a/include/linux/usb.h +++ b/include/linux/usb.h -@@ -1842,6 +1842,8 @@ extern int usb_clear_halt(struct usb_dev +@@ -1845,6 +1845,8 @@ extern int usb_clear_halt(struct usb_dev extern int usb_reset_configuration(struct usb_device *dev); extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate); extern void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr); diff --git a/target/linux/bcm27xx/patches-5.15/950-0152-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch b/target/linux/bcm27xx/patches-5.15/950-0152-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch index aa12dae1fcf..bedeb042277 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0152-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0152-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch @@ -125,7 +125,7 @@ Signed-off-by: Jonathan Bell * non-error returns are a promise to giveback() the urb later * we drop ownership so next owner (or urb unlink) can get it */ -@@ -5443,6 +5546,7 @@ static const struct hc_driver xhci_hc_dr +@@ -5457,6 +5560,7 @@ static const struct hc_driver xhci_hc_dr .endpoint_reset = xhci_endpoint_reset, .check_bandwidth = xhci_check_bandwidth, .reset_bandwidth = xhci_reset_bandwidth, diff --git a/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch b/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch index 10820c6708a..3ef184fd786 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0600-xhci-quirks-add-link-TRB-quirk-for-VL805.patch @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -293,6 +293,7 @@ static void xhci_pci_quirks(struct devic +@@ -296,6 +296,7 @@ static void xhci_pci_quirks(struct devic if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) { xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; @@ -50,7 +50,7 @@ Signed-off-by: Jonathan Bell addr = xhci_trb_virt_to_dma(new_seg, new_deq); --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1905,6 +1905,7 @@ struct xhci_hcd { +@@ -1906,6 +1906,7 @@ struct xhci_hcd { #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) #define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) diff --git a/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch b/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch index 40632ecf134..7c1c96fa921 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0605-xhci-refactor-out-TRBS_PER_SEGMENT-define-in-runtime.patch @@ -205,7 +205,7 @@ Signed-off-by: Jonathan Bell xhci_err(xhci, "Tried to move enqueue past ring segment\n"); return; } -@@ -3159,7 +3162,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd +@@ -3162,7 +3165,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd * that clears the EHB. */ while (xhci_handle_event(xhci) > 0) { @@ -214,7 +214,7 @@ Signed-off-by: Jonathan Bell continue; xhci_update_erst_dequeue(xhci, event_ring_deq); event_ring_deq = xhci->event_ring->dequeue; -@@ -3301,7 +3304,8 @@ static int prepare_ring(struct xhci_hcd +@@ -3304,7 +3307,8 @@ static int prepare_ring(struct xhci_hcd } } diff --git a/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch b/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch index f3bb6384c65..b27f505e329 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0606-usb-xhci-add-VLI_TRB_CACHE_BUG-quirk.patch @@ -53,7 +53,7 @@ Signed-off-by: Jonathan Bell cycle_state, type, max_packet, flags); --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -294,6 +294,7 @@ static void xhci_pci_quirks(struct devic +@@ -297,6 +297,7 @@ static void xhci_pci_quirks(struct devic xhci->quirks |= XHCI_LPM_SUPPORT; xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; @@ -63,7 +63,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1907,6 +1907,7 @@ struct xhci_hcd { +@@ -1908,6 +1908,7 @@ struct xhci_hcd { #define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(45) diff --git a/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch b/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch index aa54439b325..ef95a78b3e4 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0717-usb-xhci-add-a-quirk-for-Superspeed-bulk-OUT-transfe.patch @@ -26,7 +26,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c -@@ -295,6 +295,7 @@ static void xhci_pci_quirks(struct devic +@@ -298,6 +298,7 @@ static void xhci_pci_quirks(struct devic xhci->quirks |= XHCI_EP_CTX_BROKEN_DCS; xhci->quirks |= XHCI_AVOID_DQ_ON_LINK; xhci->quirks |= XHCI_VLI_TRB_CACHE_BUG; @@ -36,7 +36,7 @@ Signed-off-by: Jonathan Bell if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3614,14 +3614,15 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3617,14 +3617,15 @@ int xhci_queue_bulk_tx(struct xhci_hcd * unsigned int num_trbs; unsigned int start_cycle, num_sgs = 0; unsigned int enqd_len, block_len, trb_buff_len, full_len; @@ -54,7 +54,7 @@ Signed-off-by: Jonathan Bell full_len = urb->transfer_buffer_length; /* If we have scatter/gather list, we use it. */ if (urb->num_sgs && !(urb->transfer_flags & URB_DMA_MAP_SINGLE)) { -@@ -3658,6 +3659,17 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3661,6 +3662,17 @@ int xhci_queue_bulk_tx(struct xhci_hcd * start_cycle = ring->cycle_state; send_addr = addr; @@ -72,7 +72,7 @@ Signed-off-by: Jonathan Bell /* Queue the TRBs, even if they are zero-length */ for (enqd_len = 0; first_trb || enqd_len < full_len; enqd_len += trb_buff_len) { -@@ -3670,6 +3682,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3673,6 +3685,11 @@ int xhci_queue_bulk_tx(struct xhci_hcd * if (enqd_len + trb_buff_len > full_len) trb_buff_len = full_len - enqd_len; @@ -86,7 +86,7 @@ Signed-off-by: Jonathan Bell first_trb = false; --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1908,6 +1908,7 @@ struct xhci_hcd { +@@ -1909,6 +1909,7 @@ struct xhci_hcd { #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) #define XHCI_AVOID_DQ_ON_LINK BIT_ULL(45) #define XHCI_VLI_TRB_CACHE_BUG BIT_ULL(46) diff --git a/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch b/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch index 313a664f591..49638b3a057 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0747-usb-xhci-rework-XHCI_VLI_SS_BULK_OUT_BUG-quirk.patch @@ -13,7 +13,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c -@@ -3614,7 +3614,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3617,7 +3617,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * unsigned int num_trbs; unsigned int start_cycle, num_sgs = 0; unsigned int enqd_len, block_len, trb_buff_len, full_len; @@ -22,7 +22,7 @@ Signed-off-by: Jonathan Bell u32 field, length_field, remainder, maxpacket; u64 addr, send_addr; -@@ -3660,14 +3660,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3663,14 +3663,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd * send_addr = addr; if (xhci->quirks & XHCI_VLI_SS_BULK_OUT_BUG && @@ -40,7 +40,7 @@ Signed-off-by: Jonathan Bell } /* Queue the TRBs, even if they are zero-length */ -@@ -3682,7 +3677,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * +@@ -3685,7 +3680,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd * if (enqd_len + trb_buff_len > full_len) trb_buff_len = full_len - enqd_len; diff --git a/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index 69d70aefaf0..81a9f0c0cbc 100644 --- a/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -127,7 +127,7 @@ it on BCM4708 family. /* --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1905,6 +1905,7 @@ struct xhci_hcd { +@@ -1906,6 +1906,7 @@ struct xhci_hcd { #define XHCI_EP_CTX_BROKEN_DCS BIT_ULL(42) #define XHCI_SUSPEND_RESUME_CLKS BIT_ULL(43) #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) diff --git a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch index 60c5f6b7625..e901deb8abd 100644 --- a/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch +++ b/target/linux/generic/hack-5.15/780-usb-net-MeigLink_modem_support.patch @@ -29,7 +29,7 @@ Subject: [PATCH] net/usb/qmi_wwan: add MeigLink modem support #define QUECTEL_VENDOR_ID 0x2c7c /* These Quectel products use Quectel's vendor ID */ -@@ -1156,6 +1158,11 @@ static const struct usb_device_id option +@@ -1162,6 +1164,11 @@ static const struct usb_device_id option .driver_info = ZLP }, { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), .driver_info = RSVD(4) }, From d68a73a025648cebbf68862090471d865b2a6605 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 25 Jan 2023 00:22:01 +0100 Subject: [PATCH 054/104] tcpdump: update to 4.99.3 Changes: https://git.tcpdump.org/tcpdump/blob/032e4923e5202ea4d5a6d1cead83ed1927135874:/CHANGES Signed-off-by: Nick Hainke --- package/network/utils/tcpdump/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/network/utils/tcpdump/Makefile b/package/network/utils/tcpdump/Makefile index 5019e0b3b67..827a66e8604 100644 --- a/package/network/utils/tcpdump/Makefile +++ b/package/network/utils/tcpdump/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=tcpdump -PKG_VERSION:=4.99.2 +PKG_VERSION:=4.99.3 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.tcpdump.org/release/ -PKG_HASH:=f4304357d34b79d46f4e17e654f1f91f9ce4e3d5608a1badbd53295a26fb44d5 +PKG_HASH:=ad75a6ed3dc0d9732945b2e5483cb41dc8b4b528a169315e499c6861952e73b3 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause From 340d3d84dc545429b028d3250ddd084b3d084367 Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Mon, 23 Jan 2023 20:15:36 +0800 Subject: [PATCH 055/104] firmware: intel-microcode: update to 20221108 Changelog: * New Microcodes: sig 0x000606c1, pf_mask 0x10, 2022-08-07, rev 0x1000201, size 286720 sig 0x000b0671, pf_mask 0x32, 2022-09-07, rev 0x010e, size 204800 * Updated Microcodes: sig 0x000706e5, pf_mask 0x80, 2022-08-02, rev 0x00b6, size 113664 sig 0x000806c1, pf_mask 0x80, 2022-06-28, rev 0x00a6, size 110592 sig 0x000806d1, pf_mask 0xc2, 2022-06-28, rev 0x0042, size 102400 sig 0x000806ec, pf_mask 0x94, 2022-07-31, rev 0x00f4, size 105472 sig 0x00090661, pf_mask 0x01, 2022-07-15, rev 0x0017, size 20480 sig 0x00090672, pf_mask 0x07, 2022-09-19, rev 0x0026, size 218112 sig 0x00090675, pf_mask 0x07, 2022-09-19, rev 0x0026 sig 0x000b06f2, pf_mask 0x07, 2022-09-19, rev 0x0026 sig 0x000b06f5, pf_mask 0x07, 2022-09-19, rev 0x0026 sig 0x000906a3, pf_mask 0x80, 2022-09-19, rev 0x0424, size 217088 sig 0x000906a4, pf_mask 0x80, 2022-09-19, rev 0x0424 sig 0x000906ed, pf_mask 0x22, 2022-07-31, rev 0x00f4, size 104448 sig 0x000a0652, pf_mask 0x20, 2022-07-31, rev 0x00f4, size 96256 sig 0x000a0653, pf_mask 0x22, 2022-07-31, rev 0x00f4, size 97280 sig 0x000a0655, pf_mask 0x22, 2022-07-31, rev 0x00f4, size 96256 sig 0x000a0660, pf_mask 0x80, 2022-07-31, rev 0x00f4, size 97280 sig 0x000a0661, pf_mask 0x80, 2022-07-31, rev 0x00f4, size 96256 sig 0x000a0671, pf_mask 0x02, 2022-08-02, rev 0x0056, size 103424 We need to update to this version because https://ftp.debian.org/debian/pool/non-free/i/intel-microcode/intel-microcode_3.20220809.1.tar.xz has been removed. Signed-off-by: Linhui Liu --- package/firmware/intel-microcode/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/firmware/intel-microcode/Makefile b/package/firmware/intel-microcode/Makefile index b0379f363df..58ae7ee74be 100644 --- a/package/firmware/intel-microcode/Makefile +++ b/package/firmware/intel-microcode/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=intel-microcode -PKG_VERSION:=20220809 +PKG_VERSION:=20221108 PKG_RELEASE:=1 PKG_SOURCE:=intel-microcode_3.$(PKG_VERSION).1.tar.xz PKG_SOURCE_URL:=@DEBIAN/pool/non-free/i/intel-microcode/ -PKG_HASH:=4cf6c3638bb52d9d45c1916af866fd0929628a6f459daac3edfd369149e9c665 +PKG_HASH:=9c40fc5cbb386a4e1154f8f316422b28fccc9eaabdea707a80643f9bed3f9064 PKG_BUILD_DIR:=$(BUILD_DIR)/intel-microcode-3.$(PKG_VERSION).1 PKG_BUILD_DEPENDS:=iucode-tool/host From cfb296b79a9568386267828374eb5f2dd3ba0d37 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Thu, 19 Jan 2023 14:20:59 +0000 Subject: [PATCH 056/104] ath79: add support for D-Link DIR-629 A1 Specifications: SOC: QCA9588 CPU 720 MHz AHB 200 MHz Switch: AR8236 RAM: 64 MiB DDR2-600 Flash: 8 MiB WLAN: Wi-Fi4 2.4 GHz 3*3 LAN: LAN ports *4 WAN: WAN port *1 Buttons: reset *1 + wps *1 LEDs: ethernet *5, power, wlan, wps MAC Address: use address source label 70:62:b8:xx:xx:96 lan && wlan lan 70:62:b8:xx:xx:96 mfcdata@0x35 wan 70:62:b8:xx:xx:97 mfcdata@0x6a wlan 70:62:b8:xx:xx:96 mfcdata@0x51 Install via Web UI: Apply factory image in the stock firmware's Web UI. Install via Emergency Room Mode: DIR-629 A1 will enter recovery mode when the system fails to boot or press reset button for about 10 seconds. First, set IP address to 192.168.0.1 and server IP to 192.168.0.10. Then we can open http://192.168.0.1 in the web browser to upload OpenWrt factory image or stock firmware. Some modern browsers may need to turn on compatibility mode. Signed-off-by: Shiji Yang --- .../ath79/dts/qca9558_dlink_dir-629-a1.dts | 170 ++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 4 + .../etc/uci-defaults/09_fix-checksum | 1 + target/linux/ath79/image/generic.mk | 13 ++ 4 files changed, 188 insertions(+) create mode 100644 target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts diff --git a/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts b/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts new file mode 100644 index 00000000000..41b0039e930 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts @@ -0,0 +1,170 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x.dtsi" + +#include +#include +#include + +/ { + compatible = "dlink,dir-629-a1", "qca,qca9558"; + model = "D-Link DIR-629 A1"; + + aliases { + label-mac-device = ð0; + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + serial0 = &uart; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + color = ; + function = LED_FUNCTION_WLAN; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led_power: led-1 { + label = "green:power"; + color = ; + function = LED_FUNCTION_POWER; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + }; + + led-2 { + color = ; + function = LED_FUNCTION_WPS; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + }; + }; +}; + +ð0 { + status = "okay"; + + phy-mode = "mii"; + + nvmem-cells = <&macaddr_mfcdata_35>; + nvmem-cell-names = "mac-address-ascii"; + + fixed-link { + speed = <100>; + full-duplex; + }; +}; + +&mdio0 { + status = "okay"; + + switch0@1f { + compatible = "qca,ar8236"; + reg = <0x1f>; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <30000000>; + m25p,fast-read; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x040000 0x008000>; + read-only; + }; + + partition@48000 { + label = "mfcdata"; + reg = <0x048000 0x008000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_mfcdata_35: macaddr@35 { + reg = <0x35 0x11>; + }; + + macaddr_mfcdata_51: macaddr@51 { + reg = <0x51 0x11>; + }; + }; + + partition@50000 { + label = "devconf"; + reg = <0x050000 0x010000>; + read-only; + }; + + partition@60000 { + label = "langpack"; + reg = <0x060000 0x020000>; + read-only; + }; + + partition@80000 { + label = "art"; + reg = <0x080000 0x010000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + }; + + partition@90000 { + compatible = "seama"; + label = "firmware"; + reg = <0x090000 0x770000>; + }; + }; + }; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&cal_art_1000>, <&macaddr_mfcdata_51>; + nvmem-cell-names = "calibration", "mac-address-ascii"; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 20352095a4c..610e70e5007 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -278,6 +278,7 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan:2" "2:lan:1" ;; + dlink,dir-629-a1|\ dlink,dir-825-c1|\ dlink,dir-835-a1|\ dlink,dir-842-c1|\ @@ -623,6 +624,9 @@ ath79_setup_macs() dlink,dap-3662-a1) label_mac=$(mtd_get_mac_ascii bdcfg "wlanmac") ;; + dlink,dir-629-a1) + wan_mac=$(mtd_get_mac_text "mfcdata" 0x6a) + ;; dlink,dir-825-b1|\ trendnet,tew-673gru) lan_mac=$(mtd_get_mac_text "caldata" 0xffa0) diff --git a/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum b/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum index 92048fd8104..4d961f26d29 100644 --- a/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum +++ b/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum @@ -21,6 +21,7 @@ dlink,dap-3320-a1|\ dlink,dap-3662-a1) fixwrgg ;; +dlink,dir-629-a1|\ qihoo,c301) fix_seama_header ;; diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 7712247d39f..3e32a08295b 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1010,6 +1010,19 @@ define Device/dlink_dir-505 endef TARGET_DEVICES += dlink_dir-505 +define Device/dlink_dir-629-a1 + $(Device/seama) + SOC := qca9558 + IMAGE_SIZE := 7616k + DEVICE_VENDOR := D-Link + DEVICE_MODEL := DIR-629 + DEVICE_VARIANT := A1 + DEVICE_PACKAGES := -uboot-envtools + SEAMA_MTDBLOCK := 6 + SEAMA_SIGNATURE := wrgn83_dlob.hans_dir629 +endef +TARGET_DEVICES += dlink_dir-629-a1 + define Device/dlink_dir-825-b1 SOC := ar7161 DEVICE_VENDOR := D-Link From 1a47f19080e0c8edbf4a463020118bb9ccaa3ff0 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 25 Jan 2023 21:29:13 +0100 Subject: [PATCH 057/104] linux-firmware: update to 20230117 Changes: 32d3199 linux-firmware: Update firmware file for Intel Bluetooth AX201 2da8a7a linux-firmware: Update firmware file for Intel Bluetooth AX201 8b5ddf4 linux-firmware: Update firmware file for Intel Bluetooth AX211 4219dac linux-firmware: Update firmware file for Intel Bluetooth AX211 fb34135 linux-firmware: Update firmware file for Intel Bluetooth AX210 becd3fc linux-firmware: Update firmware file for Intel Bluetooth AX200 7101c57 linux-firmware: Update firmware file for Intel Bluetooth AX201 49e87fa linux-firmware: Update firmware file for Intel Bluetooth 9560 86b73ce linux-firmware: Update firmware file for Intel Bluetooth 9260 3723b48 brcm: add configuration files for CyberTan WC121 7f626ef qcom: add firmware files for Adreno A200 fc5a25f rtw89: 8852c: update fw to v0.27.56.10 2ba1bea QCA: Add Bluetooth firmware for QCA2066 a1ad1d5 amdgpu: add VCN4.0.4 firmware from amd-5.4 9e01e17 amdgpu: add SMU13.0.7 firmware from amd-5.4 3a50eb8 amdgpu: add SDMA6.0.2 firmware from amd-5.4 19995fb amdgpu: add PSP13.0.7 firmware from amd-5.4 32e7c93 amdgpu: add GC11.0.2 firmware from amd-5.4 20c8060 amdgpu: add DCN3.2.1 firmware from amd-5.4 5c8e895 amdgpu: update VCN4.0.0 firmware from amd-5.4 66b3435 amdgpu: update SMU13.0.0 firmware from amd-5.4 604df78 amdgpu: update SDMA6.0.0 firmware from amd-5.4 3e9169a amdgpu: update PSP13.0.0 firmware from amd-5.4 bd1b7f7 amdgpu: update GC11.0.0 firmware from amd-5.4 c8ff1f4 iwlwifi: add new FWs from core76-35 release 5630963 iwlwifi: update cc/Qu/QuZ firmwares for core76-35 release 8bbec22 iwlwifi: add new FWs from core75-47 release e20a687 iwlwifi: update 9000-family firmwares to core75-47 504b691 amdgpu: update renoir DMCUB firmware 1ed02d5 amdgpu: Update renoir PSP firmware d0598c3 amdgpu: update copyright date for LICENSE.amdgpu cee86df linux-firmware: update firmware for MT7921 WiFi device e2d1174 linux-firmware: update firmware for MT7922 WiFi device ce7cc73 linux-firmware: update firmware for mediatek bluetooth chip (MT7921) 91f4c6b linux-firmware: update firmware for mediatek bluetooth chip (MT7922) 52e62d6 cxgb4: Update firmware to revision 1.27.1.0 4704e25 qca: Update firmware files for BT chip WCN6750 c9c1958 rtw89: 8852c: update fw to v0.27.56.9 9e91f0c rtw89: 8852c: update fw to v0.27.56.8 Signed-off-by: Nick Hainke --- package/firmware/linux-firmware/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile index 7ffd8baf884..684f39f664b 100644 --- a/package/firmware/linux-firmware/Makefile +++ b/package/firmware/linux-firmware/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=linux-firmware -PKG_VERSION:=20221214 -PKG_RELEASE:=3 +PKG_VERSION:=20230117 +PKG_RELEASE:=1 PKG_SOURCE_URL:=@KERNEL/linux/kernel/firmware PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=e793783e92acbde549965521462d1d1327827360664cf242dbda08f075654331 +PKG_HASH:=df11e25ba2fb4d5343473757e17a3b4cef599250a26b1f7e0f038850f0cb3d64 PKG_MAINTAINER:=Felix Fietkau From ba3aa6233d2c269c29d5191450cdc4ad2892358f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Wed, 11 Jan 2023 10:26:16 +0100 Subject: [PATCH 058/104] ci: allow custom kernel and target jobs based on labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current job triggers based on matching of changed paths is quite limited, so lets make it possible to additionally trigger manual CI jobs by adding CI specific pull request build labels: * `ci:target:x86:64` label is going to trigger CI target check jobs for x86/64 (sub)target. * `ci:kernel:x86:64` label is going to trigger CI kernel check jobs for x86/64 (sub)target. Signed-off-by: Petr Štetiar --- .github/workflows/label-kernel.yml | 45 ++++++++++++++++++++++++++++++ .github/workflows/label-target.yml | 37 ++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 .github/workflows/label-kernel.yml create mode 100644 .github/workflows/label-target.yml diff --git a/.github/workflows/label-kernel.yml b/.github/workflows/label-kernel.yml new file mode 100644 index 00000000000..1156e0ad985 --- /dev/null +++ b/.github/workflows/label-kernel.yml @@ -0,0 +1,45 @@ +# ci:kernel:x86:64 is going to trigger CI kernel check jobs for x86/64 target + +name: Build kernel and check patches for target specified in labels +on: + pull_request: + types: + - labeled + +jobs: + set_target: + if: startsWith(github.event.label.name, 'ci:kernel:') + name: Set target + runs-on: ubuntu-latest + outputs: + target: ${{ steps.set_target.outputs.target }} + + steps: + - name: Set target + id: set_target + env: + CI_EVENT_LABEL_NAME: ${{ github.event.label.name }} + run: | + echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target="\1\/\2"/p' | tee --append $GITHUB_OUTPUT + + build_kernel: + name: Build Kernel with external toolchain + needs: set_target + permissions: + contents: read + packages: read + uses: ./.github/workflows/build.yml + with: + target: ${{ needs.set_target.outputs.target }} + build_kernel: true + build_all_kmods: true + + check-kernel-patches: + name: Check Kernel patches + needs: set_target + permissions: + contents: read + packages: read + uses: ./.github/workflows/check-kernel-patches.yml + with: + target: ${{ needs.set_target.outputs.target }} diff --git a/.github/workflows/label-target.yml b/.github/workflows/label-target.yml new file mode 100644 index 00000000000..e1890240764 --- /dev/null +++ b/.github/workflows/label-target.yml @@ -0,0 +1,37 @@ +# ci:target:x86:64 is going to trigger CI target check jobs for x86/64 target + +name: Build check target specified in labels +on: + pull_request: + types: + - labeled + +jobs: + set_target: + if: startsWith(github.event.label.name, 'ci:target:') + name: Set target + runs-on: ubuntu-latest + outputs: + target: ${{ steps.set_target.outputs.target }} + + steps: + - name: Set target + id: set_target + env: + CI_EVENT_LABEL_NAME: ${{ github.event.label.name }} + run: | + echo "$CI_EVENT_LABEL_NAME" | sed -n 's/.*:\(.*\):\(.*\)$/target="\1\/\2"/p' | tee --append $GITHUB_OUTPUT + + build_target: + name: Build target + needs: set_target + permissions: + contents: read + packages: read + uses: ./.github/workflows/build.yml + with: + target: ${{ needs.set_target.outputs.target }} + build_full: true + build_all_kmods: true + build_all_boards: true + build_all_modules: true From 36076b5a409236b44d56179071cc53fdd1c6fc78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Thu, 26 Jan 2023 10:34:31 +0100 Subject: [PATCH 059/104] ubus: update to version 2022-06-15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update which contains just a following fix: * ubusd: add lookup command queuing support Defers and continues a client's lookup command to avoid unnecessary buffering under load. Signed-off-by: Petr Štetiar --- package/system/ubus/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index c70defcafa5..8762324e7c1 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git -PKG_SOURCE_DATE:=2022-06-01 -PKG_SOURCE_VERSION:=2bebf93cd3343fe49f22a05ef935e460d2d44f67 -PKG_MIRROR_HASH:=4efd873928089c086bbac02f3ca5bae55904500b6e6f1c4c377181a00b67147f +PKG_SOURCE_DATE:=2022-06-15 +PKG_SOURCE_VERSION:=9913aa61de739e3efe067a2d186021c20bcd65e2 +PKG_MIRROR_HASH:=2a9fd9e895835b15948ab211963b7489f8437cd1b2bf43e0e321bc960e105774 PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) CMAKE_INSTALL:=1 From 7f5edeb8bd819d6e418ca0023b4ec97c60e5ca47 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Tue, 24 Jan 2023 13:48:53 +0100 Subject: [PATCH 060/104] realtek: eth: Fix missing end of comment marker Because this comment is followed by another comment, nothing luckily breaks, so only a cosmetic change. Signed-off-by: Olliver Schinagl --- .../linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c index 857d389f12d..1b35fae09be 100644 --- a/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c +++ b/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c @@ -862,7 +862,7 @@ static void rtl839x_setup_notify_ring_buffer(struct rtl838x_eth_priv *priv) /* Setup notification events */ sw_w32_mask(0, 1 << 14, RTL839X_L2_CTRL_0); /* RTL8390_L2_CTRL_0_FLUSH_NOTIFY_EN */ - sw_w32_mask(0, 1 << 12, RTL839X_L2_NOTIFICATION_CTRL); /* SUSPEND_NOTIFICATION_EN + sw_w32_mask(0, 1 << 12, RTL839X_L2_NOTIFICATION_CTRL); /* SUSPEND_NOTIFICATION_EN */ /* Enable Notification */ sw_w32_mask(0, 1 << 0, RTL839X_L2_NOTIFICATION_CTRL); From 6e428a84904daa07190f924530f975102e8e7668 Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Tue, 24 Jan 2023 19:34:22 +0100 Subject: [PATCH 061/104] mxs: fix SD-card image generation for OLinuXino boards Fixes: mxs: add generic subtarget (64ef920) Adding the generic target caused the TARGET_BOOTFS_PARTSIZE to stay hidden for these boards, crashing the FAT filesystem creation. Signed-off-by: Zoltan HERPAI --- target/linux/mxs/image/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mxs/image/Config.in b/target/linux/mxs/image/Config.in index 250553e3566..a04700a440b 100644 --- a/target/linux/mxs/image/Config.in +++ b/target/linux/mxs/image/Config.in @@ -1,6 +1,6 @@ config TARGET_BOOTFS_PARTSIZE int "Boot (SD Card) filesystem partition size (in MB)" - depends on TARGET_mxs_olinuxino-maxi || TARGET_mxs_olinuxino-micro + depends on TARGET_mxs_generic_olinuxino-maxi || TARGET_mxs_generic_olinuxino-micro default 8 help On the Olimex OLinuXino boards, mainline U-Boot loads the From a63430eac33ceb1dbf96d3667e2a0f2e04ba391f Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 28 Jan 2023 13:50:17 +0100 Subject: [PATCH 062/104] mac80211: use 802.11ax iw modes This adds missing HE modes to mac80211_prepare_ht_modes. Previously mesh without wpa_supplicant would be initialized with 802.11g /NO-HT only, as this method did not parse channel bandwidth for HE operation. Signed-off-by: David Bauer --- .../kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 0a7f787cff8..5aaba9af26c 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -901,8 +901,8 @@ mac80211_setup_supplicant_noctl() { mac80211_prepare_iw_htmode() { case "$htmode" in - VHT20|HT20) iw_htmode=HT20;; - HT40*|VHT40|VHT160) + VHT20|HT20|HE20) iw_htmode=HT20;; + HT40*|VHT40|VHT160|HE40) case "$band" in 2g) case "$htmode" in @@ -926,7 +926,7 @@ mac80211_prepare_iw_htmode() { esac [ "$auto_channel" -gt 0 ] && iw_htmode="HT40+" ;; - VHT80) + VHT80|HE80) iw_htmode="80MHZ" ;; NONE|NOHT) From 38cba61bff52f22affa66cc764dab2ac158ab7d3 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Fri, 27 Jan 2023 23:35:47 +0100 Subject: [PATCH 063/104] realtek: timer: Register enabled scheduler clock Before calling sched_clock_register(), the timer used to drive the scheduling clock should already be enabled. Otherwise the kernel log will show strange time jumps during, and the watchdog might not be pinged in a timely fashion, resulting in reboots. [ 0.160281] NET: Registered PF_NETLINK/PF_ROUTE protocol family [ 78.104319] clocksource: Switched to clocksource realtek_otto_timer Fixes: 3cc801117118 ("realtek: resurrect timer driver") Signed-off-by: Sander Vanheule --- .../realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c | 2 +- .../realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c b/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c index c096d8742b4..0395cf29e5c 100644 --- a/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c +++ b/target/linux/realtek/files-5.10/drivers/clocksource/timer-rtl-otto.c @@ -229,7 +229,6 @@ struct rttm_cs rttm_cs = { .mask = CLOCKSOURCE_MASK(RTTM_BIT_COUNT), .flags = CLOCK_SOURCE_IS_CONTINUOUS, .read = rttm_read_clocksource, - .enable = rttm_enable_clocksource } }; @@ -276,6 +275,7 @@ static int __init rttm_probe(struct device_node *np) to->of_base.index = clkidx; timer_of_init(np, to); if (rttm_cs.to.of_base.base && rttm_cs.to.of_clk.rate) { + rttm_enable_clocksource(&rttm_cs.cs); clocksource_register_hz(&rttm_cs.cs, RTTM_TICKS_PER_SEC); sched_clock_register(rttm_read_clock, RTTM_BIT_COUNT, RTTM_TICKS_PER_SEC); } else diff --git a/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c b/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c index c096d8742b4..0395cf29e5c 100644 --- a/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c +++ b/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c @@ -229,7 +229,6 @@ struct rttm_cs rttm_cs = { .mask = CLOCKSOURCE_MASK(RTTM_BIT_COUNT), .flags = CLOCK_SOURCE_IS_CONTINUOUS, .read = rttm_read_clocksource, - .enable = rttm_enable_clocksource } }; @@ -276,6 +275,7 @@ static int __init rttm_probe(struct device_node *np) to->of_base.index = clkidx; timer_of_init(np, to); if (rttm_cs.to.of_base.base && rttm_cs.to.of_clk.rate) { + rttm_enable_clocksource(&rttm_cs.cs); clocksource_register_hz(&rttm_cs.cs, RTTM_TICKS_PER_SEC); sched_clock_register(rttm_read_clock, RTTM_BIT_COUNT, RTTM_TICKS_PER_SEC); } else From 68e28cdc47ac805faf2dda58127e848f8ef6efca Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Wed, 14 Sep 2022 14:50:38 +0200 Subject: [PATCH 064/104] realtek: timer: Activate for RTL930x devices Use the new timer driver for the RTL930x devices. Signed-off-by: Olliver Schinagl [remove old clock provider, select MIPS_EXTERNAL_TIMER and refresh kernel config] Signed-off-by: Sander Vanheule --- target/linux/realtek/dts-5.15/rtl930x.dtsi | 18 ++++++++++-------- .../300-mips-add-rtl838x-platform.patch | 5 ++--- target/linux/realtek/rtl930x/config-5.15 | 8 ++++---- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/target/linux/realtek/dts-5.15/rtl930x.dtsi b/target/linux/realtek/dts-5.15/rtl930x.dtsi index c2a992a174c..fdec626c9a8 100644 --- a/target/linux/realtek/dts-5.15/rtl930x.dtsi +++ b/target/linux/realtek/dts-5.15/rtl930x.dtsi @@ -57,14 +57,6 @@ interrupts = <2>, <3>, <4>, <5>, <6>, <7>; }; - rtl9300clock: rtl9300clock@3200 { - compatible = "realtek,rtl9300clock"; - reg = <0x3200 0x10>, <0x3210 0x10>; - - interrupt-parent = <&intc>; - interrupts = <7 5>, <8 5>; - }; - spi0: spi@1200 { compatible = "realtek,rtl8380-spi"; reg = <0x1200 0x100>; @@ -73,6 +65,16 @@ #size-cells = <0>; }; + timer0: timer@3200 { + compatible = "realtek,rtl930x-timer", "realtek,otto-timer"; + reg = <0x3200 0x10>, <0x3210 0x10>, <0x3220 0x10>, + <0x3230 0x10>, <0x3240 0x10>; + + interrupt-parent = <&intc>; + interrupts = <7 4>, <8 4>, <9 4>, <10 4>, <11 4>; + clocks = <&lx_clk>; + }; + uart0: uart@2000 { compatible = "ns16550a"; reg = <0x2000 0x100>; diff --git a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch index 8428c32e4e0..4027b5319a8 100644 --- a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch @@ -25,7 +25,7 @@ Submitted-by: Birger Koblitz platform-$(CONFIG_SGI_IP28) += sgi-ip22/ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1053,8 +1053,59 @@ config NLM_XLP_BOARD +@@ -1053,8 +1053,58 @@ config NLM_XLP_BOARD This board is based on Netlogic XLP Processor. Say Y here if you have a XLP based board. @@ -68,8 +68,7 @@ Submitted-by: Birger Koblitz + bool "Realtek RTL930X based platforms" + depends on RTL83XX + select MIPS_CPU_SCACHE -+ select CSRC_R4K -+ select CEVT_RTL9300 ++ select MIPS_EXTERNAL_TIMER + select SYS_SUPPORTS_MULTITHREADING + +config RTL931X diff --git a/target/linux/realtek/rtl930x/config-5.15 b/target/linux/realtek/rtl930x/config-5.15 index 5e036166787..35365370efa 100644 --- a/target/linux/realtek/rtl930x/config-5.15 +++ b/target/linux/realtek/rtl930x/config-5.15 @@ -9,7 +9,6 @@ CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=4096 CONFIG_BOARD_SCACHE=y -CONFIG_CEVT_RTL9300=y CONFIG_CLONE_BACKWARDS=y CONFIG_COMMON_CLK=y # CONFIG_COMMON_CLK_REALTEK is not set @@ -33,7 +32,6 @@ CONFIG_CPU_SUPPORTS_MSA=y CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2 CONFIG_CRYPTO_RNG2=y -CONFIG_CSRC_R4K=y CONFIG_DEBUG_SECTION_MISMATCH=y CONFIG_DMA_NONCOHERENT=y CONFIG_DTC=y @@ -113,11 +111,11 @@ CONFIG_MIGRATION=y CONFIG_MIPS=y CONFIG_MIPS_ASID_BITS=8 CONFIG_MIPS_ASID_SHIFT=0 -CONFIG_MIPS_CLOCK_VSYSCALL=y # CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set CONFIG_MIPS_CMDLINE_FROM_DTB=y CONFIG_MIPS_CPU_SCACHE=y CONFIG_MIPS_EBPF_JIT=y +CONFIG_MIPS_EXTERNAL_TIMER=y CONFIG_MIPS_L1_CACHE_SHIFT=5 CONFIG_MIPS_LD_CAN_LINK_VDSO=y # CONFIG_MIPS_MT_SMP is not set @@ -166,7 +164,7 @@ CONFIG_POWER_RESET_GPIO_RESTART=y CONFIG_POWER_RESET_SYSCON=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_RATIONAL=y -# CONFIG_REALTEK_OTTO_TIMER is not set +CONFIG_REALTEK_OTTO_TIMER=y CONFIG_REALTEK_OTTO_WDT=y CONFIG_REALTEK_PHY=y CONFIG_REALTEK_SOC_PHY=y @@ -199,6 +197,8 @@ CONFIG_SYS_SUPPORTS_MIPS16=y CONFIG_SYS_SUPPORTS_MULTITHREADING=y CONFIG_TARGET_ISA_REV=2 CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y CONFIG_TINY_SRCU=y CONFIG_USE_GENERIC_EARLY_PRINTK_8250=y CONFIG_USE_OF=y From f6ba61b9298f12dbf116556edc879d047e5145e9 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Thu, 29 Dec 2022 11:27:54 +0100 Subject: [PATCH 065/104] realtek: timer: Remove CEVT_RTL9300 completely As the timer has been fixed now, we can drop the CEVT_RTL9300 timer all together. Signed-off-by: Olliver Schinagl --- .../arch/mips/kernel/cevt-rtl9300.c | 204 ------------------ .../300-mips-add-rtl838x-platform.patch | 10 - .../309-cevt-rtl9300-support.patch | 54 ----- 3 files changed, 268 deletions(-) delete mode 100644 target/linux/realtek/files-5.15/arch/mips/kernel/cevt-rtl9300.c delete mode 100644 target/linux/realtek/patches-5.15/309-cevt-rtl9300-support.patch diff --git a/target/linux/realtek/files-5.15/arch/mips/kernel/cevt-rtl9300.c b/target/linux/realtek/files-5.15/arch/mips/kernel/cevt-rtl9300.c deleted file mode 100644 index 1f7698d3144..00000000000 --- a/target/linux/realtek/files-5.15/arch/mips/kernel/cevt-rtl9300.c +++ /dev/null @@ -1,204 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -/* - * Timer registers - * the RTL9300/9310 SoCs have 6 timers, each register block 0x10 apart - */ -#define RTL9300_TC_DATA 0x0 -#define RTL9300_TC_CNT 0x4 -#define RTL9300_TC_CTRL 0x8 -#define RTL9300_TC_CTRL_MODE BIT(24) -#define RTL9300_TC_CTRL_EN BIT(28) -#define RTL9300_TC_INT 0xc -#define RTL9300_TC_INT_IP BIT(16) -#define RTL9300_TC_INT_IE BIT(20) - -/* Timer modes */ -#define TIMER_MODE_REPEAT 1 -#define TIMER_MODE_ONCE 0 - -/* Minimum divider is 2 */ -#define DIVISOR_RTL9300 2 - -#define N_BITS 28 - -#define RTL9300_CLOCK_RATE 87500000 - -struct rtl9300_clk_dev { - struct clock_event_device clkdev; - void __iomem *base; -}; - -static void __iomem *rtl9300_tc_base(struct clock_event_device *clk) -{ - struct rtl9300_clk_dev *rtl_clk = container_of(clk, struct rtl9300_clk_dev, clkdev); - - return rtl_clk->base; -} - -static irqreturn_t rtl9300_timer_interrupt(int irq, void *dev_id) -{ - struct rtl9300_clk_dev *rtl_clk = dev_id; - struct clock_event_device *clk = &rtl_clk->clkdev; - - u32 v = readl(rtl_clk->base + RTL9300_TC_INT); - - /* Acknowledge the IRQ */ - v |= RTL9300_TC_INT_IP; - writel(v, rtl_clk->base + RTL9300_TC_INT); - - clk->event_handler(clk); - - return IRQ_HANDLED; -} - -static void rtl9300_clock_stop(void __iomem *base) -{ - u32 v; - - writel(0, base + RTL9300_TC_CTRL); - - /* Acknowledge possibly pending IRQ */ - v = readl(base + RTL9300_TC_INT); - writel(v | RTL9300_TC_INT_IP, base + RTL9300_TC_INT); -} - -static void rtl9300_timer_start(void __iomem *base, bool periodic) -{ - u32 v = (periodic ? RTL9300_TC_CTRL_MODE : 0) | RTL9300_TC_CTRL_EN | DIVISOR_RTL9300; - - writel(0, base + RTL9300_TC_CNT); - pr_debug("------------- starting timer base %08x\n", (u32)base); - writel(v, base + RTL9300_TC_CTRL); -} - -static int rtl9300_next_event(unsigned long delta, struct clock_event_device *clk) -{ - void __iomem *base = rtl9300_tc_base(clk); - - rtl9300_clock_stop(base); - writel(delta, base + RTL9300_TC_DATA); - rtl9300_timer_start(base, TIMER_MODE_ONCE); - - return 0; -} - -static int rtl9300_state_periodic(struct clock_event_device *clk) -{ - void __iomem *base = rtl9300_tc_base(clk); - - pr_debug("------------- rtl9300_state_periodic %08x\n", (u32)base); - rtl9300_clock_stop(base); - writel(RTL9300_CLOCK_RATE / HZ, base + RTL9300_TC_DATA); - rtl9300_timer_start(base, TIMER_MODE_REPEAT); - - return 0; -} - -static int rtl9300_state_oneshot(struct clock_event_device *clk) -{ - void __iomem *base = rtl9300_tc_base(clk); - - pr_debug("------------- rtl9300_state_oneshot %08x\n", (u32)base); - rtl9300_clock_stop(base); - writel(RTL9300_CLOCK_RATE / HZ, base + RTL9300_TC_DATA); - rtl9300_timer_start(base, TIMER_MODE_ONCE); - - return 0; -} - -static int rtl9300_shutdown(struct clock_event_device *clk) -{ - void __iomem *base = rtl9300_tc_base(clk); - - pr_debug("------------- rtl9300_shutdown %08x\n", (u32)base); - rtl9300_clock_stop(base); - - return 0; -} - -static void rtl9300_clock_setup(void __iomem *base) -{ - u32 v; - - /* Disable timer */ - writel(0, base + RTL9300_TC_CTRL); - - /* Acknowledge possibly pending IRQ */ - v = readl(base + RTL9300_TC_INT); - writel(v | RTL9300_TC_INT_IP, base + RTL9300_TC_INT); - - /* Setup maximum period (for use as clock-source) */ - writel(0x0fffffff, base + RTL9300_TC_DATA); -} - -static DEFINE_PER_CPU(struct rtl9300_clk_dev, rtl9300_clockevent); -static DEFINE_PER_CPU(char [18], rtl9300_clock_name); - -void rtl9300_clockevent_init(void) -{ - int cpu = smp_processor_id(); - int irq; - struct rtl9300_clk_dev *rtl_clk = &per_cpu(rtl9300_clockevent, cpu); - struct clock_event_device *cd = &rtl_clk->clkdev; - unsigned char *name = per_cpu(rtl9300_clock_name, cpu); - unsigned long flags = IRQF_PERCPU | IRQF_TIMER; - struct device_node *node; - - pr_info("%s called for cpu%d\n", __func__, cpu); - BUG_ON(cpu > 3); /* Only have 4 general purpose timers */ - - node = of_find_compatible_node(NULL, NULL, "realtek,rtl9300clock"); - if (!node) { - pr_err("No DT entry found for realtek,rtl9300clock\n"); - return; - } - - irq = irq_of_parse_and_map(node, cpu); - pr_info("%s using IRQ %d\n", __func__, irq); - - rtl_clk->base = of_iomap(node, cpu); - if (!rtl_clk->base) { - pr_err("cannot map timer for cpu %d", cpu); - return; - } - - rtl9300_clock_setup(rtl_clk->base); - - sprintf(name, "rtl9300-counter-%d", cpu); - cd->name = name; - cd->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; - - clockevent_set_clock(cd, RTL9300_CLOCK_RATE); - - cd->max_delta_ns = clockevent_delta2ns(0x0fffffff, cd); - cd->max_delta_ticks = 0x0fffffff; - cd->min_delta_ns = clockevent_delta2ns(0x20, cd); - cd->min_delta_ticks = 0x20; - cd->rating = 300; - cd->irq = irq; - cd->cpumask = cpumask_of(cpu); - cd->set_next_event = rtl9300_next_event; - cd->set_state_shutdown = rtl9300_shutdown; - cd->set_state_periodic = rtl9300_state_periodic; - cd->set_state_oneshot = rtl9300_state_oneshot; - clockevents_register_device(cd); - - irq_set_affinity(irq, cd->cpumask); - - if (request_irq(irq, rtl9300_timer_interrupt, flags, name, rtl_clk)) - pr_err("Failed to request irq %d (%s)\n", irq, name); - - writel(RTL9300_TC_INT_IE, rtl_clk->base + RTL9300_TC_INT); -} diff --git a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch index 4027b5319a8..6407a49fb6b 100644 --- a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch @@ -84,13 +84,3 @@ Submitted-by: Birger Koblitz source "arch/mips/alchemy/Kconfig" source "arch/mips/ath25/Kconfig" source "arch/mips/ath79/Kconfig" -@@ -1112,6 +1162,9 @@ config CEVT_GT641XX - config CEVT_R4K - bool - -+config CEVT_RTL9300 -+ bool -+ - config CEVT_SB1250 - bool - diff --git a/target/linux/realtek/patches-5.15/309-cevt-rtl9300-support.patch b/target/linux/realtek/patches-5.15/309-cevt-rtl9300-support.patch deleted file mode 100644 index 93d69c07cf1..00000000000 --- a/target/linux/realtek/patches-5.15/309-cevt-rtl9300-support.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 775d903216a08c2a8009863d2f9c33f62657ba94 Mon Sep 17 00:00:00 2001 -From: Birger Koblitz -Date: Thu, 6 Jan 2022 20:27:01 +0100 -Subject: [PATCH] realtek: Replace the RTL9300 generic timer with a CEVT timer - -The RTL9300 has a broken R4K MIPS timer interrupt, however, the -R4K clocksource works. We replace the RTL9300 timer with a -Clock Event Timer (CEVT), which is VSMP aware and can be instantiated -as part of brining a VSMTP cpu up instead of the R4K CEVT source. -For this we place the RTL9300 CEVT timer in arch/mips/kernel -together with other MIPS CEVT timers, initialize the SoC IRQs -from a modified smp-mt.c and instantiate each timer as part -of the MIPS time setup in arch/mips/include/asm/time.h instead -of the R4K CEVT, similarly as is done by other MIPS CEVT timers. - -Submitted-by: Birger Koblitz ---- - arch/mips/kernel/Makefile | 1 + - arch/mips/include/asm/time.h | 7 +++++++ - 2 files changed, 8 insertions(+) - ---- a/arch/mips/kernel/Makefile -+++ b/arch/mips/kernel/Makefile -@@ -27,6 +27,7 @@ obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm14 - obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o - obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o - obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o -+obj-$(CONFIG_CEVT_RTL9300) += cevt-rtl9300.o - obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o - obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o - obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o ---- a/arch/mips/include/asm/time.h -+++ b/arch/mips/include/asm/time.h -@@ -15,6 +15,8 @@ - #include - #include - -+extern void rtl9300_clockevent_init(void); -+ - extern spinlock_t rtc_lock; - - /* -@@ -43,6 +45,11 @@ extern int r4k_clockevent_init(void); - - static inline int mips_clockevent_init(void) - { -+#ifdef CONFIG_CEVT_RTL9300 -+ rtl9300_clockevent_init(); -+ return 0; -+#endif -+ - #ifdef CONFIG_CEVT_R4K - return r4k_clockevent_init(); - #else From afb5d9e9d5a5ecafceb0e3d4ffe1210077f8a40b Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Sat, 28 Jan 2023 15:26:35 +0100 Subject: [PATCH 066/104] realtek: timer: Fix cosmetic whitespace in comments Comments are a bit weird in the timer driver, lets fix those. Signed-off-by: Olliver Schinagl --- .../drivers/clocksource/timer-rtl-otto.c | 27 +++++-------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c b/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c index 0395cf29e5c..086f62112ae 100644 --- a/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c +++ b/target/linux/realtek/files-5.15/drivers/clocksource/timer-rtl-otto.c @@ -27,7 +27,6 @@ * the timer is in operating mode COUNTER it stops. In mode TIMER it will * continue to count up. */ - #define RTTM_CTRL_COUNTER 0 #define RTTM_CTRL_TIMER BIT(24) @@ -43,7 +42,6 @@ * MHz and 153.125 MHz. The greatest common divisor of all explained possible * speeds is 3125000. Pin the timers to this 3.125 MHz reference frequency. */ - #define RTTM_TICKS_PER_SEC 3125000 struct rttm_cs { @@ -51,10 +49,7 @@ struct rttm_cs { struct clocksource cs; }; -/* - * Simple internal register functions - */ - +/* Simple internal register functions */ static inline void rttm_set_counter(void __iomem *base, unsigned int counter) { iowrite32(counter, base + RTTM_CNT); @@ -95,10 +90,7 @@ static inline void rttm_disable_irq(void __iomem *base) iowrite32(0, base + RTTM_INT); } -/* - * Aggregated control functions for kernel clock framework - */ - +/* Aggregated control functions for kernel clock framework */ #define RTTM_DEBUG(base) \ pr_debug("------------- %s %d %08x\n", __func__, \ smp_processor_id(), (u32)base) @@ -187,10 +179,7 @@ static u64 rttm_read_clocksource(struct clocksource *cs) return (u64)rttm_get_counter(rcs->to.of_base.base); } -/* - * Module initialization part. - */ - +/* Module initialization part. */ static DEFINE_PER_CPU(struct timer_of, rttm_to) = { .flags = TIMER_OF_BASE | TIMER_OF_CLOCK | TIMER_OF_IRQ, .of_irq = { @@ -256,9 +245,8 @@ static int __init rttm_probe(struct device_node *np) int cpu, cpu_rollback; struct timer_of *to; int clkidx = num_possible_cpus(); -/* - * Use the first n timers as per CPU clock event generators - */ + + /* Use the first n timers as per CPU clock event generators */ for_each_possible_cpu(cpu) { to = per_cpu_ptr(&rttm_to, cpu); to->of_irq.index = to->of_base.index = cpu; @@ -268,9 +256,8 @@ static int __init rttm_probe(struct device_node *np) } rttm_setup_timer(to->of_base.base); } -/* - * Activate the n'th+1 timer as a stable CPU clocksource. - */ + + /* Activate the n'th + 1 timer as a stable CPU clocksource. */ to = &rttm_cs.to; to->of_base.index = clkidx; timer_of_init(np, to); From d14559e9df4052cfaecd016c2afd2353ce18c455 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 28 Jan 2023 19:27:51 +0100 Subject: [PATCH 067/104] uhttpd: update to latest Git HEAD 47561aa mimetypes: add audio/video support for apple airplay 6341357 ucode: respect all arguments passed to send() Signed-off-by: Hauke Mehrtens --- package/network/services/uhttpd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile index 55ca3f68189..4090bf45798 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git -PKG_SOURCE_DATE:=2022-10-31 -PKG_SOURCE_VERSION:=23977554d9694d025eada50a5547e99ee1be7838 -PKG_MIRROR_HASH:=e546fd57d0d0be6a51e2aeb5797febe8c89d2bba61b26c930ecb0616d5f6ace9 +PKG_SOURCE_DATE:=2023-01-28 +PKG_SOURCE_VERSION:=47561aa13574068403d48f13ea310f8511057b2b +PKG_MIRROR_HASH:=84500cf0c8224fe80b5717c9b6bad8ac13f44f286e3a88e8b12adfcf02e22c7c PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=ISC From 3ba8dd0731000cd406f10e597cfa051bb02f7034 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 28 Jan 2023 19:49:51 +0100 Subject: [PATCH 068/104] realtek: Refresh kernel patches Make the patches apply cleanly again. Fixes: 4db8598e4296 ("realtek: Do not set KERNEL_ENTRY just to avoid NO_EXCEPT_FILL") Signed-off-by: Hauke Mehrtens --- .../realtek/patches-5.10/300-mips-add-rtl838x-platform.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch index f54bd28242c..fce26133fc2 100644 --- a/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch @@ -85,7 +85,7 @@ Submitted-by: Birger Koblitz source "arch/mips/alchemy/Kconfig" source "arch/mips/ath25/Kconfig" source "arch/mips/ath79/Kconfig" -@@ -1097,6 +1147,9 @@ config CEVT_GT641XX +@@ -1097,6 +1148,9 @@ config CEVT_GT641XX config CEVT_R4K bool From 5d227b16035ddcda54ecaccaed497f725bfa98f9 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 22 Jan 2023 17:17:14 +0100 Subject: [PATCH 069/104] pistachio: Cleanup kernel configuration This removes some kernel configuration options which are not needed. This brings the target closer to the OpenWrt standard configuration. Signed-off-by: Hauke Mehrtens --- target/linux/pistachio/config-5.15 | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/target/linux/pistachio/config-5.15 b/target/linux/pistachio/config-5.15 index c303e99987a..c16a0c45516 100644 --- a/target/linux/pistachio/config-5.15 +++ b/target/linux/pistachio/config-5.15 @@ -71,8 +71,6 @@ CONFIG_DMA_VIRTUAL_CHANNELS=y CONFIG_DTC=y CONFIG_DWMAC_GENERIC=y CONFIG_EXT4_FS=y -CONFIG_EXT4_FS_POSIX_ACL=y -CONFIG_EXT4_FS_SECURITY=y # CONFIG_FIT_IMAGE_FDT_BOSTON is not set # CONFIG_FIT_IMAGE_FDT_JAGUAR2 is not set # CONFIG_FIT_IMAGE_FDT_LUTON is not set @@ -120,6 +118,7 @@ CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y CONFIG_HOTPLUG_CPU=y +CONFIG_HZ_PERIODIC=y CONFIG_I2C=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_IMG=y @@ -138,7 +137,6 @@ CONFIG_LEDS_PWM=y # CONFIG_LEGACY_BOARD_OCELOT is not set # CONFIG_LEGACY_BOARD_SEAD3 is not set CONFIG_LIBFDT=y -CONFIG_LKDTM=y CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_LOG_BUF_SHIFT=18 CONFIG_LZO_COMPRESS=y @@ -201,17 +199,12 @@ CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_FASTMAP=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_NAMESPACES=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NET_FLOW_LIMIT=y -CONFIG_NET_NS=y CONFIG_NET_PTP_CLASSIFY=y CONFIG_NET_SELFTESTS=y CONFIG_NLS=y CONFIG_NO_EXCEPT_FILL=y -CONFIG_NO_HZ=y -CONFIG_NO_HZ_COMMON=y -CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_OF=y CONFIG_OF_ADDRESS=y @@ -234,11 +227,8 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_PISTACHIO=y CONFIG_POWER_SUPPLY=y CONFIG_PPS=y -# CONFIG_PREEMPT_NONE is not set -CONFIG_PREEMPT_VOLUNTARY=y CONFIG_PRINTK_TIME=y CONFIG_PROC_EVENTS=y -CONFIG_PROFILING=y CONFIG_PTP_1588_CLOCK=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y CONFIG_PWM=y @@ -329,7 +319,6 @@ CONFIG_USB_GADGET=y CONFIG_USB_ROLE_SWITCH=y CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y -CONFIG_USER_NS=y CONFIG_USE_OF=y # CONFIG_VIRT_BOARD_RANCHU is not set CONFIG_WATCHDOG_CORE=y From 015c1087559d8433f488d6dbde142489696a27e0 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 28 Jan 2023 20:23:20 +0100 Subject: [PATCH 070/104] relayd: bump to version 2023-01-28 f646ba4 route: Fix compile warning with glibc Signed-off-by: Hauke Mehrtens --- package/network/services/relayd/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/relayd/Makefile b/package/network/services/relayd/Makefile index 64a08a96652..aba69399556 100644 --- a/package/network/services/relayd/Makefile +++ b/package/network/services/relayd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_URL=$(PROJECT_GIT)/project/relayd.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2020-04-25 -PKG_SOURCE_VERSION:=f4d759be54ceb37714e9a6ca320d5b50c95e9ce9 -PKG_MIRROR_HASH:=b1ff6e99072867be0975ba0be52ba9da3a876c8b8da893d68301e8238243a51e +PKG_SOURCE_DATE:=2023-01-28 +PKG_SOURCE_VERSION:=f646ba40489371e69f624f2dee2fc4e19ceec00e +PKG_MIRROR_HASH:=672d3115728d40ee6897a9f633d269d127496699a7bd45eba11844aa771f2501 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=GPL-2.0 From 364a9be3384d87fa1d7a21862a7479a8ce8492b2 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Wed, 25 Jan 2023 09:07:51 +0100 Subject: [PATCH 071/104] ethtool: update to 6.1 Release notes: https://lore.kernel.org/netdev/20221219225600.r54vejiqapn266cm@lion.mk-sys.cz/T/ Add patches fixing compilation: - 100-uapi-Bring-in-if-h.patch - 101-netlink-Fix-maybe-uninitialized-meters-variable.patch - 102-raw-marvell-c-Fix-build-with-musl-libc.patch Signed-off-by: Nick Hainke --- package/network/utils/ethtool/Makefile | 4 +- .../patches/100-uapi-Bring-in-if-h.patch | 465 ++++++++++++++++++ ...-maybe-uninitialized-meters-variable.patch | 25 + ...w-marvell-c-Fix-build-with-musl-libc.patch | 63 +++ 4 files changed, 555 insertions(+), 2 deletions(-) create mode 100644 package/network/utils/ethtool/patches/100-uapi-Bring-in-if-h.patch create mode 100644 package/network/utils/ethtool/patches/101-netlink-Fix-maybe-uninitialized-meters-variable.patch create mode 100644 package/network/utils/ethtool/patches/102-raw-marvell-c-Fix-build-with-musl-libc.patch diff --git a/package/network/utils/ethtool/Makefile b/package/network/utils/ethtool/Makefile index 467630d24ca..bec26cd3644 100644 --- a/package/network/utils/ethtool/Makefile +++ b/package/network/utils/ethtool/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ethtool -PKG_VERSION:=6.0 +PKG_VERSION:=6.1 PKG_RELEASE:=1 PKG_MAINTAINER:=Felix Fietkau PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/software/network/ethtool -PKG_HASH:=d5446c93de570ce68f3b1ea69dbfa12fcfd67fc19897f655d3f18231e2b818d6 +PKG_HASH:=c41fc881ffa5a40432d2dd829eb44c64a49dee482e716baacf9262c64daa8f90 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/network/utils/ethtool/patches/100-uapi-Bring-in-if-h.patch b/package/network/utils/ethtool/patches/100-uapi-Bring-in-if-h.patch new file mode 100644 index 00000000000..09be05c1f62 --- /dev/null +++ b/package/network/utils/ethtool/patches/100-uapi-Bring-in-if-h.patch @@ -0,0 +1,465 @@ +From: Florian Fainelli +To: netdev@vger.kernel.org +Subject: [PATCH ethtool v2 1/3] uapi: Bring in if.h +Date: Sat, 14 Jan 2023 08:34:09 -0800 + +Bring in if.h from commit eec517cdb481 ("net: Add IF_OPER_TESTING") as +well as uapi/linux/hdlc/ioctl.h. Ensure that we define all of the +necessary guards to provide updated definitions of ifmap, ifreq and +IFNAMSIZ. This resolves build issues with kernel headers < 4.11 which +lacked 2618be7dccf8739b89e1906b64bd8d551af351e6 ("uapi: fix linux/if.h +userspace compilation errors"). + +Fixes: 1fa60003a8b8 ("misc: header includes cleanup") +Reported-by: Markus Mayer +Signed-off-by: Florian Fainelli +--- + Makefile.am | 6 +- + internal.h | 7 +- + uapi/linux/hdlc/ioctl.h | 94 +++++++++++++ + uapi/linux/if.h | 296 ++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 397 insertions(+), 6 deletions(-) + create mode 100644 uapi/linux/hdlc/ioctl.h + create mode 100644 uapi/linux/if.h + +--- a/Makefile.am ++++ b/Makefile.am +@@ -7,7 +7,8 @@ EXTRA_DIST = LICENSE ethtool.8 ethtool.s + + sbin_PROGRAMS = ethtool + ethtool_SOURCES = ethtool.c uapi/linux/ethtool.h internal.h \ +- uapi/linux/net_tstamp.h rxclass.c common.c common.h \ ++ uapi/linux/net_tstamp.h uapi/linux/if.h uapi/linux/hdlc/ioctl.h \ ++ rxclass.c common.c common.h \ + json_writer.c json_writer.h json_print.c json_print.h \ + list.h + if ETHTOOL_ENABLE_PRETTY_DUMP +@@ -43,7 +44,8 @@ ethtool_SOURCES += \ + netlink/desc-rtnl.c netlink/cable_test.c netlink/tunnels.c \ + uapi/linux/ethtool_netlink.h \ + uapi/linux/netlink.h uapi/linux/genetlink.h \ +- uapi/linux/rtnetlink.h uapi/linux/if_link.h ++ uapi/linux/rtnetlink.h uapi/linux/if_link.h \ ++ uapi/linux/if.h uapi/linux/hdlc/ioctl.h + AM_CPPFLAGS += @MNL_CFLAGS@ + LDADD += @MNL_LIBS@ + endif +--- a/internal.h ++++ b/internal.h +@@ -21,6 +21,9 @@ + #include + #include + #include ++#define __UAPI_DEF_IF_IFNAMSIZ 1 ++#define __UAPI_DEF_IF_IFMAP 1 ++#define __UAPI_DEF_IF_IFREQ 1 + #include + + #include "json_writer.h" +@@ -52,10 +55,6 @@ typedef int32_t s32; + #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) + #endif + +-#ifndef ALTIFNAMSIZ +-#define ALTIFNAMSIZ 128 +-#endif +- + #include + #include + +--- /dev/null ++++ b/uapi/linux/hdlc/ioctl.h +@@ -0,0 +1,94 @@ ++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ ++#ifndef __HDLC_IOCTL_H__ ++#define __HDLC_IOCTL_H__ ++ ++ ++#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */ ++ ++#define CLOCK_DEFAULT 0 /* Default setting */ ++#define CLOCK_EXT 1 /* External TX and RX clock - DTE */ ++#define CLOCK_INT 2 /* Internal TX and RX clock - DCE */ ++#define CLOCK_TXINT 3 /* Internal TX and external RX clock */ ++#define CLOCK_TXFROMRX 4 /* TX clock derived from external RX clock */ ++ ++ ++#define ENCODING_DEFAULT 0 /* Default setting */ ++#define ENCODING_NRZ 1 ++#define ENCODING_NRZI 2 ++#define ENCODING_FM_MARK 3 ++#define ENCODING_FM_SPACE 4 ++#define ENCODING_MANCHESTER 5 ++ ++ ++#define PARITY_DEFAULT 0 /* Default setting */ ++#define PARITY_NONE 1 /* No parity */ ++#define PARITY_CRC16_PR0 2 /* CRC16, initial value 0x0000 */ ++#define PARITY_CRC16_PR1 3 /* CRC16, initial value 0xFFFF */ ++#define PARITY_CRC16_PR0_CCITT 4 /* CRC16, initial 0x0000, ITU-T version */ ++#define PARITY_CRC16_PR1_CCITT 5 /* CRC16, initial 0xFFFF, ITU-T version */ ++#define PARITY_CRC32_PR0_CCITT 6 /* CRC32, initial value 0x00000000 */ ++#define PARITY_CRC32_PR1_CCITT 7 /* CRC32, initial value 0xFFFFFFFF */ ++ ++#define LMI_DEFAULT 0 /* Default setting */ ++#define LMI_NONE 1 /* No LMI, all PVCs are static */ ++#define LMI_ANSI 2 /* ANSI Annex D */ ++#define LMI_CCITT 3 /* ITU-T Annex A */ ++#define LMI_CISCO 4 /* The "original" LMI, aka Gang of Four */ ++ ++#ifndef __ASSEMBLY__ ++ ++typedef struct { ++ unsigned int clock_rate; /* bits per second */ ++ unsigned int clock_type; /* internal, external, TX-internal etc. */ ++ unsigned short loopback; ++} sync_serial_settings; /* V.35, V.24, X.21 */ ++ ++typedef struct { ++ unsigned int clock_rate; /* bits per second */ ++ unsigned int clock_type; /* internal, external, TX-internal etc. */ ++ unsigned short loopback; ++ unsigned int slot_map; ++} te1_settings; /* T1, E1 */ ++ ++typedef struct { ++ unsigned short encoding; ++ unsigned short parity; ++} raw_hdlc_proto; ++ ++typedef struct { ++ unsigned int t391; ++ unsigned int t392; ++ unsigned int n391; ++ unsigned int n392; ++ unsigned int n393; ++ unsigned short lmi; ++ unsigned short dce; /* 1 for DCE (network side) operation */ ++} fr_proto; ++ ++typedef struct { ++ unsigned int dlci; ++} fr_proto_pvc; /* for creating/deleting FR PVCs */ ++ ++typedef struct { ++ unsigned int dlci; ++ char master[IFNAMSIZ]; /* Name of master FRAD device */ ++}fr_proto_pvc_info; /* for returning PVC information only */ ++ ++typedef struct { ++ unsigned int interval; ++ unsigned int timeout; ++} cisco_proto; ++ ++typedef struct { ++ unsigned short dce; /* 1 for DCE (network side) operation */ ++ unsigned int modulo; /* modulo (8 = basic / 128 = extended) */ ++ unsigned int window; /* frame window size */ ++ unsigned int t1; /* timeout t1 */ ++ unsigned int t2; /* timeout t2 */ ++ unsigned int n2; /* frame retry counter */ ++} x25_hdlc_proto; ++ ++/* PPP doesn't need any info now - supply length = 0 to ioctl */ ++ ++#endif /* __ASSEMBLY__ */ ++#endif /* __HDLC_IOCTL_H__ */ +--- /dev/null ++++ b/uapi/linux/if.h +@@ -0,0 +1,296 @@ ++/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ ++/* ++ * INET An implementation of the TCP/IP protocol suite for the LINUX ++ * operating system. INET is implemented using the BSD Socket ++ * interface as the means of communication with the user level. ++ * ++ * Global definitions for the INET interface module. ++ * ++ * Version: @(#)if.h 1.0.2 04/18/93 ++ * ++ * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1982-1988 ++ * Ross Biro ++ * Fred N. van Kempen, ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; either version ++ * 2 of the License, or (at your option) any later version. ++ */ ++#ifndef _LINUX_IF_H ++#define _LINUX_IF_H ++ ++#include /* for compatibility with glibc */ ++#include /* for "__kernel_caddr_t" et al */ ++#include /* for "struct sockaddr" et al */ ++ /* for "__user" et al */ ++ ++#include /* for struct sockaddr. */ ++ ++#if __UAPI_DEF_IF_IFNAMSIZ ++#define IFNAMSIZ 16 ++#endif /* __UAPI_DEF_IF_IFNAMSIZ */ ++#define IFALIASZ 256 ++#define ALTIFNAMSIZ 128 ++#include ++ ++/* For glibc compatibility. An empty enum does not compile. */ ++#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || \ ++ __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 ++/** ++ * enum net_device_flags - &struct net_device flags ++ * ++ * These are the &struct net_device flags, they can be set by drivers, the ++ * kernel and some can be triggered by userspace. Userspace can query and ++ * set these flags using userspace utilities but there is also a sysfs ++ * entry available for all dev flags which can be queried and set. These flags ++ * are shared for all types of net_devices. The sysfs entries are available ++ * via /sys/class/net//flags. Flags which can be toggled through sysfs ++ * are annotated below, note that only a few flags can be toggled and some ++ * other flags are always preserved from the original net_device flags ++ * even if you try to set them via sysfs. Flags which are always preserved ++ * are kept under the flag grouping @IFF_VOLATILE. Flags which are __volatile__ ++ * are annotated below as such. ++ * ++ * You should have a pretty good reason to be extending these flags. ++ * ++ * @IFF_UP: interface is up. Can be toggled through sysfs. ++ * @IFF_BROADCAST: broadcast address valid. Volatile. ++ * @IFF_DEBUG: turn on debugging. Can be toggled through sysfs. ++ * @IFF_LOOPBACK: is a loopback net. Volatile. ++ * @IFF_POINTOPOINT: interface is has p-p link. Volatile. ++ * @IFF_NOTRAILERS: avoid use of trailers. Can be toggled through sysfs. ++ * Volatile. ++ * @IFF_RUNNING: interface RFC2863 OPER_UP. Volatile. ++ * @IFF_NOARP: no ARP protocol. Can be toggled through sysfs. Volatile. ++ * @IFF_PROMISC: receive all packets. Can be toggled through sysfs. ++ * @IFF_ALLMULTI: receive all multicast packets. Can be toggled through ++ * sysfs. ++ * @IFF_MASTER: master of a load balancer. Volatile. ++ * @IFF_SLAVE: slave of a load balancer. Volatile. ++ * @IFF_MULTICAST: Supports multicast. Can be toggled through sysfs. ++ * @IFF_PORTSEL: can set media type. Can be toggled through sysfs. ++ * @IFF_AUTOMEDIA: auto media select active. Can be toggled through sysfs. ++ * @IFF_DYNAMIC: dialup device with changing addresses. Can be toggled ++ * through sysfs. ++ * @IFF_LOWER_UP: driver signals L1 up. Volatile. ++ * @IFF_DORMANT: driver signals dormant. Volatile. ++ * @IFF_ECHO: echo sent packets. Volatile. ++ */ ++enum net_device_flags { ++/* for compatibility with glibc net/if.h */ ++#if __UAPI_DEF_IF_NET_DEVICE_FLAGS ++ IFF_UP = 1<<0, /* sysfs */ ++ IFF_BROADCAST = 1<<1, /* __volatile__ */ ++ IFF_DEBUG = 1<<2, /* sysfs */ ++ IFF_LOOPBACK = 1<<3, /* __volatile__ */ ++ IFF_POINTOPOINT = 1<<4, /* __volatile__ */ ++ IFF_NOTRAILERS = 1<<5, /* sysfs */ ++ IFF_RUNNING = 1<<6, /* __volatile__ */ ++ IFF_NOARP = 1<<7, /* sysfs */ ++ IFF_PROMISC = 1<<8, /* sysfs */ ++ IFF_ALLMULTI = 1<<9, /* sysfs */ ++ IFF_MASTER = 1<<10, /* __volatile__ */ ++ IFF_SLAVE = 1<<11, /* __volatile__ */ ++ IFF_MULTICAST = 1<<12, /* sysfs */ ++ IFF_PORTSEL = 1<<13, /* sysfs */ ++ IFF_AUTOMEDIA = 1<<14, /* sysfs */ ++ IFF_DYNAMIC = 1<<15, /* sysfs */ ++#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */ ++#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO ++ IFF_LOWER_UP = 1<<16, /* __volatile__ */ ++ IFF_DORMANT = 1<<17, /* __volatile__ */ ++ IFF_ECHO = 1<<18, /* __volatile__ */ ++#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ ++}; ++#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0 */ ++ ++/* for compatibility with glibc net/if.h */ ++#if __UAPI_DEF_IF_NET_DEVICE_FLAGS ++#define IFF_UP IFF_UP ++#define IFF_BROADCAST IFF_BROADCAST ++#define IFF_DEBUG IFF_DEBUG ++#define IFF_LOOPBACK IFF_LOOPBACK ++#define IFF_POINTOPOINT IFF_POINTOPOINT ++#define IFF_NOTRAILERS IFF_NOTRAILERS ++#define IFF_RUNNING IFF_RUNNING ++#define IFF_NOARP IFF_NOARP ++#define IFF_PROMISC IFF_PROMISC ++#define IFF_ALLMULTI IFF_ALLMULTI ++#define IFF_MASTER IFF_MASTER ++#define IFF_SLAVE IFF_SLAVE ++#define IFF_MULTICAST IFF_MULTICAST ++#define IFF_PORTSEL IFF_PORTSEL ++#define IFF_AUTOMEDIA IFF_AUTOMEDIA ++#define IFF_DYNAMIC IFF_DYNAMIC ++#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS */ ++ ++#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO ++#define IFF_LOWER_UP IFF_LOWER_UP ++#define IFF_DORMANT IFF_DORMANT ++#define IFF_ECHO IFF_ECHO ++#endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ ++ ++#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ ++ IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) ++ ++#define IF_GET_IFACE 0x0001 /* for querying only */ ++#define IF_GET_PROTO 0x0002 ++ ++/* For definitions see hdlc.h */ ++#define IF_IFACE_V35 0x1000 /* V.35 serial interface */ ++#define IF_IFACE_V24 0x1001 /* V.24 serial interface */ ++#define IF_IFACE_X21 0x1002 /* X.21 serial interface */ ++#define IF_IFACE_T1 0x1003 /* T1 telco serial interface */ ++#define IF_IFACE_E1 0x1004 /* E1 telco serial interface */ ++#define IF_IFACE_SYNC_SERIAL 0x1005 /* can't be set by software */ ++#define IF_IFACE_X21D 0x1006 /* X.21 Dual Clocking (FarSite) */ ++ ++/* For definitions see hdlc.h */ ++#define IF_PROTO_HDLC 0x2000 /* raw HDLC protocol */ ++#define IF_PROTO_PPP 0x2001 /* PPP protocol */ ++#define IF_PROTO_CISCO 0x2002 /* Cisco HDLC protocol */ ++#define IF_PROTO_FR 0x2003 /* Frame Relay protocol */ ++#define IF_PROTO_FR_ADD_PVC 0x2004 /* Create FR PVC */ ++#define IF_PROTO_FR_DEL_PVC 0x2005 /* Delete FR PVC */ ++#define IF_PROTO_X25 0x2006 /* X.25 */ ++#define IF_PROTO_HDLC_ETH 0x2007 /* raw HDLC, Ethernet emulation */ ++#define IF_PROTO_FR_ADD_ETH_PVC 0x2008 /* Create FR Ethernet-bridged PVC */ ++#define IF_PROTO_FR_DEL_ETH_PVC 0x2009 /* Delete FR Ethernet-bridged PVC */ ++#define IF_PROTO_FR_PVC 0x200A /* for reading PVC status */ ++#define IF_PROTO_FR_ETH_PVC 0x200B ++#define IF_PROTO_RAW 0x200C /* RAW Socket */ ++ ++/* RFC 2863 operational status */ ++enum { ++ IF_OPER_UNKNOWN, ++ IF_OPER_NOTPRESENT, ++ IF_OPER_DOWN, ++ IF_OPER_LOWERLAYERDOWN, ++ IF_OPER_TESTING, ++ IF_OPER_DORMANT, ++ IF_OPER_UP, ++}; ++ ++/* link modes */ ++enum { ++ IF_LINK_MODE_DEFAULT, ++ IF_LINK_MODE_DORMANT, /* limit upward transition to dormant */ ++ IF_LINK_MODE_TESTING, /* limit upward transition to testing */ ++}; ++ ++/* ++ * Device mapping structure. I'd just gone off and designed a ++ * beautiful scheme using only loadable modules with arguments ++ * for driver options and along come the PCMCIA people 8) ++ * ++ * Ah well. The get() side of this is good for WDSETUP, and it'll ++ * be handy for debugging things. The set side is fine for now and ++ * being very small might be worth keeping for clean configuration. ++ */ ++ ++/* for compatibility with glibc net/if.h */ ++#if __UAPI_DEF_IF_IFMAP ++struct ifmap { ++ unsigned long mem_start; ++ unsigned long mem_end; ++ unsigned short base_addr; ++ unsigned char irq; ++ unsigned char dma; ++ unsigned char port; ++ /* 3 bytes spare */ ++}; ++#endif /* __UAPI_DEF_IF_IFMAP */ ++ ++struct if_settings { ++ unsigned int type; /* Type of physical device or protocol */ ++ unsigned int size; /* Size of the data allocated by the caller */ ++ union { ++ /* {atm/eth/dsl}_settings anyone ? */ ++ raw_hdlc_proto *raw_hdlc; ++ cisco_proto *cisco; ++ fr_proto *fr; ++ fr_proto_pvc *fr_pvc; ++ fr_proto_pvc_info *fr_pvc_info; ++ x25_hdlc_proto *x25; ++ ++ /* interface settings */ ++ sync_serial_settings *sync; ++ te1_settings *te1; ++ } ifs_ifsu; ++}; ++ ++/* ++ * Interface request structure used for socket ++ * ioctl's. All interface ioctl's must have parameter ++ * definitions which begin with ifr_name. The ++ * remainder may be interface specific. ++ */ ++ ++/* for compatibility with glibc net/if.h */ ++#if __UAPI_DEF_IF_IFREQ ++struct ifreq { ++#define IFHWADDRLEN 6 ++ union ++ { ++ char ifrn_name[IFNAMSIZ]; /* if name, e.g. "en0" */ ++ } ifr_ifrn; ++ ++ union { ++ struct sockaddr ifru_addr; ++ struct sockaddr ifru_dstaddr; ++ struct sockaddr ifru_broadaddr; ++ struct sockaddr ifru_netmask; ++ struct sockaddr ifru_hwaddr; ++ short ifru_flags; ++ int ifru_ivalue; ++ int ifru_mtu; ++ struct ifmap ifru_map; ++ char ifru_slave[IFNAMSIZ]; /* Just fits the size */ ++ char ifru_newname[IFNAMSIZ]; ++ void * ifru_data; ++ struct if_settings ifru_settings; ++ } ifr_ifru; ++}; ++#endif /* __UAPI_DEF_IF_IFREQ */ ++ ++#define ifr_name ifr_ifrn.ifrn_name /* interface name */ ++#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ ++#define ifr_addr ifr_ifru.ifru_addr /* address */ ++#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-p lnk */ ++#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ ++#define ifr_netmask ifr_ifru.ifru_netmask /* interface net mask */ ++#define ifr_flags ifr_ifru.ifru_flags /* flags */ ++#define ifr_metric ifr_ifru.ifru_ivalue /* metric */ ++#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ ++#define ifr_map ifr_ifru.ifru_map /* device map */ ++#define ifr_slave ifr_ifru.ifru_slave /* slave device */ ++#define ifr_data ifr_ifru.ifru_data /* for use by interface */ ++#define ifr_ifindex ifr_ifru.ifru_ivalue /* interface index */ ++#define ifr_bandwidth ifr_ifru.ifru_ivalue /* link bandwidth */ ++#define ifr_qlen ifr_ifru.ifru_ivalue /* Queue length */ ++#define ifr_newname ifr_ifru.ifru_newname /* New name */ ++#define ifr_settings ifr_ifru.ifru_settings /* Device/proto settings*/ ++ ++/* ++ * Structure used in SIOCGIFCONF request. ++ * Used to retrieve interface configuration ++ * for machine (useful for programs which ++ * must know all networks accessible). ++ */ ++ ++/* for compatibility with glibc net/if.h */ ++#if __UAPI_DEF_IF_IFCONF ++struct ifconf { ++ int ifc_len; /* size of buffer */ ++ union { ++ char *ifcu_buf; ++ struct ifreq *ifcu_req; ++ } ifc_ifcu; ++}; ++#endif /* __UAPI_DEF_IF_IFCONF */ ++ ++#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ ++#define ifc_req ifc_ifcu.ifcu_req /* array of structures */ ++ ++#endif /* _LINUX_IF_H */ diff --git a/package/network/utils/ethtool/patches/101-netlink-Fix-maybe-uninitialized-meters-variable.patch b/package/network/utils/ethtool/patches/101-netlink-Fix-maybe-uninitialized-meters-variable.patch new file mode 100644 index 00000000000..381b949edeb --- /dev/null +++ b/package/network/utils/ethtool/patches/101-netlink-Fix-maybe-uninitialized-meters-variable.patch @@ -0,0 +1,25 @@ +From: Florian Fainelli +To: netdev@vger.kernel.org +Subject: [PATCH ethtool v2 2/3] netlink: Fix maybe uninitialized 'meters' variable +Date: Sat, 14 Jan 2023 08:34:10 -0800 + +GCC12 warns that 'meters' may be uninitialized, initialize it +accordingly. + +Fixes: 9561db9b76f4 ("Add cable test TDR support") +Signed-off-by: Florian Fainelli +--- + netlink/parser.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/netlink/parser.c ++++ b/netlink/parser.c +@@ -237,7 +237,7 @@ int nl_parse_direct_m2cm(struct nl_conte + struct nl_msg_buff *msgbuff, void *dest) + { + const char *arg = *nlctx->argp; +- float meters; ++ float meters = 0.0; + uint32_t cm; + int ret; + diff --git a/package/network/utils/ethtool/patches/102-raw-marvell-c-Fix-build-with-musl-libc.patch b/package/network/utils/ethtool/patches/102-raw-marvell-c-Fix-build-with-musl-libc.patch new file mode 100644 index 00000000000..33b1715967e --- /dev/null +++ b/package/network/utils/ethtool/patches/102-raw-marvell-c-Fix-build-with-musl-libc.patch @@ -0,0 +1,63 @@ +From: Florian Fainelli +To: netdev@vger.kernel.org +Subject: [PATCH ethtool v2 3/3] marvell.c: Fix build with musl-libc +Date: Sat, 14 Jan 2023 08:34:11 -0800 + +After commit 1fa60003a8b8 ("misc: header includes cleanup") we stopped +including net/if.h which resolved the proper defines to pull in +sys/types.h and provide a definition for u_int32_t. With musl-libc we +would need to define _GNU_SOURCE to ensure that sys/types.h does provide a +definition for u_int32_t. + +Rather, just replace u_uint{16,32}_t with the more standard +uint{16,32}_t types from stdint.h + +Fixes: 1fa60003a8b8 ("misc: header includes cleanup") +Signed-off-by: Florian Fainelli +--- + marvell.c | 34 +++++++++++++++++----------------- + 1 file changed, 17 insertions(+), 17 deletions(-) + +--- a/marvell.c ++++ b/marvell.c +@@ -31,23 +31,23 @@ static void dump_timer(const char *name, + static void dump_queue(const char *name, const void *a, int rx) + { + struct desc { +- u_int32_t ctl; +- u_int32_t next; +- u_int32_t data_lo; +- u_int32_t data_hi; +- u_int32_t status; +- u_int32_t timestamp; +- u_int16_t csum2; +- u_int16_t csum1; +- u_int16_t csum2_start; +- u_int16_t csum1_start; +- u_int32_t addr_lo; +- u_int32_t addr_hi; +- u_int32_t count_lo; +- u_int32_t count_hi; +- u_int32_t byte_count; +- u_int32_t csr; +- u_int32_t flag; ++ uint32_t ctl; ++ uint32_t next; ++ uint32_t data_lo; ++ uint32_t data_hi; ++ uint32_t status; ++ uint32_t timestamp; ++ uint16_t csum2; ++ uint16_t csum1; ++ uint16_t csum2_start; ++ uint16_t csum1_start; ++ uint32_t addr_lo; ++ uint32_t addr_hi; ++ uint32_t count_lo; ++ uint32_t count_hi; ++ uint32_t byte_count; ++ uint32_t csr; ++ uint32_t flag; + }; + const struct desc *d = a; + From 290a6527bea2b2031e8f87387247fe96cfa833c0 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 25 Jan 2023 13:02:56 -0500 Subject: [PATCH 072/104] ath79: add pcie1 wifi device to Senao qca955x AP DTSI Each individual device DTS now enables either pcie0 or pcie1. Signed-off-by: Michael Pratt --- .../ath79/dts/qca9557_araknis_an-500-ap-i-ac.dts | 4 ++++ target/linux/ath79/dts/qca9557_engenius_eap1200h.dts | 6 +++++- .../ath79/dts/qca9557_engenius_enstationac-v1.dts | 4 ++++ .../linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts | 4 ++++ .../ath79/dts/qca9558_araknis_an-700-ap-i-ac.dts | 4 ++++ target/linux/ath79/dts/qca9558_engenius_eap1750h.dts | 6 +++++- target/linux/ath79/dts/qca9558_watchguard_ap300.dts | 4 ++++ target/linux/ath79/dts/qca955x_senao_loader.dtsi | 11 ++++++++--- 8 files changed, 38 insertions(+), 5 deletions(-) diff --git a/target/linux/ath79/dts/qca9557_araknis_an-500-ap-i-ac.dts b/target/linux/ath79/dts/qca9557_araknis_an-500-ap-i-ac.dts index 419e77c4f85..bd9f3e8da8a 100644 --- a/target/linux/ath79/dts/qca9557_araknis_an-500-ap-i-ac.dts +++ b/target/linux/ath79/dts/qca9557_araknis_an-500-ap-i-ac.dts @@ -94,6 +94,10 @@ mac-address-increment = <1>; }; +&pcie0 { + status = "okay"; +}; + &art { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/ath79/dts/qca9557_engenius_eap1200h.dts b/target/linux/ath79/dts/qca9557_engenius_eap1200h.dts index beb3e5ee075..d20a0444753 100644 --- a/target/linux/ath79/dts/qca9557_engenius_eap1200h.dts +++ b/target/linux/ath79/dts/qca9557_engenius_eap1200h.dts @@ -110,10 +110,14 @@ mac-address-increment = <1>; }; -&ath10k { +&ath10k_0 { status = "okay"; nvmem-cells = <&macaddr_art_0>, <&calibration_art_5000>; nvmem-cell-names = "mac-address", "calibration"; mac-address-increment = <2>; }; + +&pcie0 { + status = "okay"; +}; diff --git a/target/linux/ath79/dts/qca9557_engenius_enstationac-v1.dts b/target/linux/ath79/dts/qca9557_engenius_enstationac-v1.dts index 812fcfc5dcb..12740b9bdf7 100644 --- a/target/linux/ath79/dts/qca9557_engenius_enstationac-v1.dts +++ b/target/linux/ath79/dts/qca9557_engenius_enstationac-v1.dts @@ -111,6 +111,10 @@ qca955x-sgmii-fixup; }; +&pcie0 { + status = "okay"; +}; + &art { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts b/target/linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts index aa1f4ad02bd..c8b1d94c965 100644 --- a/target/linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts +++ b/target/linux/ath79/dts/qca9558_allnet_all-wap02860ac.dts @@ -95,6 +95,10 @@ mac-address-increment = <1>; }; +&pcie0 { + status = "okay"; +}; + &art { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/ath79/dts/qca9558_araknis_an-700-ap-i-ac.dts b/target/linux/ath79/dts/qca9558_araknis_an-700-ap-i-ac.dts index 304eac5e62f..520ca60144b 100644 --- a/target/linux/ath79/dts/qca9558_araknis_an-700-ap-i-ac.dts +++ b/target/linux/ath79/dts/qca9558_araknis_an-700-ap-i-ac.dts @@ -93,6 +93,10 @@ mac-address-increment = <1>; }; +&pcie0 { + status = "okay"; +}; + &art { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/ath79/dts/qca9558_engenius_eap1750h.dts b/target/linux/ath79/dts/qca9558_engenius_eap1750h.dts index 605030455c4..e17eda3840b 100644 --- a/target/linux/ath79/dts/qca9558_engenius_eap1750h.dts +++ b/target/linux/ath79/dts/qca9558_engenius_eap1750h.dts @@ -110,10 +110,14 @@ mac-address-increment = <1>; }; -&ath10k { +&ath10k_0 { status = "okay"; nvmem-cells = <&macaddr_art_0>, <&calibration_art_5000>; nvmem-cell-names = "mac-address", "calibration"; mac-address-increment = <2>; }; + +&pcie0 { + status = "okay"; +}; diff --git a/target/linux/ath79/dts/qca9558_watchguard_ap300.dts b/target/linux/ath79/dts/qca9558_watchguard_ap300.dts index 90f5cddfa77..799883c350f 100644 --- a/target/linux/ath79/dts/qca9558_watchguard_ap300.dts +++ b/target/linux/ath79/dts/qca9558_watchguard_ap300.dts @@ -121,6 +121,10 @@ mac-address-increment = <1>; }; +&pcie0 { + status = "okay"; +}; + &art { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/ath79/dts/qca955x_senao_loader.dtsi b/target/linux/ath79/dts/qca955x_senao_loader.dtsi index 5a8c4fb799f..cf82c050b6d 100644 --- a/target/linux/ath79/dts/qca955x_senao_loader.dtsi +++ b/target/linux/ath79/dts/qca955x_senao_loader.dtsi @@ -26,14 +26,19 @@ }; &pcie0 { - status = "okay"; - - ath10k: wifi@0,0,0 { + ath10k_0: wifi@0,0,0 { compatible = "qcom,ath10k"; reg = <0x0 0 0 0 0>; }; }; +&pcie1 { + ath10k_1: wifi@0,1,0 { + compatible = "qcom,ath10k"; + reg = <0x0 1 0 0 0>; + }; +}; + &spi { status = "okay"; From 52992efc345b693486e102a631953600ee7c0ba8 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 13 Jan 2023 00:37:10 -0500 Subject: [PATCH 073/104] ath79: add support for Senao Engenius EWS660AP FCC ID: A8J-EWS660AP Engenius EWS660AP is an outdoor wireless access point with 2 gigabit ethernet ports, dual-band wireless, internal antenna plates, and 802.3at PoE+ **Specification:** - QCA9558 SOC 2.4 GHz, 3x3 - QCA9880 WLAN mini PCIe card, 5 GHz, 3x3, 26dBm - AR8035-A PHY RGMII GbE with PoE+ IN - AR8033 PHY SGMII GbE with PoE+ OUT - 40 MHz clock - 16 MB FLASH MX25L12845EMI-10G - 2x 64 MB RAM - UART at J1 populated, RX grounded - 6 internal antenna plates (5 dbi, omni-directional) - 5 LEDs, 1 button (power, eth0, eth1, 2G, 5G) (reset) **MAC addresses:** Base MAC addressed labeled as "MAC" Only one Vendor MAC address in flash eth0 *:d4 MAC art 0x0 eth1 *:d5 --- art 0x0 +1 phy1 *:d6 --- art 0x0 +2 phy0 *:d7 --- art 0x0 +3 **Serial Access:** the RX line on the board for UART is shorted to ground by resistor R176 therefore it must be removed to use the console but it is not necessary to remove to view boot log optionally, R175 can be replaced with a solder bridge short the resistors R175 and R176 are next to the UART RX pin **Installation:** 2 ways to flash factory.bin from OEM: Method 1: Firmware upgrade page: OEM webpage at 192.168.1.1 username and password "admin" Navigate to "Firmware Upgrade" page from left pane Click Browse and select the factory.bin image Upload and verify checksum Click Continue to confirm and wait 3 minutes Method 2: Serial to load Failsafe webpage: After connecting to serial console and rebooting... Interrupt uboot with any key pressed rapidly execute `run failsafe_boot` OR `bootm 0x9fd70000` wait a minute connect to ethernet and navigate to "192.168.1.1/index.htm" Select the factory.bin image and upload wait about 3 minutes **Return to OEM:** If you have a serial cable, see Serial Failsafe instructions otherwise, uboot-env can be used to make uboot load the failsafe image ssh into openwrt and run `fw_setenv rootfs_checksum 0` reboot, wait 3 minutes connect to ethernet and navigate to 192.168.1.1/index.htm select OEM firmware image from Engenius and click upgrade **TFTP recovery:** Requires serial console, reset button does nothing rename initramfs.bin to '0101A8C0.img' make available on TFTP server at 192.168.1.101 power board, interrupt boot execute tftpboot and bootm 0x81000000 **Format of OEM firmware image:** The OEM software of EWS660AP is a heavily modified version of Openwrt Kamikaze. One of the many modifications is to the sysupgrade program. Image verification is performed simply by the successful ungzip and untar of the supplied file and name check and header verification of the resulting contents. To form a factory.bin that is accepted by OEM Openwrt build, the kernel and rootfs must have specific names... openwrt-ar71xx-generic-ews660ap-uImage-lzma.bin openwrt-ar71xx-generic-ews660ap-root.squashfs and begin with the respective headers (uImage, squashfs). Then the files must be tarballed and gzipped. The resulting binary is actually a tar.gz file in disguise. This can be verified by using binwalk on the OEM firmware images, ungzipping then untaring. Newer EnGenius software requires more checks but their script includes a way to skip them, otherwise the tar must include a text file with the version and md5sums in a deprecated format. The OEM upgrade script is at /etc/fwupgrade.sh. OKLI kernel loader is required because the OEM software expects the kernel to be no greater than 1536k and the factory.bin upgrade procedure would otherwise overwrite part of the kernel when writing rootfs. Note on PLL-data cells: The default PLL register values will not work because of the external AR8035 switch between the SOC and the ethernet port. For QCA955x series, the PLL registers for eth0 and eth1 can be see in the DTSI as 0x28 and 0x48 respectively. Therefore the PLL registers can be read from uboot for each link speed after attempting tftpboot or another network action using that link speed with `md 0x18050028 1` and `md 0x18050048 1`. The clock delay required for RGMII can be applied at the PHY side, using the at803x driver `phy-mode`. Therefore the PLL registers for GMAC0 do not need the bits for delay on the MAC side. This is possible due to fixes in at803x driver since Linux 5.1 and 5.3 Tested-by: Niklas Arnitz Signed-off-by: Michael Pratt --- package/boot/uboot-envtools/files/ath79 | 1 + .../ath79/dts/qca9558_engenius_ews660ap.dts | 132 ++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 1 + .../base-files/lib/upgrade/platform.sh | 1 + target/linux/ath79/image/generic.mk | 12 ++ 5 files changed, 147 insertions(+) create mode 100644 target/linux/ath79/dts/qca9558_engenius_ews660ap.dts diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index 71dd104f55f..0510a4b51a8 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -38,6 +38,7 @@ engenius,ecb600|\ engenius,enh202-v1|\ engenius,ens202ext-v1|\ engenius,enstationac-v1|\ +engenius,ews660ap|\ etactica,eg200|\ glinet,gl-ar750s-nor|\ glinet,gl-ar750s-nor-nand|\ diff --git a/target/linux/ath79/dts/qca9558_engenius_ews660ap.dts b/target/linux/ath79/dts/qca9558_engenius_ews660ap.dts new file mode 100644 index 00000000000..eca3a6091f7 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_engenius_ews660ap.dts @@ -0,0 +1,132 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x_senao_loader.dtsi" + +#include +#include + +/ { + compatible = "engenius,ews660ap", "qca,qca9558"; + model = "EnGenius EWS660AP"; + + aliases { + label-mac-device = ð0; + led-boot = &led_wifi5g; + led-failsafe = &led_wifi5g; + led-upgrade = &led_wifi5g; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 21 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + wifi2g { + label = "green:wifi2g"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + + led_wifi5g: wifi5g { + label = "green:wifi5g"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + }; +}; + +&partitions { + partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + calibration_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + + calibration_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy1: ethernet-phy@1 { + reg = <1>; + eee-broken-100tx; + eee-broken-1000t; + }; + + phy2: ethernet-phy@2 { + reg = <2>; + eee-broken-100tx; + eee-broken-1000t; + at803x-override-sgmii-link-check; + }; +}; + +ð0 { + status = "okay"; + + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + + phy-handle = <&phy1>; + phy-mode = "rgmii-id"; + + pll-data = <0x82000000 0x80000101 0x80001313>; +}; + +ð1 { + status = "okay"; + + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + + phy-handle = <&phy2>; + + pll-data = <0x03000000 0x00000101 0x00001313>; + + qca955x-sgmii-fixup; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&macaddr_art_0>, <&calibration_art_1000>; + nvmem-cell-names = "mac-address", "calibration"; + mac-address-increment = <2>; +}; + +&ath10k_1 { + status = "okay"; + + nvmem-cells = <&macaddr_art_0>, <&calibration_art_5000>; + nvmem-cell-names = "mac-address", "calibration"; + mac-address-increment = <3>; +}; + +&pcie1 { + status = "okay"; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 610e70e5007..5db3a2d3c4a 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -136,6 +136,7 @@ ath79_setup_interfaces() devolo,dvl1750e|\ engenius,enstationac-v1|\ engenius,ews511ap|\ + engenius,ews660ap|\ ocedo,ursus|\ ruckus,zf7372|\ ubnt,unifi-ap-outdoor-plus) diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh index d03163a8eaf..67a3635075b 100644 --- a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh @@ -42,6 +42,7 @@ platform_do_upgrade() { engenius,ecb600|\ engenius,ens202ext-v1|\ engenius,enstationac-v1|\ + engenius,ews660ap|\ watchguard,ap100|\ watchguard,ap200|\ watchguard,ap300) diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 3e32a08295b..b3b510a2ec4 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1308,6 +1308,18 @@ define Device/engenius_ews511ap endef TARGET_DEVICES += engenius_ews511ap +define Device/engenius_ews660ap + $(Device/senao_loader_okli) + SOC := qca9558 + DEVICE_VENDOR := EnGenius + DEVICE_MODEL := EWS660AP + DEVICE_PACKAGES := ath10k-firmware-qca988x-ct kmod-ath10k-ct + IMAGE_SIZE := 11584k + LOADER_FLASH_OFFS := 0x220000 + SENAO_IMGNAME := ar71xx-generic-ews660ap +endef +TARGET_DEVICES += engenius_ews660ap + define Device/enterasys_ws-ap3705i SOC := ar9344 DEVICE_VENDOR := Enterasys From a911f63df9bade09e950059b4ed3222e4d278fab Mon Sep 17 00:00:00 2001 From: Daniel Groth Date: Sat, 14 Jan 2023 15:32:00 +0100 Subject: [PATCH 074/104] realtek: dgs-1210-10mp: update sfp phy-handle Adjust the wrong phy-handle definitions for the sfp ports so that they match the correct switch ports. Fixes: 89eb8b50d18d ("realtek: dgs-1210-10mp: add full sfp description") Signed-off-by: Daniel Groth --- .../linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts | 4 ++-- .../linux/realtek/dts-5.15/rtl8380_d-link_dgs-1210-10mp-f.dts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts index 39e37ee5959..664cab59998 100644 --- a/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts +++ b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10mp-f.dts @@ -112,7 +112,7 @@ port@24 { reg = <24>; label = "lan9"; - phy-handle = <14>; + phy-handle = <&phy24>; phy-mode = "1000base-x"; managed = "in-band-status"; sfp = <&sfp0>; @@ -121,7 +121,7 @@ port@26 { reg = <26>; label = "lan10"; - phy-handle = <15>; + phy-handle = <&phy26>; phy-mode = "1000base-x"; managed = "in-band-status"; sfp = <&sfp1>; diff --git a/target/linux/realtek/dts-5.15/rtl8380_d-link_dgs-1210-10mp-f.dts b/target/linux/realtek/dts-5.15/rtl8380_d-link_dgs-1210-10mp-f.dts index 39e37ee5959..664cab59998 100644 --- a/target/linux/realtek/dts-5.15/rtl8380_d-link_dgs-1210-10mp-f.dts +++ b/target/linux/realtek/dts-5.15/rtl8380_d-link_dgs-1210-10mp-f.dts @@ -112,7 +112,7 @@ port@24 { reg = <24>; label = "lan9"; - phy-handle = <14>; + phy-handle = <&phy24>; phy-mode = "1000base-x"; managed = "in-band-status"; sfp = <&sfp0>; @@ -121,7 +121,7 @@ port@26 { reg = <26>; label = "lan10"; - phy-handle = <15>; + phy-handle = <&phy26>; phy-mode = "1000base-x"; managed = "in-band-status"; sfp = <&sfp1>; From f83f5f8452edd3115aacf333b0038da89639a218 Mon Sep 17 00:00:00 2001 From: Tom Herbers Date: Tue, 24 Jan 2023 14:14:58 +0100 Subject: [PATCH 075/104] ath79: add label-mac-device for GL-XE300 This adds an label-mac-device alias which refrences the mac which is printed on the Label of the device. Signed-off-by: Tom Herbers --- target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts b/target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts index 9c2760398bd..9212c0a7548 100644 --- a/target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts +++ b/target/linux/ath79/dts/qca9531_glinet_gl-xe300.dts @@ -9,6 +9,10 @@ compatible = "glinet,gl-xe300", "qca,qca9531"; model = "GL.iNet GL-XE300"; + aliases { + label-mac-device = ð0; + }; + gpio-export { compatible = "gpio-export"; From a7f3a51982be34270d9b10283f6d188bd54fc7a1 Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Tue, 6 Dec 2022 16:39:27 -0800 Subject: [PATCH 076/104] kernel: add kmod-lib-842 "842" is a compression scheme and this is the software implementation which is too slow to really use beyond a proof of concept. It can be selected in ZRAM, ZSWAP, or `fs/pstore`, and is here for completeness. In general you need a Power8 or better with 842-in-hardware for it to be fast, but other 842-accelerators are emerging. Signed-off-by: Tony Butler --- package/kernel/linux/modules/lib.mk | 22 ++++++++++++++++++++++ target/linux/generic/config-5.15 | 1 + 2 files changed, 23 insertions(+) diff --git a/package/kernel/linux/modules/lib.mk b/package/kernel/linux/modules/lib.mk index d4d44ad8f0a..299c5a8c354 100644 --- a/package/kernel/linux/modules/lib.mk +++ b/package/kernel/linux/modules/lib.mk @@ -170,6 +170,28 @@ endef $(eval $(call KernelPackage,lib-lz4)) +define KernelPackage/lib-842 + SUBMENU:=$(LIB_MENU) + TITLE:=842 support + DEPENDS:=+kmod-crypto-acompress +kmod-crypto-crc32 + KCONFIG:= \ + CONFIG_CRYPTO_842 \ + CONFIG_842_COMPRESS \ + CONFIG_842_DECOMPRESS + FILES:= \ + $(LINUX_DIR)/crypto/842.ko \ + $(LINUX_DIR)/lib/842/842_compress.ko \ + $(LINUX_DIR)/lib/842/842_decompress.ko + AUTOLOAD:=$(call AutoProbe,842 842_compress 842_decompress) +endef + +define KernelPackage/lib-842/description + Kernel module for 842 compression/decompression support +endef + +$(eval $(call KernelPackage,lib-842)) + + define KernelPackage/lib-raid6 SUBMENU:=$(LIB_MENU) TITLE:=RAID6 algorithm support diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index 878a60e66bc..bd27f74d73c 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -7562,6 +7562,7 @@ CONFIG_ZONE_DMA=y # CONFIG_ZPA2326 is not set # CONFIG_ZPOOL is not set # CONFIG_ZRAM is not set +# CONFIG_ZRAM_DEF_COMP_842 is not set # CONFIG_ZRAM_DEF_COMP_LZ4 is not set # CONFIG_ZRAM_DEF_COMP_LZ4HC is not set # CONFIG_ZRAM_DEF_COMP_LZO is not set From 2a20dc717a897efe54f241636ee1566b695dbc7d Mon Sep 17 00:00:00 2001 From: Edward Chow Date: Mon, 2 Jan 2023 19:24:20 +0800 Subject: [PATCH 077/104] ath79: calibrate dlink dir-825 c1 and dir-835 a1 with nvmem Driver for both soc (2.4GHz Wifi) and pci (5 GHz) now pull the calibration data from the nvmem subsystem. This allows us to move the userspace caldata extraction for the pci-e ath9k supported wifi into the device-tree definition of the device. Currently, "mac-address-ascii" cells only works for ethernet and wmac devices, so PCI ath9k device uses the old method to calibrate. Signed-off-by: Edward Chow --- .../linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi | 42 +++++++++++++++++-- .../generic/base-files/etc/board.d/02_network | 1 - .../etc/hotplug.d/firmware/10-ath9k-eeprom | 4 +- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi b/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi index 33c75f49675..8e21b0dd9e8 100644 --- a/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi +++ b/target/linux/ath79/dts/ar9344_dlink_dir-8x5.dtsi @@ -29,6 +29,9 @@ /* default for ar934x, except for 1000M */ pll-data = <0x06000000 0x00000101 0x00001616>; + nvmem-cells = <&macaddr_lan>; + nvmem-cell-names = "mac-address-ascii"; + phy-mode = "rgmii"; phy-handle = <&phy0>; }; @@ -55,7 +58,13 @@ ath9k: wifi@0,0 { compatible = "pci168c,0030"; reg = <0x0000 0 0 0 0>; - qca,no-eeprom; + /* "mac-address-ascii" currently does not work for + ath9k pci devices. these below are retained for future + improvements. */ + /* nvmem-cells = <&macaddr_wan>, <&cal_art_5000>; + nvmem-cell-names = "mac-address-ascii", "calibration"; + mac-address-increment = <1>; */ + qca,no-eeprom; /* remove this when "mac-address-ascii" works */ gpio-controller; #gpio-cells = <2>; }; @@ -102,16 +111,40 @@ read-only; }; - partition@fe0000 { + mac: partition@fe0000 { label = "mac"; reg = <0xfe0000 0x010000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_lan: macaddr@4 { + reg = <0x4 0x11>; + }; + + macaddr_wan: macaddr@18 { + reg = <0x18 0x11>; + }; }; - partition@ff0000 { + art: partition@ff0000 { label = "art"; reg = <0xff0000 0x010000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_1000: cal@1000 { + reg = <0x1000 0x440>; + }; + + cal_art_5000: cal@5000 { + reg = <0x5000 0x440>; + }; }; }; }; @@ -127,5 +160,6 @@ &wmac { status = "okay"; - qca,no-eeprom; + nvmem-cells = <&macaddr_lan>, <&cal_art_1000>; + nvmem-cell-names = "mac-address-ascii", "calibration"; }; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 5db3a2d3c4a..3330cd2b0ae 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -639,7 +639,6 @@ ath79_setup_macs() ;; dlink,dir-825-c1|\ dlink,dir-835-a1) - lan_mac=$(mtd_get_mac_text "mac" 0x4) wan_mac=$(mtd_get_mac_text "mac" 0x18) ;; dlink,dir-842-c1|\ diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 961f5f46aa0..14c8eb7d642 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -23,9 +23,7 @@ case "$FIRMWARE" in avm,fritzdvbc) caldata_extract_reverse "urlader" 0x1541 0x440 ;; - dlink,dir-505|\ - dlink,dir-825-c1|\ - dlink,dir-835-a1) + dlink,dir-505) caldata_extract "art" 0x1000 0x440 ath9k_patch_mac $(mtd_get_mac_text "mac" 0x4) ;; From c7059c56a85567ce6bc943960168b19e2572508b Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Fri, 20 Jan 2023 03:16:33 +0000 Subject: [PATCH 078/104] ath79: improve support for Letv LBA-047-CH 1. Convert wireless calibration data to NVMEM. 2. Enable control green status LED and change default LED behaviors. The three LEDs of LBA-047-CH are in the same position, and the green LED will be completely covered by the other two LEDs. So don's use green LED as WAN indicator to ensure that only one LED is on at a time. LED Factory OpenWrt blue internet fail failsafe && upgrade green internet okay run red boot boot 3. Reduce the SPI clock to 30 MHz because the ath79 target does not support 50 MHz SPI operation well. Keep the fast-read support to ensure the spi-mem feature (b3f9842330) is enabled. 4. Remove unused package "uboot-envtools". 5. Split the factory image into two parts: rootfs and kernel. This change can reduce the factory image size and allow users to upgrade the OpenWrt kernel loader uImage (OKLI) independently. The new installation method: First, rename "squashfs-kernel.bin" to "openwrt-ar71xx-generic-ap147-16M-kernel.bin" and rename "rootfs.bin" to "openwrt-ar71xx-generic-ap147-16M-rootfs-squashfs.bin". Then we can press reset button for about 5 seconds to enter tftp download mode. Finally, set IP address to 192.168.67.100 and upload the above two parts via tftp server. Tested on Letv LBA-047-CH Signed-off-by: Shiji Yang --- .../ath79/dts/qca9531_letv_lba-047-ch.dts | 71 ++++++++++--------- target/linux/ath79/image/generic.mk | 10 +-- 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/target/linux/ath79/dts/qca9531_letv_lba-047-ch.dts b/target/linux/ath79/dts/qca9531_letv_lba-047-ch.dts index d65417c0d52..586facc9e5b 100644 --- a/target/linux/ath79/dts/qca9531_letv_lba-047-ch.dts +++ b/target/linux/ath79/dts/qca9531_letv_lba-047-ch.dts @@ -4,6 +4,7 @@ #include #include +#include #include / { @@ -11,11 +12,11 @@ compatible = "letv,lba-047-ch", "qca,qca9531"; aliases { - led-boot = &led_status_red; - led-failsafe = &led_status_red; - led-running = &led_status_blue; - led-upgrade = &led_status_red; label-mac-device = ð0; + led-boot = &led_status_red; + led-failsafe = &led_status_blue; + led-running = &led_status_green; + led-upgrade = &led_status_blue; }; keys { @@ -31,16 +32,24 @@ leds { compatible = "gpio-leds"; - pinctrl-names = "default"; - pinctrl-0 = <&led_wan_pin>; - - led_status_blue: status_blue { + led_status_blue: led-0 { label = "blue:status"; + color = ; + function = LED_FUNCTION_STATUS; gpios = <&gpio 13 GPIO_ACTIVE_LOW>; }; - led_status_red: status_red { + led_status_green: led-1 { + label = "green:status"; + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + led_status_red: led-2 { label = "red:status"; + color = ; + function = LED_FUNCTION_STATUS; gpios = <&gpio 11 GPIO_ACTIVE_LOW>; }; }; @@ -64,20 +73,13 @@ }; }; -&pinmux { - /* GPIO 4: LED_LINK_5 (WAN) */ - led_wan_pin: pinmux_led_wan_pin { - pinctrl-single,bits = <0x04 0x0000002d 0x000000ff>; - }; -}; - &spi { status = "okay"; flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <50000000>; + spi-max-frequency = <30000000>; m25p,fast-read; partitions { @@ -112,10 +114,26 @@ reg = <0xe90000 0x160000>; }; - art: partition@ff0000 { + partition@ff0000 { label = "art"; reg = <0xff0000 0x10000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_art_6: macaddr@6 { + reg = <0x6 0x6>; + }; + + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; }; }; }; @@ -140,19 +158,6 @@ &wmac { status = "okay"; - mtd-cal-data = <&art 0x1000>; -}; - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_0: macaddr@0 { - reg = <0x0 0x6>; - }; - - macaddr_art_6: macaddr@6 { - reg = <0x6 0x6>; - }; + nvmem-cells = <&cal_art_1000>; + nvmem-cell-names = "calibration"; }; diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index b3b510a2ec4..0837d37a307 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1645,13 +1645,15 @@ define Device/letv_lba-047-ch SOC := qca9531 DEVICE_VENDOR := Letv DEVICE_MODEL := LBA-047-CH + DEVICE_PACKAGES := -uboot-envtools + FACTORY_SIZE := 14528k IMAGE_SIZE := 15936k LOADER_FLASH_OFFS := 0x50000 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 - IMAGES += factory.bin - IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ - append-rootfs | pad-rootfs | check-size | pad-to 14528k | \ - append-loader-okli-uimage $(1) | pad-to 64k + IMAGES += kernel.bin rootfs.bin + IMAGE/kernel.bin := append-loader-okli-uimage $(1) | pad-to 64k + IMAGE/rootfs.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | check-size $$$$(FACTORY_SIZE) endef TARGET_DEVICES += letv_lba-047-ch From 67f283be4430ebfb46be6c00fcc7c12a6adabce3 Mon Sep 17 00:00:00 2001 From: Tom Herbers Date: Sat, 10 Sep 2022 16:45:42 +0200 Subject: [PATCH 079/104] ath79: add LTE packages for GL-XE300 Add LTE packages required for operating the LTE modems shipped with the GL-XE300. Example configuration for an unauthenticated dual-stack APN: network.wwan0=interface network.wwan0.proto='qmi' network.wwan0.device='/dev/cdc-wdm0' network.wwan0.apn='internet' network.wwan0.auth='none' network.wwan0.delay='10' network.wwan0.pdptype='IPV4V6' Signed-off-by: Tom Herbers --- target/linux/ath79/image/nand.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index ee14c005ccc..c83beef952d 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -199,7 +199,8 @@ define Device/glinet_gl-xe300 SOC := qca9531 DEVICE_VENDOR := GL.iNet DEVICE_MODEL := GL-XE300 - DEVICE_PACKAGES := kmod-usb2 block-mount kmod-usb-serial-ch341 + DEVICE_PACKAGES := kmod-usb2 block-mount kmod-usb-serial-ch341 \ + kmod-usb-net-qmi-wwan uqmi KERNEL_SIZE := 4096k IMAGE_SIZE := 131072k PAGESIZE := 2048 From 2fe29794b11928f363a38d312a53f56a0043df91 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Fri, 20 Jan 2023 16:09:09 +0300 Subject: [PATCH 080/104] ramips: use hex value in zyimage command for Keenetic KN-3010 This is cosmetic change. The hex value is related to the device model and more human friendly. Signed-off-by: Maxim Anisimov --- target/linux/ramips/image/mt7621.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 9d01399c5cc..6d199b0d6a8 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1304,7 +1304,7 @@ define Device/keenetic_kn-3010 DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to $$$$(BLOCKSIZE) | \ - check-size | zyimage -d 8400912 -v "KN-3010" + check-size | zyimage -d 0x803010 -v "KN-3010" endef TARGET_DEVICES += keenetic_kn-3010 From 3690c4a092e2590a2cd5d06855eb905012dced6b Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Fri, 20 Jan 2023 14:23:40 +0300 Subject: [PATCH 081/104] ramips: improve support for Zyxel Keenetic Extra II - drop unneeded default-state for led_power - concat firmware partitions to extend available free space - increase spi flash frequency to 32 Mhz (value from stock firmware bootlog) - drop broken-flash-reset because of onboard flash chip W25Q256FV has reset support - add compatible for pcie wifi according to kernel documetation - switch to wan mac address with offset 0x28 in rf-eeprom Signed-off-by: Maxim Anisimov --- .../dts/mt7628an_zyxel_keenetic-extra-ii.dts | 32 +++++++++++++------ target/linux/ramips/image/mt76x8.mk | 2 +- .../mt76x8/base-files/etc/board.d/02_network | 6 ++-- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts b/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts index d292b211afc..c53289debf0 100644 --- a/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts +++ b/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts @@ -46,7 +46,6 @@ led_power: power { label = "green:power"; gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - default-state = "keep"; }; internet { @@ -77,6 +76,23 @@ gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; }; }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware1 &firmware2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x0 0x1d20000>; + }; + }; + }; }; &spi0 { @@ -85,8 +101,7 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <10000000>; - broken-flash-reset; + spi-max-frequency = <32000000>; partitions { compatible = "fixed-partitions"; @@ -106,14 +121,13 @@ }; factory: partition@40000 { - label = "factory"; + label = "rf-eeprom"; reg = <0x40000 0x10000>; read-only; }; - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; + firmware1: partition@50000 { + label = "firmware_1"; reg = <0x50000 0xe90000>; }; @@ -153,10 +167,9 @@ read-only; }; - partition@1050000 { + firmware2: partition@1050000 { label = "firmware_2"; reg = <0x1050000 0xe90000>; - read-only; }; partition@1ee0000 { @@ -189,6 +202,7 @@ &pcie0 { mt76@0,0 { + compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x8000>; ieee80211-freq-limit = <5000000 6000000>; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index f4828728131..156aa634be7 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -1029,7 +1029,7 @@ endef TARGET_DEVICES += zbtlink_zbt-we1226 define Device/zyxel_keenetic-extra-ii - IMAGE_SIZE := 14912k + IMAGE_SIZE := 29824k BLOCKSIZE := 64k DEVICE_VENDOR := ZyXEL DEVICE_MODEL := Keenetic Extra II diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 7570999a4ef..bfd11fda2e6 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -228,8 +228,7 @@ ramips_setup_macs() netgear,r6080|\ netgear,r6120|\ wrtnode,wrtnode2p|\ - wrtnode,wrtnode2r|\ - zyxel,keenetic-extra-ii) + wrtnode,wrtnode2r) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1) ;; hiwifi,hc5611|\ @@ -253,7 +252,8 @@ ramips_setup_macs() totolink,lr1200) wan_mac=$(mtd_get_mac_binary factory 0x2e) ;; - keenetic,kn-1613) + keenetic,kn-1613|\ + zyxel,keenetic-extra-ii) wan_mac=$(mtd_get_mac_binary rf-eeprom 0x28) ;; linksys,e5400) From 39e4f03fd335d5b5d1259d74fc3f00ad09e7796c Mon Sep 17 00:00:00 2001 From: Dmitry Sokolov Date: Mon, 16 Jan 2023 02:52:27 +0500 Subject: [PATCH 082/104] ramips: mt7621: add support for Xiaomi Mi Router 4A Gigabit v2 Device is the same as Xiaomi Mi Router 4A Gigabit, except of: - 5G WiFi is MT7663 - addresses of leds, wifi and eth ports are slightly changed Specs: SoC: MT7621 CPU: 2 x 880 MHz ROM: 16 MB RAM: 128 MB WLAN: MT7603, MT7663 MAC addresses: WAN **** factory 0xe006 (label) LAN *:f7 factory 0xe000 2.4 GHz *:f8 factory 0x0000+0x4 (mtd-eeprom+0x4) 5 GHz *:f9 factory 0x8000+0x4 (mtd-eeprom+0x4) Installation: Factory firmware is based on a custom OpenWrt 17.x. Installation is the same as for Xiaomi Mi Router 4A Gigabit. Probably the easiest way to install is to use the script from this repository: https://github.com/acecilia/OpenWRTInvasion/pull/155 In a more advanced case, you can do everything yourself: - gain access to the device through one of the exploits described in the link above - upload sysupgrade image to /tmp - overwrite stock firmware: # mtd -e OS1 -r write /tmp/sysupgrade.bin OS1 Recovery: Recovery procedure is the same as for Xiaomi Mi Router 4A Gigabit. Possible options can be found here: https://openwrt.org/inbox/toh/xiaomi/xiaomi_mi_router_4a_gigabit_edition One of the ways is to use another router with OpenWrt: - connect both routers by their LAN ports - download stock firmware from [1] - place it inside /tmp/test.bin on the main router - configure PXE/TFTP on the main router - power off 4Av2, hold Reset button, power on - as soon as image download via TFTP starts, Reset can be released - blinking blue wan LED will indicate the end of the flashing process, now router can be rebooted [1] http://cdn.cnbj1.fds.api.mi-img.com/xiaoqiang/rom/r4av2/miwifi_r4av2_firmware_release_2.30.28.bin Signed-off-by: Dmitry Sokolov --- .../dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi | 138 +----------------- .../mt7621_xiaomi_mi-router-4a-common.dtsi | 138 ++++++++++++++++++ .../mt7621_xiaomi_mi-router-4a-gigabit-v2.dts | 80 ++++++++++ target/linux/ramips/image/mt7621.mk | 11 ++ .../mt7621/base-files/etc/board.d/01_leds | 3 + .../mt7621/base-files/etc/board.d/02_network | 3 +- 6 files changed, 241 insertions(+), 132 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi index a0ee79ae23c..d05872337be 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi @@ -1,23 +1,12 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "mt7621.dtsi" - -#include -#include +#include "mt7621_xiaomi_mi-router-4a-common.dtsi" / { aliases { - led-boot = &led_status_yellow; - led-failsafe = &led_status_yellow; - led-running = &led_status_blue; - led-upgrade = &led_status_yellow; label-mac-device = &gmac1; }; - chosen { - bootargs = "console=ttyS0,115200n8"; - }; - leds { compatible = "gpio-leds"; @@ -31,108 +20,16 @@ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; }; }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio 18 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <50000000>; - m25p,fast-read; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - partition@40000 { - label = "Bdata"; - reg = <0x40000 0x10000>; - read-only; - }; - - factory: partition@50000 { - label = "factory"; - reg = <0x50000 0x10000>; - read-only; - }; - - partition@60000 { - label = "crash"; - reg = <0x60000 0x10000>; - read-only; - }; - - partition@70000 { - label = "cfg_bak"; - reg = <0x70000 0x10000>; - read-only; - }; - - partition@80000 { - label = "overlay"; - reg = <0x80000 0x100000>; - read-only; - }; - - firmware: partition@180000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x180000 0xe80000>; - }; - }; - }; +&wifi0 { + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; }; -&pcie { - status = "okay"; -}; - -&pcie0 { - wifi@0,0 { - compatible = "pci14c3,7662"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; -}; - -&pcie1 { - wifi@0,0 { - compatible = "pci14c3,7603"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - }; -}; - -&gmac0 { - nvmem-cells = <&macaddr_factory_e000>; - nvmem-cell-names = "mac-address"; +&wifi1 { + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; }; &gmac1 { @@ -163,24 +60,3 @@ }; }; }; - -&state_default { - gpio { - groups = "jtag", "uart2", "uart3", "wdt"; - function = "gpio"; - }; -}; - -&factory { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_factory_e000: macaddr@e000 { - reg = <0xe000 0x6>; - }; - - macaddr_factory_e006: macaddr@e006 { - reg = <0xe006 0x6>; - }; -}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi new file mode 100644 index 00000000000..efc32733e9b --- /dev/null +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-common.dtsi @@ -0,0 +1,138 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_status_yellow; + led-failsafe = &led_status_yellow; + led-running = &led_status_blue; + led-upgrade = &led_status_yellow; + }; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + m25p,fast-read; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "Bdata"; + reg = <0x40000 0x10000>; + read-only; + }; + + factory: partition@50000 { + label = "factory"; + reg = <0x50000 0x10000>; + read-only; + }; + + partition@60000 { + label = "crash"; + reg = <0x60000 0x10000>; + read-only; + }; + + partition@70000 { + label = "cfg_bak"; + reg = <0x70000 0x10000>; + read-only; + }; + + partition@80000 { + label = "overlay"; + reg = <0x80000 0x100000>; + read-only; + }; + + firmware: partition@180000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x180000 0xe80000>; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi0: wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + }; +}; + +&pcie1 { + wifi1: wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&state_default { + gpio { + groups = "jtag", "uart2", "uart3", "wdt"; + function = "gpio"; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_e000: macaddr@e000 { + reg = <0xe000 0x6>; + }; + + macaddr_factory_e006: macaddr@e006 { + reg = <0xe006 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts new file mode 100644 index 00000000000..67ff6ea11e1 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_xiaomi_mi-router-4a-common.dtsi" + +/ { + compatible = "xiaomi,mi-router-4a-gigabit-v2", "mediatek,mt7621-soc"; + model = "Xiaomi Mi Router 4A Gigabit Edition v2"; + + aliases { + label-mac-device = &wan; + }; + + leds { + compatible = "gpio-leds"; + + led_status_blue: status_blue { + label = "blue:status"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + led_status_yellow: status_yellow { + label = "yellow:status"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + wan_blue { + label = "blue:wan"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + wan_yellow { + label = "yellow:wan"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&partitions { + partition@180000 { + // size changed against to the common dtsi + reg = <0x180000 0xe70000>; + }; + + partition@ff0000 { + label = "Config"; + reg = <0xff0000 0x10000>; + read-only; + }; +}; + +&wifi0 { + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; +}; + +&wifi1 { + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + label = "lan1"; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + wan: port@3 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 6d199b0d6a8..3587fb613ad 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2427,6 +2427,17 @@ define Device/xiaomi_mi-router-4a-gigabit endef TARGET_DEVICES += xiaomi_mi-router-4a-gigabit +define Device/xiaomi_mi-router-4a-gigabit-v2 + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 14784k + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := Mi Router 4A + DEVICE_VARIANT := Gigabit Edition v2 + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap +endef +TARGET_DEVICES += xiaomi_mi-router-4a-gigabit-v2 + define Device/xiaomi_mi-router-ac2100 $(Device/xiaomi_nand_separate) DEVICE_MODEL := Mi Router AC2100 diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 91f3fe6e93c..597d7302ac8 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -179,6 +179,9 @@ tplink,re650-v2) tplink,tl-wpa8631p-v3) ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan" ;; +xiaomi,mi-router-4a-gigabit-v2) + ucidef_set_led_netdev "wan" "wan" "blue:wan" "wan" "link" + ;; xiaomi,mi-router-ac2100) ucidef_set_led_netdev "wan-blue" "WAN (blue)" "blue:wan" "wan" ;; diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index ddbbf9891d6..67f58b10b27 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -72,7 +72,8 @@ ramips_setup_interfaces() xiaomi,mi-router-3g|\ xiaomi,mi-router-3g-v2|\ xiaomi,mi-router-4|\ - xiaomi,mi-router-4a-gigabit) + xiaomi,mi-router-4a-gigabit|\ + xiaomi,mi-router-4a-gigabit-v2) ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" ;; bolt,arion) From d1893f1c889b991746f6546b98f009b4125d5046 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 28 Dec 2022 00:11:00 +0100 Subject: [PATCH 083/104] px5g-mbedtls: Use getrandom() Instead of accessing /dev/urandom use the getrandom syscall. This way we do not have to keep the file open all the time. This also fixes a compile error with glibc: -------- px5g-mbedtls.c: In function '_urandom': px5g-mbedtls.c:48:9: error: ignoring return value of 'read' declared with attribute 'warn_unused_result' [-Werror=unused-result] 48 | read(urandom_fd, out, len); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors -------- Signed-off-by: Hauke Mehrtens --- package/utils/px5g-mbedtls/px5g-mbedtls.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/package/utils/px5g-mbedtls/px5g-mbedtls.c b/package/utils/px5g-mbedtls/px5g-mbedtls.c index 0b72154509a..4e0a73ab0a7 100644 --- a/package/utils/px5g-mbedtls/px5g-mbedtls.c +++ b/package/utils/px5g-mbedtls/px5g-mbedtls.c @@ -20,6 +20,7 @@ */ #include +#include #include #include @@ -31,6 +32,7 @@ #include #include +#include #include #include #include @@ -40,12 +42,16 @@ #define PX5G_COPY "Copyright (c) 2009 Steven Barth " #define PX5G_LICENSE "Licensed under the GNU Lesser General Public License v2.1" -static int urandom_fd; static char buf[16384]; static int _urandom(void *ctx, unsigned char *out, size_t len) { - read(urandom_fd, out, len); + ssize_t ret; + + ret = getrandom(out, len, 0); + if (ret < 0 || (size_t)ret != len) + return MBEDTLS_ERR_ENTROPY_SOURCE_FAILED; + return 0; } @@ -306,8 +312,6 @@ int selfsigned(char **arg) int main(int argc, char *argv[]) { - urandom_fd = open("/dev/urandom", O_RDONLY); - if (!argv[1]) { //Usage } else if (!strcmp(argv[1], "eckey")) { From 9902c8520be2418a6f57652ccda814ec9bbd322b Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Mon, 28 Nov 2022 10:06:07 +0100 Subject: [PATCH 084/104] uhttpd: clean up Makefile uhttpd's cmake options all default to ON. Either we set all of them or none if the defaults need to be changed. Let's go with the latter. Because support for all modules is always compiled in, remove two unused and useless config toggles. uhttpd detects and uses libcrypt itself, no need to add it here again. Signed-off-by: Andre Heider --- package/network/services/uhttpd/Makefile | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile index 4090bf45798..3923e55b072 100644 --- a/package/network/services/uhttpd/Makefile +++ b/package/network/services/uhttpd/Makefile @@ -20,7 +20,6 @@ PKG_LICENSE:=ISC PKG_ASLR_PIE_REGULAR:=1 PKG_BUILD_DEPENDS = ustream-ssl -PKG_CONFIG_DEPENDS:= CONFIG_uhttpd_lua CONFIG_uhttpd_ucode include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk @@ -44,18 +43,6 @@ define Package/uhttpd/description HTTP daemon. endef -define Package/uhttpd/config - config uhttpd_lua - depends on PACKAGE_uhttpd-mod-lua - bool "Enable Integrated Lua interpreter" - default y - - config uhttpd_ucode - depends on PACKAGE_uhttpd-mod-ucode - bool "Enable Integrated ucode interpreter" - default y -endef - define Package/uhttpd/conffiles /etc/config/uhttpd /etc/uhttpd.crt @@ -101,17 +88,11 @@ ifneq ($(CONFIG_USE_GLIBC),) TARGET_CFLAGS += -D_DEFAULT_SOURCE endif -TARGET_LDFLAGS += -lcrypt - -CMAKE_OPTIONS += -DTLS_SUPPORT=on - define Package/uhttpd/install - $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config $(1)/usr/sbin $(INSTALL_BIN) ./files/uhttpd.init $(1)/etc/init.d/uhttpd - $(INSTALL_DIR) $(1)/etc/config $(INSTALL_CONF) ./files/uhttpd.config $(1)/etc/config/uhttpd $(VERSION_SED_SCRIPT) $(1)/etc/config/uhttpd - $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd $(1)/usr/sbin/uhttpd endef From b246385126ace0aeabacf9c94851d2f6dc26f912 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Mon, 28 Nov 2022 11:17:43 +0100 Subject: [PATCH 085/104] ucode: move to the lang submenu Just as lua or the various languages from the package feed. libucode is the exception, so move it to the libs menu instead. Signed-off-by: Andre Heider --- package/utils/ucode/Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index 3913fd2aa43..ddad598c7f1 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -39,9 +39,10 @@ CMAKE_HOST_OPTIONS += \ define Package/ucode/default - SECTION:=utils - CATEGORY:=Utilities - TITLE:=ucode - Tiny scripting and templating language + SUBMENU:=ucode + SECTION:=lang + CATEGORY:=Languages + TITLE:=Tiny scripting and templating language endef define Package/ucode @@ -57,7 +58,10 @@ endef define Package/libucode $(Package/ucode/default) - TITLE+= - runtime library + SUBMENU:= + SECTION:=libs + CATEGORY:=Libraries + TITLE+= (library) ABI_VERSION:=$(PKG_ABI_VERSION) DEPENDS:=+libjson-c endef @@ -129,7 +133,7 @@ define Package/ucode-mod-struct endef define Package/ucode-mod-struct/description - The struct plugin implemnts Python 3 compatible struct.pack/unpack functionality. + The struct plugin implements Python 3 compatible struct.pack/unpack functionality. endef From 781a3ae5dc4755e5826862d023e149e68029d554 Mon Sep 17 00:00:00 2001 From: Chen Minqiang Date: Sun, 18 Dec 2022 08:57:20 +0800 Subject: [PATCH 086/104] base-files: fix nand_do_platform_check fail This change ensures compatibility with both types of sysupgrade-tar files. 1. For some boards like xiaomi,redmi-router-ax6s, sysupgrade-tar is pack in directory `vendor,name/` 2. For some boards like xiaomi,mi-router-3g, sysupgrade-tar is pack in directory `vendor_name/` Signed-off-by: Chen Minqiang --- package/base-files/files/lib/upgrade/nand.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh index a1dbd6e2663..e7ac34f5d0c 100644 --- a/package/base-files/files/lib/upgrade/nand.sh +++ b/package/base-files/files/lib/upgrade/nand.sh @@ -453,7 +453,11 @@ nand_do_platform_check() { local gz="$(identify_if_gzip "$file")" local file_type="$(identify "$file" "" "$gz")" - local control_length=$( (tar xO${gz}f "$file" "sysupgrade-$board_name/CONTROL" | wc -c) 2> /dev/null) + local control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//,/_}/CONTROL" | wc -c) 2> /dev/null) + + if [ "$control_length" = 0 ]; then + control_length=$( (tar xO${gz}f "$file" "sysupgrade-${board_name//_/,}/CONTROL" | wc -c) 2> /dev/null) + fi if [ "$control_length" != 0 ]; then nand_verify_tar_file "$file" "$gz" || return 1 From 016a7bd558183dae67e6ed3c29ee82d7b5c2f579 Mon Sep 17 00:00:00 2001 From: Chen Minqiang Date: Sun, 18 Dec 2022 08:59:44 +0800 Subject: [PATCH 087/104] mediatek: fix wrong return code in platform_check_image() Ensure that the platform_check_image() function returns an error code. Signed-off-by: Chen Minqiang --- .../linux/mediatek/filogic/base-files/lib/upgrade/platform.sh | 2 +- target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 93b202218a8..9a389d59b1d 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -95,7 +95,7 @@ platform_check_image() { ;; *) nand_do_platform_check "$board" "$1" - return 0 + return $? ;; esac diff --git a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh index d3d503dd1ef..e3c66a3b01a 100755 --- a/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/mt7622/base-files/lib/upgrade/platform.sh @@ -74,6 +74,7 @@ platform_check_image() { totolink,a8000ru|\ xiaomi,redmi-router-ax6s) nand_do_platform_check "$board" "$1" + return $? ;; *) [ "$magic" != "d00dfeed" ] && { From e51a57e1924176afe60cd6e76b7ee4eec3e6f6a2 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 29 Jan 2023 03:40:15 +0000 Subject: [PATCH 088/104] uboot-envtools: mt7622: bpi-r64: fix env selection Selecting the environment when booting from SD card has been broken by a previous commit. Fix it. Fixes: 84b5b0f88c ("uboot-envtools: mediatek/mt7622: don't rely on mapped rootfs") Signed-off-by: Daniel Golle --- package/boot/uboot-envtools/files/mediatek_mt7622 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/package/boot/uboot-envtools/files/mediatek_mt7622 b/package/boot/uboot-envtools/files/mediatek_mt7622 index 9ad4c7c1a7a..e01dcc4fefd 100644 --- a/package/boot/uboot-envtools/files/mediatek_mt7622 +++ b/package/boot/uboot-envtools/files/mediatek_mt7622 @@ -17,13 +17,16 @@ linksys,e8450-ubi) ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1" ;; bananapi,bpi-r64) - case "$(cmdline_get_var root)" in - /dev/mmc*) + rootdev="$(cmdline_get_var root)" + rootdev="${rootdev##*/}" + rootdev="${rootdev%%p[0-9]*}" + case "$rootdev" in + mmc*) local envdev=$(find_mmc_part "ubootenv" $rootdev) ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1" ubootenv_add_uci_config "$envdev" "0x80000" "0x80000" "0x80000" "1" ;; - /dev/ubi*) + ubi*) ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1" ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1" ;; From 90dbdb4941ba79055cc9327c6f7d503583020c96 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 29 Jan 2023 03:42:15 +0000 Subject: [PATCH 089/104] uboot-envtools: filogic: bpi-r3: fix env selection Selecting the environment when booting from SD card has been broken by a previous commit. Fix it. Fixes: f46355b4d7 ("uboot-envtools: mediatek_filogic: fix BPi-R3 when no OS is installed") Signed-off-by: Daniel Golle --- package/boot/uboot-envtools/files/mediatek_filogic | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index 787fac8dd67..30cd0e83674 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -13,18 +13,21 @@ board=$(board_name) case "$board" in bananapi,bpi-r3) - case "$(cmdline_get_var root)" in - /dev/mmc*) + rootdev="$(cmdline_get_var root)" + rootdev="${rootdev##*/}" + rootdev="${rootdev%%p[0-9]*}" + case "$rootdev" in + mmc*) local envdev=$(find_mmc_part "ubootenv" $rootdev) ubootenv_add_uci_config "$envdev" "0x0" "0x40000" "0x40000" "1" ubootenv_add_uci_config "$envdev" "0x40000" "0x40000" "0x40000" "1" ;; - /dev/mtd*) + mtd*) local envdev=/dev/mtd$(find_mtd_index "u-boot-env") ubootenv_add_uci_config "$envdev" "0x0" "0x20000" "0x20000" "1" ubootenv_add_uci_config "$envdev" "0x20000" "0x20000" "0x20000" "1" ;; - /dev/ubi*) + ubi*) . /lib/upgrade/nand.sh local envubi=$(nand_find_ubi ubi) local envdev=/dev/$(nand_find_volume $envubi ubootenv) From 74e5e213da152bc3791fe0c664ffae9b0218bd55 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 27 Jan 2023 10:35:51 +0100 Subject: [PATCH 090/104] ucode: update to the latest version 1c8df08824ef style: add .editorconfig file ec167d39b803 nl80211: refactor command bitmask handling 6704ec0d5b29 nl80211: add support for registering an uloop based listener 48a6eac1da15 fs: implement `fs.pipe()` f1be0d725735 types: fix array unshift operations and add test coverage 941d14837faf Merge pull request #138 from nbd168/nl80211 Signed-off-by: Felix Fietkau --- package/utils/ucode/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index ddad598c7f1..893daf99c72 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2023-01-09 -PKG_SOURCE_VERSION:=8dad974baa4696fcba85837fa70cde8b68dd7c12 -PKG_MIRROR_HASH:=91494352ac298ac2735d62355837a1f18e366999c9e940613e6fa3265edc0364 +PKG_SOURCE_DATE:=2023-01-23 +PKG_SOURCE_VERSION:=941d14837faf248eb2fa88dd0d5cfddeed044a15 +PKG_MIRROR_HASH:=19e8654bcb8a13a0a276a240a1da0f2815b0dd0d4f8bb8622e8de1040d5408a5 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC @@ -96,7 +96,7 @@ endef define Package/ucode-mod-nl80211 $(Package/ucode/default) TITLE+= (nl80211 module) - DEPENDS:=ucode +libnl-tiny + DEPENDS:=ucode +libnl-tiny +libubox endef define Package/ucode-mod-nl80211/description From 908397f6d2d167c02ee579b51c79ef03cdcdae9c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 27 Jan 2023 11:35:41 +0100 Subject: [PATCH 091/104] mac80211: backport napi_build_skb for 5.10 It is needed for an upcoming mt76 update Signed-off-by: Felix Fietkau --- .../patches/build/110-backport_napi_build_skb.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch diff --git a/package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch b/package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch new file mode 100644 index 00000000000..e2f6be56334 --- /dev/null +++ b/package/kernel/mac80211/patches/build/110-backport_napi_build_skb.patch @@ -0,0 +1,11 @@ +--- a/backport-include/linux/skbuff.h ++++ b/backport-include/linux/skbuff.h +@@ -140,4 +140,8 @@ static inline u64 skb_get_kcov_handle(st + } + #endif + ++#if LINUX_VERSION_IS_LESS(5,11,0) ++#define napi_build_skb build_skb ++#endif ++ + #endif /* __BACKPORT_SKBUFF_H */ From 638283d481a15769ba60ae42f11c6603f6c2dd11 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 27 Jan 2023 11:40:46 +0100 Subject: [PATCH 092/104] kernel: backport page pool fragment support from v5.15 Required for an upcoming mt76 update Signed-off-by: Felix Fietkau --- .../630-v5.15-page_pool_frag_support.patch | 798 ++++++++++++++++++ .../721-net-add-packet-mangeling.patch | 4 +- .../pending-5.10/655-increase_skb_pad.patch | 2 +- ...T-skip-GRO-for-foreign-MAC-addresses.patch | 2 +- 4 files changed, 802 insertions(+), 4 deletions(-) create mode 100644 target/linux/generic/backport-5.10/630-v5.15-page_pool_frag_support.patch diff --git a/target/linux/generic/backport-5.10/630-v5.15-page_pool_frag_support.patch b/target/linux/generic/backport-5.10/630-v5.15-page_pool_frag_support.patch new file mode 100644 index 00000000000..dbcdac8590f --- /dev/null +++ b/target/linux/generic/backport-5.10/630-v5.15-page_pool_frag_support.patch @@ -0,0 +1,798 @@ +--- a/include/net/page_pool.h ++++ b/include/net/page_pool.h +@@ -45,7 +45,10 @@ + * Please note DMA-sync-for-CPU is still + * device driver responsibility + */ +-#define PP_FLAG_ALL (PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV) ++#define PP_FLAG_PAGE_FRAG BIT(2) /* for page frag feature */ ++#define PP_FLAG_ALL (PP_FLAG_DMA_MAP |\ ++ PP_FLAG_DMA_SYNC_DEV |\ ++ PP_FLAG_PAGE_FRAG) + + /* + * Fast allocation side cache array/stack +@@ -65,7 +68,7 @@ + #define PP_ALLOC_CACHE_REFILL 64 + struct pp_alloc_cache { + u32 count; +- void *cache[PP_ALLOC_CACHE_SIZE]; ++ struct page *cache[PP_ALLOC_CACHE_SIZE]; + }; + + struct page_pool_params { +@@ -79,6 +82,22 @@ struct page_pool_params { + unsigned int offset; /* DMA addr offset */ + }; + ++ ++static inline int page_pool_ethtool_stats_get_count(void) ++{ ++ return 0; ++} ++ ++static inline u8 *page_pool_ethtool_stats_get_strings(u8 *data) ++{ ++ return data; ++} ++ ++static inline u64 *page_pool_ethtool_stats_get(u64 *data, void *stats) ++{ ++ return data; ++} ++ + struct page_pool { + struct page_pool_params p; + +@@ -88,6 +107,9 @@ struct page_pool { + unsigned long defer_warn; + + u32 pages_state_hold_cnt; ++ unsigned int frag_offset; ++ struct page *frag_page; ++ long frag_users; + + /* + * Data structure for allocation side +@@ -137,6 +159,18 @@ static inline struct page *page_pool_dev + return page_pool_alloc_pages(pool, gfp); + } + ++struct page *page_pool_alloc_frag(struct page_pool *pool, unsigned int *offset, ++ unsigned int size, gfp_t gfp); ++ ++static inline struct page *page_pool_dev_alloc_frag(struct page_pool *pool, ++ unsigned int *offset, ++ unsigned int size) ++{ ++ gfp_t gfp = (GFP_ATOMIC | __GFP_NOWARN); ++ ++ return page_pool_alloc_frag(pool, offset, size, gfp); ++} ++ + /* get the stored dma direction. A driver might decide to treat this locally and + * avoid the extra cache line from page_pool to determine the direction + */ +@@ -146,6 +180,8 @@ inline enum dma_data_direction page_pool + return pool->p.dma_dir; + } + ++bool page_pool_return_skb_page(struct page *page); ++ + struct page_pool *page_pool_create(const struct page_pool_params *params); + + #ifdef CONFIG_PAGE_POOL +@@ -165,6 +201,7 @@ static inline void page_pool_release_pag + struct page *page) + { + } ++ + #endif + + void page_pool_put_page(struct page_pool *pool, struct page *page, +@@ -189,19 +226,48 @@ static inline void page_pool_recycle_dir + page_pool_put_full_page(pool, page, true); + } + ++#define PAGE_POOL_DMA_USE_PP_FRAG_COUNT \ ++ (sizeof(dma_addr_t) > sizeof(unsigned long)) ++ + static inline dma_addr_t page_pool_get_dma_addr(struct page *page) + { +- dma_addr_t ret = page->dma_addr[0]; +- if (sizeof(dma_addr_t) > sizeof(unsigned long)) +- ret |= (dma_addr_t)page->dma_addr[1] << 16 << 16; ++ dma_addr_t ret = page->dma_addr; ++ ++ if (PAGE_POOL_DMA_USE_PP_FRAG_COUNT) ++ ret |= (dma_addr_t)page->dma_addr_upper << 16 << 16; ++ + return ret; + } + + static inline void page_pool_set_dma_addr(struct page *page, dma_addr_t addr) + { +- page->dma_addr[0] = addr; +- if (sizeof(dma_addr_t) > sizeof(unsigned long)) +- page->dma_addr[1] = upper_32_bits(addr); ++ page->dma_addr = addr; ++ if (PAGE_POOL_DMA_USE_PP_FRAG_COUNT) ++ page->dma_addr_upper = upper_32_bits(addr); ++} ++ ++static inline void page_pool_set_frag_count(struct page *page, long nr) ++{ ++ atomic_long_set(&page->pp_frag_count, nr); ++} ++ ++static inline long page_pool_atomic_sub_frag_count_return(struct page *page, ++ long nr) ++{ ++ long ret; ++ ++ /* As suggested by Alexander, atomic_long_read() may cover up the ++ * reference count errors, so avoid calling atomic_long_read() in ++ * the cases of freeing or draining the page_frags, where we would ++ * not expect it to match or that are slowpath anyway. ++ */ ++ if (__builtin_constant_p(nr) && ++ atomic_long_read(&page->pp_frag_count) == nr) ++ return 0; ++ ++ ret = atomic_long_sub_return(nr, &page->pp_frag_count); ++ WARN_ON(ret < 0); ++ return ret; + } + + static inline bool is_page_pool_compiled_in(void) +@@ -225,4 +291,23 @@ static inline void page_pool_nid_changed + if (unlikely(pool->p.nid != new_nid)) + page_pool_update_nid(pool, new_nid); + } ++ ++static inline void page_pool_ring_lock(struct page_pool *pool) ++ __acquires(&pool->ring.producer_lock) ++{ ++ if (in_serving_softirq()) ++ spin_lock(&pool->ring.producer_lock); ++ else ++ spin_lock_bh(&pool->ring.producer_lock); ++} ++ ++static inline void page_pool_ring_unlock(struct page_pool *pool) ++ __releases(&pool->ring.producer_lock) ++{ ++ if (in_serving_softirq()) ++ spin_unlock(&pool->ring.producer_lock); ++ else ++ spin_unlock_bh(&pool->ring.producer_lock); ++} ++ + #endif /* _NET_PAGE_POOL_H */ +--- a/net/core/page_pool.c ++++ b/net/core/page_pool.c +@@ -11,16 +11,22 @@ + #include + + #include ++#include ++ + #include + #include + #include + #include /* for __put_page() */ ++#include ++#include + + #include + + #define DEFER_TIME (msecs_to_jiffies(1000)) + #define DEFER_WARN_INTERVAL (60 * HZ) + ++#define BIAS_MAX LONG_MAX ++ + static int page_pool_init(struct page_pool *pool, + const struct page_pool_params *params) + { +@@ -64,6 +70,10 @@ static int page_pool_init(struct page_po + */ + } + ++ if (PAGE_POOL_DMA_USE_PP_FRAG_COUNT && ++ pool->p.flags & PP_FLAG_PAGE_FRAG) ++ return -EINVAL; ++ + if (ptr_ring_init(&pool->ring, ring_qsize, GFP_KERNEL) < 0) + return -ENOMEM; + +@@ -180,40 +190,10 @@ static void page_pool_dma_sync_for_devic + pool->p.dma_dir); + } + +-/* slow path */ +-noinline +-static struct page *__page_pool_alloc_pages_slow(struct page_pool *pool, +- gfp_t _gfp) ++static bool page_pool_dma_map(struct page_pool *pool, struct page *page) + { +- struct page *page; +- gfp_t gfp = _gfp; + dma_addr_t dma; + +- /* We could always set __GFP_COMP, and avoid this branch, as +- * prep_new_page() can handle order-0 with __GFP_COMP. +- */ +- if (pool->p.order) +- gfp |= __GFP_COMP; +- +- /* FUTURE development: +- * +- * Current slow-path essentially falls back to single page +- * allocations, which doesn't improve performance. This code +- * need bulk allocation support from the page allocator code. +- */ +- +- /* Cache was empty, do real allocation */ +-#ifdef CONFIG_NUMA +- page = alloc_pages_node(pool->p.nid, gfp, pool->p.order); +-#else +- page = alloc_pages(gfp, pool->p.order); +-#endif +- if (!page) +- return NULL; +- +- if (!(pool->p.flags & PP_FLAG_DMA_MAP)) +- goto skip_dma_map; +- + /* Setup DMA mapping: use 'struct page' area for storing DMA-addr + * since dma_addr_t can be either 32 or 64 bits and does not always fit + * into page private data (i.e 32bit cpu with 64bit DMA caps) +@@ -222,22 +202,53 @@ static struct page *__page_pool_alloc_pa + dma = dma_map_page_attrs(pool->p.dev, page, 0, + (PAGE_SIZE << pool->p.order), + pool->p.dma_dir, DMA_ATTR_SKIP_CPU_SYNC); +- if (dma_mapping_error(pool->p.dev, dma)) { +- put_page(page); +- return NULL; +- } ++ if (dma_mapping_error(pool->p.dev, dma)) ++ return false; ++ + page_pool_set_dma_addr(page, dma); + + if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV) + page_pool_dma_sync_for_device(pool, page, pool->p.max_len); + +-skip_dma_map: ++ return true; ++} ++ ++static void page_pool_set_pp_info(struct page_pool *pool, ++ struct page *page) ++{ ++ page->pp = pool; ++ page->pp_magic |= PP_SIGNATURE; ++} ++ ++static void page_pool_clear_pp_info(struct page *page) ++{ ++ page->pp_magic = 0; ++ page->pp = NULL; ++} ++ ++/* slow path */ ++noinline ++static struct page *__page_pool_alloc_pages_slow(struct page_pool *pool, ++ gfp_t gfp) ++{ ++ struct page *page; ++ ++ gfp |= __GFP_COMP; ++ page = alloc_pages_node(pool->p.nid, gfp, pool->p.order); ++ if (unlikely(!page)) ++ return NULL; ++ ++ if ((pool->p.flags & PP_FLAG_DMA_MAP) && ++ unlikely(!page_pool_dma_map(pool, page))) { ++ put_page(page); ++ return NULL; ++ } ++ ++ page_pool_set_pp_info(pool, page); ++ + /* Track how many pages are held 'in-flight' */ + pool->pages_state_hold_cnt++; +- + trace_page_pool_state_hold(pool, page, pool->pages_state_hold_cnt); +- +- /* When page just alloc'ed is should/must have refcnt 1. */ + return page; + } + +@@ -302,10 +313,12 @@ void page_pool_release_page(struct page_ + DMA_ATTR_SKIP_CPU_SYNC); + page_pool_set_dma_addr(page, 0); + skip_dma_unmap: ++ page_pool_clear_pp_info(page); ++ + /* This may be the last page returned, releasing the pool, so + * it is not safe to reference pool afterwards. + */ +- count = atomic_inc_return(&pool->pages_state_release_cnt); ++ count = atomic_inc_return_relaxed(&pool->pages_state_release_cnt); + trace_page_pool_state_release(pool, page, count); + } + EXPORT_SYMBOL(page_pool_release_page); +@@ -331,7 +344,10 @@ static bool page_pool_recycle_in_ring(st + else + ret = ptr_ring_produce_bh(&pool->ring, page); + +- return (ret == 0) ? true : false; ++ if (!ret) ++ return true; ++ ++ return false; + } + + /* Only allow direct recycling in special circumstances, into the +@@ -350,46 +366,43 @@ static bool page_pool_recycle_in_cache(s + return true; + } + +-/* page is NOT reusable when: +- * 1) allocated when system is under some pressure. (page_is_pfmemalloc) +- */ +-static bool pool_page_reusable(struct page_pool *pool, struct page *page) +-{ +- return !page_is_pfmemalloc(page); +-} +- + /* If the page refcnt == 1, this will try to recycle the page. + * if PP_FLAG_DMA_SYNC_DEV is set, we'll try to sync the DMA area for + * the configured size min(dma_sync_size, pool->max_len). + * If the page refcnt != 1, then the page will be returned to memory + * subsystem. + */ +-void page_pool_put_page(struct page_pool *pool, struct page *page, +- unsigned int dma_sync_size, bool allow_direct) +-{ ++static __always_inline struct page * ++__page_pool_put_page(struct page_pool *pool, struct page *page, ++ unsigned int dma_sync_size, bool allow_direct) ++{ ++ /* It is not the last user for the page frag case */ ++ if (pool->p.flags & PP_FLAG_PAGE_FRAG && ++ page_pool_atomic_sub_frag_count_return(page, 1)) ++ return NULL; ++ + /* This allocator is optimized for the XDP mode that uses + * one-frame-per-page, but have fallbacks that act like the + * regular page allocator APIs. + * + * refcnt == 1 means page_pool owns page, and can recycle it. ++ * ++ * page is NOT reusable when allocated when system is under ++ * some pressure. (page_is_pfmemalloc) + */ +- if (likely(page_ref_count(page) == 1 && +- pool_page_reusable(pool, page))) { ++ if (likely(page_ref_count(page) == 1 && !page_is_pfmemalloc(page))) { + /* Read barrier done in page_ref_count / READ_ONCE */ + + if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV) + page_pool_dma_sync_for_device(pool, page, + dma_sync_size); + +- if (allow_direct && in_serving_softirq()) +- if (page_pool_recycle_in_cache(page, pool)) +- return; ++ if (allow_direct && in_serving_softirq() && ++ page_pool_recycle_in_cache(page, pool)) ++ return NULL; + +- if (!page_pool_recycle_in_ring(pool, page)) { +- /* Cache full, fallback to free pages */ +- page_pool_return_page(pool, page); +- } +- return; ++ /* Page found as candidate for recycling */ ++ return page; + } + /* Fallback/non-XDP mode: API user have elevated refcnt. + * +@@ -407,9 +420,98 @@ void page_pool_put_page(struct page_pool + /* Do not replace this with page_pool_return_page() */ + page_pool_release_page(pool, page); + put_page(page); ++ ++ return NULL; ++} ++ ++void page_pool_put_page(struct page_pool *pool, struct page *page, ++ unsigned int dma_sync_size, bool allow_direct) ++{ ++ page = __page_pool_put_page(pool, page, dma_sync_size, allow_direct); ++ if (page && !page_pool_recycle_in_ring(pool, page)) ++ /* Cache full, fallback to free pages */ ++ page_pool_return_page(pool, page); + } + EXPORT_SYMBOL(page_pool_put_page); + ++static struct page *page_pool_drain_frag(struct page_pool *pool, ++ struct page *page) ++{ ++ long drain_count = BIAS_MAX - pool->frag_users; ++ ++ /* Some user is still using the page frag */ ++ if (likely(page_pool_atomic_sub_frag_count_return(page, ++ drain_count))) ++ return NULL; ++ ++ if (page_ref_count(page) == 1 && !page_is_pfmemalloc(page)) { ++ if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV) ++ page_pool_dma_sync_for_device(pool, page, -1); ++ ++ return page; ++ } ++ ++ page_pool_return_page(pool, page); ++ return NULL; ++} ++ ++static void page_pool_free_frag(struct page_pool *pool) ++{ ++ long drain_count = BIAS_MAX - pool->frag_users; ++ struct page *page = pool->frag_page; ++ ++ pool->frag_page = NULL; ++ ++ if (!page || ++ page_pool_atomic_sub_frag_count_return(page, drain_count)) ++ return; ++ ++ page_pool_return_page(pool, page); ++} ++ ++struct page *page_pool_alloc_frag(struct page_pool *pool, ++ unsigned int *offset, ++ unsigned int size, gfp_t gfp) ++{ ++ unsigned int max_size = PAGE_SIZE << pool->p.order; ++ struct page *page = pool->frag_page; ++ ++ if (WARN_ON(!(pool->p.flags & PP_FLAG_PAGE_FRAG) || ++ size > max_size)) ++ return NULL; ++ ++ size = ALIGN(size, dma_get_cache_alignment()); ++ *offset = pool->frag_offset; ++ ++ if (page && *offset + size > max_size) { ++ page = page_pool_drain_frag(pool, page); ++ if (page) ++ goto frag_reset; ++ } ++ ++ if (!page) { ++ page = page_pool_alloc_pages(pool, gfp); ++ if (unlikely(!page)) { ++ pool->frag_page = NULL; ++ return NULL; ++ } ++ ++ pool->frag_page = page; ++ ++frag_reset: ++ pool->frag_users = 1; ++ *offset = 0; ++ pool->frag_offset = size; ++ page_pool_set_frag_count(page, BIAS_MAX); ++ return page; ++ } ++ ++ pool->frag_users++; ++ pool->frag_offset = *offset + size; ++ return page; ++} ++EXPORT_SYMBOL(page_pool_alloc_frag); ++ + static void page_pool_empty_ring(struct page_pool *pool) + { + struct page *page; +@@ -515,6 +617,8 @@ void page_pool_destroy(struct page_pool + if (!page_pool_put(pool)) + return; + ++ page_pool_free_frag(pool); ++ + if (!page_pool_release(pool)) + return; + +@@ -541,3 +645,32 @@ void page_pool_update_nid(struct page_po + } + } + EXPORT_SYMBOL(page_pool_update_nid); ++ ++bool page_pool_return_skb_page(struct page *page) ++{ ++ struct page_pool *pp; ++ ++ page = compound_head(page); ++ ++ /* page->pp_magic is OR'ed with PP_SIGNATURE after the allocation ++ * in order to preserve any existing bits, such as bit 0 for the ++ * head page of compound page and bit 1 for pfmemalloc page, so ++ * mask those bits for freeing side when doing below checking, ++ * and page_is_pfmemalloc() is checked in __page_pool_put_page() ++ * to avoid recycling the pfmemalloc page. ++ */ ++ if (unlikely((page->pp_magic & ~0x3UL) != PP_SIGNATURE)) ++ return false; ++ ++ pp = page->pp; ++ ++ /* Driver set this to memory recycling info. Reset it on recycle. ++ * This will *not* work for NIC using a split-page memory model. ++ * The page will be returned to the pool here regardless of the ++ * 'flipped' fragment being in use or not. ++ */ ++ page_pool_put_full_page(pp, page, false); ++ ++ return true; ++} ++EXPORT_SYMBOL(page_pool_return_skb_page); +--- a/include/linux/mm_types.h ++++ b/include/linux/mm_types.h +@@ -97,10 +97,25 @@ struct page { + }; + struct { /* page_pool used by netstack */ + /** +- * @dma_addr: might require a 64-bit value on +- * 32-bit architectures. ++ * @pp_magic: magic value to avoid recycling non ++ * page_pool allocated pages. + */ +- unsigned long dma_addr[2]; ++ unsigned long pp_magic; ++ struct page_pool *pp; ++ unsigned long _pp_mapping_pad; ++ unsigned long dma_addr; ++ union { ++ /** ++ * dma_addr_upper: might require a 64-bit ++ * value on 32-bit architectures. ++ */ ++ unsigned long dma_addr_upper; ++ /** ++ * For frag page support, not supported in ++ * 32-bit architectures with 64-bit DMA. ++ */ ++ atomic_long_t pp_frag_count; ++ }; + }; + struct { /* slab, slob and slub */ + union { +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -594,13 +594,22 @@ static void skb_clone_fraglist(struct sk + skb_get(list); + } + ++static bool skb_pp_recycle(struct sk_buff *skb, void *data) ++{ ++ if (!IS_ENABLED(CONFIG_PAGE_POOL) || !skb->pp_recycle) ++ return false; ++ return page_pool_return_skb_page(virt_to_page(data)); ++} ++ + static void skb_free_head(struct sk_buff *skb) + { + unsigned char *head = skb->head; + +- if (skb->head_frag) ++ if (skb->head_frag) { ++ if (skb_pp_recycle(skb, head)) ++ return; + skb_free_frag(head); +- else ++ } else + kfree(head); + } + +@@ -612,16 +621,27 @@ static void skb_release_data(struct sk_b + if (skb->cloned && + atomic_sub_return(skb->nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1, + &shinfo->dataref)) +- return; ++ goto exit; + + for (i = 0; i < shinfo->nr_frags; i++) +- __skb_frag_unref(&shinfo->frags[i]); ++ __skb_frag_unref(&shinfo->frags[i], skb->pp_recycle); + + if (shinfo->frag_list) + kfree_skb_list(shinfo->frag_list); + + skb_zcopy_clear(skb, true); + skb_free_head(skb); ++exit: ++ /* When we clone an SKB we copy the reycling bit. The pp_recycle ++ * bit is only set on the head though, so in order to avoid races ++ * while trying to recycle fragments on __skb_frag_unref() we need ++ * to make one SKB responsible for triggering the recycle path. ++ * So disable the recycling bit if an SKB is cloned and we have ++ * additional references to to the fragmented part of the SKB. ++ * Eventually the last SKB will have the recycling bit set and it's ++ * dataref set to 0, which will trigger the recycling ++ */ ++ skb->pp_recycle = 0; + } + + /* +@@ -1003,6 +1023,7 @@ static struct sk_buff *__skb_clone(struc + n->nohdr = 0; + n->peeked = 0; + C(pfmemalloc); ++ C(pp_recycle); + n->destructor = NULL; + C(tail); + C(end); +@@ -3421,7 +3442,7 @@ int skb_shift(struct sk_buff *tgt, struc + fragto = &skb_shinfo(tgt)->frags[merge]; + + skb_frag_size_add(fragto, skb_frag_size(fragfrom)); +- __skb_frag_unref(fragfrom); ++ __skb_frag_unref(fragfrom, skb->pp_recycle); + } + + /* Reposition in the original skb */ +@@ -5189,6 +5210,20 @@ bool skb_try_coalesce(struct sk_buff *to + if (skb_cloned(to)) + return false; + ++ /* In general, avoid mixing slab allocated and page_pool allocated ++ * pages within the same SKB. However when @to is not pp_recycle and ++ * @from is cloned, we can transition frag pages from page_pool to ++ * reference counted. ++ * ++ * On the other hand, don't allow coalescing two pp_recycle SKBs if ++ * @from is cloned, in case the SKB is using page_pool fragment ++ * references (PP_FLAG_PAGE_FRAG). Since we only take full page ++ * references for cloned SKBs at the moment that would result in ++ * inconsistent reference counts. ++ */ ++ if (to->pp_recycle != (from->pp_recycle && !skb_cloned(from))) ++ return false; ++ + if (len <= skb_tailroom(to)) { + if (len) + BUG_ON(skb_copy_bits(from, 0, skb_put(to, len), len)); +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + #if IS_ENABLED(CONFIG_NF_CONNTRACK) + #include + #endif +@@ -786,7 +787,8 @@ struct sk_buff { + fclone:2, + peeked:1, + head_frag:1, +- pfmemalloc:1; ++ pfmemalloc:1, ++ pp_recycle:1; /* page_pool recycle indicator */ + #ifdef CONFIG_SKB_EXTENSIONS + __u8 active_extensions; + #endif +@@ -3029,9 +3031,15 @@ static inline void skb_frag_ref(struct s + * + * Releases a reference on the paged fragment @frag. + */ +-static inline void __skb_frag_unref(skb_frag_t *frag) ++static inline void __skb_frag_unref(skb_frag_t *frag, bool recycle) + { +- put_page(skb_frag_page(frag)); ++ struct page *page = skb_frag_page(frag); ++ ++#ifdef CONFIG_PAGE_POOL ++ if (recycle && page_pool_return_skb_page(page)) ++ return; ++#endif ++ put_page(page); + } + + /** +@@ -3043,7 +3051,7 @@ static inline void __skb_frag_unref(skb_ + */ + static inline void skb_frag_unref(struct sk_buff *skb, int f) + { +- __skb_frag_unref(&skb_shinfo(skb)->frags[f]); ++ __skb_frag_unref(&skb_shinfo(skb)->frags[f], skb->pp_recycle); + } + + /** +@@ -4642,5 +4650,12 @@ static inline u64 skb_get_kcov_handle(st + #endif + } + ++#ifdef CONFIG_PAGE_POOL ++static inline void skb_mark_for_recycle(struct sk_buff *skb) ++{ ++ skb->pp_recycle = 1; ++} ++#endif ++ + #endif /* __KERNEL__ */ + #endif /* _LINUX_SKBUFF_H */ +--- a/drivers/net/ethernet/marvell/sky2.c ++++ b/drivers/net/ethernet/marvell/sky2.c +@@ -2501,7 +2501,7 @@ static void skb_put_frags(struct sk_buff + + if (length == 0) { + /* don't need this page */ +- __skb_frag_unref(frag); ++ __skb_frag_unref(frag, false); + --skb_shinfo(skb)->nr_frags; + } else { + size = min(length, (unsigned) PAGE_SIZE); +--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c ++++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c +@@ -526,7 +526,7 @@ static int mlx4_en_complete_rx_desc(stru + fail: + while (nr > 0) { + nr--; +- __skb_frag_unref(skb_shinfo(skb)->frags + nr); ++ __skb_frag_unref(skb_shinfo(skb)->frags + nr, false); + } + return 0; + } +--- a/net/tls/tls_device.c ++++ b/net/tls/tls_device.c +@@ -131,7 +131,7 @@ static void destroy_record(struct tls_re + int i; + + for (i = 0; i < record->num_frags; i++) +- __skb_frag_unref(&record->frags[i]); ++ __skb_frag_unref(&record->frags[i], false); + kfree(record); + } + +--- a/include/linux/poison.h ++++ b/include/linux/poison.h +@@ -82,4 +82,7 @@ + /********** security/ **********/ + #define KEY_DESTROY 0xbd + ++/********** net/core/page_pool.c **********/ ++#define PP_SIGNATURE (0x40 + POISON_POINTER_DELTA) ++ + #endif +--- a/include/linux/mm.h ++++ b/include/linux/mm.h +@@ -1602,7 +1602,7 @@ static inline bool page_is_pfmemalloc(st + * Page index cannot be this large so this must be + * a pfmemalloc page. + */ +- return page->index == -1UL; ++ return (uintptr_t)page->lru.next & BIT(1); + } + + /* +@@ -1611,12 +1611,12 @@ static inline bool page_is_pfmemalloc(st + */ + static inline void set_page_pfmemalloc(struct page *page) + { +- page->index = -1UL; ++ page->lru.next = (void *)BIT(1); + } + + static inline void clear_page_pfmemalloc(struct page *page) + { +- page->index = 0; ++ page->lru.next = NULL; + } + + /* diff --git a/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch index 41b85b1f7c5..a4ce0d1dbc6 100644 --- a/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch @@ -60,7 +60,7 @@ Signed-off-by: Felix Fietkau */ --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2725,6 +2725,10 @@ static inline int pskb_trim(struct sk_bu +@@ -2727,6 +2727,10 @@ static inline int pskb_trim(struct sk_bu return (len < skb->len) ? __pskb_trim(skb, len) : 0; } @@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau /** * pskb_trim_unique - remove end from a paged unique (not cloned) buffer * @skb: buffer to alter -@@ -2856,16 +2860,6 @@ static inline struct sk_buff *dev_alloc_ +@@ -2858,16 +2862,6 @@ static inline struct sk_buff *dev_alloc_ } diff --git a/target/linux/generic/pending-5.10/655-increase_skb_pad.patch b/target/linux/generic/pending-5.10/655-increase_skb_pad.patch index 3655f75a5cf..0b25a76416c 100644 --- a/target/linux/generic/pending-5.10/655-increase_skb_pad.patch +++ b/target/linux/generic/pending-5.10/655-increase_skb_pad.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2691,7 +2691,7 @@ static inline int pskb_network_may_pull( +@@ -2693,7 +2693,7 @@ static inline int pskb_network_may_pull( * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) */ #ifndef NET_SKB_PAD diff --git a/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch b/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch index f1fc063a456..10f5c9b9c6a 100644 --- a/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch +++ b/target/linux/generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch @@ -22,7 +22,7 @@ Signed-off-by: Felix Fietkau #endif --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -861,6 +861,7 @@ struct sk_buff { +@@ -863,6 +863,7 @@ struct sk_buff { __u8 decrypted:1; #endif __u8 scm_io_uring:1; From 2770cbe63ff32a8006b7c6ea4e0a16eebd0f0f5f Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 26 Jan 2023 20:44:21 +0100 Subject: [PATCH 093/104] kernel: add fix for a page pool related crash on GRO Needed for upcoming mt76 page pool support Signed-off-by: Felix Fietkau --- ...pool-and-page-referenced-frags-in-GR.patch | 35 +++++++++++++++++++ ...pool-and-page-referenced-frags-in-GR.patch | 35 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 target/linux/generic/pending-5.10/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch create mode 100644 target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch diff --git a/target/linux/generic/pending-5.10/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch b/target/linux/generic/pending-5.10/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch new file mode 100644 index 00000000000..5a145abed33 --- /dev/null +++ b/target/linux/generic/pending-5.10/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch @@ -0,0 +1,35 @@ +From: Alexander Duyck +Date: Thu, 26 Jan 2023 11:06:59 -0800 +Subject: [PATCH] skb: Do mix page pool and page referenced frags in GRO + +GSO should not merge page pool recycled frames with standard reference +counted frames. Traditionally this didn't occur, at least not often. +However as we start looking at adding support for wireless adapters there +becomes the potential to mix the two due to A-MSDU repartitioning frames in +the receive path. There are possibly other places where this may have +occurred however I suspect they must be few and far between as we have not +seen this issue until now. + +Fixes: 53e0961da1c7 ("page_pool: add frag page recycling support in page pool") +Reported-by: Felix Fietkau +Signed-off-by: Alexander Duyck +--- + +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -4166,6 +4166,15 @@ int skb_gro_receive(struct sk_buff *p, s + if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush)) + return -E2BIG; + ++ /* Do not splice page pool based packets w/ non-page pool ++ * packets. This can result in reference count issues as page ++ * pool pages will not decrement the reference count and will ++ * instead be immediately returned to the pool or have frag ++ * count decremented. ++ */ ++ if (p->pp_recycle != skb->pp_recycle) ++ return -ETOOMANYREFS; ++ + lp = NAPI_GRO_CB(p)->last; + pinfo = skb_shinfo(lp); + diff --git a/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch b/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch new file mode 100644 index 00000000000..60c7721df03 --- /dev/null +++ b/target/linux/generic/pending-5.15/750-skb-Do-mix-page-pool-and-page-referenced-frags-in-GR.patch @@ -0,0 +1,35 @@ +From: Alexander Duyck +Date: Thu, 26 Jan 2023 11:06:59 -0800 +Subject: [PATCH] skb: Do mix page pool and page referenced frags in GRO + +GSO should not merge page pool recycled frames with standard reference +counted frames. Traditionally this didn't occur, at least not often. +However as we start looking at adding support for wireless adapters there +becomes the potential to mix the two due to A-MSDU repartitioning frames in +the receive path. There are possibly other places where this may have +occurred however I suspect they must be few and far between as we have not +seen this issue until now. + +Fixes: 53e0961da1c7 ("page_pool: add frag page recycling support in page pool") +Reported-by: Felix Fietkau +Signed-off-by: Alexander Duyck +--- + +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -4348,6 +4348,15 @@ int skb_gro_receive(struct sk_buff *p, s + if (unlikely(p->len + len >= 65536 || NAPI_GRO_CB(skb)->flush)) + return -E2BIG; + ++ /* Do not splice page pool based packets w/ non-page pool ++ * packets. This can result in reference count issues as page ++ * pool pages will not decrement the reference count and will ++ * instead be immediately returned to the pool or have frag ++ * count decremented. ++ */ ++ if (p->pp_recycle != skb->pp_recycle) ++ return -ETOOMANYREFS; ++ + lp = NAPI_GRO_CB(p)->last; + pinfo = skb_shinfo(lp); + From 83d3e255f1cc7ca59e51f02857cef2e004d946dc Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 27 Jan 2023 19:07:00 +0100 Subject: [PATCH 094/104] bridger: update to the latest version 8be8bb9df789 nl: fix accessing hairpin mode and isolated from the right attribute set Signed-off-by: Felix Fietkau --- package/network/services/bridger/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/bridger/Makefile b/package/network/services/bridger/Makefile index 39cbd2c560c..be4ae3bc428 100644 --- a/package/network/services/bridger/Makefile +++ b/package/network/services/bridger/Makefile @@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bridger PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/nbd168/bridger -PKG_SOURCE_DATE:=2023-01-03 -PKG_SOURCE_VERSION:=978c1f9eed07504cc0b84f72ee7384aab722386a -PKG_MIRROR_HASH:=2a019b188d8de2fdc95453529d1820b0a7a5576adf161bd19e182c9c1c2b2c85 +PKG_SOURCE_DATE:=2023-01-27 +PKG_SOURCE_VERSION:=8be8bb9df789b53a68f08298f610648ebded6063 +PKG_MIRROR_HASH:=d4f47009bb00c4f129d0959cb00ed90bc14bfe5dd0e67458ddb54176365e65f0 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:=Felix Fietkau From d02d4556789f59f472c3134569a341a48f18c1ec Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 27 Jan 2023 19:07:32 +0100 Subject: [PATCH 095/104] kernel: make it possible for packages to select page pool support Will be used by the next mt76 update Signed-off-by: Felix Fietkau --- config/Config-kernel.in | 7 +++++++ target/linux/generic/hack-5.10/251-kconfig.patch | 11 +++++++++++ target/linux/generic/hack-5.15/251-kconfig.patch | 11 +++++++++++ 3 files changed, 29 insertions(+) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index eed3fba1aa0..81b76179a53 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -1123,6 +1123,13 @@ config KERNEL_WEXT_PROC config KERNEL_WEXT_SPY def_bool KERNEL_WIRELESS_EXT +config KERNEL_PAGE_POOL + def_bool n + +config KERNEL_PAGE_POOL_STATS + bool "Page pool stats support" + depends on KERNEL_PAGE_POOL + depends on !LINUX_5_10 # # NFS related symbols diff --git a/target/linux/generic/hack-5.10/251-kconfig.patch b/target/linux/generic/hack-5.10/251-kconfig.patch index 30b8ee23ea3..d692d137f15 100644 --- a/target/linux/generic/hack-5.10/251-kconfig.patch +++ b/target/linux/generic/hack-5.10/251-kconfig.patch @@ -197,3 +197,14 @@ Signed-off-by: John Crispin config SND_JACK bool +--- a/net/Kconfig ++++ b/net/Kconfig +@@ -436,7 +436,7 @@ config NET_DEVLINK + default n + + config PAGE_POOL +- bool ++ bool "Page pool support" + + config FAILOVER + tristate "Generic failover module" diff --git a/target/linux/generic/hack-5.15/251-kconfig.patch b/target/linux/generic/hack-5.15/251-kconfig.patch index 5a8a820252a..0e24c3e8041 100644 --- a/target/linux/generic/hack-5.15/251-kconfig.patch +++ b/target/linux/generic/hack-5.15/251-kconfig.patch @@ -197,3 +197,14 @@ Signed-off-by: John Crispin config SND_JACK bool +--- a/net/Kconfig ++++ b/net/Kconfig +@@ -432,7 +432,7 @@ config NET_DEVLINK + default n + + config PAGE_POOL +- bool ++ bool "Page pool support" + + config PAGE_POOL_STATS + default n From a336b6c7cffcf4e299db3b5cf17e499b427545f5 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Sun, 29 Jan 2023 10:57:48 +0100 Subject: [PATCH 096/104] realtek: remove KERNEL_PATCHVER overrides On the realtek target, the subtarget makefiles include a KERNEL_PATCHVER setting, shadowing KERNEL_PATCHVER from target/linux/realtek/Makefile. This makes the realtek target an exception in this regard, and makes switching kernel version a bit bothersome. Remove the overrides so all subtargets use the same kernel version. Signed-off-by: Sander Vanheule --- target/linux/realtek/rtl838x/target.mk | 2 -- target/linux/realtek/rtl839x/target.mk | 2 -- target/linux/realtek/rtl930x/target.mk | 2 -- target/linux/realtek/rtl931x/target.mk | 2 -- 4 files changed, 8 deletions(-) diff --git a/target/linux/realtek/rtl838x/target.mk b/target/linux/realtek/rtl838x/target.mk index d78b44b717f..e776676f663 100644 --- a/target/linux/realtek/rtl838x/target.mk +++ b/target/linux/realtek/rtl838x/target.mk @@ -5,8 +5,6 @@ CPU_TYPE:=4kec BOARD:=realtek BOARDNAME:=Realtek MIPS RTL838X -KERNEL_PATCHVER:=5.10 - define Target/Description Build firmware images for Realtek RTL838x based boards. endef diff --git a/target/linux/realtek/rtl839x/target.mk b/target/linux/realtek/rtl839x/target.mk index 88993fad147..b2f4e9c0dd2 100644 --- a/target/linux/realtek/rtl839x/target.mk +++ b/target/linux/realtek/rtl839x/target.mk @@ -5,8 +5,6 @@ CPU_TYPE:=24kc BOARD:=realtek BOARDNAME:=Realtek MIPS RTL839X -KERNEL_PATCHVER:=5.10 - define Target/Description Build firmware images for Realtek RTL839x based boards. endef diff --git a/target/linux/realtek/rtl930x/target.mk b/target/linux/realtek/rtl930x/target.mk index 31b06219cab..a2b95f4db9b 100644 --- a/target/linux/realtek/rtl930x/target.mk +++ b/target/linux/realtek/rtl930x/target.mk @@ -5,8 +5,6 @@ CPU_TYPE:=24kc BOARD:=realtek BOARDNAME:=Realtek MIPS RTL930X -KERNEL_PATCHVER:=5.10 - define Target/Description Build firmware images for Realtek RTL930x based boards. endef diff --git a/target/linux/realtek/rtl931x/target.mk b/target/linux/realtek/rtl931x/target.mk index 39892e54842..eaa6b61214c 100644 --- a/target/linux/realtek/rtl931x/target.mk +++ b/target/linux/realtek/rtl931x/target.mk @@ -5,8 +5,6 @@ CPU_TYPE:=24kc BOARD:=realtek BOARDNAME:=Realtek MIPS RTL931X -KERNEL_PATCHVER:=5.10 - define Target/Description Build firmware images for Realtek RTL931x based boards. endef From 3d7d93cf6579de4362b96c0829d0595f0fcd8e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Mon, 30 Jan 2023 10:54:45 +0100 Subject: [PATCH 097/104] ubus: fix wrong package mirror hash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I've somehow managed to commit wrong package mirror hash in commit 36076b5a4092 ("ubus: update to version 2022-06-15"), so lets fix it by using a proper one. Fixes: 36076b5a4092 ("ubus: update to version 2022-06-15") Reported-by: Andre Heider Signed-off-by: Petr Štetiar --- package/system/ubus/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index 8762324e7c1..4c72780703b 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -7,7 +7,7 @@ PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git PKG_SOURCE_DATE:=2022-06-15 PKG_SOURCE_VERSION:=9913aa61de739e3efe067a2d186021c20bcd65e2 -PKG_MIRROR_HASH:=2a9fd9e895835b15948ab211963b7489f8437cd1b2bf43e0e321bc960e105774 +PKG_MIRROR_HASH:=f6702e68d7c60388c11f40ca5ca8e932d0bf423325db5bee2c79404782bbcb52 PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) CMAKE_INSTALL:=1 From 459d40811e0b83e360c530307cdda1bf252ab381 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Tue, 24 Jan 2023 13:01:07 +0100 Subject: [PATCH 098/104] zynq: switch default kernel to 5.15 The default kernel should be switched to 5.15 in order to enable testing by a broader audience. Signed-off-by: Nick Hainke --- target/linux/zynq/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/zynq/Makefile b/target/linux/zynq/Makefile index b3ad1db8d50..f48b58e5982 100644 --- a/target/linux/zynq/Makefile +++ b/target/linux/zynq/Makefile @@ -18,8 +18,7 @@ define Target/Description Build firmware image for Zynq 7000 SoC devices. endef -KERNEL_PATCHVER:=5.10 -KERNEL_TESTING_PATCHVER:=5.15 +KERNEL_PATCHVER:=5.15 include $(INCLUDE_DIR)/target.mk From 0c64c5f520cd0230f5047bed810c071c81c1ea55 Mon Sep 17 00:00:00 2001 From: Chuanhong Guo Date: Mon, 30 Jan 2023 17:55:55 +0800 Subject: [PATCH 099/104] zynq: remove kconfig for 5.10 Signed-off-by: Chuanhong Guo --- target/linux/zynq/config-5.10 | 546 ---------------------------------- 1 file changed, 546 deletions(-) delete mode 100644 target/linux/zynq/config-5.10 diff --git a/target/linux/zynq/config-5.10 b/target/linux/zynq/config-5.10 deleted file mode 100644 index 767ee677f65..00000000000 --- a/target/linux/zynq/config-5.10 +++ /dev/null @@ -1,546 +0,0 @@ -CONFIG_ALIGNMENT_TRAP=y -# CONFIG_ALTERA_FREEZE_BRIDGE is not set -# CONFIG_ALTERA_PR_IP_CORE is not set -CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_KEEP_MEMBLOCK=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MULTIPLATFORM=y -CONFIG_ARCH_MULTI_V6_V7=y -CONFIG_ARCH_MULTI_V7=y -CONFIG_ARCH_NR_GPIO=1024 -CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y -CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_VEXPRESS=y -CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA=y -# CONFIG_ARCH_VEXPRESS_SPC is not set -CONFIG_ARCH_ZYNQ=y -CONFIG_ARM=y -CONFIG_ARM_AMBA=y -CONFIG_ARM_CPU_SUSPEND=y -CONFIG_ARM_ERRATA_643719=y -CONFIG_ARM_ERRATA_720789=y -CONFIG_ARM_ERRATA_754322=y -CONFIG_ARM_ERRATA_754327=y -CONFIG_ARM_ERRATA_764369=y -CONFIG_ARM_ERRATA_775420=y -CONFIG_ARM_GIC=y -CONFIG_ARM_GLOBAL_TIMER=y -CONFIG_ARM_HAS_SG_CHAIN=y -CONFIG_ARM_HEAVY_MB=y -CONFIG_ARM_L1_CACHE_SHIFT=6 -CONFIG_ARM_L1_CACHE_SHIFT_6=y -CONFIG_ARM_PATCH_IDIV=y -CONFIG_ARM_PATCH_PHYS_VIRT=y -# CONFIG_ARM_PL172_MPMC is not set -# CONFIG_ARM_SMMU is not set -CONFIG_ARM_THUMB=y -CONFIG_ARM_TIMER_SP804=y -CONFIG_ARM_UNWIND=y -CONFIG_ARM_VIRT_EXT=y -CONFIG_ARM_ZYNQ_CPUIDLE=y -CONFIG_ATAGS=y -CONFIG_AUTO_ZRELADDR=y -# CONFIG_AXI_DMAC is not set -CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=16 -CONFIG_BLK_DEV_RAM_SIZE=16384 -CONFIG_BLK_MQ_PCI=y -CONFIG_BLK_PM=y -CONFIG_BOUNCE=y -CONFIG_CACHE_L2X0=y -CONFIG_CADENCE_TTC_TIMER=y -CONFIG_CADENCE_WATCHDOG=y -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK=y -CONFIG_CLKSRC_MMIO=y -CONFIG_CLKSRC_VERSATILE=y -CONFIG_CLK_SP810=y -CONFIG_CLK_VEXPRESS_OSC=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMA=y -CONFIG_CMA_ALIGNMENT=8 -CONFIG_CMA_AREAS=7 -# CONFIG_CMA_DEBUG is not set -# CONFIG_CMA_DEBUGFS is not set -CONFIG_CMA_SIZE_MBYTES=16 -# CONFIG_CMA_SIZE_SEL_MAX is not set -CONFIG_CMA_SIZE_SEL_MBYTES=y -# CONFIG_CMA_SIZE_SEL_MIN is not set -# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set -CONFIG_COMMON_CLK=y -# CONFIG_COMMON_CLK_AXI_CLKGEN is not set -CONFIG_COMMON_CLK_SI570=y -CONFIG_COMPAT_32BIT_TIME=y -CONFIG_CONNECTOR=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_CONTIG_ALLOC=y -CONFIG_COREDUMP=y -# CONFIG_CPUFREQ_DT is not set -CONFIG_CPU_32v6K=y -CONFIG_CPU_32v7=y -CONFIG_CPU_ABRT_EV7=y -CONFIG_CPU_CACHE_V7=y -CONFIG_CPU_CACHE_VIPT=y -CONFIG_CPU_COPY_V6=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y -CONFIG_CPU_FREQ=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y -CONFIG_CPU_FREQ_GOV_ATTR_SET=y -CONFIG_CPU_FREQ_GOV_COMMON=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -CONFIG_CPU_FREQ_GOV_USERSPACE=y -CONFIG_CPU_FREQ_STAT=y -CONFIG_CPU_HAS_ASID=y -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_IDLE_GOV_MENU=y -CONFIG_CPU_PABRT_V7=y -CONFIG_CPU_PM=y -CONFIG_CPU_RMAP=y -CONFIG_CPU_SPECTRE=y -CONFIG_CPU_THERMAL=y -CONFIG_CPU_THUMB_CAPABLE=y -CONFIG_CPU_TLB_V7=y -CONFIG_CPU_V7=y -CONFIG_CRC16=y -# CONFIG_CRC32_SARWATE is not set -CONFIG_CRC32_SLICEBY8=y -CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_CRYPTO_BLAKE2S=y -CONFIG_CRYPTO_CRC32=y -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_HW=y -CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y -CONFIG_CRYPTO_RNG2=y -CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" -CONFIG_DMADEVICES=y -CONFIG_DMA_CMA=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y -CONFIG_DMA_OPS=y -CONFIG_DMA_REMAP=y -CONFIG_DMA_SHARED_BUFFER=y -CONFIG_DRM=y -CONFIG_DRM_BRIDGE=y -CONFIG_DRM_FBDEV_EMULATION=y -CONFIG_DRM_FBDEV_OVERALLOC=100 -CONFIG_DRM_KMS_FB_HELPER=y -CONFIG_DRM_KMS_HELPER=y -CONFIG_DRM_PANEL=y -CONFIG_DRM_PANEL_BRIDGE=y -CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y -CONFIG_DTC=y -CONFIG_DUMMY_CONSOLE=y -CONFIG_E1000E=y -CONFIG_EDAC=y -CONFIG_EDAC_ATOMIC_SCRUB=y -# CONFIG_EDAC_DEBUG is not set -CONFIG_EDAC_LEGACY_SYSFS=y -CONFIG_EDAC_SUPPORT=y -# CONFIG_EDAC_SYNOPSYS is not set -CONFIG_EEPROM_AT24=y -CONFIG_EEPROM_AT25=y -CONFIG_ELF_CORE=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_EXT4_FS=y -CONFIG_EXTCON=y -CONFIG_F2FS_FS=y -CONFIG_FB=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_CMDLINE=y -CONFIG_FB_DEFERRED_IO=y -CONFIG_FB_SYS_COPYAREA=y -CONFIG_FB_SYS_FILLRECT=y -CONFIG_FB_SYS_FOPS=y -CONFIG_FB_SYS_IMAGEBLIT=y -# CONFIG_FB_XILINX is not set -CONFIG_FHANDLE=y -CONFIG_FIXED_PHY=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_FPGA=y -CONFIG_FPGA_BRIDGE=y -# CONFIG_FPGA_DFL is not set -# CONFIG_FPGA_MGR_ALTERA_CVP is not set -# CONFIG_FPGA_MGR_ALTERA_PS_SPI is not set -# CONFIG_FPGA_MGR_ICE40_SPI is not set -# CONFIG_FPGA_MGR_MACHXO2_SPI is not set -# CONFIG_FPGA_MGR_XILINX_SPI is not set -CONFIG_FPGA_MGR_ZYNQ_FPGA=y -CONFIG_FPGA_REGION=y -CONFIG_FREEZER=y -CONFIG_FS_IOMAP=y -CONFIG_FS_MBCACHE=y -CONFIG_FW_CACHE=y -CONFIG_FW_LOADER_PAGED_BUF=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_ARCH_TOPOLOGY=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_EARLY_IOREMAP=y -CONFIG_GENERIC_GETTIMEOFDAY=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y -CONFIG_GENERIC_IRQ_MIGRATION=y -CONFIG_GENERIC_IRQ_MULTI_HANDLER=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_MSI_IRQ_DOMAIN=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_PINCONF=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GENERIC_VDSO_32=y -CONFIG_GLOB=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_GPIO_GENERIC=y -CONFIG_GPIO_GENERIC_PLATFORM=y -CONFIG_GPIO_ZYNQ=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDEN_BRANCH_PREDICTOR=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAVE_SMP=y -CONFIG_HDMI=y -CONFIG_HID=y -CONFIG_HID_GENERIC=y -CONFIG_HID_MICROSOFT=y -CONFIG_HIGHMEM=y -CONFIG_HIGHPTE=y -CONFIG_HOTPLUG_CPU=y -CONFIG_HWMON=y -CONFIG_HW_CONSOLE=y -CONFIG_HZ_FIXED=0 -CONFIG_I2C=y -CONFIG_I2C_ALGOBIT=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_CADENCE=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_COMPAT=y -CONFIG_I2C_HELPER_AUTO=y -CONFIG_I2C_MUX=y -CONFIG_I2C_MUX_PCA954x=y -CONFIG_ICST=y -CONFIG_IIO=y -CONFIG_IIO_BUFFER=y -CONFIG_IIO_KFIFO_BUF=y -CONFIG_IIO_TRIGGER=y -CONFIG_IIO_TRIGGERED_BUFFER=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=y -CONFIG_INPUT_EVDEV=y -CONFIG_INPUT_FF_MEMLESS=y -CONFIG_INPUT_KEYBOARD=y -CONFIG_INPUT_MOUSE=y -CONFIG_INPUT_MOUSEDEV=y -CONFIG_INPUT_MOUSEDEV_PSAUX=y -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -CONFIG_INPUT_POLLDEV=y -CONFIG_INPUT_SPARSEKMAP=y -# CONFIG_IOMMU_DEBUGFS is not set -# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set -# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set -CONFIG_IOMMU_SUPPORT=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_BOOTP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_RARP=y -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -# CONFIG_ISDN is not set -CONFIG_JBD2=y -# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set -CONFIG_JFFS2_ZLIB=y -CONFIG_KCMP=y -CONFIG_KERNEL_GZIP=y -# CONFIG_KERNEL_XZ is not set -CONFIG_KEYBOARD_ATKBD=y -CONFIG_KEYBOARD_GPIO=y -CONFIG_KEYBOARD_GPIO_POLLED=y -CONFIG_LEDS_GPIO=y -CONFIG_LEDS_TRIGGER_BACKLIGHT=y -CONFIG_LEDS_TRIGGER_CAMERA=y -CONFIG_LEDS_TRIGGER_CPU=y -CONFIG_LEDS_TRIGGER_GPIO=y -CONFIG_LEDS_TRIGGER_ONESHOT=y -CONFIG_LEDS_TRIGGER_TRANSIENT=y -CONFIG_LIBFDT=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_MACB=y -# CONFIG_MACB_PCI is not set -CONFIG_MACB_USE_HWSTAMP=y -CONFIG_MARVELL_PHY=y -CONFIG_MDIO_BITBANG=y -CONFIG_MDIO_BUS=y -CONFIG_MDIO_DEVICE=y -CONFIG_MDIO_DEVRES=y -# CONFIG_MDIO_GPIO is not set -CONFIG_MEMFD_CREATE=y -CONFIG_MEMORY=y -CONFIG_MEMORY_ISOLATION=y -CONFIG_MFD_CORE=y -CONFIG_MFD_SYSCON=y -CONFIG_MFD_VEXPRESS_SYSREG=y -CONFIG_MIGHT_HAVE_CACHE_L2X0=y -CONFIG_MIGRATION=y -CONFIG_MMC=y -CONFIG_MMC_BLOCK=y -CONFIG_MMC_CQHCI=y -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_OF_ARASAN=y -# CONFIG_MMC_SDHCI_PCI is not set -CONFIG_MMC_SDHCI_PLTFM=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MODULE_FORCE_UNLOAD=y -# CONFIG_MODULE_STRIPPED is not set -# CONFIG_MOUSE_BCM5974 is not set -# CONFIG_MOUSE_CYAPA is not set -CONFIG_MOUSE_PS2=y -CONFIG_MOUSE_PS2_ALPS=y -CONFIG_MOUSE_PS2_BYD=y -CONFIG_MOUSE_PS2_CYPRESS=y -# CONFIG_MOUSE_PS2_ELANTECH is not set -CONFIG_MOUSE_PS2_FOCALTECH=y -CONFIG_MOUSE_PS2_LOGIPS2PP=y -CONFIG_MOUSE_PS2_SMBUS=y -CONFIG_MOUSE_PS2_SYNAPTICS=y -CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=y -# CONFIG_MOUSE_PS2_TOUCHKIT is not set -CONFIG_MOUSE_PS2_TRACKPOINT=y -# CONFIG_MOUSE_SERIAL is not set -# CONFIG_MOUSE_VSXXXAA is not set -# CONFIG_MTD_CFI_INTELEXT is not set -CONFIG_MTD_CMDLINE_PARTS=y -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -CONFIG_MTD_PHYSMAP=y -CONFIG_MTD_SPI_NOR=y -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y -CONFIG_MTD_SPLIT_FIRMWARE=y -# CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEON=y -CONFIG_NET_FLOW_LIMIT=y -CONFIG_NET_PTP_CLASSIFY=y -# CONFIG_NET_VENDOR_CIRRUS is not set -# CONFIG_NET_VENDOR_FARADAY is not set -# CONFIG_NET_VENDOR_MARVELL is not set -# CONFIG_NET_VENDOR_MICREL is not set -# CONFIG_NET_VENDOR_MICROCHIP is not set -# CONFIG_NET_VENDOR_NATSEMI is not set -# CONFIG_NET_VENDOR_SEEQ is not set -# CONFIG_NET_VENDOR_SMSC is not set -# CONFIG_NET_VENDOR_STMICRO is not set -# CONFIG_NET_VENDOR_VIA is not set -CONFIG_NLS=y -CONFIG_NLS_ASCII=y -CONFIG_NLS_CODEPAGE_437=y -CONFIG_NLS_ISO8859_1=y -CONFIG_NOP_USB_XCEIV=y -CONFIG_NO_HZ=y -CONFIG_NO_HZ_COMMON=y -CONFIG_NO_HZ_IDLE=y -CONFIG_NO_IOPORT_MAP=y -CONFIG_NR_CPUS=4 -CONFIG_NVMEM=y -CONFIG_NVMEM_SYSFS=y -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -# CONFIG_OF_FPGA_REGION is not set -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_KOBJ=y -CONFIG_OF_MDIO=y -CONFIG_OF_NET=y -CONFIG_OLD_SIGACTION=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_OUTER_CACHE=y -CONFIG_OUTER_CACHE_SYNC=y -CONFIG_PADATA=y -CONFIG_PAGE_OFFSET=0xC0000000 -# CONFIG_PARTITION_ADVANCED is not set -CONFIG_PCI=y -CONFIG_PCIE_XILINX=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DOMAINS_GENERIC=y -CONFIG_PCI_MSI=y -CONFIG_PCI_MSI_ARCH_FALLBACKS=y -CONFIG_PCI_MSI_IRQ_DOMAIN=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -CONFIG_PHYLINK=y -CONFIG_PINCTRL=y -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_PINCTRL_ZYNQ=y -CONFIG_PL310_ERRATA_588369=y -CONFIG_PL310_ERRATA_727915=y -CONFIG_PL310_ERRATA_753970=y -CONFIG_PL310_ERRATA_769419=y -CONFIG_PL330_DMA=y -# CONFIG_PL353_SMC is not set -CONFIG_PLAT_VERSATILE=y -CONFIG_PM=y -CONFIG_PMBUS=y -CONFIG_PM_CLK=y -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_VEXPRESS=y -CONFIG_POWER_SUPPLY=y -CONFIG_PPS=y -CONFIG_PROC_EVENTS=y -CONFIG_PTP_1588_CLOCK=y -CONFIG_R8169=y -CONFIG_RAS=y -CONFIG_RATIONAL=y -CONFIG_REALTEK_PHY=y -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y -# CONFIG_REGULATOR_VEXPRESS is not set -CONFIG_RESET_CONTROLLER=y -CONFIG_RESET_ZYNQ=y -CONFIG_RFS_ACCEL=y -CONFIG_RPS=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_DRV_PCF8563=y -CONFIG_RTC_I2C_AND_SPI=y -CONFIG_RTC_MC146818_LIB=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -CONFIG_SCHED_MC=y -CONFIG_SCHED_SMT=y -CONFIG_SENSORS_PMBUS=y -CONFIG_SENSORS_UCD9000=y -CONFIG_SENSORS_UCD9200=y -# CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_XILINX_PS_UART=y -CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y -CONFIG_SERIO=y -CONFIG_SERIO_LIBPS2=y -CONFIG_SERIO_SERPORT=y -CONFIG_SMP=y -CONFIG_SMP_ON_UP=y -CONFIG_SOC_BUS=y -CONFIG_SPARSE_IRQ=y -CONFIG_SPI=y -CONFIG_SPI_BITBANG=y -CONFIG_SPI_CADENCE=y -CONFIG_SPI_MASTER=y -CONFIG_SPI_MEM=y -CONFIG_SPI_XILINX=y -CONFIG_SPI_ZYNQ_QSPI=y -CONFIG_SRAM=y -CONFIG_SRAM_EXEC=y -CONFIG_SRCU=y -# CONFIG_STRIP_ASM_SYMS is not set -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -CONFIG_SWPHY=y -CONFIG_SWP_EMULATE=y -CONFIG_SYNC_FILE=y -CONFIG_SYSFS_SYSCALL=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -# CONFIG_TEXTSEARCH is not set -CONFIG_THERMAL=y -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 -CONFIG_THERMAL_GOV_STEP_WISE=y -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_OF=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TIMER_OF=y -CONFIG_TIMER_PROBE=y -CONFIG_TREE_RCU=y -CONFIG_TREE_SRCU=y -CONFIG_UIO=y -# CONFIG_UIO_AEC is not set -# CONFIG_UIO_CIF is not set -# CONFIG_UIO_DMEM_GENIRQ is not set -# CONFIG_UIO_MF624 is not set -# CONFIG_UIO_NETX is not set -# CONFIG_UIO_PCI_GENERIC is not set -CONFIG_UIO_PDRV_GENIRQ=y -# CONFIG_UIO_PRUSS is not set -# CONFIG_UIO_SERCOS3 is not set -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -CONFIG_UNWINDER_ARM=y -CONFIG_USB=y -CONFIG_USB_CHIPIDEA=y -CONFIG_USB_CHIPIDEA_HOST=y -CONFIG_USB_CHIPIDEA_UDC=y -CONFIG_USB_COMMON=y -CONFIG_USB_EHCI_HCD=y -# CONFIG_USB_EHCI_HCD_PLATFORM is not set -# CONFIG_USB_EHCI_TT_NEWSCHED is not set -CONFIG_USB_GADGET=y -CONFIG_USB_GADGET_XILINX=y -CONFIG_USB_HID=y -CONFIG_USB_NET_DRIVERS=y -CONFIG_USB_OTG=y -CONFIG_USB_OTG_FSM=y -CONFIG_USB_PHY=y -CONFIG_USB_ROLE_SWITCH=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_ULPI=y -CONFIG_USB_ULPI_BUS=y -CONFIG_USB_ULPI_VIEWPORT=y -CONFIG_USE_OF=y -CONFIG_VEXPRESS_CONFIG=y -CONFIG_VFP=y -CONFIG_VFPv3=y -CONFIG_VGA_ARB=y -CONFIG_VGA_ARB_MAX_GPUS=16 -CONFIG_VITESSE_PHY=y -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -# CONFIG_VT_HW_CONSOLE_BINDING is not set -CONFIG_WATCHDOG_CORE=y -# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set -CONFIG_XILINX_EMACLITE=y -# CONFIG_XILINX_PR_DECOUPLER is not set -CONFIG_XILINX_WATCHDOG=y -CONFIG_XILINX_XADC=y -CONFIG_XPS=y -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_ARMTHUMB=y -CONFIG_XZ_DEC_BCJ=y -CONFIG_XZ_DEC_IA64=y -CONFIG_XZ_DEC_POWERPC=y -CONFIG_XZ_DEC_SPARC=y -CONFIG_XZ_DEC_X86=y -CONFIG_ZBOOT_ROM_BSS=0x0 -CONFIG_ZBOOT_ROM_TEXT=0x0 -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y From c2903ebadc994720fbf466a9e51fbdf027ceda70 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 16 Jan 2023 13:18:56 +0100 Subject: [PATCH 100/104] ath25: mark as source-only ath25 seems to be a target with low number of users according to download statistics, most of which are for older releases anyway. Users that we managed to find are currently building images downstream as due to low amount of RAM (32MB) default config will not work. Target also suffers from inability for the 5.15 kernel bump to be tested which is a requirment for the next release. So, for those reasons, lets mark it as source-only so that Buildbots dont use the resources for building the images for this target anymore. Signed-off-by: Robert Marko --- target/linux/ath25/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ath25/Makefile b/target/linux/ath25/Makefile index 4675962e6f1..debb0a324b3 100644 --- a/target/linux/ath25/Makefile +++ b/target/linux/ath25/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk ARCH:=mips BOARD:=ath25 BOARDNAME:=Atheros AR231x/AR5312 -FEATURES:=squashfs low_mem small_flash +FEATURES:=squashfs low_mem small_flash source-only SUBTARGETS:=generic KERNEL_PATCHVER:=5.10 From d649a8dcef853e187fe55ef421c8a0304cfa7eaa Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Tue, 24 Jan 2023 19:42:08 +0100 Subject: [PATCH 101/104] mxs: switch default kernel to 5.15 The testing kernel has been available since Mar/2022, let's switch to it by default. Signed-off-by: Zoltan HERPAI --- target/linux/mxs/Makefile | 3 +- target/linux/mxs/config-5.10 | 243 ----------------------------------- 2 files changed, 1 insertion(+), 245 deletions(-) delete mode 100644 target/linux/mxs/config-5.10 diff --git a/target/linux/mxs/Makefile b/target/linux/mxs/Makefile index 998983090ec..6ae4814e95a 100644 --- a/target/linux/mxs/Makefile +++ b/target/linux/mxs/Makefile @@ -11,8 +11,7 @@ FEATURES:=ext4 rtc usb gpio CPU_TYPE:=arm926ej-s SUBTARGETS:=generic -KERNEL_PATCHVER:=5.10 -KERNEL_TESTING_PATCHVER:=5.15 +KERNEL_PATCHVER:=5.15 KERNELNAME:=zImage dtbs diff --git a/target/linux/mxs/config-5.10 b/target/linux/mxs/config-5.10 deleted file mode 100644 index e440f3a6308..00000000000 --- a/target/linux/mxs/config-5.10 +++ /dev/null @@ -1,243 +0,0 @@ -CONFIG_ALIGNMENT_TRAP=y -CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_KEEP_MEMBLOCK=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MULTIPLATFORM=y -CONFIG_ARCH_MULTI_CPU_AUTO=y -# CONFIG_ARCH_MULTI_V4 is not set -# CONFIG_ARCH_MULTI_V4T is not set -CONFIG_ARCH_MULTI_V4_V5=y -CONFIG_ARCH_MULTI_V5=y -CONFIG_ARCH_MXS=y -CONFIG_ARCH_NR_GPIO=0 -CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM=y -CONFIG_ARM_AMBA=y -CONFIG_ARM_APPENDED_DTB=y -CONFIG_ARM_ATAG_DTB_COMPAT=y -CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y -CONFIG_ARM_CPU_SUSPEND=y -CONFIG_ARM_HAS_SG_CHAIN=y -CONFIG_ARM_L1_CACHE_SHIFT=5 -CONFIG_ARM_PATCH_PHYS_VIRT=y -CONFIG_ARM_THUMB=y -CONFIG_ARM_UNWIND=y -CONFIG_ATAGS=y -CONFIG_AUTO_ZRELADDR=y -CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y -CONFIG_BLK_PM=y -CONFIG_CLKDEV_LOOKUP=y -CONFIG_CLKSRC_MMIO=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="console=ttyAMA0,115200 root=/dev/mmcblk0p2 rw rootwait" -CONFIG_CMDLINE_FROM_BOOTLOADER=y -CONFIG_COMMON_CLK=y -CONFIG_COMPAT_32BIT_TIME=y -CONFIG_COREDUMP=y -CONFIG_CPU_32v5=y -CONFIG_CPU_ABRT_EV5TJ=y -CONFIG_CPU_ARM926T=y -# CONFIG_CPU_CACHE_ROUND_ROBIN is not set -CONFIG_CPU_CACHE_VIVT=y -CONFIG_CPU_COPY_V4WB=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y -# CONFIG_CPU_DCACHE_WRITETHROUGH is not set -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_IDLE_GOV_MENU=y -CONFIG_CPU_PABRT_LEGACY=y -CONFIG_CPU_PM=y -CONFIG_CPU_THUMB_CAPABLE=y -CONFIG_CPU_TLB_V4WBI=y -CONFIG_CPU_USE_DOMAINS=y -CONFIG_CRC16=y -CONFIG_CROSS_MEMORY_ATTACH=y -CONFIG_CRYPTO_BLAKE2S=y -CONFIG_CRYPTO_CBC=y -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_DEV_MXS_DCP=y -CONFIG_CRYPTO_ECB=y -CONFIG_CRYPTO_HW=y -CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y -CONFIG_CRYPTO_RNG2=y -CONFIG_DEBUG_ALIGN_RODATA=y -CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" -CONFIG_DMADEVICES=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y -CONFIG_DMA_OPS=y -CONFIG_DMA_REMAP=y -CONFIG_DTC=y -CONFIG_EDAC_ATOMIC_SCRUB=y -CONFIG_EDAC_SUPPORT=y -CONFIG_EXT4_FS=y -CONFIG_EXTCON=y -CONFIG_FEC=y -CONFIG_FIXED_PHY=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_FS_IOMAP=y -CONFIG_FS_MBCACHE=y -CONFIG_FW_LOADER_PAGED_BUF=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_EARLY_IOREMAP=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_MULTI_HANDLER=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -# CONFIG_GIANFAR is not set -CONFIG_GLOB=y -CONFIG_GPIO_GENERIC=y -CONFIG_GPIO_GENERIC_PLATFORM=y -CONFIG_GPIO_MXS=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HZ_FIXED=0 -CONFIG_HZ_PERIODIC=y -CONFIG_I2C=y -CONFIG_I2C_ALGOBIT=y -CONFIG_I2C_ALGOPCA=y -CONFIG_I2C_ALGOPCF=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_COMPAT=y -CONFIG_I2C_MUX=y -CONFIG_I2C_MUX_PINCTRL=y -CONFIG_I2C_MXS=y -CONFIG_IIO=y -CONFIG_IIO_BUFFER=y -CONFIG_IIO_KFIFO_BUF=y -CONFIG_IIO_SYSFS_TRIGGER=y -CONFIG_IIO_TRIGGER=y -# CONFIG_IIO_TRIGGERED_BUFFER is not set -CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT=y -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_MXS=y -CONFIG_IRQ_WORK=y -# CONFIG_ISDN is not set -CONFIG_JBD2=y -CONFIG_LIBFDT=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_MDIO_BUS=y -CONFIG_MDIO_DEVICE=y -CONFIG_MDIO_DEVRES=y -CONFIG_MEMFD_CREATE=y -CONFIG_MFD_CORE=y -CONFIG_MFD_MXS_LRADC=y -CONFIG_MIGRATION=y -CONFIG_MMC=y -CONFIG_MMC_BLOCK=y -CONFIG_MMC_MXS=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MXS_DMA=y -# CONFIG_MXS_LRADC_ADC is not set -CONFIG_MXS_TIMER=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_KUSER_HELPERS=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NET_PTP_CLASSIFY=y -CONFIG_NLS=y -CONFIG_NVMEM=y -CONFIG_NVMEM_MXS_OCOTP=y -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_KOBJ=y -CONFIG_OF_MDIO=y -CONFIG_OF_NET=y -CONFIG_OLD_SIGACTION=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -CONFIG_PINCTRL=y -CONFIG_PINCTRL_IMX23=y -CONFIG_PINCTRL_IMX28=y -CONFIG_PINCTRL_MXS=y -# CONFIG_PINCTRL_SINGLE is not set -CONFIG_PM=y -CONFIG_PM_CLK=y -CONFIG_POWER_SUPPLY=y -CONFIG_PPS=y -CONFIG_PTP_1588_CLOCK=y -CONFIG_RATIONAL=y -CONFIG_REGULATOR=y -CONFIG_REGULATOR_FIXED_VOLTAGE=y -CONFIG_REGULATOR_GPIO=y -CONFIG_RESET_CONTROLLER=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_DRV_STMP=y -CONFIG_RTC_I2C_AND_SPI=y -CONFIG_RTC_MC146818_LIB=y -# CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_AMBA_PL011=y -CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -CONFIG_SERIAL_MCTRL_GPIO=y -CONFIG_SERIAL_MXS_AUART=y -CONFIG_SERIAL_MXS_AUART_CONSOLE=y -CONFIG_SMSC_PHY=y -CONFIG_SOC_BUS=y -CONFIG_SOC_IMX23=y -CONFIG_SOC_IMX28=y -CONFIG_SPARSE_IRQ=y -CONFIG_SPI=y -CONFIG_SPI_MASTER=y -CONFIG_SPI_MXS=y -CONFIG_SPLIT_PTLOCK_CPUS=999999 -CONFIG_SRCU=y -CONFIG_STMP3XXX_RTC_WATCHDOG=y -CONFIG_STMP_DEVICE=y -CONFIG_SWPHY=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TIMER_OF=y -CONFIG_TIMER_PROBE=y -CONFIG_TINY_SRCU=y -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -CONFIG_UNWINDER_ARM=y -CONFIG_USB=y -CONFIG_USB_CHIPIDEA=y -CONFIG_USB_CHIPIDEA_HOST=y -CONFIG_USB_CHIPIDEA_IMX=y -CONFIG_USB_CHIPIDEA_UDC=y -CONFIG_USB_COMMON=y -CONFIG_USB_EHCI_HCD=y -# CONFIG_USB_EHCI_HCD_PLATFORM is not set -CONFIG_USB_GADGET=y -CONFIG_USB_MXS_PHY=y -CONFIG_USB_OTG=y -CONFIG_USB_PHY=y -CONFIG_USB_ROLE_SWITCH=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_ULPI_BUS=y -CONFIG_USE_OF=y -# CONFIG_VFP is not set -CONFIG_WATCHDOG_CORE=y -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_BCJ=y -CONFIG_ZBOOT_ROM_BSS=0 -CONFIG_ZBOOT_ROM_TEXT=0 From 3cfa465387ee75451d59a37a3a198bba2deed3ed Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Thu, 29 Sep 2022 13:13:22 +0900 Subject: [PATCH 102/104] realtek: use generic earlycon setup on 5.15 Use generic earlycon on Linux Kernel instead of initialization in platform setup. And also, drop bootargs with console= parameter from I-O DATA BSH-G24MB. It uses 115200bps as baud-rate, the same as default in rtl838x.dtsi. Signed-off-by: INAGAKI Hiroshi Signed-off-by: Olliver Schinagl --- .../realtek/dts-5.15/rtl8382_iodata_bsh-g24mb.dts | 4 ---- target/linux/realtek/dts-5.15/rtl838x.dtsi | 8 +++++++- target/linux/realtek/dts-5.15/rtl838x_hpe_1920.dtsi | 2 +- .../realtek/dts-5.15/rtl8393_tplink_sg2452p-v4.dts | 2 +- target/linux/realtek/dts-5.15/rtl839x.dtsi | 8 +++++++- .../dts-5.15/rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi | 2 +- target/linux/realtek/dts-5.15/rtl930x.dtsi | 8 +++++++- target/linux/realtek/dts-5.15/rtl931x.dtsi | 10 ++++++++-- .../linux/realtek/files-5.15/arch/mips/rtl838x/prom.c | 3 --- 9 files changed, 32 insertions(+), 15 deletions(-) diff --git a/target/linux/realtek/dts-5.15/rtl8382_iodata_bsh-g24mb.dts b/target/linux/realtek/dts-5.15/rtl8382_iodata_bsh-g24mb.dts index d19960c1086..8ea28ed2fde 100644 --- a/target/linux/realtek/dts-5.15/rtl8382_iodata_bsh-g24mb.dts +++ b/target/linux/realtek/dts-5.15/rtl8382_iodata_bsh-g24mb.dts @@ -16,10 +16,6 @@ led-upgrade = &led_sys_loop; }; - chosen { - bootargs = "console=ttyS0,115200"; - }; - memory@0 { device_type = "memory"; reg = <0x0 0x8000000>; diff --git a/target/linux/realtek/dts-5.15/rtl838x.dtsi b/target/linux/realtek/dts-5.15/rtl838x.dtsi index 64e13e1ff37..13ba6450b2d 100644 --- a/target/linux/realtek/dts-5.15/rtl838x.dtsi +++ b/target/linux/realtek/dts-5.15/rtl838x.dtsi @@ -117,8 +117,14 @@ }; }; + aliases { + serial0 = &uart0; + serial1 = &uart1; + }; + chosen { - bootargs = "console=ttyS0,115200"; + bootargs = "earlycon"; + stdout-path = "serial0:115200n8"; }; cpuintc: cpuintc { diff --git a/target/linux/realtek/dts-5.15/rtl838x_hpe_1920.dtsi b/target/linux/realtek/dts-5.15/rtl838x_hpe_1920.dtsi index 8e29af62bbf..e18f61345ea 100644 --- a/target/linux/realtek/dts-5.15/rtl838x_hpe_1920.dtsi +++ b/target/linux/realtek/dts-5.15/rtl838x_hpe_1920.dtsi @@ -5,7 +5,7 @@ / { chosen { - bootargs = "console=ttyS0,38400"; + stdout-path = "serial0:38400n8"; }; memory@0 { diff --git a/target/linux/realtek/dts-5.15/rtl8393_tplink_sg2452p-v4.dts b/target/linux/realtek/dts-5.15/rtl8393_tplink_sg2452p-v4.dts index b7300cfcbee..d2221c1d2f0 100644 --- a/target/linux/realtek/dts-5.15/rtl8393_tplink_sg2452p-v4.dts +++ b/target/linux/realtek/dts-5.15/rtl8393_tplink_sg2452p-v4.dts @@ -24,7 +24,7 @@ }; chosen { - bootargs = "console=ttyS0,38400"; + stdout-path = "serial0:38400n8"; }; keys { diff --git a/target/linux/realtek/dts-5.15/rtl839x.dtsi b/target/linux/realtek/dts-5.15/rtl839x.dtsi index 91d6e17a9ea..3f87f5622e2 100644 --- a/target/linux/realtek/dts-5.15/rtl839x.dtsi +++ b/target/linux/realtek/dts-5.15/rtl839x.dtsi @@ -142,8 +142,14 @@ }; }; + aliases { + serial0 = &uart0; + serial1 = &uart1; + }; + chosen { - bootargs = "console=ttyS0,115200"; + bootargs = "earlycon"; + stdout-path = "serial0:115200n8"; }; cpuintc: cpuintc { diff --git a/target/linux/realtek/dts-5.15/rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi b/target/linux/realtek/dts-5.15/rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi index fb2aa18d218..f04e98b9cfe 100644 --- a/target/linux/realtek/dts-5.15/rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi +++ b/target/linux/realtek/dts-5.15/rtl83xx_panasonic_mxxeg-pn28xx0k.dtsi @@ -6,7 +6,7 @@ / { chosen { - bootargs = "console=ttyS0,9600"; + stdout-path = "serial0:9600n8"; }; memory@0 { diff --git a/target/linux/realtek/dts-5.15/rtl930x.dtsi b/target/linux/realtek/dts-5.15/rtl930x.dtsi index fdec626c9a8..9b0a5781a26 100644 --- a/target/linux/realtek/dts-5.15/rtl930x.dtsi +++ b/target/linux/realtek/dts-5.15/rtl930x.dtsi @@ -24,8 +24,14 @@ reg = <0x0 0x8000000>; }; + aliases { + serial0 = &uart0; + serial1 = &uart1; + }; + chosen { - bootargs = "console=ttyS0,115200"; + bootargs = "earlycon"; + stdout-path = "serial0:115200n8"; }; cpuintc: cpuintc { diff --git a/target/linux/realtek/dts-5.15/rtl931x.dtsi b/target/linux/realtek/dts-5.15/rtl931x.dtsi index a5166141e6f..e7e7840a223 100644 --- a/target/linux/realtek/dts-5.15/rtl931x.dtsi +++ b/target/linux/realtek/dts-5.15/rtl931x.dtsi @@ -28,9 +28,15 @@ device_type = "memory"; reg = <0x0 0x10000000>; }; - + + aliases { + serial0 = &uart0; + serial1 = &uart1; + }; + chosen { - bootargs = "console=ttyS0,115200"; + bootargs = "earlycon"; + stdout-path = "serial0:115200n8"; }; lx_clk: lx_clk { diff --git a/target/linux/realtek/files-5.15/arch/mips/rtl838x/prom.c b/target/linux/realtek/files-5.15/arch/mips/rtl838x/prom.c index abf594aa040..0c98af95485 100644 --- a/target/linux/realtek/files-5.15/arch/mips/rtl838x/prom.c +++ b/target/linux/realtek/files-5.15/arch/mips/rtl838x/prom.c @@ -117,9 +117,6 @@ void __init prom_init(void) { uint32_t model; - /* uart0 */ - setup_8250_early_printk_port(0xb8002000, 2, 0); - model = sw_r32(RTL838X_MODEL_NAME_INFO); pr_info("RTL838X model is %x\n", model); model = model >> 16 & 0xFFFF; From 91add68e50ea71b92f8528cba01de0017a15492b Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Mon, 30 Jan 2023 18:20:38 +0200 Subject: [PATCH 103/104] ipq807x: Enable CPU frequency scaling stats Enable the CPU frequency scaling statistics in kernel config. Signed-off-by: Hannu Nyman Reviewed-by: Robert Marko --- target/linux/ipq807x/config-5.15 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq807x/config-5.15 b/target/linux/ipq807x/config-5.15 index 4a5aee7d9ef..5dbc62dd66a 100644 --- a/target/linux/ipq807x/config-5.15 +++ b/target/linux/ipq807x/config-5.15 @@ -73,7 +73,7 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y # CONFIG_CPU_FREQ_GOV_POWERSAVE is not set CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y # CONFIG_CPU_FREQ_GOV_USERSPACE is not set -# CONFIG_CPU_FREQ_STAT is not set +CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_THERMAL=y CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE_GOV_MENU=y From 6f89a0ca20505e85f53bdd5573f26e443e961257 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Mon, 23 Jan 2023 19:47:41 +0100 Subject: [PATCH 104/104] CI: use openwrt official tools container by default Use openwrt official tools container by default. Fork will use openwrt tools container by default. This can be disabled by setting the option use_openwrt_container to false for the build.yml and check-kernel-patches.yml. The push-containers workflow is disabled on forks. The workflow can be reenabled by commenting the condition in push-containers.yml. Signed-off-by: Christian Marangi --- .github/workflows/build.yml | 8 ++++++++ .github/workflows/check-kernel-patches.yml | 8 ++++++++ .github/workflows/push-containers.yml | 2 ++ 3 files changed, 18 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62a4441a3b7..19d3c23403e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,9 @@ on: type: boolean build_all_boards: type: boolean + use_openwrt_container: + type: boolean + default: true permissions: contents: read @@ -44,6 +47,11 @@ jobs: run: | OWNER_LC=$(echo "${{ github.repository_owner }}" \ | tr '[:upper:]' '[:lower:]') + + if [ ${{ inputs.use_openwrt_container }} == "true" ]; then + OWNER_LC=openwrt + fi + echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT - name: Generate ccache hash diff --git a/.github/workflows/check-kernel-patches.yml b/.github/workflows/check-kernel-patches.yml index 7e0fe5071a5..50a6d1495cf 100644 --- a/.github/workflows/check-kernel-patches.yml +++ b/.github/workflows/check-kernel-patches.yml @@ -8,6 +8,9 @@ on: type: string testing: type: boolean + use_openwrt_container: + type: boolean + default: true permissions: contents: read @@ -26,6 +29,11 @@ jobs: run: | OWNER_LC=$(echo "${{ github.repository_owner }}" \ | tr '[:upper:]' '[:lower:]') + + if [ ${{ inputs.use_openwrt_container }} == "true" ]; then + OWNER_LC=openwrt + fi + echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT # Per branch tools container tag diff --git a/.github/workflows/push-containers.yml b/.github/workflows/push-containers.yml index cc13cda5725..bad39c2fc2c 100644 --- a/.github/workflows/push-containers.yml +++ b/.github/workflows/push-containers.yml @@ -18,6 +18,7 @@ concurrency: jobs: build-linux-buildbot: name: Build tools with buildbot container + if: ${{ github.repository_owner == 'openwrt' }} uses: ./.github/workflows/build-tools.yml with: generate_prebuilt_artifacts: true @@ -25,6 +26,7 @@ jobs: push-tools-container: needs: build-linux-buildbot name: Push prebuilt tools container + if: ${{ github.repository_owner == 'openwrt' }} runs-on: ubuntu-latest permissions: