From: Mathew McBride Date: Tue, 6 Jun 2023 23:19:16 +0000 (+0000) Subject: armsr: rename from armvirt X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=40b02a230167626def69389452f19b7109aaeac1;p=openwrt%2Fstaging%2Fwigyori.git armsr: rename from armvirt Now that the armvirt target supports real hardware, not just VMs, thanks to the addition of EFI, rename it to something more appropriate. 'armsr' (Arm SystemReady) was chosen after the name of the Arm standards program. The 32 and 64 bit targets have also been renamed armv7 and armv8 respectively, to allow future profiles where required (such as armv9). See https://developer.arm.com/documentation/102858/0100/Introduction for more information. Signed-off-by: Mathew McBride --- diff --git a/target/linux/armsr/Makefile b/target/linux/armsr/Makefile new file mode 100644 index 0000000000..b34500ed8a --- /dev/null +++ b/target/linux/armsr/Makefile @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2017 Yousong Zhou + +include $(TOPDIR)/rules.mk + +BOARD:=armsr +BOARDNAME:=Arm SystemReady (EFI) compliant +FEATURES:=fpu pci pcie rtc usb boot-part rootfs-part +FEATURES+=cpiogz ext4 ramdisk squashfs targz vmdk + +KERNEL_PATCHVER:=6.1 + +include $(INCLUDE_DIR)/target.mk + +DEFAULT_PACKAGES += mkf2fs e2fsprogs +# blkid used for resolving PARTUUID +# in sysupgrade +DEFAULT_PACKAGES += blkid + +$(eval $(call BuildTarget)) diff --git a/target/linux/armsr/README b/target/linux/armsr/README new file mode 100644 index 0000000000..bce839ddfc --- /dev/null +++ b/target/linux/armsr/README @@ -0,0 +1,76 @@ +This target generates images that can be used on ARM machines with EFI +support (e.g EDKII/TianoCore or U-Boot with bootefi). + +There are two subtargets: +- armv7 for 32-bit machines +- armv8 for 64-bit machines + +The kernel and filesystem images can also be used directly by QEMU: + +Run with qemu-system-arm + + # boot with initramfs embedded in + qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armsr-armv7-generic-initramfs-kernel.bin + + # boot with accel=kvm + qemu-system-arm -nographic -M virt,accel=kvm -cpu host -m 64 -kernel + openwrt-armsr-armv7-generic-initramfs-kernel.bin + + # boot with a separate rootfs + qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armsr-armv7-generic-kernel.bin \ + -drive file=openwrt-armsr-armv7-generic-ext4-rootfs.img,format=raw,if=virtio -append 'root=/dev/vda rootwait' + + # boot with local dir as rootfs + qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armsr-armv7-generic-kernel.bin \ + -fsdev local,id=rootdev,path=root-armsr/,security_model=none \ + -device virtio-9p-pci,fsdev=rootdev,mount_tag=/dev/root \ + -append 'rootflags=trans=virtio,version=9p2000.L,cache=loose rootfstype=9p' + +Run with kvmtool + + # start a named machine + lkvm run -k openwrt-armsr-armv7-zImage -i openwrt-armsr-armv7-rootfs.cpio --name armsr0 + + # start with virtio-9p rootfs + lkvm run -k openwrt-armsr-armv7-zImage -d root-armsr/ + + # stop "armsr0" + lkvm stop --name armsr0 + + # stop all + lkvm stop --all + +The multi-platform ARMv8 target can be used with QEMU: + + qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic \ + -kernel openwrt-armsr-armv8-generic-initramfs-kernel.bin \ + +With a EDKII or U-Boot binary for the QEMU ARM virtual machines, you can use these +images in EFI mode: + +32-bit: +gunzip -c bin/targets/armsr/armv7/openwrt-armsr-armv7-generic-ext4-combined.img.gz > openwrt-arm-32.img +qemu-system-arm -nographic \ + -cpu cortex-a15 -machine virt \ + -bios QEMU_EFI_32.fd \ + -smp 1 -m 1024 \ + -device virtio-rng-pci \ + -drive file=openwrt-arm-32.img,format=raw,index=0,media=disk \ + -netdev user,id=testlan -net nic,netdev=testlan \ + -netdev user,id=testwan -net nic,netdev=testwan + +64-bit: +gunzip -c bin/targets/armsr/armv8/openwrt-armsr-armv8-generic-ext4-combined.img.gz > openwrt-arm-64.img +qemu-system-aarch64 -nographic \ + -cpu cortex-a53 -machine virt \ + -bios QEMU_EFI_64.fd \ + -smp 1 -m 1024 \ + -device virtio-rng-pci \ + -drive file=openwrt-arm-64.img,format=raw,index=0,media=disk \ + -netdev user,id=testlan -net nic,netdev=testlan \ + -netdev user,id=testwan -net nic,netdev=testwan + +One can find EFI/BIOS binaries from: +- Compile mainline U-Boot for the QEMU ARM virtual machine (qemu_arm_defconfig/qemu_arm64_defconfig) +- From distribution packages (such as qemu-efi-arm and qemu-efi-aarch64 in Debian) +- Community builds, like retrage/edk2-nightly: https://retrage.github.io/edk2-nightly/ diff --git a/target/linux/armsr/armv7/config-6.1 b/target/linux/armsr/armv7/config-6.1 new file mode 100644 index 0000000000..664ef2e05b --- /dev/null +++ b/target/linux/armsr/armv7/config-6.1 @@ -0,0 +1,78 @@ +CONFIG_ALIGNMENT_TRAP=y +CONFIG_ARCH_32BIT_OFF_T=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_MMAP_RND_BITS=8 +CONFIG_ARCH_NR_GPIO=0 +CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_VIRT=y +CONFIG_ARM=y +CONFIG_ARM_CPU_SUSPEND=y +CONFIG_ARM_HAS_SG_CHAIN=y +CONFIG_ARM_HEAVY_MB=y +# CONFIG_ARM_HIGHBANK_CPUIDLE is not set +CONFIG_ARM_L1_CACHE_SHIFT=6 +CONFIG_ARM_L1_CACHE_SHIFT_6=y +CONFIG_ARM_LPAE=y +CONFIG_ARM_PATCH_IDIV=y +CONFIG_ARM_PATCH_PHYS_VIRT=y +CONFIG_ARM_PSCI=y +CONFIG_ARM_THUMB=y +CONFIG_ARM_UNWIND=y +CONFIG_ARM_VIRT_EXT=y +CONFIG_AUTO_ZRELADDR=y +CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y +CONFIG_CACHE_L2X0=y +CONFIG_COMPAT_32BIT_TIME=y +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_HAS_ASID=y +CONFIG_CPU_PABRT_V7=y +CONFIG_CPU_SPECTRE=y +CONFIG_CPU_THUMB_CAPABLE=y +CONFIG_CPU_TLB_V7=y +CONFIG_CPU_V7=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +CONFIG_DMA_OPS=y +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_GENERIC_IRQ_MULTI_HANDLER=y +CONFIG_GENERIC_VDSO_32=y +CONFIG_HARDEN_BRANCH_PREDICTOR=y +CONFIG_HAVE_SMP=y +CONFIG_HZ_FIXED=0 +CONFIG_HZ_PERIODIC=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_NEON=y +CONFIG_NR_CPUS=4 +CONFIG_OLD_SIGACTION=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OUTER_CACHE=y +CONFIG_OUTER_CACHE_SYNC=y +CONFIG_PAGE_OFFSET=0xC0000000 +CONFIG_PERF_USE_VMALLOC=y +CONFIG_RTC_MC146818_LIB=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SMP_ON_UP=y +CONFIG_SWP_EMULATE=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +CONFIG_UNWINDER_ARM=y +CONFIG_USE_OF=y +CONFIG_VFP=y +CONFIG_VFPv3=y +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_BCJ=y +CONFIG_ZBOOT_ROM_BSS=0 +CONFIG_ZBOOT_ROM_TEXT=0 diff --git a/target/linux/armsr/armv7/target.mk b/target/linux/armsr/armv7/target.mk new file mode 100644 index 0000000000..fbad3abb26 --- /dev/null +++ b/target/linux/armsr/armv7/target.mk @@ -0,0 +1,10 @@ +ARCH:=arm +SUBTARGET:=armv7 +BOARDNAME:=32-bit (armv7) machines +CPU_TYPE:=cortex-a15 +CPU_SUBTYPE:=neon-vfpv4 +KERNELNAME:=zImage + +define Target/Description + Build images for $(BOARDNAME) +endef diff --git a/target/linux/armsr/armv8/config-6.1 b/target/linux/armsr/armv8/config-6.1 new file mode 100644 index 0000000000..f1b4838d15 --- /dev/null +++ b/target/linux/armsr/armv8/config-6.1 @@ -0,0 +1,444 @@ +CONFIG_64BIT=y +CONFIG_ACPI_PCC=y +CONFIG_ARCH_HISI=y +CONFIG_ARCH_INTEL_SOCFPGA=y +CONFIG_ARCH_LAYERSCAPE=y +CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y +CONFIG_ARCH_MMAP_RND_BITS=18 +CONFIG_ARCH_MMAP_RND_BITS_MAX=24 +CONFIG_ARCH_MMAP_RND_BITS_MIN=18 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 +CONFIG_ARCH_MVEBU=y +CONFIG_ARCH_NXP=y +CONFIG_ARCH_PROC_KCORE_TEXT=y +CONFIG_ARCH_ROCKCHIP=y +CONFIG_ARCH_STACKWALK=y +CONFIG_ARCH_SUNXI=y +CONFIG_ARCH_SYNQUACER=y +CONFIG_ARCH_THUNDER=y +CONFIG_ARCH_THUNDER2=y +CONFIG_ARCH_VEXPRESS=y +CONFIG_ARCH_WANTS_NO_INSTR=y +CONFIG_ARCH_ZYNQMP=y +CONFIG_ARM64=y +CONFIG_ARM64_4K_PAGES=y +CONFIG_ARM64_CNP=y +CONFIG_ARM64_CRYPTO=y +CONFIG_ARM64_EPAN=y +CONFIG_ARM64_ERRATUM_1165522=y +CONFIG_ARM64_ERRATUM_1286807=y +CONFIG_ARM64_ERRATUM_819472=y +CONFIG_ARM64_ERRATUM_824069=y +CONFIG_ARM64_ERRATUM_826319=y +CONFIG_ARM64_ERRATUM_827319=y +CONFIG_ARM64_ERRATUM_832075=y +CONFIG_ARM64_ERRATUM_843419=y +CONFIG_ARM64_HW_AFDBM=y +CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y +CONFIG_ARM64_PAGE_SHIFT=12 +CONFIG_ARM64_PAN=y +CONFIG_ARM64_PA_BITS=48 +CONFIG_ARM64_PA_BITS_48=y +CONFIG_ARM64_PTR_AUTH=y +CONFIG_ARM64_PTR_AUTH_KERNEL=y +CONFIG_ARM64_SME=y +CONFIG_ARM64_SVE=y +CONFIG_ARM64_TAGGED_ADDR_ABI=y +CONFIG_ARM64_VA_BITS=48 +CONFIG_ARM64_VA_BITS_48=y +CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y +CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y +CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT=y +# CONFIG_ARMADA_37XX_RWTM_MBOX is not set +CONFIG_ARMADA_37XX_WATCHDOG=y +CONFIG_ARMADA_THERMAL=y +CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND=y +# CONFIG_ARM_DMC620_PMU is not set +# CONFIG_ARM_MHU_V2 is not set +CONFIG_ARM_SBSA_WATCHDOG=y +CONFIG_ARM_SMC_WATCHDOG=y +CONFIG_ARM_SMMU=y +# CONFIG_ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT is not set +# CONFIG_ARM_SMMU_LEGACY_DT_BINDINGS is not set +CONFIG_ARM_SMMU_V3=y +# CONFIG_ARM_SMMU_V3_PMU is not set +# CONFIG_ARM_SMMU_V3_SVA is not set +CONFIG_ATOMIC64_SELFTEST=y +CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y +# CONFIG_AXI_DMAC is not set +CONFIG_BACKLIGHT_CLASS_DEVICE=y +CONFIG_BLK_PM=y +CONFIG_CAVIUM_TX2_ERRATUM_219=y +CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y +CONFIG_CLK_INTEL_SOCFPGA=y +CONFIG_CLK_INTEL_SOCFPGA64=y +CONFIG_CLK_LS1028A_PLLDIG=y +CONFIG_CLK_PX30=y +CONFIG_CLK_QORIQ=y +CONFIG_CLK_RK3308=y +CONFIG_CLK_RK3328=y +CONFIG_CLK_RK3368=y +CONFIG_CLK_RK3399=y +CONFIG_CLK_RK3568=y +CONFIG_CLK_SP810=y +CONFIG_CLK_SUNXI=y +CONFIG_CLK_SUNXI_CLOCKS=y +# CONFIG_CLK_SUNXI_PRCM_SUN6I is not set +# CONFIG_CLK_SUNXI_PRCM_SUN8I is not set +# CONFIG_CLK_SUNXI_PRCM_SUN9I is not set +CONFIG_CLK_VEXPRESS_OSC=y +# CONFIG_COMMON_CLK_FSL_FLEXSPI is not set +# CONFIG_COMMON_CLK_FSL_SAI is not set +CONFIG_COMMON_CLK_HI3516CV300=y +CONFIG_COMMON_CLK_HI3519=y +CONFIG_COMMON_CLK_HI3559A=y +CONFIG_COMMON_CLK_HI3660=y +CONFIG_COMMON_CLK_HI3670=y +CONFIG_COMMON_CLK_HI3798CV200=y +CONFIG_COMMON_CLK_HI6220=y +CONFIG_COMMON_CLK_HI655X=y +CONFIG_COMMON_CLK_ROCKCHIP=y +CONFIG_COMMON_CLK_SCPI=y +CONFIG_COMMON_CLK_ZYNQMP=y +CONFIG_COMMON_RESET_HI3660=y +CONFIG_COMMON_RESET_HI6220=y +# CONFIG_COMPAT_32BIT_TIME is not set +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_PM=y +CONFIG_CRYPTO_AES_ARM64=y +CONFIG_CRYPTO_AES_ARM64_BS=y +CONFIG_CRYPTO_AES_ARM64_CE=y +CONFIG_CRYPTO_AES_ARM64_CE_BLK=y +CONFIG_CRYPTO_AES_ARM64_CE_CCM=y +CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y +CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=y +CONFIG_CRYPTO_BLAKE2S=y +CONFIG_CRYPTO_CHACHA20=y +CONFIG_CRYPTO_CHACHA20_NEON=y +CONFIG_CRYPTO_CRYPTD=y +# CONFIG_CRYPTO_DEV_ALLWINNER is not set +# CONFIG_CRYPTO_DEV_FSL_DPAA2_CAAM is not set +# CONFIG_CRYPTO_DEV_HISI_HPRE is not set +# CONFIG_CRYPTO_DEV_HISI_SEC2 is not set +# CONFIG_CRYPTO_DEV_HISI_TRNG is not set +# CONFIG_CRYPTO_DEV_OCTEONTX2_CPT is not set +# CONFIG_CRYPTO_DEV_ROCKCHIP is not set +# CONFIG_CRYPTO_DEV_ZYNQMP_AES is not set +# CONFIG_CRYPTO_DEV_ZYNQMP_SHA3 is not set +CONFIG_CRYPTO_GHASH_ARM64_CE=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_CHACHA_GENERIC=y +CONFIG_CRYPTO_POLYVAL_ARM64_CE=y +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_SHA1_ARM64_CE=y +CONFIG_CRYPTO_SHA256_ARM64=y +CONFIG_CRYPTO_SHA2_ARM64_CE=y +CONFIG_CRYPTO_SHA512_ARM64=y +CONFIG_CRYPTO_SIMD=y +# CONFIG_CRYPTO_SM4_ARM64_CE_BLK is not set +# CONFIG_CRYPTO_SM4_ARM64_NEON_BLK is not set +CONFIG_DMA_DIRECT_REMAP=y +CONFIG_DMA_SHARED_BUFFER=y +CONFIG_DMA_SUN6I=y +CONFIG_DRM=y +CONFIG_DRM_BOCHS=y +CONFIG_DRM_BRIDGE=y +CONFIG_DRM_GEM_SHMEM_HELPER=y +CONFIG_DRM_KMS_HELPER=y +CONFIG_DRM_PANEL=y +CONFIG_DRM_PANEL_BRIDGE=y +CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y +CONFIG_DRM_QXL=y +# CONFIG_DRM_ROCKCHIP is not set +CONFIG_DRM_TTM=y +CONFIG_DRM_TTM_HELPER=y +CONFIG_DRM_VIRTIO_GPU=y +CONFIG_DRM_VRAM_HELPER=y +# CONFIG_DWMAC_SUN8I is not set +# CONFIG_DWMAC_SUNXI is not set +CONFIG_DW_WATCHDOG=y +CONFIG_FB=y +CONFIG_FB_ARMCLCD=y +CONFIG_FB_CFB_COPYAREA=y +CONFIG_FB_CFB_FILLRECT=y +CONFIG_FB_CFB_IMAGEBLIT=y +CONFIG_FB_CMDLINE=y +CONFIG_FB_MODE_HELPERS=y +# CONFIG_FB_XILINX is not set +CONFIG_FRAME_POINTER=y +CONFIG_FRAME_WARN=2048 +# CONFIG_FSL_DPAA is not set +# CONFIG_FSL_DPAA2_QDMA is not set +CONFIG_FSL_ERRATUM_A008585=y +# CONFIG_FSL_IMX8_DDR_PMU is not set +# CONFIG_FSL_PQ_MDIO is not set +CONFIG_FUJITSU_ERRATUM_010001=y +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +CONFIG_GENERIC_CSUM=y +CONFIG_GENERIC_FIND_FIRST_BIT=y +# CONFIG_GIANFAR is not set +CONFIG_GPIO_GENERIC=y +CONFIG_GPIO_GENERIC_PLATFORM=y +CONFIG_GPIO_MPC8XXX=y +CONFIG_GPIO_ROCKCHIP=y +CONFIG_GPIO_THUNDERX=y +CONFIG_GPIO_XLP=y +CONFIG_GPIO_ZYNQ=y +CONFIG_GPIO_ZYNQMP_MODEPIN=y +CONFIG_HDMI=y +CONFIG_HI3660_MBOX=y +CONFIG_HI6220_MBOX=y +CONFIG_HISILICON_LPC=y +CONFIG_HISI_PMU=y +CONFIG_HISI_THERMAL=y +CONFIG_HW_RANDOM=y +CONFIG_HW_RANDOM_ARM_SMCCC_TRNG=y +# CONFIG_HW_RANDOM_HISI is not set +CONFIG_HW_RANDOM_VIRTIO=y +CONFIG_I2C=y +CONFIG_I2C_ALGOBIT=y +CONFIG_I2C_ALTERA=y +CONFIG_I2C_BOARDINFO=y +# CONFIG_I2C_HIX5HD2 is not set +CONFIG_I2C_IMX=y +# CONFIG_I2C_SLAVE_TESTUNIT is not set +CONFIG_I2C_SYNQUACER=y +CONFIG_I2C_THUNDERX=y +# CONFIG_I2C_XLP9XX is not set +CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 +# CONFIG_IMX2_WDT is not set +# CONFIG_INPUT_HISI_POWERKEY is not set +# CONFIG_INPUT_IBM_PANEL is not set +# CONFIG_INTEL_STRATIX10_RSU is not set +# CONFIG_INTEL_STRATIX10_SERVICE is not set +# CONFIG_IOMMU_DEBUGFS is not set +# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set +CONFIG_IOMMU_DEFAULT_DMA_STRICT=y +CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y +# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set +# CONFIG_IOMMU_IO_PGTABLE_DART is not set +# CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set +CONFIG_IOMMU_SUPPORT=y +# CONFIG_K3_DMA is not set +CONFIG_KCMP=y +# CONFIG_KEYBOARD_SUN4I_LRADC is not set +CONFIG_LCD_CLASS_DEVICE=m +# CONFIG_LCD_PLATFORM is not set +# CONFIG_MAILBOX_TEST is not set +CONFIG_MARVELL_10G_PHY=y +# CONFIG_MARVELL_CN10K_DDR_PMU is not set +# CONFIG_MARVELL_CN10K_TAD_PMU is not set +CONFIG_MDIO_SUN4I=y +# CONFIG_MFD_ALTERA_A10SR is not set +CONFIG_MFD_ALTERA_SYSMGR=y +# CONFIG_MFD_AXP20X_RSB is not set +CONFIG_MFD_CORE=y +CONFIG_MFD_HI655X_PMIC=y +# CONFIG_MFD_KHADAS_MCU is not set +CONFIG_MFD_SUN4I_GPADC=y +# CONFIG_MFD_SUN6I_PRCM is not set +CONFIG_MFD_SYSCON=y +CONFIG_MFD_VEXPRESS_SYSREG=y +CONFIG_MMC=y +CONFIG_MMC_ARMMMCI=y +CONFIG_MMC_CAVIUM_THUNDERX=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_PCI is not set +CONFIG_MMC_DW_PLTFM=y +CONFIG_MMC_DW_ROCKCHIP=y +CONFIG_MMC_RICOH_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_ACPI=y +CONFIG_MMC_SDHCI_OF_ESDHC=y +CONFIG_MMC_SDHCI_PCI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SUNXI=y +CONFIG_MODULES_USE_ELF_RELA=y +# CONFIG_MVNETA is not set +# CONFIG_MVPP2 is not set +# CONFIG_MV_XOR is not set +CONFIG_NEED_SG_DMA_LENGTH=y +# CONFIG_NET_VENDOR_ALLWINNER is not set +CONFIG_NO_HZ=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_IDLE=y +CONFIG_NR_CPUS=64 +CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y +# CONFIG_NVMEM_LAYERSCAPE_SFP is not set +CONFIG_NVMEM_ROCKCHIP_EFUSE=y +# CONFIG_NVMEM_ROCKCHIP_OTP is not set +# CONFIG_NVMEM_SUNXI_SID is not set +# CONFIG_NVMEM_ZYNQMP is not set +CONFIG_PCC=y +CONFIG_PCIE_HISI_STB=y +CONFIG_PCIE_LAYERSCAPE=y +CONFIG_PCIE_MOBIVEIL_PLAT=y +CONFIG_PCIE_ROCKCHIP=y +# CONFIG_PCIE_ROCKCHIP_DW_HOST is not set +CONFIG_PCIE_ROCKCHIP_HOST=y +CONFIG_PCIE_XILINX_CPM=y +CONFIG_PCIE_XILINX_NWL=y +CONFIG_PCI_AARDVARK=y +CONFIG_PCI_LAYERSCAPE=y +# CONFIG_PHY_FSL_LYNX_28G is not set +CONFIG_PHY_HI3660_USB=y +CONFIG_PHY_HI3670_PCIE=y +CONFIG_PHY_HI3670_USB=y +CONFIG_PHY_HI6220_USB=y +CONFIG_PHY_HISI_INNO_USB2=y +# CONFIG_PHY_HISTB_COMBPHY is not set +CONFIG_PHY_MVEBU_A3700_COMPHY=y +CONFIG_PHY_MVEBU_A3700_UTMI=y +CONFIG_PHY_MVEBU_A38X_COMPHY=y +CONFIG_PHY_MVEBU_CP110_COMPHY=y +# CONFIG_PHY_ROCKCHIP_DP is not set +# CONFIG_PHY_ROCKCHIP_DPHY_RX0 is not set +CONFIG_PHY_ROCKCHIP_EMMC=y +# CONFIG_PHY_ROCKCHIP_INNO_CSIDPHY is not set +# CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY is not set +# CONFIG_PHY_ROCKCHIP_INNO_HDMI is not set +CONFIG_PHY_ROCKCHIP_INNO_USB2=y +# CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY is not set +CONFIG_PHY_ROCKCHIP_PCIE=y +CONFIG_PHY_ROCKCHIP_SNPS_PCIE3=y +CONFIG_PHY_ROCKCHIP_TYPEC=y +# CONFIG_PHY_ROCKCHIP_USB is not set +CONFIG_PHY_SUN4I_USB=y +CONFIG_PHY_SUN50I_USB3=y +# CONFIG_PHY_SUN6I_MIPI_DPHY is not set +CONFIG_PHY_SUN9I_USB=y +# CONFIG_PHY_XILINX_ZYNQMP is not set +CONFIG_PINCTRL_ROCKCHIP=y +# CONFIG_PINCTRL_SUN20I_D1 is not set +CONFIG_PINCTRL_SUN4I_A10=y +CONFIG_PINCTRL_SUN50I_A100=y +CONFIG_PINCTRL_SUN50I_A100_R=y +CONFIG_PINCTRL_SUN50I_A64=y +CONFIG_PINCTRL_SUN50I_A64_R=y +CONFIG_PINCTRL_SUN50I_H5=y +CONFIG_PINCTRL_SUN50I_H6=y +CONFIG_PINCTRL_SUN50I_H616=y +CONFIG_PINCTRL_SUN50I_H616_R=y +CONFIG_PINCTRL_SUN50I_H6_R=y +CONFIG_PINCTRL_SUN5I=y +# CONFIG_PINCTRL_SUN6I_A31 is not set +# CONFIG_PINCTRL_SUN6I_A31_R is not set +# CONFIG_PINCTRL_SUN8I_A23 is not set +# CONFIG_PINCTRL_SUN8I_A23_R is not set +# CONFIG_PINCTRL_SUN8I_A33 is not set +# CONFIG_PINCTRL_SUN8I_A83T is not set +# CONFIG_PINCTRL_SUN8I_A83T_R is not set +# CONFIG_PINCTRL_SUN8I_H3 is not set +# CONFIG_PINCTRL_SUN8I_H3_R is not set +# CONFIG_PINCTRL_SUN8I_V3S is not set +# CONFIG_PINCTRL_SUN9I_A80 is not set +# CONFIG_PINCTRL_SUN9I_A80_R is not set +CONFIG_PINCTRL_ZYNQMP=y +CONFIG_PM=y +CONFIG_PM_CLK=y +CONFIG_PM_GENERIC_DOMAINS=y +CONFIG_PM_GENERIC_DOMAINS_OF=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_HISI=y +CONFIG_POWER_RESET_VEXPRESS=y +CONFIG_POWER_SUPPLY=y +CONFIG_QORIQ_THERMAL=y +CONFIG_QUEUED_RWLOCKS=y +CONFIG_QUEUED_SPINLOCKS=y +CONFIG_REGMAP=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGULATOR_AXP20X=y +CONFIG_REGULATOR_HI655X=y +CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_ROCKCHIP_IOMMU=y +# CONFIG_ROCKCHIP_MBOX is not set +CONFIG_ROCKCHIP_PM_DOMAINS=y +# CONFIG_ROCKCHIP_SARADC is not set +# CONFIG_ROCKCHIP_THERMAL is not set +CONFIG_RODATA_FULL_DEFAULT_ENABLED=y +# CONFIG_RTC_DRV_FSL_FTM_ALARM is not set +CONFIG_RTC_DRV_MV=y +CONFIG_RTC_I2C_AND_SPI=y +# CONFIG_SERIAL_8250_EXAR is not set +CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_PCI=y +CONFIG_SERIAL_FSL_LPUART=y +CONFIG_SERIAL_FSL_LPUART_CONSOLE=y +CONFIG_SERIAL_MVEBU_CONSOLE=y +CONFIG_SERIAL_MVEBU_UART=y +CONFIG_SERIAL_SAMSUNG=y +CONFIG_SERIAL_SAMSUNG_CONSOLE=y +# CONFIG_SMC91X is not set +# CONFIG_SND_SUN4I_I2S is not set +# CONFIG_SND_SUN50I_CODEC_ANALOG is not set +# CONFIG_SND_SUN50I_DMIC is not set +# CONFIG_SND_SUN8I_CODEC is not set +# CONFIG_SND_SUN8I_CODEC_ANALOG is not set +# CONFIG_SNI_NETSEC is not set +CONFIG_SPARSEMEM=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_VMEMMAP=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPI_ARMADA_3700=y +# CONFIG_SPI_FSL_QUADSPI is not set +# CONFIG_SPI_HISI_KUNPENG is not set +# CONFIG_SPI_HISI_SFC is not set +# CONFIG_SPI_HISI_SFC_V3XX is not set +# CONFIG_SPI_ROCKCHIP_SFC is not set +# CONFIG_SPI_SUN4I is not set +# CONFIG_SPI_SUN6I is not set +# CONFIG_SPI_SYNQUACER is not set +CONFIG_SPI_THUNDERX=y +# CONFIG_SPI_XLP is not set +CONFIG_STUB_CLK_HI3660=y +CONFIG_STUB_CLK_HI6220=y +CONFIG_SUN50I_A100_CCU=y +CONFIG_SUN50I_A100_R_CCU=y +CONFIG_SUN50I_A64_CCU=y +CONFIG_SUN50I_H616_CCU=y +CONFIG_SUN50I_H6_CCU=y +CONFIG_SUN50I_H6_R_CCU=y +CONFIG_SUN50I_IOMMU=y +CONFIG_SUN6I_MSGBOX=y +CONFIG_SUN6I_RTC_CCU=y +# CONFIG_SUN8I_A83T_CCU is not set +CONFIG_SUN8I_DE2_CCU=y +# CONFIG_SUN8I_H3_CCU is not set +CONFIG_SUN8I_R_CCU=y +CONFIG_SUN8I_THERMAL=y +CONFIG_SUNXI_CCU=y +CONFIG_SUNXI_RSB=y +CONFIG_SUNXI_WATCHDOG=y +CONFIG_SYNC_FILE=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +# CONFIG_TCG_TIS_SYNQUACER is not set +CONFIG_THREAD_INFO_IN_TASK=y +# CONFIG_TURRIS_MOX_RWTM is not set +# CONFIG_UACCE is not set +CONFIG_UNMAP_KERNEL_AT_EL0=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_XILINX=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_HISTB=y +CONFIG_USB_XHCI_MVEBU=y +CONFIG_USB_XHCI_PLATFORM=y +CONFIG_VEXPRESS_CONFIG=y +CONFIG_VIDEOMODE_HELPERS=y +CONFIG_VIRTIO_DMA_SHARED_BUFFER=y +# CONFIG_VIRTIO_IOMMU is not set +CONFIG_VMAP_STACK=y +CONFIG_WDAT_WDT=y +# CONFIG_XILINX_AMS is not set +# CONFIG_XILINX_INTC is not set +CONFIG_XLNX_EVENT_MANAGER=y +CONFIG_ZONE_DMA32=y +CONFIG_ZYNQMP_FIRMWARE=y +# CONFIG_ZYNQMP_FIRMWARE_DEBUG is not set +CONFIG_ZYNQMP_PM_DOMAINS=y +CONFIG_ZYNQMP_POWER=y diff --git a/target/linux/armsr/armv8/target.mk b/target/linux/armsr/armv8/target.mk new file mode 100644 index 0000000000..654e5976ca --- /dev/null +++ b/target/linux/armsr/armv8/target.mk @@ -0,0 +1,7 @@ +ARCH:=aarch64 +SUBTARGET:=armv8 +BOARDNAME:=64-bit (armv8) machines + +define Target/Description + Build multi-platform images for the ARMv8 instruction set architecture +endef diff --git a/target/linux/armsr/base-files/etc/board.d/01_led b/target/linux/armsr/base-files/etc/board.d/01_led new file mode 100644 index 0000000000..0250a9672f --- /dev/null +++ b/target/linux/armsr/base-files/etc/board.d/01_led @@ -0,0 +1,19 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +traverse,ten64) + ucidef_set_led_netdev "sfp1" "SFP 1" "ten64:green:sfp1:down" "eth8" "link tx rx" + ucidef_set_led_netdev "sfp2" "SFP 2" "ten64:green:sfp2:up" "eth9" "link tx rx" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/armsr/base-files/etc/board.d/02_network b/target/linux/armsr/base-files/etc/board.d/02_network new file mode 100644 index 0000000000..f58de1c27d --- /dev/null +++ b/target/linux/armsr/base-files/etc/board.d/02_network @@ -0,0 +1,18 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later + +. /lib/functions/system.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in + traverse,ten64) + ucidef_set_interface_lan "eth0 eth1 eth2 eth3" + ucidef_set_interface_wan "eth6" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/armsr/base-files/etc/board.d/03_gpio_switches b/target/linux/armsr/base-files/etc/board.d/03_gpio_switches new file mode 100644 index 0000000000..cf07bc0f54 --- /dev/null +++ b/target/linux/armsr/base-files/etc/board.d/03_gpio_switches @@ -0,0 +1,23 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +traverse,ten64) + ucidef_add_gpio_switch "lte_reset" "Cell Modem Reset" "376" + ucidef_add_gpio_switch "lte_power" "Cell Modem Power" "377" + ucidef_add_gpio_switch "lte_disable" "Cell Modem Airplane mode" "378" + ucidef_add_gpio_switch "gnss_disable" "Cell Modem Disable GNSS receiver" "379" + ucidef_add_gpio_switch "lower_sfp_txidsable" "Lower SFP+ TX Disable" "369" + ucidef_add_gpio_switch "upper_sfp_txdisable" "Upper SFP+ TX Disable" "373" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/armsr/base-files/etc/inittab b/target/linux/armsr/base-files/etc/inittab new file mode 100644 index 0000000000..51832eb775 --- /dev/null +++ b/target/linux/armsr/base-files/etc/inittab @@ -0,0 +1,9 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +ttyAMA0::askfirst:/usr/libexec/login.sh +ttyS0::askfirst:/usr/libexec/login.sh +tty0::askfirst:/usr/libexec/login.sh +hvc0::askfirst:/usr/libexec/login.sh +ttymxc0::askfirst:/usr/libexec/login.sh +ttymxc1::askfirst:/usr/libexec/login.sh +ttymxc2::askfirst:/usr/libexec/login.sh diff --git a/target/linux/armsr/base-files/lib/preinit/01_sysinfo_acpi b/target/linux/armsr/base-files/lib/preinit/01_sysinfo_acpi new file mode 100644 index 0000000000..1069d74cf3 --- /dev/null +++ b/target/linux/armsr/base-files/lib/preinit/01_sysinfo_acpi @@ -0,0 +1,52 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +sanitize_name_arm64() { + sed -e ' + y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/; + s/[^a-z0-9_-]\+/-/g; + s/^-//; + s/-$//; + ' "$@" +} + +do_sysinfo_arm64() { + local vendor product file + + for file in sys_vendor board_vendor; do + vendor="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)" + case "$vendor" in + empty | \ + System\ manufacturer | \ + To\ [bB]e\ [fF]illed\ [bB]y\ O\.E\.M\.) + continue + ;; + esac + [ -n "$vendor" ] && break + done + + for file in product_name board_name; do + product="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)" + case "$vendor:$product" in + ?*:empty | \ + ?*:System\ Product\ Name | \ + ?*:To\ [bB]e\ [fF]illed\ [bB]y\ O\.E\.M\.) + continue + ;; + ?*:?*) + break + ;; + esac + done + + [ -d "/sys/firmware/devicetree/base" ] && return + + [ -n "$vendor" -a -n "$product" ] || return + + mkdir -p /tmp/sysinfo + + echo "$vendor $product" > /tmp/sysinfo/model + + sanitize_name_arm64 /tmp/sysinfo/model > /tmp/sysinfo/board_name +} + +boot_hook_add preinit_main do_sysinfo_arm64 diff --git a/target/linux/armsr/base-files/lib/upgrade/platform.sh b/target/linux/armsr/base-files/lib/upgrade/platform.sh new file mode 100644 index 0000000000..8263b9c7e3 --- /dev/null +++ b/target/linux/armsr/base-files/lib/upgrade/platform.sh @@ -0,0 +1,164 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +RAMFS_COPY_BIN="/usr/sbin/blkid" + +platform_check_image() { + local board=$(board_name) + local diskdev partdev diff + [ "$#" -gt 1 ] && return 1 + + v "Board is ${board}" + + export_bootdevice && export_partdevice diskdev 0 || { + v "platform_check_image: Unable to determine upgrade device" + return 1 + } + + get_partitions "/dev/$diskdev" bootdisk + + v "Extract boot sector from the image" + get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b + + get_partitions /tmp/image.bs image + + #compare tables + diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)" + + rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image + + if [ -n "$diff" ]; then + v "Partition layout has changed. Full image will be written." + ask_bool 0 "Abort" && exit 1 + return 0 + fi +} + +platform_copy_config() { + local partdev parttype=ext4 + + if export_partdevice partdev 2; then + mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt + cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" + umount /mnt + else + v "ERROR: Unable to find partition to copy config data to" + fi + + sleep 5 +} + +# To avoid writing over any firmware +# files (e.g ubootefi.var or firmware/X/ aka EBBR) +# Copy efi/openwrt and efi/boot from the new image +# to the existing ESP +platform_do_upgrade_efi_system_partition() { + local image_file=$1 + local target_partdev=$2 + local image_efisp_start=$3 + local image_efisp_size=$4 + + v "Updating ESP on ${target_partdev}" + NEW_ESP_DIR="/mnt/new_esp_loop" + CUR_ESP_DIR="/mnt/cur_esp" + mkdir "${NEW_ESP_DIR}" + mkdir "${CUR_ESP_DIR}" + + get_image_dd "$image_file" of="/tmp/new_efi_sys_part.img" \ + skip="$image_efisp_start" count="$image_efisp_size" + + mount -t vfat -o loop -o ro /tmp/new_efi_sys_part.img "${NEW_ESP_DIR}" + if [ ! -d "${NEW_ESP_DIR}/efi/boot" ]; then + v "ERROR: Image does not contain EFI boot files (/efi/boot)" + return 1 + fi + + mount -t vfat "/dev/$partdev" "${CUR_ESP_DIR}" + + for d in $(find "${NEW_ESP_DIR}/efi/" -mindepth 1 -maxdepth 1 -type d); do + v "Copying ${d}" + newdir_bname=$(basename "${d}") + rm -rf "${CUR_ESP_DIR}/efi/${newdir_bname}" + cp -r "${d}" "${CUR_ESP_DIR}/efi" + done + + umount "${NEW_ESP_DIR}" + umount "${CUR_ESP_DIR}" +} + +platform_do_upgrade() { + local board=$(board_name) + local diskdev partdev diff + + export_bootdevice && export_partdevice diskdev 0 || { + v "platform_do_upgrade: Unable to determine upgrade device" + return 1 + } + + sync + + if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then + get_partitions "/dev/$diskdev" bootdisk + + v "Extract boot sector from the image" + get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b + + get_partitions /tmp/image.bs image + + #compare tables + diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)" + else + diff=1 + fi + + # Only change the partition table if sysupgrade -p is set, + # otherwise doing so could interfere with embedded "single storage" + # (e.g SoC boot from SD card) setups, as well as other user + # created storage (like uvol) + if [ -n "$diff" ] && [ "${UPGRADE_OPT_SAVE_PARTITIONS}" = "0" ]; then + # Need to remove partitions before dd, otherwise the partitions + # that are added after will have minor numbers offset + partx -d - "/dev/$diskdev" + + get_image_dd "$1" of="/dev/$diskdev" bs=4096 conv=fsync + + # Separate removal and addtion is necessary; otherwise, partition 1 + # will be missing if it overlaps with the old partition 2 + partx -a - "/dev/$diskdev" + + return 0 + fi + + #iterate over each partition from the image and write it to the boot disk + while read part start size; do + if export_partdevice partdev $part; then + v "Writing image to /dev/$partdev..." + if [ "$part" = "1" ]; then + platform_do_upgrade_efi_system_partition \ + $1 $partdev $start $size || return 1 + else + v "Normal partition, doing DD" + get_image_dd "$1" of="/dev/$partdev" ibs=512 obs=1M skip="$start" \ + count="$size" conv=fsync + fi + else + v "Unable to find partition $part device, skipped." + fi + done < /tmp/partmap.image + + local parttype=ext4 + + if (blkid > /dev/null) && export_partdevice partdev 1; then + part_magic_fat "/dev/$partdev" && parttype=vfat + mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt + if export_partdevice partdev 2; then + THIS_PART_BLKID=$(blkid -o value -s PARTUUID "/dev/${partdev}") + v "Setting rootfs PARTUUID=${THIS_PART_BLKID}" + sed -i "s/\(PARTUUID=\)[a-f0-9-]\+/\1${THIS_PART_BLKID}/ig" \ + /mnt/efi/openwrt/grub.cfg + fi + umount /mnt + fi + # Provide time for the storage medium to flush before system reset + # (despite the sync/umount it appears NVMe etc. do it in the background) + sleep 5 +} diff --git a/target/linux/armsr/config-6.1 b/target/linux/armsr/config-6.1 new file mode 100644 index 0000000000..a48af89b87 --- /dev/null +++ b/target/linux/armsr/config-6.1 @@ -0,0 +1,336 @@ +CONFIG_64BIT=y +CONFIG_9P_FS=y +# CONFIG_9P_FS_POSIX_ACL is not set +# CONFIG_9P_FS_SECURITY is not set +# CONFIG_A64FX_DIAG is not set +CONFIG_ACPI=y +CONFIG_ACPI_AC=y +CONFIG_ACPI_APEI=y +CONFIG_ACPI_APEI_EINJ=y +# CONFIG_ACPI_APEI_ERST_DEBUG is not set +CONFIG_ACPI_APEI_GHES=y +CONFIG_ACPI_APEI_MEMORY_FAILURE=y +CONFIG_ACPI_APEI_PCIEAER=y +CONFIG_ACPI_BATTERY=y +# CONFIG_ACPI_BGRT is not set +CONFIG_ACPI_CCA_REQUIRED=y +CONFIG_ACPI_CONTAINER=y +CONFIG_ACPI_CPPC_CPUFREQ=y +# CONFIG_ACPI_DEBUG is not set +# CONFIG_ACPI_DEBUGGER is not set +# CONFIG_ACPI_DOCK is not set +# CONFIG_ACPI_EC_DEBUGFS is not set +CONFIG_ACPI_FAN=y +CONFIG_ACPI_GENERIC_GSI=y +CONFIG_ACPI_GTDT=y +CONFIG_ACPI_HOTPLUG_CPU=y +CONFIG_ACPI_I2C_OPREGION=y +CONFIG_ACPI_IORT=y +CONFIG_ACPI_MCFG=y +# CONFIG_ACPI_PCI_SLOT is not set +# CONFIG_ACPI_PFRUT is not set +CONFIG_ACPI_PPTT=y +CONFIG_ACPI_PRMT=y +CONFIG_ACPI_PROCESSOR=y +CONFIG_ACPI_PROCESSOR_IDLE=y +CONFIG_ACPI_REDUCED_HARDWARE_ONLY=y +CONFIG_ACPI_SPCR_TABLE=y +CONFIG_ACPI_THERMAL=y +# CONFIG_ACPI_TINY_POWER_BUTTON is not set +# CONFIG_ALIBABA_UNCORE_DRW_PMU is not set +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_ARCH_FORCE_MAX_ORDER=11 +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_KEEP_MEMBLOCK=y +CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y +CONFIG_ARCH_MMAP_RND_BITS=18 +CONFIG_ARCH_MMAP_RND_BITS_MAX=24 +CONFIG_ARCH_MMAP_RND_BITS_MIN=18 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 +CONFIG_ARCH_PROC_KCORE_TEXT=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_STACKWALK=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANTS_NO_INSTR=y +CONFIG_ARM64=y +CONFIG_ARM64_4K_PAGES=y +# CONFIG_ARM64_ACPI_PARKING_PROTOCOL is not set +CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y +CONFIG_ARM64_PAGE_SHIFT=12 +CONFIG_ARM64_PA_BITS=48 +CONFIG_ARM64_PA_BITS_48=y +CONFIG_ARM64_TAGGED_ADDR_ABI=y +CONFIG_ARM64_VA_BITS=39 +CONFIG_ARM64_VA_BITS_39=y +CONFIG_ARM_AMBA=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_ARM_GIC=y +CONFIG_ARM_GIC_V2M=y +CONFIG_ARM_GIC_V3=y +CONFIG_ARM_GIC_V3_ITS=y +CONFIG_ARM_GIC_V3_ITS_PCI=y +CONFIG_ARM_PSCI_FW=y +# CONFIG_ARM_SMMU_V3_PMU is not set +CONFIG_ATA=y +CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y +CONFIG_BALLOON_COMPACTION=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_NVME=y +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_MQ_PCI=y +CONFIG_BLK_MQ_VIRTIO=y +CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_COMMON_CLK=y +# CONFIG_COMPAT_32BIT_TIME is not set +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_LADDER=y +CONFIG_CPU_PM=y +CONFIG_CPU_RMAP=y +CONFIG_CRC16=y +CONFIG_CRYPTO_CRC32=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_RNG2=y +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_DEBUG_BUGVERBOSE=y +CONFIG_DMADEVICES=y +CONFIG_DMA_ACPI=y +CONFIG_DMA_DIRECT_REMAP=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_OF=y +CONFIG_DMA_REMAP=y +CONFIG_DMI=y +CONFIG_DMIID=y +CONFIG_DMI_SYSFS=y +CONFIG_DTC=y +CONFIG_EDAC_SUPPORT=y +CONFIG_EFI=y +CONFIG_EFIVAR_FS=y +CONFIG_EFI_ARMSTUB_DTB_LOADER=y +# CONFIG_EFI_BOOTLOADER_CONTROL is not set +# CONFIG_EFI_CAPSULE_LOADER is not set +# CONFIG_EFI_COCO_SECRET is not set +# CONFIG_EFI_CUSTOM_SSDT_OVERLAYS is not set +# CONFIG_EFI_DISABLE_PCI_DMA is not set +# CONFIG_EFI_DISABLE_RUNTIME is not set +CONFIG_EFI_EARLYCON=y +CONFIG_EFI_ESRT=y +CONFIG_EFI_GENERIC_STUB=y +# CONFIG_EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER is not set +CONFIG_EFI_PARAMS_FROM_FDT=y +CONFIG_EFI_RUNTIME_WRAPPERS=y +CONFIG_EFI_STUB=y +# CONFIG_EFI_TEST is not set +# CONFIG_EFI_ZBOOT is not set +CONFIG_EXT4_FS=y +CONFIG_F2FS_FS=y +CONFIG_FAILOVER=y +CONFIG_FB_EFI=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FONT_8x16=y +CONFIG_FONT_AUTOSELECT=y +CONFIG_FONT_SUPPORT=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y +# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set +CONFIG_FRAME_POINTER=y +CONFIG_FS_IOMAP=y +CONFIG_FS_MBCACHE=y +CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_ARCH_TOPOLOGY=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_CPU_VULNERABILITIES=y +CONFIG_GENERIC_CSUM=y +CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_GENERIC_FIND_FIRST_BIT=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_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y +CONFIG_GENERIC_MSI_IRQ=y +CONFIG_GENERIC_MSI_IRQ_DOMAIN=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_GENERIC_TIME_VSYSCALL=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_ACPI=y +CONFIG_GPIO_CDEV=y +# CONFIG_GPIO_HISI is not set +CONFIG_GPIO_PL061=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_HID=y +CONFIG_HID_GENERIC=y +CONFIG_HOTPLUG_CPU=y +CONFIG_HOTPLUG_PCI_ACPI=y +CONFIG_HVC_DRIVER=y +CONFIG_HZ_PERIODIC=y +# CONFIG_I2C_AMD_MP2 is not set +CONFIG_I2C_HID_ACPI=y +# CONFIG_I2C_HISI is not set +# CONFIG_I2C_SLAVE_TESTUNIT is not set +CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 +# CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT is not set +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INPUT_KEYBOARD=y +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +# CONFIG_ISCSI_IBFT is not set +CONFIG_JBD2=y +CONFIG_LIBFDT=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_MEMFD_CREATE=y +CONFIG_MEMORY_BALLOON=y +CONFIG_MIGRATION=y +# CONFIG_MLXBF_GIGE is not set +CONFIG_MMC_SDHCI_ACPI=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_MVMDIO=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_NET_9P=y +# CONFIG_NET_9P_DEBUG is not set +# CONFIG_NET_9P_FD is not set +CONFIG_NET_9P_VIRTIO=y +CONFIG_NET_FAILOVER=y +CONFIG_NET_FLOW_LIMIT=y +CONFIG_NLS=y +CONFIG_NR_CPUS=256 +CONFIG_NVMEM=y +CONFIG_NVME_CORE=y +# CONFIG_NVME_MULTIPATH is not set +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_PADATA=y +CONFIG_PAGE_REPORTING=y +CONFIG_PARTITION_PERCPU=y +CONFIG_PCI=y +# CONFIG_PCIE_HISI_ERR is not set +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_DOMAINS_GENERIC=y +CONFIG_PCI_ECAM=y +CONFIG_PCI_HOST_COMMON=y +CONFIG_PCI_HOST_GENERIC=y +CONFIG_PCI_LABEL=y +CONFIG_PCI_MSI=y +CONFIG_PCI_MSI_IRQ_DOMAIN=y +CONFIG_PGTABLE_LEVELS=3 +CONFIG_PHYS_ADDR_T_64BIT=y +# CONFIG_PMIC_OPREGION is not set +CONFIG_PNP=y +CONFIG_PNPACPI=y +CONFIG_PNP_DEBUG_MESSAGES=y +CONFIG_POWER_RESET=y +CONFIG_POWER_SUPPLY=y +CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_QUEUED_RWLOCKS=y +CONFIG_QUEUED_SPINLOCKS=y +CONFIG_RATIONAL=y +# CONFIG_RESET_ATTACK_MITIGATION is not set +CONFIG_RFS_ACCEL=y +CONFIG_RODATA_FULL_DEFAULT_ENABLED=y +CONFIG_RPS=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_EFI=y +CONFIG_RTC_DRV_PL031=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_SATA_AHCI=y +CONFIG_SATA_AHCI_PLATFORM=y +CONFIG_SATA_HOST=y +CONFIG_SCSI=y +CONFIG_SCSI_COMMON=y +CONFIG_SCSI_VIRTIO=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_PNP=y +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +CONFIG_SERIAL_8250_SHARE_IRQ=y +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +CONFIG_SERIAL_EARLYCON=y +CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SG_POOL=y +CONFIG_SMP=y +CONFIG_SOCK_RX_QUEUE_MAPPING=y +CONFIG_SPARSEMEM=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_VMEMMAP=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSE_IRQ=y +CONFIG_SRCU=y +# CONFIG_SURFACE_PLATFORMS is not set +CONFIG_SWIOTLB=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_SYSFB=y +# CONFIG_SYSFB_SIMPLEFB 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_OF=y +CONFIG_THREAD_INFO_IN_TASK=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_ACPI=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_TREE_RCU=y +CONFIG_TREE_SRCU=y +# CONFIG_UACCE is not set +CONFIG_UCS2_STRING=y +CONFIG_UNMAP_KERNEL_AT_EL0=y +CONFIG_USB=y +CONFIG_USB_HID=y +CONFIG_USB_HIDDEV=y +CONFIG_USB_PCI=y +CONFIG_USB_STORAGE=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_PCI=y +CONFIG_VIRTIO=y +CONFIG_VIRTIO_BALLOON=y +CONFIG_VIRTIO_BLK=y +CONFIG_VIRTIO_CONSOLE=y +CONFIG_VIRTIO_MMIO=y +CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y +CONFIG_VIRTIO_NET=y +CONFIG_VIRTIO_PCI=y +CONFIG_VIRTIO_PCI_LEGACY=y +CONFIG_VIRTIO_PCI_LIB=y +CONFIG_VMAP_STACK=y +CONFIG_WATCHDOG_CORE=y +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +CONFIG_XPS=y +CONFIG_ZONE_DMA32=y diff --git a/target/linux/armsr/image/Makefile b/target/linux/armsr/image/Makefile new file mode 100644 index 0000000000..8642c88a49 --- /dev/null +++ b/target/linux/armsr/image/Makefile @@ -0,0 +1,117 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2016-2017 Yousong Zhou + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +GRUB2_VARIANT = +GRUB_TERMINALS = +GRUB_SERIAL_CONFIG = +GRUB_TERMINAL_CONFIG = +GRUB_CONSOLE_CMDLINE = earlycon + +ifneq ($(CONFIG_GRUB_CONSOLE),) + GRUB_TERMINALS += console +endif + +GRUB_SERIAL:=$(call qstrip,$(CONFIG_GRUB_SERIAL)) + +ifneq ($(GRUB_SERIAL),) + GRUB_SERIAL_CONFIG := serial --unit=0 --speed=$(CONFIG_GRUB_BAUDRATE) --word=8 --parity=no --stop=1 --rtscts=$(if $(CONFIG_GRUB_FLOWCONTROL),on,off) + GRUB_TERMINALS += serial +endif + +ifneq ($(GRUB_TERMINALS),) + GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output $(GRUB_TERMINALS) +endif + +ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME)) +ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(IMG_PART_SIGNATURE)-02) +GPT_ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME)) +GPT_ROOTPART:=$(if $(GPT_ROOTPART),$(GPT_ROOTPART),PARTUUID=$(shell echo $(IMG_PART_DISKGUID) | sed 's/00$$/02/')) + +GRUB_TIMEOUT:=$(call qstrip,$(CONFIG_GRUB_TIMEOUT)) +GRUB_TITLE:=$(call qstrip,$(CONFIG_GRUB_TITLE)) + +BOOTOPTS:=$(call qstrip,$(CONFIG_GRUB_BOOTOPTS)) + +define Build/combined + $(INSTALL_DIR) $@.boot/ + $(CP) $(KDIR)/$(KERNEL_NAME) $@.boot/efi/openwrt/ + -$(CP) $(STAGING_DIR_ROOT)/boot/. $@.boot/boot/ + $(if $(filter $(1),efi), + $(INSTALL_DIR) $@.boot/efi/boot + $(CP) $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi $@.boot/efi/openwrt/ + $(CP) $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi $@.boot/efi/boot/ + ) + KERNELPARTTYPE=ef FAT_TYPE="32" PADDING="1" SIGNATURE="$(IMG_PART_SIGNATURE)" \ + $(if $(filter $(1),efi),GUID="$(IMG_PART_DISKGUID)") $(SCRIPT_DIR)/gen_image_generic.sh \ + $@ \ + $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \ + $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \ + 256 +endef + +define Build/grub-config + rm -fR $@.boot + $(INSTALL_DIR) $@.boot/efi/openwrt/ + sed \ + -e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \ + -e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \ + -e 's#@ROOTPART@#root=$(ROOTPART) rootwait#g' \ + -e 's#@GPT_ROOTPART@#root=$(GPT_ROOTPART) rootwait#g' \ + -e 's#@CMDLINE@#$(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE)#g' \ + -e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \ + -e 's#@TITLE@#$(GRUB_TITLE)#g' \ + -e 's#@KERNEL_NAME@#$(KERNEL_NAME)#g' \ + ./grub-$(1).cfg > $@.boot/efi/openwrt/grub.cfg +endef + +define Build/grub-install + rm -fR $@.grub2 + $(INSTALL_DIR) $@.grub2 +endef + +DEVICE_VARS += GRUB2_VARIANT +define Device/efi-default + IMAGE/rootfs.img := append-rootfs | pad-to $(ROOTFS_PARTSIZE) + IMAGE/rootfs.img.gz := append-rootfs | pad-to $(ROOTFS_PARTSIZE) | gzip + IMAGE/combined.img := grub-config efi | combined efi | grub-install efi | append-metadata + IMAGE/combined.img.gz := grub-config efi | combined efi | grub-install efi | gzip | append-metadata + IMAGE/combined.vmdk := grub-config efi | combined efi | grub-install efi | qemu-image vmdk + ifeq ($(CONFIG_TARGET_IMAGES_GZIP),y) + IMAGES-y := rootfs.img.gz + IMAGES-y += combined.img.gz + else + IMAGES-y := rootfs.img + IMAGES-y += combined.img + endif + ifeq ($(CONFIG_VMDK_IMAGES),y) + IMAGES-y += combined.vmdk + endif + KERNEL := kernel-bin + KERNEL_INSTALL := 1 + IMAGES := $$(IMAGES-y) + ARTIFACTS := $$(ARTIFACTS-y) + SUPPORTED_DEVICES := + ifeq ($(CONFIG_arm),y) + KERNEL_NAME = zImage + endif +endef + +define Device/generic + $(call Device/efi-default) + DEVICE_TITLE := Generic EFI Boot + GRUB2_VARIANT := generic + FILESYSTEMS := ext4 squashfs + DEVICE_PACKAGES += kmod-amazon-ena kmod-e1000e kmod-vmxnet3 kmod-rtc-rx8025 \ + kmod-i2c-mux-pca954x kmod-gpio-pca953x partx-utils kmod-wdt-sp805 \ + kmod-mvneta kmod-mvpp2 kmod-fsl-dpaa1-net kmod-fsl-dpaa2-net \ + kmod-fsl-enetc-net kmod-dwmac-imx kmod-fsl-fec kmod-thunderx-net \ + kmod-dwmac-rockchip kmod-dwmac-sun8i kmod-phy-aquantia kmod-phy-broadcom \ + kmod-phy-marvell kmod-phy-marvell-10g kmod-sfp kmod-atlantic +endef +TARGET_DEVICES += generic + +$(eval $(call BuildImage)) diff --git a/target/linux/armsr/image/grub-efi.cfg b/target/linux/armsr/image/grub-efi.cfg new file mode 100644 index 0000000000..fd329e41e0 --- /dev/null +++ b/target/linux/armsr/image/grub-efi.cfg @@ -0,0 +1,14 @@ +@SERIAL_CONFIG@ +@TERMINAL_CONFIG@ + +set default="0" +set timeout="@TIMEOUT@" + +menuentry "@TITLE@" { + search --set=root --label kernel + linux /efi/openwrt/@KERNEL_NAME@ @GPT_ROOTPART@ @CMDLINE@ noinitrd +} +menuentry "@TITLE@ (failsafe)" { + search --set=root --label kernel + linux /efi/openwrt/@KERNEL_NAME@ failsafe=true @GPT_ROOTPART@ @CMDLINE@ noinitrd +} diff --git a/target/linux/armsr/modules.mk b/target/linux/armsr/modules.mk new file mode 100644 index 0000000000..7a349337d8 --- /dev/null +++ b/target/linux/armsr/modules.mk @@ -0,0 +1,292 @@ +define KernelPackage/acpi-mdio + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=ACPI MDIO support + DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-mdio-devres + KCONFIG:=CONFIG_ACPI_MDIO + FILES:=$(LINUX_DIR)/drivers/net/mdio/acpi_mdio.ko + AUTOLOAD:=$(call AutoLoad,11,acpi_mdio) +endef + +define KernelPackage/acpi-mdio/description + Kernel driver for ACPI MDIO support +endef + +$(eval $(call KernelPackage,acpi-mdio)) + +define KernelPackage/fsl-pcs-lynx + SUBMENU=$(NETWORK_DEVICES_MENU) + DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio +kmod-phylink + TITLE:=NXP (Freescale) Lynx PCS + HIDDEN:=1 + KCONFIG:=CONFIG_PCS_LYNX + FILES=$(LINUX_DIR)/drivers/net/pcs/pcs-lynx.ko + AUTOLOAD=$(call AutoLoad,30,pcs-lynx) +endef + +$(eval $(call KernelPackage,fsl-pcs-lynx)) + +define KernelPackage/pcs-xpcs + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Synopsis DesignWare PCS driver + DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink + KCONFIG:=CONFIG_PCS_XPCS + FILES:=$(LINUX_DIR)/drivers/net/pcs/pcs_xpcs.ko + AUTOLOAD:=$(call AutoLoad,20,pcs_xpcs) +endef + +$(eval $(call KernelPackage,pcs-xpcs)) + +define KernelPackage/fsl-fec + SUBMENU:=$(NETWORK_DEVICES_MENU) + DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio \ + +kmod-ptp +kmod-net-selftests + TITLE:=NXP (Freescale) FEC Ethernet controller (i.MX) + KCONFIG:=CONFIG_FEC + FILES:=$(LINUX_DIR)/drivers/net/ethernet/freescale/fec.ko + AUTOLOAD:=$(call AutoLoad,35,fec) +endef + +$(eval $(call KernelPackage,fsl-fec)) + +define KernelPackage/fsl-xgmac-mdio + SUBMENU=$(NETWORK_DEVICES_MENU) + DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio + TITLE:=NXP (Freescale) MDIO bus + KCONFIG:=CONFIG_FSL_XGMAC_MDIO + FILES=$(LINUX_DIR)/drivers/net/ethernet/freescale/xgmac_mdio.ko + AUTOLOAD=$(call AutoLoad,30,xgmac_mdio) +endef + +$(eval $(call KernelPackage,fsl-xgmac-mdio)) + +define KernelPackage/fsl-mc-dpio + SUBMENU:=$(OTHER_MENU) + TITLE:=NXP DPAA2 DPIO (Data Path IO) driver + HIDDEN:=1 + KCONFIG:=CONFIG_FSL_MC_BUS=y \ + CONFIG_FSL_MC_DPIO + FILES:=$(LINUX_DIR)/drivers/soc/fsl/dpio/fsl-mc-dpio.ko + AUTOLOAD=$(call AutoLoad,30,fsl-mc-dpio) +endef + +$(eval $(call KernelPackage,fsl-mc-dpio)) + +define KernelPackage/fsl-enetc-net + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=:NXP ENETC (LS1028A) Ethernet + DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink +kmod-fsl-pcs-lynx + KCONFIG:= \ + CONFIG_FSL_ENETC \ + CONFIG_FSL_ENETC_VF \ + CONFIG_FSL_ENETC_QOS + FILES:= \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc.ko \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-vf.ko \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-mdio.ko \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-ierb.ko + AUTOLOAD=$(call AutoLoad,35,fsl-enetc) +endef + +$(eval $(call KernelPackage,fsl-enetc-net)) + +define KernelPackage/fsl-dpaa1-net + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=NXP DPAA1 (LS1043/LS1046) Ethernet + DEPENDS:=@(TARGET_armsr_armv8) +kmod-fsl-xgmac-mdio +kmod-libphy +kmod-crypto-crc32 + KCONFIG:= \ + CONFIG_FSL_DPAA=y \ + CONFIG_FSL_DPAA_ETH \ + CONFIG_FSL_FMAN \ + CONFIG_FSL_DPAA_CHECKING=n \ + CONFIG_FSL_BMAN_TEST=n \ + CONFIG_FSL_QMAN_TEST=n + MODULES:= \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/dpaa/fsl_dpa.ko \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/fman/fsl_dpaa_fman.ko \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/fman/fsl_dpaa_mac.ko + AUTOLOAD=$(call AutoLoad,35,fsl-dpa) +endef + +$(eval $(call KernelPackage,fsl-dpaa1-net)) + +define KernelPackage/fsl-dpaa2-net + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=NXP DPAA2 Ethernet + DEPENDS:=@(TARGET_armsr_armv8) +kmod-fsl-xgmac-mdio +kmod-phylink \ + +kmod-fsl-pcs-lynx +kmod-fsl-mc-dpio + KCONFIG:= \ + CONFIG_FSL_MC_UAPI_SUPPORT=y \ + CONFIG_FSL_DPAA2_ETH + FILES:= \ + $(LINUX_DIR)/drivers/net/ethernet/freescale/dpaa2/fsl-dpaa2-eth.ko + AUTOLOAD=$(call AutoLoad,35,fsl-dpaa2-eth) +endef + +$(eval $(call KernelPackage,fsl-dpaa2-net)) + +define KernelPackage/fsl-dpaa2-console + SUBMENU:=$(OTHER_MENU) + TITLE:=NXP DPAA2 Debug console + DEPENDS:=@(TARGET_armsr_armv8) + KCONFIG:=CONFIG_DPAA2_CONSOLE + FILES=$(LINUX_DIR)/drivers/soc/fsl/dpaa2-console.ko + AUTOLOAD=$(call AutoLoad,40,dpaa2-console) +endef + +define KernelPackage/fsl-dpaa2-console/description + Kernel modules for the NXP DPAA2 debug consoles + (Management Complex and AIOP). +endef + +$(eval $(call KernelPackage,fsl-dpaa2-console)) + +define KernelPackage/marvell-mdio + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell Armada platform MDIO driver + DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio + KCONFIG:=CONFIG_MVMDIO + FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvmdio.ko + AUTOLOAD=$(call AutoLoad,30,marvell-mdio) +endef + +$(eval $(call KernelPackage,marvell-mdio)) + +define KernelPackage/phy-marvell-10g + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell Alaska 10G PHY driver + DEPENDS:=@(TARGET_armsr_armv8) +kmod-libphy + KCONFIG:=CONFIG_MARVELL_10G_PHY + FILES=$(LINUX_DIR)/drivers/net/phy/marvell10g.ko + AUTOLOAD=$(call AutoLoad,35,marvell10g) +endef + +$(eval $(call KernelPackage,phy-marvell-10g)) + +define KernelPackage/mvneta + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell Armada 370/38x/XP/37xx network driver + DEPENDS:=@(TARGET_armsr_armv8) +kmod-marvell-mdio +kmod-phylink + KCONFIG:=CONFIG_MVNETA + FILES:=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvneta.ko + AUTOLOAD=$(call AutoLoad,30,mvneta) +endef + +$(eval $(call KernelPackage,mvneta)) + +define KernelPackage/mvpp2 + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell Armada 375/7K/8K network driver + DEPENDS:=@(TARGET_armsr_armv8) +kmod-marvell-mdio +kmod-phylink + KCONFIG:=CONFIG_MVPP2 \ + CONFIG_MVPP2_PTP=n + FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvpp2/mvpp2.ko + AUTOLOAD=$(call AutoLoad,40,mvpp2) +endef + +$(eval $(call KernelPackage,mvpp2)) + +define KernelPackage/imx2-wdt + SUBMENU:=$(OTHER_MENU) + TITLE:=NXP (Freescale) i.MX2+ and Layerscape watchdog driver + KCONFIG:=CONFIG_IMX2_WDT + FILES=$(LINUX_DIR)/drivers/watchdog/imx2_wdt.ko + AUTOLOAD=$(call AutoLoad,60,imx2_wdt) +endef + +$(eval $(call KernelPackage,imx2-wdt)) + +define KernelPackage/imx7-ulp-wdt + SUBMENU:=$(OTHER_MENU) + TITLE:=NXP (Freescale) i.MX7ULP and later watchdog + KCONFIG:=CONFIG_IMX7ULP_WDT + FILES=$(LINUX_DIR)/drivers/watchdog/imx7ulp_wdt.ko + AUTOLOAD=$(call AutoLoad,60,imx7ulp_wdt) +endef + +$(eval $(call KernelPackage,imx7-ulp-wdt)) + +define KernelPackage/stmmac-core + SUBMENU=$(NETWORK_DEVICES_MENU) + TITLE:=Synopsis Ethernet Controller core (NXP,STMMicro,others) + DEPENDS:=@(TARGET_armsr_armv8) +kmod-pcs-xpcs +kmod-ptp \ + +kmod-of-mdio + KCONFIG:=CONFIG_STMMAC_ETH \ + CONFIG_STMMAC_SELFTESTS=n \ + CONFIG_STMMAC_PLATFORM \ + CONFIG_CONFIG_DWMAC_DWC_QOS_ETH=n \ + CONFIG_DWMAC_GENERIC + FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/stmmac.ko \ + $(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/stmmac-platform.ko \ + $(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.ko + AUTOLOAD=$(call AutoLoad,40,stmmac stmmac-platform dwmac-generic) +endef + +$(eval $(call KernelPackage,stmmac-core)) + +define KernelPackage/dwmac-imx + SUBMENU=$(NETWORK_DEVICES_MENU) + TITLE:=NXP i.MX8 Ethernet controller + DEPENDS:=+kmod-stmmac-core + KCONFIG:=CONFIG_DWMAC_IMX8 + FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.ko + AUTOLOAD=$(call AutoLoad,45,dwmac-imx) +endef + +$(eval $(call KernelPackage,dwmac-imx)) + +define KernelPackage/dwmac-sun8i + SUBMENU=$(NETWORK_DEVICES_MENU) + TITLE:=Allwinner H3/A83T/A64 (sun8i) Ethernet + DEPENDS:=+kmod-stmmac-core +kmod-mdio-bus-mux + KCONFIG:=CONFIG_DWMAC_SUN8I + FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.ko + AUTOLOAD=$(call AutoLoad,45,dwmac-sun8i) +endef + +$(eval $(call KernelPackage,dwmac-sun8i)) + +define KernelPackage/dwmac-rockchip + SUBMENU=$(NETWORK_DEVICES_MENU) + TITLE:=Rockchip RK3328/RK3399/RK3568 Ethernet + DEPENDS:=+kmod-stmmac-core +kmod-mdio-bus-mux + KCONFIG:=CONFIG_DWMAC_ROCKCHIP + FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.ko + AUTOLOAD=$(call AutoLoad,45,dwmac-rk) +endef + +$(eval $(call KernelPackage,dwmac-rockchip)) + +define KernelPackage/thunderx-net + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell (Cavium) ThunderX/2 network drivers + DEPENDS:=@(TARGET_armsr_armv8) +kmod-phylink +kmod-of-mdio + KCONFIG:=CONFIG_NET_VENDOR_CAVIUM \ + CONFIG_THUNDER_NIC_PF \ + CONFIG_THUNDER_NIC_VF \ + CONFIG_THUNDER_NIC_BGX \ + CONFIG_THUNDER_NIC_RGX + FILES=$(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/nicvf.ko \ + $(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/nicpf.ko \ + $(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/thunder_xcv.ko \ + $(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/thunder_bgx.ko + AUTOLOAD=$(call AutoLoad,40,nicpf nicvf thunder_xcv thunder_bgx) +endef + +$(eval $(call KernelPackage,thunderx-net)) + +define KernelPackage/wdt-sp805 + SUBMENU:=$(OTHER_MENU) + TITLE:=ARM SP805 Watchdog + KCONFIG:=CONFIG_ARM_SP805_WATCHDOG + FILES=$(LINUX_DIR)/drivers/watchdog/sp805_wdt.ko + AUTOLOAD=$(call AutoLoad,50,sp805_wdt) +endef + +define KernelPackage/wdt-sp805/description + Support for the ARM SP805 wathchdog module. + This is present in the NXP Layerscape family, + HiSilicon HI3660 among others. +endef + +$(eval $(call KernelPackage,wdt-sp805)) + diff --git a/target/linux/armsr/patches-6.1/221-armsr-disable_gc_sections_armv7.patch b/target/linux/armsr/patches-6.1/221-armsr-disable_gc_sections_armv7.patch new file mode 100644 index 0000000000..cb124c1cf8 --- /dev/null +++ b/target/linux/armsr/patches-6.1/221-armsr-disable_gc_sections_armv7.patch @@ -0,0 +1,23 @@ +From b77c0ecdc7915e5c5c515da1aa6cfaf6f4eb8351 Mon Sep 17 00:00:00 2001 +From: Mathew McBride +Date: Wed, 28 Sep 2022 16:39:31 +1000 +Subject: [PATCH] arm: disable code size reduction measures + (gc-sections,-f*-sections) + +This interferes with the EFI boot stub on armv7l. + +Signed-off-by: Mathew McBride +--- + arch/arm/Kconfig | 1 - + 1 file changed, 1 deletion(-) + +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -122,7 +122,6 @@ config ARM + select HAVE_UID16 + select HAVE_VIRT_CPU_ACCOUNTING_GEN + select IRQ_FORCED_THREADING +- select HAVE_LD_DEAD_CODE_DATA_ELIMINATION + select MODULES_USE_ELF_REL + select NEED_DMA_MAP_STATE + select OF_EARLY_FLATTREE if OF diff --git a/target/linux/armsr/patches-6.1/701-v6.2-0001-net-dpaa2-eth-don-t-use-ENOTSUPP-error-code.patch b/target/linux/armsr/patches-6.1/701-v6.2-0001-net-dpaa2-eth-don-t-use-ENOTSUPP-error-code.patch new file mode 100644 index 0000000000..6238c0a903 --- /dev/null +++ b/target/linux/armsr/patches-6.1/701-v6.2-0001-net-dpaa2-eth-don-t-use-ENOTSUPP-error-code.patch @@ -0,0 +1,44 @@ +From f3763a0c1b07273218cbf5886bdf8df9df501111 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Tue, 29 Nov 2022 16:12:10 +0200 +Subject: [PATCH 03/14] net: dpaa2-eth: don't use -ENOTSUPP error code + +dpaa2_eth_setup_dpni() is called from the probe path and +dpaa2_eth_set_link_ksettings() is propagated to user space. + +include/linux/errno.h says that ENOTSUPP is "Defined for the NFSv3 +protocol". Conventional wisdom has it to not use it in networking +drivers. Replace it with -EOPNOTSUPP. + +Signed-off-by: Vladimir Oltean +Reviewed-by: Andrew Lunn +Reviewed-by: Ioana Ciornei +Tested-by: Ioana Ciornei +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 +- + drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +@@ -3613,7 +3613,7 @@ static int dpaa2_eth_setup_dpni(struct f + dev_err(dev, "DPNI version %u.%u not supported, need >= %u.%u\n", + priv->dpni_ver_major, priv->dpni_ver_minor, + DPNI_VER_MAJOR, DPNI_VER_MINOR); +- err = -ENOTSUPP; ++ err = -EOPNOTSUPP; + goto close; + } + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +@@ -118,7 +118,7 @@ dpaa2_eth_set_link_ksettings(struct net_ + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); + + if (!dpaa2_eth_is_type_phy(priv)) +- return -ENOTSUPP; ++ return -EOPNOTSUPP; + + return phylink_ethtool_ksettings_set(priv->mac->phylink, link_settings); + } diff --git a/target/linux/armsr/patches-6.1/701-v6.2-0002-net-dpaa2-replace-dpaa2_mac_is_type_fixed-with-dpaa2.patch b/target/linux/armsr/patches-6.1/701-v6.2-0002-net-dpaa2-replace-dpaa2_mac_is_type_fixed-with-dpaa2.patch new file mode 100644 index 0000000000..501eaf42ff --- /dev/null +++ b/target/linux/armsr/patches-6.1/701-v6.2-0002-net-dpaa2-replace-dpaa2_mac_is_type_fixed-with-dpaa2.patch @@ -0,0 +1,99 @@ +From 022a11062261dc4703da846d3bf4d194ef6bebf5 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Tue, 29 Nov 2022 16:12:11 +0200 +Subject: [PATCH 04/14] net: dpaa2: replace dpaa2_mac_is_type_fixed() with + dpaa2_mac_is_type_phy() + +dpaa2_mac_is_type_fixed() is a header with no implementation and no +callers, which is referenced from the documentation though. It can be +deleted. + +On the other hand, it would be useful to reuse the code between +dpaa2_eth_is_type_phy() and dpaa2_switch_port_is_type_phy(). That common +code should be called dpaa2_mac_is_type_phy(), so let's create that. + +The removal and the addition are merged into the same patch because, +in fact, is_type_phy() is the logical opposite of is_type_fixed(). + +Signed-off-by: Vladimir Oltean +Reviewed-by: Andrew Lunn +Reviewed-by: Ioana Ciornei +Tested-by: Ioana Ciornei +Signed-off-by: Paolo Abeni +--- + .../ethernet/freescale/dpaa2/mac-phy-support.rst | 9 ++++++--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 7 +------ + drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h | 10 ++++++++-- + drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h | 7 +------ + 4 files changed, 16 insertions(+), 17 deletions(-) + +--- a/Documentation/networking/device_drivers/ethernet/freescale/dpaa2/mac-phy-support.rst ++++ b/Documentation/networking/device_drivers/ethernet/freescale/dpaa2/mac-phy-support.rst +@@ -181,10 +181,13 @@ when necessary using the below listed AP + - int dpaa2_mac_connect(struct dpaa2_mac *mac); + - void dpaa2_mac_disconnect(struct dpaa2_mac *mac); + +-A phylink integration is necessary only when the partner DPMAC is not of TYPE_FIXED. +-One can check for this condition using the below API:: ++A phylink integration is necessary only when the partner DPMAC is not of ++``TYPE_FIXED``. This means it is either of ``TYPE_PHY``, or of ++``TYPE_BACKPLANE`` (the difference being the two that in the ``TYPE_BACKPLANE`` ++mode, the MC firmware does not access the PCS registers). One can check for ++this condition using the following helper:: + +- - bool dpaa2_mac_is_type_fixed(struct fsl_mc_device *dpmac_dev,struct fsl_mc_io *mc_io); ++ - static inline bool dpaa2_mac_is_type_phy(struct dpaa2_mac *mac); + + Before connection to a MAC, the caller must allocate and populate the + dpaa2_mac structure with the associated net_device, a pointer to the MC portal +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +@@ -733,12 +733,7 @@ static inline unsigned int dpaa2_eth_rx_ + + static inline bool dpaa2_eth_is_type_phy(struct dpaa2_eth_priv *priv) + { +- if (priv->mac && +- (priv->mac->attr.link_type == DPMAC_LINK_TYPE_PHY || +- priv->mac->attr.link_type == DPMAC_LINK_TYPE_BACKPLANE)) +- return true; +- +- return false; ++ return dpaa2_mac_is_type_phy(priv->mac); + } + + static inline bool dpaa2_eth_has_mac(struct dpaa2_eth_priv *priv) +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h +@@ -30,8 +30,14 @@ struct dpaa2_mac { + struct phy *serdes_phy; + }; + +-bool dpaa2_mac_is_type_fixed(struct fsl_mc_device *dpmac_dev, +- struct fsl_mc_io *mc_io); ++static inline bool dpaa2_mac_is_type_phy(struct dpaa2_mac *mac) ++{ ++ if (!mac) ++ return false; ++ ++ return mac->attr.link_type == DPMAC_LINK_TYPE_PHY || ++ mac->attr.link_type == DPMAC_LINK_TYPE_BACKPLANE; ++} + + int dpaa2_mac_open(struct dpaa2_mac *mac); + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h +@@ -230,12 +230,7 @@ static inline bool dpaa2_switch_supports + static inline bool + dpaa2_switch_port_is_type_phy(struct ethsw_port_priv *port_priv) + { +- if (port_priv->mac && +- (port_priv->mac->attr.link_type == DPMAC_LINK_TYPE_PHY || +- port_priv->mac->attr.link_type == DPMAC_LINK_TYPE_BACKPLANE)) +- return true; +- +- return false; ++ return dpaa2_mac_is_type_phy(port_priv->mac); + } + + static inline bool dpaa2_switch_port_has_mac(struct ethsw_port_priv *port_priv) diff --git a/target/linux/armsr/patches-6.1/701-v6.2-0003-net-dpaa2-mac-absorb-phylink_start-call-into-dpaa2_m.patch b/target/linux/armsr/patches-6.1/701-v6.2-0003-net-dpaa2-mac-absorb-phylink_start-call-into-dpaa2_m.patch new file mode 100644 index 0000000000..e84195f3cd --- /dev/null +++ b/target/linux/armsr/patches-6.1/701-v6.2-0003-net-dpaa2-mac-absorb-phylink_start-call-into-dpaa2_m.patch @@ -0,0 +1,88 @@ +From 97c07369ab8bf9895e05d4b468f18e6567263154 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Tue, 29 Nov 2022 16:12:12 +0200 +Subject: [PATCH 05/14] net: dpaa2-mac: absorb phylink_start() call into + dpaa2_mac_start() + +The phylink handling is intended to be hidden inside the dpaa2_mac +object. Move the phylink_start() call into dpaa2_mac_start(), and +phylink_stop() into dpaa2_mac_stop(). + +Signed-off-by: Vladimir Oltean +Reviewed-by: Andrew Lunn +Reviewed-by: Ioana Ciornei +Tested-by: Ioana Ciornei +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 5 +---- + drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 8 ++++++++ + drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 5 +---- + 3 files changed, 10 insertions(+), 8 deletions(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +@@ -2082,10 +2082,8 @@ static int dpaa2_eth_open(struct net_dev + goto enable_err; + } + +- if (dpaa2_eth_is_type_phy(priv)) { ++ if (dpaa2_eth_is_type_phy(priv)) + dpaa2_mac_start(priv->mac); +- phylink_start(priv->mac->phylink); +- } + + return 0; + +@@ -2159,7 +2157,6 @@ static int dpaa2_eth_stop(struct net_dev + int retries = 10; + + if (dpaa2_eth_is_type_phy(priv)) { +- phylink_stop(priv->mac->phylink); + dpaa2_mac_stop(priv->mac); + } else { + netif_tx_stop_all_queues(net_dev); +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +@@ -336,12 +336,20 @@ static void dpaa2_mac_set_supported_inte + + void dpaa2_mac_start(struct dpaa2_mac *mac) + { ++ ASSERT_RTNL(); ++ + if (mac->serdes_phy) + phy_power_on(mac->serdes_phy); ++ ++ phylink_start(mac->phylink); + } + + void dpaa2_mac_stop(struct dpaa2_mac *mac) + { ++ ASSERT_RTNL(); ++ ++ phylink_stop(mac->phylink); ++ + if (mac->serdes_phy) + phy_power_off(mac->serdes_phy); + } +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +@@ -703,10 +703,8 @@ static int dpaa2_switch_port_open(struct + + dpaa2_switch_enable_ctrl_if_napi(ethsw); + +- if (dpaa2_switch_port_is_type_phy(port_priv)) { ++ if (dpaa2_switch_port_is_type_phy(port_priv)) + dpaa2_mac_start(port_priv->mac); +- phylink_start(port_priv->mac->phylink); +- } + + return 0; + } +@@ -718,7 +716,6 @@ static int dpaa2_switch_port_stop(struct + int err; + + if (dpaa2_switch_port_is_type_phy(port_priv)) { +- phylink_stop(port_priv->mac->phylink); + dpaa2_mac_stop(port_priv->mac); + } else { + netif_tx_stop_all_queues(netdev); diff --git a/target/linux/armsr/patches-6.1/701-v6.2-0004-net-dpaa2-mac-remove-defensive-check-in-dpaa2_mac_di.patch b/target/linux/armsr/patches-6.1/701-v6.2-0004-net-dpaa2-mac-remove-defensive-check-in-dpaa2_mac_di.patch new file mode 100644 index 0000000000..c3028357fe --- /dev/null +++ b/target/linux/armsr/patches-6.1/701-v6.2-0004-net-dpaa2-mac-remove-defensive-check-in-dpaa2_mac_di.patch @@ -0,0 +1,50 @@ +From 095ef388f714d622aa503fcccf20dc4095b72762 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Tue, 29 Nov 2022 16:12:13 +0200 +Subject: [PATCH 06/14] net: dpaa2-mac: remove defensive check in + dpaa2_mac_disconnect() + +dpaa2_mac_disconnect() will only be called with a NULL mac->phylink if +dpaa2_mac_connect() failed, or was never called. + +The callers are these: + +dpaa2_eth_disconnect_mac(): + + if (dpaa2_eth_is_type_phy(priv)) + dpaa2_mac_disconnect(priv->mac); + +dpaa2_switch_port_disconnect_mac(): + + if (dpaa2_switch_port_is_type_phy(port_priv)) + dpaa2_mac_disconnect(port_priv->mac); + +priv->mac can be NULL, but in that case, dpaa2_eth_is_type_phy() returns +false, and dpaa2_mac_disconnect() is never called. Similar for +dpaa2-switch. + +When priv->mac is non-NULL, it means that dpaa2_mac_connect() returned +zero (success), and therefore, priv->mac->phylink is also a valid +pointer. + +Signed-off-by: Vladimir Oltean +Reviewed-by: Andrew Lunn +Reviewed-by: Ioana Ciornei +Tested-by: Ioana Ciornei +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +@@ -446,9 +446,6 @@ err_pcs_destroy: + + void dpaa2_mac_disconnect(struct dpaa2_mac *mac) + { +- if (!mac->phylink) +- return; +- + phylink_disconnect_phy(mac->phylink); + phylink_destroy(mac->phylink); + dpaa2_pcs_destroy(mac); diff --git a/target/linux/armsr/patches-6.1/701-v6.2-0005-net-dpaa2-eth-assign-priv-mac-after-dpaa2_mac_connec.patch b/target/linux/armsr/patches-6.1/701-v6.2-0005-net-dpaa2-eth-assign-priv-mac-after-dpaa2_mac_connec.patch new file mode 100644 index 0000000000..8c7ed6c793 --- /dev/null +++ b/target/linux/armsr/patches-6.1/701-v6.2-0005-net-dpaa2-eth-assign-priv-mac-after-dpaa2_mac_connec.patch @@ -0,0 +1,101 @@ +From 06efc9b8a1360cad83cae6e71558e5458cc1fbf3 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Tue, 29 Nov 2022 16:12:14 +0200 +Subject: [PATCH 07/14] net: dpaa2-eth: assign priv->mac after + dpaa2_mac_connect() call + +There are 2 requirements for correct code: + +- Any time the driver accesses the priv->mac pointer at runtime, it + either holds NULL to indicate a DPNI-DPNI connection (or unconnected + DPNI), or a struct dpaa2_mac whose phylink instance was fully + initialized (created and connected to the PHY). No changes are made to + priv->mac while it is being used. Currently, rtnl_lock() watches over + the call to dpaa2_eth_connect_mac(), so it serves the purpose of + serializing this with all readers of priv->mac. + +- dpaa2_mac_connect() should run unlocked, because inside it are 2 + phylink calls with incompatible locking requirements: phylink_create() + requires that the rtnl_mutex isn't held, and phylink_fwnode_phy_connect() + requires that the rtnl_mutex is held. The only way to solve those + contradictory requirements is to let dpaa2_mac_connect() take + rtnl_lock() when it needs to. + +To solve both requirements, we need to identify the writer side of the +priv->mac pointer, which can be wrapped in a mutex private to the driver +in a future patch. The dpaa2_mac_connect() cannot be part of the writer +side critical section, because of an AB/BA deadlock with rtnl_lock(). + +So the strategy needs to be that where we prepare the DPMAC by calling +dpaa2_mac_connect(), and only make priv->mac point to it once it's fully +prepared. This ensures that the writer side critical section has the +absolute minimum surface it can. + +The reverse strategy is adopted in the dpaa2_eth_disconnect_mac() code +path. This makes sure that priv->mac is NULL when we start tearing down +the DPMAC that we disconnected from, and concurrent code will simply not +see it. + +No locking changes in this patch (concurrent code is still blocked by +the rtnl_mutex). + +Signed-off-by: Vladimir Oltean +Reviewed-by: Ioana Ciornei +Tested-by: Ioana Ciornei +Signed-off-by: Paolo Abeni +--- + .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 21 +++++++++++-------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +@@ -4443,9 +4443,8 @@ static int dpaa2_eth_connect_mac(struct + err = dpaa2_mac_open(mac); + if (err) + goto err_free_mac; +- priv->mac = mac; + +- if (dpaa2_eth_is_type_phy(priv)) { ++ if (dpaa2_mac_is_type_phy(mac)) { + err = dpaa2_mac_connect(mac); + if (err && err != -EPROBE_DEFER) + netdev_err(priv->net_dev, "Error connecting to the MAC endpoint: %pe", +@@ -4454,11 +4453,12 @@ static int dpaa2_eth_connect_mac(struct + goto err_close_mac; + } + ++ priv->mac = mac; ++ + return 0; + + err_close_mac: + dpaa2_mac_close(mac); +- priv->mac = NULL; + err_free_mac: + kfree(mac); + return err; +@@ -4466,15 +4466,18 @@ err_free_mac: + + static void dpaa2_eth_disconnect_mac(struct dpaa2_eth_priv *priv) + { +- if (dpaa2_eth_is_type_phy(priv)) +- dpaa2_mac_disconnect(priv->mac); ++ struct dpaa2_mac *mac = priv->mac; ++ ++ priv->mac = NULL; + +- if (!dpaa2_eth_has_mac(priv)) ++ if (!mac) + return; + +- dpaa2_mac_close(priv->mac); +- kfree(priv->mac); +- priv->mac = NULL; ++ if (dpaa2_mac_is_type_phy(mac)) ++ dpaa2_mac_disconnect(mac); ++ ++ dpaa2_mac_close(mac); ++ kfree(mac); + } + + static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg) diff --git a/target/linux/armsr/patches-6.1/701-v6.2-0006-net-dpaa2-switch-assign-port_priv-mac-after-dpaa2_ma.patch b/target/linux/armsr/patches-6.1/701-v6.2-0006-net-dpaa2-switch-assign-port_priv-mac-after-dpaa2_ma.patch new file mode 100644 index 0000000000..e63654984a --- /dev/null +++ b/target/linux/armsr/patches-6.1/701-v6.2-0006-net-dpaa2-switch-assign-port_priv-mac-after-dpaa2_ma.patch @@ -0,0 +1,73 @@ +From a5e7f7e277bd4403c45c1c7922d56d0eb08dbc7c Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Tue, 29 Nov 2022 16:12:15 +0200 +Subject: [PATCH 08/14] net: dpaa2-switch: assign port_priv->mac after + dpaa2_mac_connect() call + +The dpaa2-switch has the exact same locking requirements when connected +to a DPMAC, so it needs port_priv->mac to always point either to NULL, +or to a DPMAC with a fully initialized phylink instance. + +Make the same preparatory change in the dpaa2-switch driver as in the +dpaa2-eth one. + +Signed-off-by: Vladimir Oltean +Reviewed-by: Ioana Ciornei +Tested-by: Ioana Ciornei +Signed-off-by: Paolo Abeni +--- + .../ethernet/freescale/dpaa2/dpaa2-switch.c | 21 +++++++++++-------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +@@ -1450,9 +1450,8 @@ static int dpaa2_switch_port_connect_mac + err = dpaa2_mac_open(mac); + if (err) + goto err_free_mac; +- port_priv->mac = mac; + +- if (dpaa2_switch_port_is_type_phy(port_priv)) { ++ if (dpaa2_mac_is_type_phy(mac)) { + err = dpaa2_mac_connect(mac); + if (err) { + netdev_err(port_priv->netdev, +@@ -1462,11 +1461,12 @@ static int dpaa2_switch_port_connect_mac + } + } + ++ port_priv->mac = mac; ++ + return 0; + + err_close_mac: + dpaa2_mac_close(mac); +- port_priv->mac = NULL; + err_free_mac: + kfree(mac); + return err; +@@ -1474,15 +1474,18 @@ err_free_mac: + + static void dpaa2_switch_port_disconnect_mac(struct ethsw_port_priv *port_priv) + { +- if (dpaa2_switch_port_is_type_phy(port_priv)) +- dpaa2_mac_disconnect(port_priv->mac); ++ struct dpaa2_mac *mac = port_priv->mac; ++ ++ port_priv->mac = NULL; + +- if (!dpaa2_switch_port_has_mac(port_priv)) ++ if (!mac) + return; + +- dpaa2_mac_close(port_priv->mac); +- kfree(port_priv->mac); +- port_priv->mac = NULL; ++ if (dpaa2_mac_is_type_phy(mac)) ++ dpaa2_mac_disconnect(mac); ++ ++ dpaa2_mac_close(mac); ++ kfree(mac); + } + + static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg) diff --git a/target/linux/armsr/patches-6.1/701-v6.2-0007-net-dpaa2-publish-MAC-stringset-to-ethtool-S-even-if.patch b/target/linux/armsr/patches-6.1/701-v6.2-0007-net-dpaa2-publish-MAC-stringset-to-ethtool-S-even-if.patch new file mode 100644 index 0000000000..c790ba1bd5 --- /dev/null +++ b/target/linux/armsr/patches-6.1/701-v6.2-0007-net-dpaa2-publish-MAC-stringset-to-ethtool-S-even-if.patch @@ -0,0 +1,111 @@ +From ce44b6ed9ee65efa9b3025552c513842eabcab88 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Tue, 29 Nov 2022 16:12:16 +0200 +Subject: [PATCH 09/14] net: dpaa2: publish MAC stringset to ethtool -S even if + MAC is missing + +DPNIs and DPSW objects can connect and disconnect at runtime from DPMAC +objects on the same fsl-mc bus. The DPMAC object also holds "ethtool -S" +unstructured counters. Those counters are only shown for the entity +owning the netdev (DPNI, DPSW) if it's connected to a DPMAC. + +The ethtool stringset code path is split into multiple callbacks, but +currently, connecting and disconnecting the DPMAC takes the rtnl_lock(). +This blocks the entire ethtool code path from running, see +ethnl_default_doit() -> rtnl_lock() -> ops->prepare_data() -> +strset_prepare_data(). + +This is going to be a problem if we are going to no longer require +rtnl_lock() when connecting/disconnecting the DPMAC, because the DPMAC +could appear between ops->get_sset_count() and ops->get_strings(). +If it appears out of the blue, we will provide a stringset into an array +that was dimensioned thinking the DPMAC wouldn't be there => array +accessed out of bounds. + +There isn't really a good way to work around that, and I don't want to +put too much pressure on the ethtool framework by playing locking games. +Just make the DPMAC counters be always available. They'll be zeroes if +the DPNI or DPSW isn't connected to a DPMAC. + +Signed-off-by: Vladimir Oltean +Reviewed-by: Andrew Lunn +Reviewed-by: Ioana Ciornei +Tested-by: Ioana Ciornei +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 12 +++--------- + .../ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c | 11 ++--------- + 2 files changed, 5 insertions(+), 18 deletions(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +@@ -186,7 +186,6 @@ static int dpaa2_eth_set_pauseparam(stru + static void dpaa2_eth_get_strings(struct net_device *netdev, u32 stringset, + u8 *data) + { +- struct dpaa2_eth_priv *priv = netdev_priv(netdev); + u8 *p = data; + int i; + +@@ -200,22 +199,17 @@ static void dpaa2_eth_get_strings(struct + strscpy(p, dpaa2_ethtool_extras[i], ETH_GSTRING_LEN); + p += ETH_GSTRING_LEN; + } +- if (dpaa2_eth_has_mac(priv)) +- dpaa2_mac_get_strings(p); ++ dpaa2_mac_get_strings(p); + break; + } + } + + static int dpaa2_eth_get_sset_count(struct net_device *net_dev, int sset) + { +- int num_ss_stats = DPAA2_ETH_NUM_STATS + DPAA2_ETH_NUM_EXTRA_STATS; +- struct dpaa2_eth_priv *priv = netdev_priv(net_dev); +- + switch (sset) { + case ETH_SS_STATS: /* ethtool_get_stats(), ethtool_get_drvinfo() */ +- if (dpaa2_eth_has_mac(priv)) +- num_ss_stats += dpaa2_mac_get_sset_count(); +- return num_ss_stats; ++ return DPAA2_ETH_NUM_STATS + DPAA2_ETH_NUM_EXTRA_STATS + ++ dpaa2_mac_get_sset_count(); + default: + return -EOPNOTSUPP; + } +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c +@@ -145,14 +145,9 @@ dpaa2_switch_set_link_ksettings(struct n + static int + dpaa2_switch_ethtool_get_sset_count(struct net_device *netdev, int sset) + { +- struct ethsw_port_priv *port_priv = netdev_priv(netdev); +- int num_ss_stats = DPAA2_SWITCH_NUM_COUNTERS; +- + switch (sset) { + case ETH_SS_STATS: +- if (port_priv->mac) +- num_ss_stats += dpaa2_mac_get_sset_count(); +- return num_ss_stats; ++ return DPAA2_SWITCH_NUM_COUNTERS + dpaa2_mac_get_sset_count(); + default: + return -EOPNOTSUPP; + } +@@ -161,7 +156,6 @@ dpaa2_switch_ethtool_get_sset_count(stru + static void dpaa2_switch_ethtool_get_strings(struct net_device *netdev, + u32 stringset, u8 *data) + { +- struct ethsw_port_priv *port_priv = netdev_priv(netdev); + u8 *p = data; + int i; + +@@ -172,8 +166,7 @@ static void dpaa2_switch_ethtool_get_str + ETH_GSTRING_LEN); + p += ETH_GSTRING_LEN; + } +- if (port_priv->mac) +- dpaa2_mac_get_strings(p); ++ dpaa2_mac_get_strings(p); + break; + } + } diff --git a/target/linux/armsr/patches-6.1/701-v6.2-0008-net-dpaa2-switch-replace-direct-MAC-access-with-dpaa.patch b/target/linux/armsr/patches-6.1/701-v6.2-0008-net-dpaa2-switch-replace-direct-MAC-access-with-dpaa.patch new file mode 100644 index 0000000000..0663bf6fb1 --- /dev/null +++ b/target/linux/armsr/patches-6.1/701-v6.2-0008-net-dpaa2-switch-replace-direct-MAC-access-with-dpaa.patch @@ -0,0 +1,28 @@ +From c838d9fd7e6ba9ddd6006bf0a296396266e9f121 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Tue, 29 Nov 2022 16:12:17 +0200 +Subject: [PATCH 10/14] net: dpaa2-switch replace direct MAC access with + dpaa2_switch_port_has_mac() + +The helper function will gain a lockdep annotation in a future patch. +Make sure to benefit from it. + +Signed-off-by: Vladimir Oltean +Reviewed-by: Ioana Ciornei +Tested-by: Ioana Ciornei +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c +@@ -189,7 +189,7 @@ static void dpaa2_switch_ethtool_get_sta + dpaa2_switch_ethtool_counters[i].name, err); + } + +- if (port_priv->mac) ++ if (dpaa2_switch_port_has_mac(port_priv)) + dpaa2_mac_get_ethtool_stats(port_priv->mac, data + i); + } + diff --git a/target/linux/armsr/patches-6.1/701-v6.2-0009-net-dpaa2-eth-connect-to-MAC-before-requesting-the-e.patch b/target/linux/armsr/patches-6.1/701-v6.2-0009-net-dpaa2-eth-connect-to-MAC-before-requesting-the-e.patch new file mode 100644 index 0000000000..37831f264b --- /dev/null +++ b/target/linux/armsr/patches-6.1/701-v6.2-0009-net-dpaa2-eth-connect-to-MAC-before-requesting-the-e.patch @@ -0,0 +1,93 @@ +From e0ea63162cb5f1ca7f844d6ef5fc4079448ee2d5 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Tue, 29 Nov 2022 16:12:18 +0200 +Subject: [PATCH 11/14] net: dpaa2-eth: connect to MAC before requesting the + "endpoint changed" IRQ + +dpaa2_eth_connect_mac() is called both from dpaa2_eth_probe() and from +dpni_irq0_handler_thread(). + +It could happen that the DPNI gets connected to a DPMAC on the fsl-mc +bus exactly during probe, as soon as the "endpoint change" interrupt is +requested in dpaa2_eth_setup_irqs(). This will cause the +dpni_irq0_handler_thread() to register a phylink instance for that DPMAC. + +Then, the probing function will also try to register a phylink instance +for the same DPMAC, operation which should fail (and this will fail the +probing of the driver). + +Reorder dpaa2_eth_setup_irqs() and dpaa2_eth_connect_mac(), such that +dpni_irq0_handler_thread() never races with the DPMAC-related portion of +the probing path. + +Also reorder dpaa2_eth_disconnect_mac() to be in the mirror position of +dpaa2_eth_connect_mac() in the teardown path. + +Signed-off-by: Vladimir Oltean +Reviewed-by: Ioana Ciornei +Tested-by: Ioana Ciornei +Signed-off-by: Paolo Abeni +--- + .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +@@ -4710,6 +4710,10 @@ static int dpaa2_eth_probe(struct fsl_mc + } + #endif + ++ err = dpaa2_eth_connect_mac(priv); ++ if (err) ++ goto err_connect_mac; ++ + err = dpaa2_eth_setup_irqs(dpni_dev); + if (err) { + netdev_warn(net_dev, "Failed to set link interrupt, fall back to polling\n"); +@@ -4722,10 +4726,6 @@ static int dpaa2_eth_probe(struct fsl_mc + priv->do_link_poll = true; + } + +- err = dpaa2_eth_connect_mac(priv); +- if (err) +- goto err_connect_mac; +- + err = dpaa2_eth_dl_alloc(priv); + if (err) + goto err_dl_register; +@@ -4759,13 +4759,13 @@ err_dl_port_add: + err_dl_trap_register: + dpaa2_eth_dl_free(priv); + err_dl_register: +- dpaa2_eth_disconnect_mac(priv); +-err_connect_mac: + if (priv->do_link_poll) + kthread_stop(priv->poll_thread); + else + fsl_mc_free_irqs(dpni_dev); + err_poll_thread: ++ dpaa2_eth_disconnect_mac(priv); ++err_connect_mac: + dpaa2_eth_free_rings(priv); + err_alloc_rings: + err_csum: +@@ -4813,9 +4813,6 @@ static int dpaa2_eth_remove(struct fsl_m + #endif + + unregister_netdev(net_dev); +- rtnl_lock(); +- dpaa2_eth_disconnect_mac(priv); +- rtnl_unlock(); + + dpaa2_eth_dl_port_del(priv); + dpaa2_eth_dl_traps_unregister(priv); +@@ -4826,6 +4823,9 @@ static int dpaa2_eth_remove(struct fsl_m + else + fsl_mc_free_irqs(ls_dev); + ++ rtnl_lock(); ++ dpaa2_eth_disconnect_mac(priv); ++ rtnl_unlock(); + dpaa2_eth_free_rings(priv); + free_percpu(priv->fd); + free_percpu(priv->sgt_cache); diff --git a/target/linux/armsr/patches-6.1/701-v6.2-0010-net-dpaa2-eth-serialize-changes-to-priv-mac-with-a-m.patch b/target/linux/armsr/patches-6.1/701-v6.2-0010-net-dpaa2-eth-serialize-changes-to-priv-mac-with-a-m.patch new file mode 100644 index 0000000000..89f58412d4 --- /dev/null +++ b/target/linux/armsr/patches-6.1/701-v6.2-0010-net-dpaa2-eth-serialize-changes-to-priv-mac-with-a-m.patch @@ -0,0 +1,320 @@ +From 5e448a17dfa2e95166534df7f677a3694ef6187d Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Tue, 29 Nov 2022 16:12:19 +0200 +Subject: [PATCH 12/14] net: dpaa2-eth: serialize changes to priv->mac with a + mutex + +The dpaa2 architecture permits dynamic connections between objects on +the fsl-mc bus, specifically between a DPNI object (represented by a +struct net_device) and a DPMAC object (represented by a struct phylink). + +The DPNI driver is notified when those connections are created/broken +through the dpni_irq0_handler_thread() method. To ensure that ethtool +operations, as well as netdev up/down operations serialize with the +connection/disconnection of the DPNI with a DPMAC, +dpni_irq0_handler_thread() takes the rtnl_lock() to block those other +operations from taking place. + +There is code called by dpaa2_mac_connect() which wants to acquire the +rtnl_mutex once again, see phylink_create() -> phylink_register_sfp() -> +sfp_bus_add_upstream() -> rtnl_lock(). So the strategy doesn't quite +work out, even though it's fairly simple. + +Create a different strategy, where all code paths in the dpaa2-eth +driver access priv->mac only while they are holding priv->mac_lock. +The phylink instance is not created or connected to the PHY under the +priv->mac_lock, but only assigned to priv->mac then. This will eliminate +the reliance on the rtnl_mutex. + +Add lockdep annotations and put comments where holding the lock is not +necessary, and priv->mac can be dereferenced freely. + +Signed-off-by: Vladimir Oltean +Reviewed-by: Ioana Ciornei +Tested-by: Ioana Ciornei +Signed-off-by: Paolo Abeni +--- + .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 43 ++++++++++++-- + .../net/ethernet/freescale/dpaa2/dpaa2-eth.h | 6 ++ + .../ethernet/freescale/dpaa2/dpaa2-ethtool.c | 58 +++++++++++++++---- + 3 files changed, 91 insertions(+), 16 deletions(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +@@ -2020,8 +2020,11 @@ static int dpaa2_eth_link_state_update(s + + /* When we manage the MAC/PHY using phylink there is no need + * to manually update the netif_carrier. ++ * We can avoid locking because we are called from the "link changed" ++ * IRQ handler, which is the same as the "endpoint changed" IRQ handler ++ * (the writer to priv->mac), so we cannot race with it. + */ +- if (dpaa2_eth_is_type_phy(priv)) ++ if (dpaa2_mac_is_type_phy(priv->mac)) + goto out; + + /* Chech link state; speed / duplex changes are not treated yet */ +@@ -2060,6 +2063,8 @@ static int dpaa2_eth_open(struct net_dev + priv->dpbp_dev->obj_desc.id, priv->bpid); + } + ++ mutex_lock(&priv->mac_lock); ++ + if (!dpaa2_eth_is_type_phy(priv)) { + /* We'll only start the txqs when the link is actually ready; + * make sure we don't race against the link up notification, +@@ -2078,6 +2083,7 @@ static int dpaa2_eth_open(struct net_dev + + err = dpni_enable(priv->mc_io, 0, priv->mc_token); + if (err < 0) { ++ mutex_unlock(&priv->mac_lock); + netdev_err(net_dev, "dpni_enable() failed\n"); + goto enable_err; + } +@@ -2085,6 +2091,8 @@ static int dpaa2_eth_open(struct net_dev + if (dpaa2_eth_is_type_phy(priv)) + dpaa2_mac_start(priv->mac); + ++ mutex_unlock(&priv->mac_lock); ++ + return 0; + + enable_err: +@@ -2156,6 +2164,8 @@ static int dpaa2_eth_stop(struct net_dev + int dpni_enabled = 0; + int retries = 10; + ++ mutex_lock(&priv->mac_lock); ++ + if (dpaa2_eth_is_type_phy(priv)) { + dpaa2_mac_stop(priv->mac); + } else { +@@ -2163,6 +2173,8 @@ static int dpaa2_eth_stop(struct net_dev + netif_carrier_off(net_dev); + } + ++ mutex_unlock(&priv->mac_lock); ++ + /* On dpni_disable(), the MC firmware will: + * - stop MAC Rx and wait for all Rx frames to be enqueued to software + * - cut off WRIOP dequeues from egress FQs and wait until transmission +@@ -2488,12 +2500,20 @@ static int dpaa2_eth_ts_ioctl(struct net + static int dpaa2_eth_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) + { + struct dpaa2_eth_priv *priv = netdev_priv(dev); ++ int err; + + if (cmd == SIOCSHWTSTAMP) + return dpaa2_eth_ts_ioctl(dev, rq, cmd); + +- if (dpaa2_eth_is_type_phy(priv)) +- return phylink_mii_ioctl(priv->mac->phylink, rq, cmd); ++ mutex_lock(&priv->mac_lock); ++ ++ if (dpaa2_eth_is_type_phy(priv)) { ++ err = phylink_mii_ioctl(priv->mac->phylink, rq, cmd); ++ mutex_unlock(&priv->mac_lock); ++ return err; ++ } ++ ++ mutex_unlock(&priv->mac_lock); + + return -EOPNOTSUPP; + } +@@ -4453,7 +4473,9 @@ static int dpaa2_eth_connect_mac(struct + goto err_close_mac; + } + ++ mutex_lock(&priv->mac_lock); + priv->mac = mac; ++ mutex_unlock(&priv->mac_lock); + + return 0; + +@@ -4466,9 +4488,12 @@ err_free_mac: + + static void dpaa2_eth_disconnect_mac(struct dpaa2_eth_priv *priv) + { +- struct dpaa2_mac *mac = priv->mac; ++ struct dpaa2_mac *mac; + ++ mutex_lock(&priv->mac_lock); ++ mac = priv->mac; + priv->mac = NULL; ++ mutex_unlock(&priv->mac_lock); + + if (!mac) + return; +@@ -4487,6 +4512,7 @@ static irqreturn_t dpni_irq0_handler_thr + struct fsl_mc_device *dpni_dev = to_fsl_mc_device(dev); + struct net_device *net_dev = dev_get_drvdata(dev); + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); ++ bool had_mac; + int err; + + err = dpni_get_irq_status(dpni_dev->mc_io, 0, dpni_dev->mc_handle, +@@ -4504,7 +4530,12 @@ static irqreturn_t dpni_irq0_handler_thr + dpaa2_eth_update_tx_fqids(priv); + + rtnl_lock(); +- if (dpaa2_eth_has_mac(priv)) ++ /* We can avoid locking because the "endpoint changed" IRQ ++ * handler is the only one who changes priv->mac at runtime, ++ * so we are not racing with anyone. ++ */ ++ had_mac = !!priv->mac; ++ if (had_mac) + dpaa2_eth_disconnect_mac(priv); + else + dpaa2_eth_connect_mac(priv); +@@ -4605,6 +4636,8 @@ static int dpaa2_eth_probe(struct fsl_mc + priv = netdev_priv(net_dev); + priv->net_dev = net_dev; + ++ mutex_init(&priv->mac_lock); ++ + priv->iommu_domain = iommu_get_domain_for_dev(dev); + + priv->tx_tstamp_type = HWTSTAMP_TX_OFF; +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h +@@ -580,6 +580,8 @@ struct dpaa2_eth_priv { + #endif + + struct dpaa2_mac *mac; ++ /* Serializes changes to priv->mac */ ++ struct mutex mac_lock; + struct workqueue_struct *dpaa2_ptp_wq; + struct work_struct tx_onestep_tstamp; + struct sk_buff_head tx_skbs; +@@ -733,11 +735,15 @@ static inline unsigned int dpaa2_eth_rx_ + + static inline bool dpaa2_eth_is_type_phy(struct dpaa2_eth_priv *priv) + { ++ lockdep_assert_held(&priv->mac_lock); ++ + return dpaa2_mac_is_type_phy(priv->mac); + } + + static inline bool dpaa2_eth_has_mac(struct dpaa2_eth_priv *priv) + { ++ lockdep_assert_held(&priv->mac_lock); ++ + return priv->mac ? true : false; + } + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c +@@ -86,11 +86,16 @@ static void dpaa2_eth_get_drvinfo(struct + static int dpaa2_eth_nway_reset(struct net_device *net_dev) + { + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); ++ int err = -EOPNOTSUPP; ++ ++ mutex_lock(&priv->mac_lock); + + if (dpaa2_eth_is_type_phy(priv)) +- return phylink_ethtool_nway_reset(priv->mac->phylink); ++ err = phylink_ethtool_nway_reset(priv->mac->phylink); ++ ++ mutex_unlock(&priv->mac_lock); + +- return -EOPNOTSUPP; ++ return err; + } + + static int +@@ -98,10 +103,18 @@ dpaa2_eth_get_link_ksettings(struct net_ + struct ethtool_link_ksettings *link_settings) + { + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); ++ int err; + +- if (dpaa2_eth_is_type_phy(priv)) +- return phylink_ethtool_ksettings_get(priv->mac->phylink, +- link_settings); ++ mutex_lock(&priv->mac_lock); ++ ++ if (dpaa2_eth_is_type_phy(priv)) { ++ err = phylink_ethtool_ksettings_get(priv->mac->phylink, ++ link_settings); ++ mutex_unlock(&priv->mac_lock); ++ return err; ++ } ++ ++ mutex_unlock(&priv->mac_lock); + + link_settings->base.autoneg = AUTONEG_DISABLE; + if (!(priv->link_state.options & DPNI_LINK_OPT_HALF_DUPLEX)) +@@ -116,11 +129,17 @@ dpaa2_eth_set_link_ksettings(struct net_ + const struct ethtool_link_ksettings *link_settings) + { + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); ++ int err = -EOPNOTSUPP; + +- if (!dpaa2_eth_is_type_phy(priv)) +- return -EOPNOTSUPP; ++ mutex_lock(&priv->mac_lock); ++ ++ if (dpaa2_eth_is_type_phy(priv)) ++ err = phylink_ethtool_ksettings_set(priv->mac->phylink, ++ link_settings); + +- return phylink_ethtool_ksettings_set(priv->mac->phylink, link_settings); ++ mutex_unlock(&priv->mac_lock); ++ ++ return err; + } + + static void dpaa2_eth_get_pauseparam(struct net_device *net_dev, +@@ -129,11 +148,16 @@ static void dpaa2_eth_get_pauseparam(str + struct dpaa2_eth_priv *priv = netdev_priv(net_dev); + u64 link_options = priv->link_state.options; + ++ mutex_lock(&priv->mac_lock); ++ + if (dpaa2_eth_is_type_phy(priv)) { + phylink_ethtool_get_pauseparam(priv->mac->phylink, pause); ++ mutex_unlock(&priv->mac_lock); + return; + } + ++ mutex_unlock(&priv->mac_lock); ++ + pause->rx_pause = dpaa2_eth_rx_pause_enabled(link_options); + pause->tx_pause = dpaa2_eth_tx_pause_enabled(link_options); + pause->autoneg = AUTONEG_DISABLE; +@@ -152,9 +176,17 @@ static int dpaa2_eth_set_pauseparam(stru + return -EOPNOTSUPP; + } + +- if (dpaa2_eth_is_type_phy(priv)) +- return phylink_ethtool_set_pauseparam(priv->mac->phylink, +- pause); ++ mutex_lock(&priv->mac_lock); ++ ++ if (dpaa2_eth_is_type_phy(priv)) { ++ err = phylink_ethtool_set_pauseparam(priv->mac->phylink, ++ pause); ++ mutex_unlock(&priv->mac_lock); ++ return err; ++ } ++ ++ mutex_unlock(&priv->mac_lock); ++ + if (pause->autoneg) + return -EOPNOTSUPP; + +@@ -309,8 +341,12 @@ static void dpaa2_eth_get_ethtool_stats( + } + *(data + i++) = buf_cnt; + ++ mutex_lock(&priv->mac_lock); ++ + if (dpaa2_eth_has_mac(priv)) + dpaa2_mac_get_ethtool_stats(priv->mac, data + i); ++ ++ mutex_unlock(&priv->mac_lock); + } + + static int dpaa2_eth_prep_eth_rule(struct ethhdr *eth_value, struct ethhdr *eth_mask, diff --git a/target/linux/armsr/patches-6.1/701-v6.2-0011-net-dpaa2-switch-serialize-changes-to-priv-mac-with.patch b/target/linux/armsr/patches-6.1/701-v6.2-0011-net-dpaa2-switch-serialize-changes-to-priv-mac-with.patch new file mode 100644 index 0000000000..7ea446516b --- /dev/null +++ b/target/linux/armsr/patches-6.1/701-v6.2-0011-net-dpaa2-switch-serialize-changes-to-priv-mac-with.patch @@ -0,0 +1,203 @@ +From 80d12452a5f160c39d63efc1be07df36f9d07133 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Tue, 29 Nov 2022 16:12:20 +0200 +Subject: [PATCH 13/14] net: dpaa2-switch: serialize changes to priv->mac with + a mutex + +The dpaa2-switch driver uses a DPMAC in the same way as the dpaa2-eth +driver, so we need to duplicate the locking solution established by the +previous change to the switch driver as well. + +Signed-off-by: Vladimir Oltean +Reviewed-by: Ioana Ciornei +Tested-by: Ioana Ciornei +Signed-off-by: Paolo Abeni +--- + .../freescale/dpaa2/dpaa2-switch-ethtool.c | 32 +++++++++++++++---- + .../ethernet/freescale/dpaa2/dpaa2-switch.c | 31 ++++++++++++++++-- + .../ethernet/freescale/dpaa2/dpaa2-switch.h | 2 ++ + 3 files changed, 55 insertions(+), 10 deletions(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c +@@ -60,11 +60,18 @@ dpaa2_switch_get_link_ksettings(struct n + { + struct ethsw_port_priv *port_priv = netdev_priv(netdev); + struct dpsw_link_state state = {0}; +- int err = 0; ++ int err; + +- if (dpaa2_switch_port_is_type_phy(port_priv)) +- return phylink_ethtool_ksettings_get(port_priv->mac->phylink, +- link_ksettings); ++ mutex_lock(&port_priv->mac_lock); ++ ++ if (dpaa2_switch_port_is_type_phy(port_priv)) { ++ err = phylink_ethtool_ksettings_get(port_priv->mac->phylink, ++ link_ksettings); ++ mutex_unlock(&port_priv->mac_lock); ++ return err; ++ } ++ ++ mutex_unlock(&port_priv->mac_lock); + + err = dpsw_if_get_link_state(port_priv->ethsw_data->mc_io, 0, + port_priv->ethsw_data->dpsw_handle, +@@ -99,9 +106,16 @@ dpaa2_switch_set_link_ksettings(struct n + bool if_running; + int err = 0, ret; + +- if (dpaa2_switch_port_is_type_phy(port_priv)) +- return phylink_ethtool_ksettings_set(port_priv->mac->phylink, +- link_ksettings); ++ mutex_lock(&port_priv->mac_lock); ++ ++ if (dpaa2_switch_port_is_type_phy(port_priv)) { ++ err = phylink_ethtool_ksettings_set(port_priv->mac->phylink, ++ link_ksettings); ++ mutex_unlock(&port_priv->mac_lock); ++ return err; ++ } ++ ++ mutex_unlock(&port_priv->mac_lock); + + /* Interface needs to be down to change link settings */ + if_running = netif_running(netdev); +@@ -189,8 +203,12 @@ static void dpaa2_switch_ethtool_get_sta + dpaa2_switch_ethtool_counters[i].name, err); + } + ++ mutex_lock(&port_priv->mac_lock); ++ + if (dpaa2_switch_port_has_mac(port_priv)) + dpaa2_mac_get_ethtool_stats(port_priv->mac, data + i); ++ ++ mutex_unlock(&port_priv->mac_lock); + } + + const struct ethtool_ops dpaa2_switch_port_ethtool_ops = { +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +@@ -603,8 +603,11 @@ static int dpaa2_switch_port_link_state_ + + /* When we manage the MAC/PHY using phylink there is no need + * to manually update the netif_carrier. ++ * We can avoid locking because we are called from the "link changed" ++ * IRQ handler, which is the same as the "endpoint changed" IRQ handler ++ * (the writer to port_priv->mac), so we cannot race with it. + */ +- if (dpaa2_switch_port_is_type_phy(port_priv)) ++ if (dpaa2_mac_is_type_phy(port_priv->mac)) + return 0; + + /* Interrupts are received even though no one issued an 'ifconfig up' +@@ -684,6 +687,8 @@ static int dpaa2_switch_port_open(struct + struct ethsw_core *ethsw = port_priv->ethsw_data; + int err; + ++ mutex_lock(&port_priv->mac_lock); ++ + if (!dpaa2_switch_port_is_type_phy(port_priv)) { + /* Explicitly set carrier off, otherwise + * netif_carrier_ok() will return true and cause 'ip link show' +@@ -697,6 +702,7 @@ static int dpaa2_switch_port_open(struct + port_priv->ethsw_data->dpsw_handle, + port_priv->idx); + if (err) { ++ mutex_unlock(&port_priv->mac_lock); + netdev_err(netdev, "dpsw_if_enable err %d\n", err); + return err; + } +@@ -706,6 +712,8 @@ static int dpaa2_switch_port_open(struct + if (dpaa2_switch_port_is_type_phy(port_priv)) + dpaa2_mac_start(port_priv->mac); + ++ mutex_unlock(&port_priv->mac_lock); ++ + return 0; + } + +@@ -715,6 +723,8 @@ static int dpaa2_switch_port_stop(struct + struct ethsw_core *ethsw = port_priv->ethsw_data; + int err; + ++ mutex_lock(&port_priv->mac_lock); ++ + if (dpaa2_switch_port_is_type_phy(port_priv)) { + dpaa2_mac_stop(port_priv->mac); + } else { +@@ -722,6 +732,8 @@ static int dpaa2_switch_port_stop(struct + netif_carrier_off(netdev); + } + ++ mutex_unlock(&port_priv->mac_lock); ++ + err = dpsw_if_disable(port_priv->ethsw_data->mc_io, 0, + port_priv->ethsw_data->dpsw_handle, + port_priv->idx); +@@ -1461,7 +1473,9 @@ static int dpaa2_switch_port_connect_mac + } + } + ++ mutex_lock(&port_priv->mac_lock); + port_priv->mac = mac; ++ mutex_unlock(&port_priv->mac_lock); + + return 0; + +@@ -1474,9 +1488,12 @@ err_free_mac: + + static void dpaa2_switch_port_disconnect_mac(struct ethsw_port_priv *port_priv) + { +- struct dpaa2_mac *mac = port_priv->mac; ++ struct dpaa2_mac *mac; + ++ mutex_lock(&port_priv->mac_lock); ++ mac = port_priv->mac; + port_priv->mac = NULL; ++ mutex_unlock(&port_priv->mac_lock); + + if (!mac) + return; +@@ -1495,6 +1512,7 @@ static irqreturn_t dpaa2_switch_irq0_han + struct ethsw_port_priv *port_priv; + u32 status = ~0; + int err, if_id; ++ bool had_mac; + + err = dpsw_get_irq_status(ethsw->mc_io, 0, ethsw->dpsw_handle, + DPSW_IRQ_INDEX_IF, &status); +@@ -1513,7 +1531,12 @@ static irqreturn_t dpaa2_switch_irq0_han + + if (status & DPSW_IRQ_EVENT_ENDPOINT_CHANGED) { + rtnl_lock(); +- if (dpaa2_switch_port_has_mac(port_priv)) ++ /* We can avoid locking because the "endpoint changed" IRQ ++ * handler is the only one who changes priv->mac at runtime, ++ * so we are not racing with anyone. ++ */ ++ had_mac = !!port_priv->mac; ++ if (had_mac) + dpaa2_switch_port_disconnect_mac(port_priv); + else + dpaa2_switch_port_connect_mac(port_priv); +@@ -3256,6 +3279,8 @@ static int dpaa2_switch_probe_port(struc + port_priv->netdev = port_netdev; + port_priv->ethsw_data = ethsw; + ++ mutex_init(&port_priv->mac_lock); ++ + port_priv->idx = port_idx; + port_priv->stp_state = BR_STATE_FORWARDING; + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h +@@ -161,6 +161,8 @@ struct ethsw_port_priv { + + struct dpaa2_switch_filter_block *filter_block; + struct dpaa2_mac *mac; ++ /* Protects against changes to port_priv->mac */ ++ struct mutex mac_lock; + }; + + /* Switch data */ diff --git a/target/linux/armsr/patches-6.1/701-v6.2-0012-net-dpaa2-mac-move-rtnl_lock-only-around-phylink.patch b/target/linux/armsr/patches-6.1/701-v6.2-0012-net-dpaa2-mac-move-rtnl_lock-only-around-phylink.patch new file mode 100644 index 0000000000..976c2a0335 --- /dev/null +++ b/target/linux/armsr/patches-6.1/701-v6.2-0012-net-dpaa2-mac-move-rtnl_lock-only-around-phylink.patch @@ -0,0 +1,113 @@ +From 4ea2faf5bb13d9ba9f07e996d495c4cbe34a4236 Mon Sep 17 00:00:00 2001 +From: Vladimir Oltean +Date: Tue, 29 Nov 2022 16:12:21 +0200 +Subject: [PATCH 14/14] net: dpaa2-mac: move rtnl_lock() only around + phylink_{,dis}connect_phy() + +After the introduction of a private mac_lock that serializes access to +priv->mac (and port_priv->mac in the switch), the only remaining purpose +of rtnl_lock() is to satisfy the locking requirements of +phylink_fwnode_phy_connect() and phylink_disconnect_phy(). + +But the functions these live in, dpaa2_mac_connect() and +dpaa2_mac_disconnect(), have contradictory locking requirements. +While phylink_fwnode_phy_connect() wants rtnl_lock() to be held, +phylink_create() wants it to not be held. + +Move the rtnl_lock() from top-level (in the dpaa2-eth and dpaa2-switch +drivers) to only surround the phylink calls that require it, in the +dpaa2-mac library code. + +This is possible because dpaa2_mac_connect() and dpaa2_mac_disconnect() +run unlocked, and there isn't any danger of an AB/BA deadlock between +the rtnl_mutex and other private locks. + +Signed-off-by: Vladimir Oltean +Reviewed-by: Ioana Ciornei +Tested-by: Ioana Ciornei +Signed-off-by: Paolo Abeni +--- + drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ---- + drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 5 +++++ + drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 4 ---- + 3 files changed, 5 insertions(+), 8 deletions(-) + +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +@@ -4529,7 +4529,6 @@ static irqreturn_t dpni_irq0_handler_thr + dpaa2_eth_set_mac_addr(netdev_priv(net_dev)); + dpaa2_eth_update_tx_fqids(priv); + +- rtnl_lock(); + /* We can avoid locking because the "endpoint changed" IRQ + * handler is the only one who changes priv->mac at runtime, + * so we are not racing with anyone. +@@ -4539,7 +4538,6 @@ static irqreturn_t dpni_irq0_handler_thr + dpaa2_eth_disconnect_mac(priv); + else + dpaa2_eth_connect_mac(priv); +- rtnl_unlock(); + } + + return IRQ_HANDLED; +@@ -4856,9 +4854,7 @@ static int dpaa2_eth_remove(struct fsl_m + else + fsl_mc_free_irqs(ls_dev); + +- rtnl_lock(); + dpaa2_eth_disconnect_mac(priv); +- rtnl_unlock(); + dpaa2_eth_free_rings(priv); + free_percpu(priv->fd); + free_percpu(priv->sgt_cache); +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c +@@ -428,7 +428,9 @@ int dpaa2_mac_connect(struct dpaa2_mac * + } + mac->phylink = phylink; + ++ rtnl_lock(); + err = phylink_fwnode_phy_connect(mac->phylink, dpmac_node, 0); ++ rtnl_unlock(); + if (err) { + netdev_err(net_dev, "phylink_fwnode_phy_connect() = %d\n", err); + goto err_phylink_destroy; +@@ -446,7 +448,10 @@ err_pcs_destroy: + + void dpaa2_mac_disconnect(struct dpaa2_mac *mac) + { ++ rtnl_lock(); + phylink_disconnect_phy(mac->phylink); ++ rtnl_unlock(); ++ + phylink_destroy(mac->phylink); + dpaa2_pcs_destroy(mac); + of_phy_put(mac->serdes_phy); +--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c ++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c +@@ -1530,7 +1530,6 @@ static irqreturn_t dpaa2_switch_irq0_han + } + + if (status & DPSW_IRQ_EVENT_ENDPOINT_CHANGED) { +- rtnl_lock(); + /* We can avoid locking because the "endpoint changed" IRQ + * handler is the only one who changes priv->mac at runtime, + * so we are not racing with anyone. +@@ -1540,7 +1539,6 @@ static irqreturn_t dpaa2_switch_irq0_han + dpaa2_switch_port_disconnect_mac(port_priv); + else + dpaa2_switch_port_connect_mac(port_priv); +- rtnl_unlock(); + } + + out: +@@ -2958,9 +2956,7 @@ static void dpaa2_switch_remove_port(str + { + struct ethsw_port_priv *port_priv = ethsw->ports[port_idx]; + +- rtnl_lock(); + dpaa2_switch_port_disconnect_mac(port_priv); +- rtnl_unlock(); + free_netdev(port_priv->netdev); + ethsw->ports[port_idx] = NULL; + } diff --git a/target/linux/armvirt/32/config-6.1 b/target/linux/armvirt/32/config-6.1 deleted file mode 100644 index 664ef2e05b..0000000000 --- a/target/linux/armvirt/32/config-6.1 +++ /dev/null @@ -1,78 +0,0 @@ -CONFIG_ALIGNMENT_TRAP=y -CONFIG_ARCH_32BIT_OFF_T=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_MMAP_RND_BITS=8 -CONFIG_ARCH_NR_GPIO=0 -CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y -CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y -CONFIG_ARCH_SELECT_MEMORY_MODEL=y -CONFIG_ARCH_VIRT=y -CONFIG_ARM=y -CONFIG_ARM_CPU_SUSPEND=y -CONFIG_ARM_HAS_SG_CHAIN=y -CONFIG_ARM_HEAVY_MB=y -# CONFIG_ARM_HIGHBANK_CPUIDLE is not set -CONFIG_ARM_L1_CACHE_SHIFT=6 -CONFIG_ARM_L1_CACHE_SHIFT_6=y -CONFIG_ARM_LPAE=y -CONFIG_ARM_PATCH_IDIV=y -CONFIG_ARM_PATCH_PHYS_VIRT=y -CONFIG_ARM_PSCI=y -CONFIG_ARM_THUMB=y -CONFIG_ARM_UNWIND=y -CONFIG_ARM_VIRT_EXT=y -CONFIG_AUTO_ZRELADDR=y -CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y -CONFIG_CACHE_L2X0=y -CONFIG_COMPAT_32BIT_TIME=y -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_HAS_ASID=y -CONFIG_CPU_PABRT_V7=y -CONFIG_CPU_SPECTRE=y -CONFIG_CPU_THUMB_CAPABLE=y -CONFIG_CPU_TLB_V7=y -CONFIG_CPU_V7=y -CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y -CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" -CONFIG_DMA_OPS=y -CONFIG_EDAC_ATOMIC_SCRUB=y -CONFIG_GENERIC_IRQ_MULTI_HANDLER=y -CONFIG_GENERIC_VDSO_32=y -CONFIG_HARDEN_BRANCH_PREDICTOR=y -CONFIG_HAVE_SMP=y -CONFIG_HZ_FIXED=0 -CONFIG_HZ_PERIODIC=y -CONFIG_MIGHT_HAVE_CACHE_L2X0=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_NEON=y -CONFIG_NR_CPUS=4 -CONFIG_OLD_SIGACTION=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_OUTER_CACHE=y -CONFIG_OUTER_CACHE_SYNC=y -CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_PERF_USE_VMALLOC=y -CONFIG_RTC_MC146818_LIB=y -CONFIG_SERIAL_OF_PLATFORM=y -CONFIG_SMP_ON_UP=y -CONFIG_SWP_EMULATE=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -CONFIG_UNWINDER_ARM=y -CONFIG_USE_OF=y -CONFIG_VFP=y -CONFIG_VFPv3=y -CONFIG_XZ_DEC_ARM=y -CONFIG_XZ_DEC_BCJ=y -CONFIG_ZBOOT_ROM_BSS=0 -CONFIG_ZBOOT_ROM_TEXT=0 diff --git a/target/linux/armvirt/32/target.mk b/target/linux/armvirt/32/target.mk deleted file mode 100644 index df22040241..0000000000 --- a/target/linux/armvirt/32/target.mk +++ /dev/null @@ -1,10 +0,0 @@ -ARCH:=arm -SUBTARGET:=32 -BOARDNAME:=32-bit ARM QEMU Virtual Machine -CPU_TYPE:=cortex-a15 -CPU_SUBTYPE:=neon-vfpv4 -KERNELNAME:=zImage - -define Target/Description - Build images for $(BOARDNAME) -endef diff --git a/target/linux/armvirt/64/config-6.1 b/target/linux/armvirt/64/config-6.1 deleted file mode 100644 index f1b4838d15..0000000000 --- a/target/linux/armvirt/64/config-6.1 +++ /dev/null @@ -1,444 +0,0 @@ -CONFIG_64BIT=y -CONFIG_ACPI_PCC=y -CONFIG_ARCH_HISI=y -CONFIG_ARCH_INTEL_SOCFPGA=y -CONFIG_ARCH_LAYERSCAPE=y -CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y -CONFIG_ARCH_MMAP_RND_BITS=18 -CONFIG_ARCH_MMAP_RND_BITS_MAX=24 -CONFIG_ARCH_MMAP_RND_BITS_MIN=18 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 -CONFIG_ARCH_MVEBU=y -CONFIG_ARCH_NXP=y -CONFIG_ARCH_PROC_KCORE_TEXT=y -CONFIG_ARCH_ROCKCHIP=y -CONFIG_ARCH_STACKWALK=y -CONFIG_ARCH_SUNXI=y -CONFIG_ARCH_SYNQUACER=y -CONFIG_ARCH_THUNDER=y -CONFIG_ARCH_THUNDER2=y -CONFIG_ARCH_VEXPRESS=y -CONFIG_ARCH_WANTS_NO_INSTR=y -CONFIG_ARCH_ZYNQMP=y -CONFIG_ARM64=y -CONFIG_ARM64_4K_PAGES=y -CONFIG_ARM64_CNP=y -CONFIG_ARM64_CRYPTO=y -CONFIG_ARM64_EPAN=y -CONFIG_ARM64_ERRATUM_1165522=y -CONFIG_ARM64_ERRATUM_1286807=y -CONFIG_ARM64_ERRATUM_819472=y -CONFIG_ARM64_ERRATUM_824069=y -CONFIG_ARM64_ERRATUM_826319=y -CONFIG_ARM64_ERRATUM_827319=y -CONFIG_ARM64_ERRATUM_832075=y -CONFIG_ARM64_ERRATUM_843419=y -CONFIG_ARM64_HW_AFDBM=y -CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y -CONFIG_ARM64_PAGE_SHIFT=12 -CONFIG_ARM64_PAN=y -CONFIG_ARM64_PA_BITS=48 -CONFIG_ARM64_PA_BITS_48=y -CONFIG_ARM64_PTR_AUTH=y -CONFIG_ARM64_PTR_AUTH_KERNEL=y -CONFIG_ARM64_SME=y -CONFIG_ARM64_SVE=y -CONFIG_ARM64_TAGGED_ADDR_ABI=y -CONFIG_ARM64_VA_BITS=48 -CONFIG_ARM64_VA_BITS_48=y -CONFIG_ARM64_WORKAROUND_CLEAN_CACHE=y -CONFIG_ARM64_WORKAROUND_REPEAT_TLBI=y -CONFIG_ARM64_WORKAROUND_SPECULATIVE_AT=y -# CONFIG_ARMADA_37XX_RWTM_MBOX is not set -CONFIG_ARMADA_37XX_WATCHDOG=y -CONFIG_ARMADA_THERMAL=y -CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND=y -# CONFIG_ARM_DMC620_PMU is not set -# CONFIG_ARM_MHU_V2 is not set -CONFIG_ARM_SBSA_WATCHDOG=y -CONFIG_ARM_SMC_WATCHDOG=y -CONFIG_ARM_SMMU=y -# CONFIG_ARM_SMMU_DISABLE_BYPASS_BY_DEFAULT is not set -# CONFIG_ARM_SMMU_LEGACY_DT_BINDINGS is not set -CONFIG_ARM_SMMU_V3=y -# CONFIG_ARM_SMMU_V3_PMU is not set -# CONFIG_ARM_SMMU_V3_SVA is not set -CONFIG_ATOMIC64_SELFTEST=y -CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y -# CONFIG_AXI_DMAC is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=y -CONFIG_BLK_PM=y -CONFIG_CAVIUM_TX2_ERRATUM_219=y -CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CLK_INTEL_SOCFPGA=y -CONFIG_CLK_INTEL_SOCFPGA64=y -CONFIG_CLK_LS1028A_PLLDIG=y -CONFIG_CLK_PX30=y -CONFIG_CLK_QORIQ=y -CONFIG_CLK_RK3308=y -CONFIG_CLK_RK3328=y -CONFIG_CLK_RK3368=y -CONFIG_CLK_RK3399=y -CONFIG_CLK_RK3568=y -CONFIG_CLK_SP810=y -CONFIG_CLK_SUNXI=y -CONFIG_CLK_SUNXI_CLOCKS=y -# CONFIG_CLK_SUNXI_PRCM_SUN6I is not set -# CONFIG_CLK_SUNXI_PRCM_SUN8I is not set -# CONFIG_CLK_SUNXI_PRCM_SUN9I is not set -CONFIG_CLK_VEXPRESS_OSC=y -# CONFIG_COMMON_CLK_FSL_FLEXSPI is not set -# CONFIG_COMMON_CLK_FSL_SAI is not set -CONFIG_COMMON_CLK_HI3516CV300=y -CONFIG_COMMON_CLK_HI3519=y -CONFIG_COMMON_CLK_HI3559A=y -CONFIG_COMMON_CLK_HI3660=y -CONFIG_COMMON_CLK_HI3670=y -CONFIG_COMMON_CLK_HI3798CV200=y -CONFIG_COMMON_CLK_HI6220=y -CONFIG_COMMON_CLK_HI655X=y -CONFIG_COMMON_CLK_ROCKCHIP=y -CONFIG_COMMON_CLK_SCPI=y -CONFIG_COMMON_CLK_ZYNQMP=y -CONFIG_COMMON_RESET_HI3660=y -CONFIG_COMMON_RESET_HI6220=y -# CONFIG_COMPAT_32BIT_TIME is not set -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_MENU=y -CONFIG_CPU_LITTLE_ENDIAN=y -CONFIG_CPU_PM=y -CONFIG_CRYPTO_AES_ARM64=y -CONFIG_CRYPTO_AES_ARM64_BS=y -CONFIG_CRYPTO_AES_ARM64_CE=y -CONFIG_CRYPTO_AES_ARM64_CE_BLK=y -CONFIG_CRYPTO_AES_ARM64_CE_CCM=y -CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y -CONFIG_CRYPTO_ARCH_HAVE_LIB_CHACHA=y -CONFIG_CRYPTO_BLAKE2S=y -CONFIG_CRYPTO_CHACHA20=y -CONFIG_CRYPTO_CHACHA20_NEON=y -CONFIG_CRYPTO_CRYPTD=y -# CONFIG_CRYPTO_DEV_ALLWINNER is not set -# CONFIG_CRYPTO_DEV_FSL_DPAA2_CAAM is not set -# CONFIG_CRYPTO_DEV_HISI_HPRE is not set -# CONFIG_CRYPTO_DEV_HISI_SEC2 is not set -# CONFIG_CRYPTO_DEV_HISI_TRNG is not set -# CONFIG_CRYPTO_DEV_OCTEONTX2_CPT is not set -# CONFIG_CRYPTO_DEV_ROCKCHIP is not set -# CONFIG_CRYPTO_DEV_ZYNQMP_AES is not set -# CONFIG_CRYPTO_DEV_ZYNQMP_SHA3 is not set -CONFIG_CRYPTO_GHASH_ARM64_CE=y -CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y -CONFIG_CRYPTO_LIB_CHACHA_GENERIC=y -CONFIG_CRYPTO_POLYVAL_ARM64_CE=y -CONFIG_CRYPTO_SHA1=y -CONFIG_CRYPTO_SHA1_ARM64_CE=y -CONFIG_CRYPTO_SHA256_ARM64=y -CONFIG_CRYPTO_SHA2_ARM64_CE=y -CONFIG_CRYPTO_SHA512_ARM64=y -CONFIG_CRYPTO_SIMD=y -# CONFIG_CRYPTO_SM4_ARM64_CE_BLK is not set -# CONFIG_CRYPTO_SM4_ARM64_NEON_BLK is not set -CONFIG_DMA_DIRECT_REMAP=y -CONFIG_DMA_SHARED_BUFFER=y -CONFIG_DMA_SUN6I=y -CONFIG_DRM=y -CONFIG_DRM_BOCHS=y -CONFIG_DRM_BRIDGE=y -CONFIG_DRM_GEM_SHMEM_HELPER=y -CONFIG_DRM_KMS_HELPER=y -CONFIG_DRM_PANEL=y -CONFIG_DRM_PANEL_BRIDGE=y -CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y -CONFIG_DRM_QXL=y -# CONFIG_DRM_ROCKCHIP is not set -CONFIG_DRM_TTM=y -CONFIG_DRM_TTM_HELPER=y -CONFIG_DRM_VIRTIO_GPU=y -CONFIG_DRM_VRAM_HELPER=y -# CONFIG_DWMAC_SUN8I is not set -# CONFIG_DWMAC_SUNXI is not set -CONFIG_DW_WATCHDOG=y -CONFIG_FB=y -CONFIG_FB_ARMCLCD=y -CONFIG_FB_CFB_COPYAREA=y -CONFIG_FB_CFB_FILLRECT=y -CONFIG_FB_CFB_IMAGEBLIT=y -CONFIG_FB_CMDLINE=y -CONFIG_FB_MODE_HELPERS=y -# CONFIG_FB_XILINX is not set -CONFIG_FRAME_POINTER=y -CONFIG_FRAME_WARN=2048 -# CONFIG_FSL_DPAA is not set -# CONFIG_FSL_DPAA2_QDMA is not set -CONFIG_FSL_ERRATUM_A008585=y -# CONFIG_FSL_IMX8_DDR_PMU is not set -# CONFIG_FSL_PQ_MDIO is not set -CONFIG_FUJITSU_ERRATUM_010001=y -CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y -CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_FIND_FIRST_BIT=y -# CONFIG_GIANFAR is not set -CONFIG_GPIO_GENERIC=y -CONFIG_GPIO_GENERIC_PLATFORM=y -CONFIG_GPIO_MPC8XXX=y -CONFIG_GPIO_ROCKCHIP=y -CONFIG_GPIO_THUNDERX=y -CONFIG_GPIO_XLP=y -CONFIG_GPIO_ZYNQ=y -CONFIG_GPIO_ZYNQMP_MODEPIN=y -CONFIG_HDMI=y -CONFIG_HI3660_MBOX=y -CONFIG_HI6220_MBOX=y -CONFIG_HISILICON_LPC=y -CONFIG_HISI_PMU=y -CONFIG_HISI_THERMAL=y -CONFIG_HW_RANDOM=y -CONFIG_HW_RANDOM_ARM_SMCCC_TRNG=y -# CONFIG_HW_RANDOM_HISI is not set -CONFIG_HW_RANDOM_VIRTIO=y -CONFIG_I2C=y -CONFIG_I2C_ALGOBIT=y -CONFIG_I2C_ALTERA=y -CONFIG_I2C_BOARDINFO=y -# CONFIG_I2C_HIX5HD2 is not set -CONFIG_I2C_IMX=y -# CONFIG_I2C_SLAVE_TESTUNIT is not set -CONFIG_I2C_SYNQUACER=y -CONFIG_I2C_THUNDERX=y -# CONFIG_I2C_XLP9XX is not set -CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 -# CONFIG_IMX2_WDT is not set -# CONFIG_INPUT_HISI_POWERKEY is not set -# CONFIG_INPUT_IBM_PANEL is not set -# CONFIG_INTEL_STRATIX10_RSU is not set -# CONFIG_INTEL_STRATIX10_SERVICE is not set -# CONFIG_IOMMU_DEBUGFS is not set -# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set -CONFIG_IOMMU_DEFAULT_DMA_STRICT=y -CONFIG_IOMMU_DEFAULT_PASSTHROUGH=y -# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set -# CONFIG_IOMMU_IO_PGTABLE_DART is not set -# CONFIG_IOMMU_IO_PGTABLE_LPAE_SELFTEST is not set -CONFIG_IOMMU_SUPPORT=y -# CONFIG_K3_DMA is not set -CONFIG_KCMP=y -# CONFIG_KEYBOARD_SUN4I_LRADC is not set -CONFIG_LCD_CLASS_DEVICE=m -# CONFIG_LCD_PLATFORM is not set -# CONFIG_MAILBOX_TEST is not set -CONFIG_MARVELL_10G_PHY=y -# CONFIG_MARVELL_CN10K_DDR_PMU is not set -# CONFIG_MARVELL_CN10K_TAD_PMU is not set -CONFIG_MDIO_SUN4I=y -# CONFIG_MFD_ALTERA_A10SR is not set -CONFIG_MFD_ALTERA_SYSMGR=y -# CONFIG_MFD_AXP20X_RSB is not set -CONFIG_MFD_CORE=y -CONFIG_MFD_HI655X_PMIC=y -# CONFIG_MFD_KHADAS_MCU is not set -CONFIG_MFD_SUN4I_GPADC=y -# CONFIG_MFD_SUN6I_PRCM is not set -CONFIG_MFD_SYSCON=y -CONFIG_MFD_VEXPRESS_SYSREG=y -CONFIG_MMC=y -CONFIG_MMC_ARMMMCI=y -CONFIG_MMC_CAVIUM_THUNDERX=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_PCI is not set -CONFIG_MMC_DW_PLTFM=y -CONFIG_MMC_DW_ROCKCHIP=y -CONFIG_MMC_RICOH_MMC=y -CONFIG_MMC_SDHCI=y -CONFIG_MMC_SDHCI_ACPI=y -CONFIG_MMC_SDHCI_OF_ESDHC=y -CONFIG_MMC_SDHCI_PCI=y -CONFIG_MMC_SDHCI_PLTFM=y -CONFIG_MMC_SUNXI=y -CONFIG_MODULES_USE_ELF_RELA=y -# CONFIG_MVNETA is not set -# CONFIG_MVPP2 is not set -# CONFIG_MV_XOR is not set -CONFIG_NEED_SG_DMA_LENGTH=y -# CONFIG_NET_VENDOR_ALLWINNER is not set -CONFIG_NO_HZ=y -CONFIG_NO_HZ_COMMON=y -CONFIG_NO_HZ_IDLE=y -CONFIG_NR_CPUS=64 -CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y -# CONFIG_NVMEM_LAYERSCAPE_SFP is not set -CONFIG_NVMEM_ROCKCHIP_EFUSE=y -# CONFIG_NVMEM_ROCKCHIP_OTP is not set -# CONFIG_NVMEM_SUNXI_SID is not set -# CONFIG_NVMEM_ZYNQMP is not set -CONFIG_PCC=y -CONFIG_PCIE_HISI_STB=y -CONFIG_PCIE_LAYERSCAPE=y -CONFIG_PCIE_MOBIVEIL_PLAT=y -CONFIG_PCIE_ROCKCHIP=y -# CONFIG_PCIE_ROCKCHIP_DW_HOST is not set -CONFIG_PCIE_ROCKCHIP_HOST=y -CONFIG_PCIE_XILINX_CPM=y -CONFIG_PCIE_XILINX_NWL=y -CONFIG_PCI_AARDVARK=y -CONFIG_PCI_LAYERSCAPE=y -# CONFIG_PHY_FSL_LYNX_28G is not set -CONFIG_PHY_HI3660_USB=y -CONFIG_PHY_HI3670_PCIE=y -CONFIG_PHY_HI3670_USB=y -CONFIG_PHY_HI6220_USB=y -CONFIG_PHY_HISI_INNO_USB2=y -# CONFIG_PHY_HISTB_COMBPHY is not set -CONFIG_PHY_MVEBU_A3700_COMPHY=y -CONFIG_PHY_MVEBU_A3700_UTMI=y -CONFIG_PHY_MVEBU_A38X_COMPHY=y -CONFIG_PHY_MVEBU_CP110_COMPHY=y -# CONFIG_PHY_ROCKCHIP_DP is not set -# CONFIG_PHY_ROCKCHIP_DPHY_RX0 is not set -CONFIG_PHY_ROCKCHIP_EMMC=y -# CONFIG_PHY_ROCKCHIP_INNO_CSIDPHY is not set -# CONFIG_PHY_ROCKCHIP_INNO_DSIDPHY is not set -# CONFIG_PHY_ROCKCHIP_INNO_HDMI is not set -CONFIG_PHY_ROCKCHIP_INNO_USB2=y -# CONFIG_PHY_ROCKCHIP_NANENG_COMBO_PHY is not set -CONFIG_PHY_ROCKCHIP_PCIE=y -CONFIG_PHY_ROCKCHIP_SNPS_PCIE3=y -CONFIG_PHY_ROCKCHIP_TYPEC=y -# CONFIG_PHY_ROCKCHIP_USB is not set -CONFIG_PHY_SUN4I_USB=y -CONFIG_PHY_SUN50I_USB3=y -# CONFIG_PHY_SUN6I_MIPI_DPHY is not set -CONFIG_PHY_SUN9I_USB=y -# CONFIG_PHY_XILINX_ZYNQMP is not set -CONFIG_PINCTRL_ROCKCHIP=y -# CONFIG_PINCTRL_SUN20I_D1 is not set -CONFIG_PINCTRL_SUN4I_A10=y -CONFIG_PINCTRL_SUN50I_A100=y -CONFIG_PINCTRL_SUN50I_A100_R=y -CONFIG_PINCTRL_SUN50I_A64=y -CONFIG_PINCTRL_SUN50I_A64_R=y -CONFIG_PINCTRL_SUN50I_H5=y -CONFIG_PINCTRL_SUN50I_H6=y -CONFIG_PINCTRL_SUN50I_H616=y -CONFIG_PINCTRL_SUN50I_H616_R=y -CONFIG_PINCTRL_SUN50I_H6_R=y -CONFIG_PINCTRL_SUN5I=y -# CONFIG_PINCTRL_SUN6I_A31 is not set -# CONFIG_PINCTRL_SUN6I_A31_R is not set -# CONFIG_PINCTRL_SUN8I_A23 is not set -# CONFIG_PINCTRL_SUN8I_A23_R is not set -# CONFIG_PINCTRL_SUN8I_A33 is not set -# CONFIG_PINCTRL_SUN8I_A83T is not set -# CONFIG_PINCTRL_SUN8I_A83T_R is not set -# CONFIG_PINCTRL_SUN8I_H3 is not set -# CONFIG_PINCTRL_SUN8I_H3_R is not set -# CONFIG_PINCTRL_SUN8I_V3S is not set -# CONFIG_PINCTRL_SUN9I_A80 is not set -# CONFIG_PINCTRL_SUN9I_A80_R is not set -CONFIG_PINCTRL_ZYNQMP=y -CONFIG_PM=y -CONFIG_PM_CLK=y -CONFIG_PM_GENERIC_DOMAINS=y -CONFIG_PM_GENERIC_DOMAINS_OF=y -CONFIG_POWER_RESET=y -CONFIG_POWER_RESET_HISI=y -CONFIG_POWER_RESET_VEXPRESS=y -CONFIG_POWER_SUPPLY=y -CONFIG_QORIQ_THERMAL=y -CONFIG_QUEUED_RWLOCKS=y -CONFIG_QUEUED_SPINLOCKS=y -CONFIG_REGMAP=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGULATOR_AXP20X=y -CONFIG_REGULATOR_HI655X=y -CONFIG_ROCKCHIP_IODOMAIN=y -CONFIG_ROCKCHIP_IOMMU=y -# CONFIG_ROCKCHIP_MBOX is not set -CONFIG_ROCKCHIP_PM_DOMAINS=y -# CONFIG_ROCKCHIP_SARADC is not set -# CONFIG_ROCKCHIP_THERMAL is not set -CONFIG_RODATA_FULL_DEFAULT_ENABLED=y -# CONFIG_RTC_DRV_FSL_FTM_ALARM is not set -CONFIG_RTC_DRV_MV=y -CONFIG_RTC_I2C_AND_SPI=y -# CONFIG_SERIAL_8250_EXAR is not set -CONFIG_SERIAL_8250_FSL=y -CONFIG_SERIAL_8250_PCI=y -CONFIG_SERIAL_FSL_LPUART=y -CONFIG_SERIAL_FSL_LPUART_CONSOLE=y -CONFIG_SERIAL_MVEBU_CONSOLE=y -CONFIG_SERIAL_MVEBU_UART=y -CONFIG_SERIAL_SAMSUNG=y -CONFIG_SERIAL_SAMSUNG_CONSOLE=y -# CONFIG_SMC91X is not set -# CONFIG_SND_SUN4I_I2S is not set -# CONFIG_SND_SUN50I_CODEC_ANALOG is not set -# CONFIG_SND_SUN50I_DMIC is not set -# CONFIG_SND_SUN8I_CODEC is not set -# CONFIG_SND_SUN8I_CODEC_ANALOG is not set -# CONFIG_SNI_NETSEC is not set -CONFIG_SPARSEMEM=y -CONFIG_SPARSEMEM_EXTREME=y -CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPI_ARMADA_3700=y -# CONFIG_SPI_FSL_QUADSPI is not set -# CONFIG_SPI_HISI_KUNPENG is not set -# CONFIG_SPI_HISI_SFC is not set -# CONFIG_SPI_HISI_SFC_V3XX is not set -# CONFIG_SPI_ROCKCHIP_SFC is not set -# CONFIG_SPI_SUN4I is not set -# CONFIG_SPI_SUN6I is not set -# CONFIG_SPI_SYNQUACER is not set -CONFIG_SPI_THUNDERX=y -# CONFIG_SPI_XLP is not set -CONFIG_STUB_CLK_HI3660=y -CONFIG_STUB_CLK_HI6220=y -CONFIG_SUN50I_A100_CCU=y -CONFIG_SUN50I_A100_R_CCU=y -CONFIG_SUN50I_A64_CCU=y -CONFIG_SUN50I_H616_CCU=y -CONFIG_SUN50I_H6_CCU=y -CONFIG_SUN50I_H6_R_CCU=y -CONFIG_SUN50I_IOMMU=y -CONFIG_SUN6I_MSGBOX=y -CONFIG_SUN6I_RTC_CCU=y -# CONFIG_SUN8I_A83T_CCU is not set -CONFIG_SUN8I_DE2_CCU=y -# CONFIG_SUN8I_H3_CCU is not set -CONFIG_SUN8I_R_CCU=y -CONFIG_SUN8I_THERMAL=y -CONFIG_SUNXI_CCU=y -CONFIG_SUNXI_RSB=y -CONFIG_SUNXI_WATCHDOG=y -CONFIG_SYNC_FILE=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -# CONFIG_TCG_TIS_SYNQUACER is not set -CONFIG_THREAD_INFO_IN_TASK=y -# CONFIG_TURRIS_MOX_RWTM is not set -# CONFIG_UACCE is not set -CONFIG_UNMAP_KERNEL_AT_EL0=y -CONFIG_USB_DWC3=y -CONFIG_USB_DWC3_XILINX=y -CONFIG_USB_XHCI_HCD=y -CONFIG_USB_XHCI_HISTB=y -CONFIG_USB_XHCI_MVEBU=y -CONFIG_USB_XHCI_PLATFORM=y -CONFIG_VEXPRESS_CONFIG=y -CONFIG_VIDEOMODE_HELPERS=y -CONFIG_VIRTIO_DMA_SHARED_BUFFER=y -# CONFIG_VIRTIO_IOMMU is not set -CONFIG_VMAP_STACK=y -CONFIG_WDAT_WDT=y -# CONFIG_XILINX_AMS is not set -# CONFIG_XILINX_INTC is not set -CONFIG_XLNX_EVENT_MANAGER=y -CONFIG_ZONE_DMA32=y -CONFIG_ZYNQMP_FIRMWARE=y -# CONFIG_ZYNQMP_FIRMWARE_DEBUG is not set -CONFIG_ZYNQMP_PM_DOMAINS=y -CONFIG_ZYNQMP_POWER=y diff --git a/target/linux/armvirt/64/target.mk b/target/linux/armvirt/64/target.mk deleted file mode 100644 index ac5a60d848..0000000000 --- a/target/linux/armvirt/64/target.mk +++ /dev/null @@ -1,7 +0,0 @@ -ARCH:=aarch64 -SUBTARGET:=64 -BOARDNAME:=64-bit ARM machines - -define Target/Description - Build multi-platform images for the ARMv8 instruction set architecture -endef diff --git a/target/linux/armvirt/Makefile b/target/linux/armvirt/Makefile deleted file mode 100644 index 0ae51597bc..0000000000 --- a/target/linux/armvirt/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2017 Yousong Zhou - -include $(TOPDIR)/rules.mk - -BOARD:=armvirt -BOARDNAME:=QEMU ARM Virtual Machine -FEATURES:=fpu pci pcie rtc usb boot-part rootfs-part -FEATURES+=cpiogz ext4 ramdisk squashfs targz vmdk - -KERNEL_PATCHVER:=6.1 - -include $(INCLUDE_DIR)/target.mk - -DEFAULT_PACKAGES += mkf2fs e2fsprogs -# blkid used for resolving PARTUUID -# in sysupgrade -DEFAULT_PACKAGES += blkid - -$(eval $(call BuildTarget)) diff --git a/target/linux/armvirt/README b/target/linux/armvirt/README deleted file mode 100644 index b4409f8f11..0000000000 --- a/target/linux/armvirt/README +++ /dev/null @@ -1,72 +0,0 @@ -This target generates images that can be used on ARM machines with EFI -support (e.g EDKII/TianoCore or U-Boot with bootefi). - -The kernel and filesystem images can also be used directly by QEMU: - -Run with qemu-system-arm - - # boot with initramfs embedded in - qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-initramfs-kernel.bin - - # boot with accel=kvm - qemu-system-arm -nographic -M virt,accel=kvm -cpu host -m 64 -kernel - openwrt-armvirt-32-generic-initramfs-kernel.bin - - # boot with a separate rootfs - qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-kernel.bin \ - -drive file=openwrt-armvirt-32-generic-ext4-rootfs.img,format=raw,if=virtio -append 'root=/dev/vda rootwait' - - # boot with local dir as rootfs - qemu-system-arm -nographic -M virt -m 64 -kernel openwrt-armvirt-32-generic-kernel.bin \ - -fsdev local,id=rootdev,path=root-armvirt/,security_model=none \ - -device virtio-9p-pci,fsdev=rootdev,mount_tag=/dev/root \ - -append 'rootflags=trans=virtio,version=9p2000.L,cache=loose rootfstype=9p' - -Run with kvmtool - - # start a named machine - lkvm run -k openwrt-armvirt-32-zImage -i openwrt-armvirt-32-rootfs.cpio --name armvirt0 - - # start with virtio-9p rootfs - lkvm run -k openwrt-armvirt-32-zImage -d root-armvirt/ - - # stop "armvirt0" - lkvm stop --name armvirt0 - - # stop all - lkvm stop --all - -The multi-platform ARMv8 target can be used with QEMU: - - qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic \ - -kernel openwrt-armvirt-64-generic-initramfs-kernel.bin \ - -With a EDKII or U-Boot binary for the QEMU ARM virtual machines, you can use these -images in EFI mode: - -32-bit: -gunzip -c bin/targets/armvirt/32/openwrt-armvirt-32-generic-ext4-combined.img.gz > openwrt-arm-32.img -qemu-system-arm -nographic \ - -cpu cortex-a15 -machine virt \ - -bios QEMU_EFI_32.fd \ - -smp 1 -m 1024 \ - -device virtio-rng-pci \ - -drive file=openwrt-arm-32.img,format=raw,index=0,media=disk \ - -netdev user,id=testlan -net nic,netdev=testlan \ - -netdev user,id=testwan -net nic,netdev=testwan - -64-bit: -gunzip -c bin/targets/armvirt/64/openwrt-armvirt-64-generic-ext4-combined.img.gz > openwrt-arm-64.img -qemu-system-aarch64 -nographic \ - -cpu cortex-a53 -machine virt \ - -bios QEMU_EFI_64.fd \ - -smp 1 -m 1024 \ - -device virtio-rng-pci \ - -drive file=openwrt-arm-64.img,format=raw,index=0,media=disk \ - -netdev user,id=testlan -net nic,netdev=testlan \ - -netdev user,id=testwan -net nic,netdev=testwan - -One can find EFI/BIOS binaries from: -- Compile mainline U-Boot for the QEMU ARM virtual machine (qemu_arm_defconfig/qemu_arm64_defconfig) -- From distribution packages (such as qemu-efi-arm and qemu-efi-aarch64 in Debian) -- Community builds, like retrage/edk2-nightly: https://retrage.github.io/edk2-nightly/ diff --git a/target/linux/armvirt/base-files/etc/board.d/01_led b/target/linux/armvirt/base-files/etc/board.d/01_led deleted file mode 100644 index 0250a9672f..0000000000 --- a/target/linux/armvirt/base-files/etc/board.d/01_led +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0-or-later - -. /lib/functions/uci-defaults.sh - -board_config_update - -board=$(board_name) - -case "$board" in -traverse,ten64) - ucidef_set_led_netdev "sfp1" "SFP 1" "ten64:green:sfp1:down" "eth8" "link tx rx" - ucidef_set_led_netdev "sfp2" "SFP 2" "ten64:green:sfp2:up" "eth9" "link tx rx" - ;; -esac - -board_config_flush - -exit 0 diff --git a/target/linux/armvirt/base-files/etc/board.d/02_network b/target/linux/armvirt/base-files/etc/board.d/02_network deleted file mode 100644 index f58de1c27d..0000000000 --- a/target/linux/armvirt/base-files/etc/board.d/02_network +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0-or-later - -. /lib/functions/system.sh -. /lib/functions/uci-defaults.sh - -board_config_update - -case "$(board_name)" in - traverse,ten64) - ucidef_set_interface_lan "eth0 eth1 eth2 eth3" - ucidef_set_interface_wan "eth6" - ;; -esac - -board_config_flush - -exit 0 diff --git a/target/linux/armvirt/base-files/etc/board.d/03_gpio_switches b/target/linux/armvirt/base-files/etc/board.d/03_gpio_switches deleted file mode 100644 index cf07bc0f54..0000000000 --- a/target/linux/armvirt/base-files/etc/board.d/03_gpio_switches +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0-or-later - -. /lib/functions/uci-defaults.sh - -board_config_update - -board=$(board_name) - -case "$board" in -traverse,ten64) - ucidef_add_gpio_switch "lte_reset" "Cell Modem Reset" "376" - ucidef_add_gpio_switch "lte_power" "Cell Modem Power" "377" - ucidef_add_gpio_switch "lte_disable" "Cell Modem Airplane mode" "378" - ucidef_add_gpio_switch "gnss_disable" "Cell Modem Disable GNSS receiver" "379" - ucidef_add_gpio_switch "lower_sfp_txidsable" "Lower SFP+ TX Disable" "369" - ucidef_add_gpio_switch "upper_sfp_txdisable" "Upper SFP+ TX Disable" "373" - ;; -esac - -board_config_flush - -exit 0 diff --git a/target/linux/armvirt/base-files/etc/inittab b/target/linux/armvirt/base-files/etc/inittab deleted file mode 100644 index 51832eb775..0000000000 --- a/target/linux/armvirt/base-files/etc/inittab +++ /dev/null @@ -1,9 +0,0 @@ -::sysinit:/etc/init.d/rcS S boot -::shutdown:/etc/init.d/rcS K shutdown -ttyAMA0::askfirst:/usr/libexec/login.sh -ttyS0::askfirst:/usr/libexec/login.sh -tty0::askfirst:/usr/libexec/login.sh -hvc0::askfirst:/usr/libexec/login.sh -ttymxc0::askfirst:/usr/libexec/login.sh -ttymxc1::askfirst:/usr/libexec/login.sh -ttymxc2::askfirst:/usr/libexec/login.sh diff --git a/target/linux/armvirt/base-files/lib/preinit/01_sysinfo_acpi b/target/linux/armvirt/base-files/lib/preinit/01_sysinfo_acpi deleted file mode 100644 index 1069d74cf3..0000000000 --- a/target/linux/armvirt/base-files/lib/preinit/01_sysinfo_acpi +++ /dev/null @@ -1,52 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later - -sanitize_name_arm64() { - sed -e ' - y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/; - s/[^a-z0-9_-]\+/-/g; - s/^-//; - s/-$//; - ' "$@" -} - -do_sysinfo_arm64() { - local vendor product file - - for file in sys_vendor board_vendor; do - vendor="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)" - case "$vendor" in - empty | \ - System\ manufacturer | \ - To\ [bB]e\ [fF]illed\ [bB]y\ O\.E\.M\.) - continue - ;; - esac - [ -n "$vendor" ] && break - done - - for file in product_name board_name; do - product="$(cat /sys/devices/virtual/dmi/id/$file 2>/dev/null)" - case "$vendor:$product" in - ?*:empty | \ - ?*:System\ Product\ Name | \ - ?*:To\ [bB]e\ [fF]illed\ [bB]y\ O\.E\.M\.) - continue - ;; - ?*:?*) - break - ;; - esac - done - - [ -d "/sys/firmware/devicetree/base" ] && return - - [ -n "$vendor" -a -n "$product" ] || return - - mkdir -p /tmp/sysinfo - - echo "$vendor $product" > /tmp/sysinfo/model - - sanitize_name_arm64 /tmp/sysinfo/model > /tmp/sysinfo/board_name -} - -boot_hook_add preinit_main do_sysinfo_arm64 diff --git a/target/linux/armvirt/base-files/lib/upgrade/platform.sh b/target/linux/armvirt/base-files/lib/upgrade/platform.sh deleted file mode 100644 index 8263b9c7e3..0000000000 --- a/target/linux/armvirt/base-files/lib/upgrade/platform.sh +++ /dev/null @@ -1,164 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later - -RAMFS_COPY_BIN="/usr/sbin/blkid" - -platform_check_image() { - local board=$(board_name) - local diskdev partdev diff - [ "$#" -gt 1 ] && return 1 - - v "Board is ${board}" - - export_bootdevice && export_partdevice diskdev 0 || { - v "platform_check_image: Unable to determine upgrade device" - return 1 - } - - get_partitions "/dev/$diskdev" bootdisk - - v "Extract boot sector from the image" - get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b - - get_partitions /tmp/image.bs image - - #compare tables - diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)" - - rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image - - if [ -n "$diff" ]; then - v "Partition layout has changed. Full image will be written." - ask_bool 0 "Abort" && exit 1 - return 0 - fi -} - -platform_copy_config() { - local partdev parttype=ext4 - - if export_partdevice partdev 2; then - mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt - cp -af "$UPGRADE_BACKUP" "/mnt/$BACKUP_FILE" - umount /mnt - else - v "ERROR: Unable to find partition to copy config data to" - fi - - sleep 5 -} - -# To avoid writing over any firmware -# files (e.g ubootefi.var or firmware/X/ aka EBBR) -# Copy efi/openwrt and efi/boot from the new image -# to the existing ESP -platform_do_upgrade_efi_system_partition() { - local image_file=$1 - local target_partdev=$2 - local image_efisp_start=$3 - local image_efisp_size=$4 - - v "Updating ESP on ${target_partdev}" - NEW_ESP_DIR="/mnt/new_esp_loop" - CUR_ESP_DIR="/mnt/cur_esp" - mkdir "${NEW_ESP_DIR}" - mkdir "${CUR_ESP_DIR}" - - get_image_dd "$image_file" of="/tmp/new_efi_sys_part.img" \ - skip="$image_efisp_start" count="$image_efisp_size" - - mount -t vfat -o loop -o ro /tmp/new_efi_sys_part.img "${NEW_ESP_DIR}" - if [ ! -d "${NEW_ESP_DIR}/efi/boot" ]; then - v "ERROR: Image does not contain EFI boot files (/efi/boot)" - return 1 - fi - - mount -t vfat "/dev/$partdev" "${CUR_ESP_DIR}" - - for d in $(find "${NEW_ESP_DIR}/efi/" -mindepth 1 -maxdepth 1 -type d); do - v "Copying ${d}" - newdir_bname=$(basename "${d}") - rm -rf "${CUR_ESP_DIR}/efi/${newdir_bname}" - cp -r "${d}" "${CUR_ESP_DIR}/efi" - done - - umount "${NEW_ESP_DIR}" - umount "${CUR_ESP_DIR}" -} - -platform_do_upgrade() { - local board=$(board_name) - local diskdev partdev diff - - export_bootdevice && export_partdevice diskdev 0 || { - v "platform_do_upgrade: Unable to determine upgrade device" - return 1 - } - - sync - - if [ "$UPGRADE_OPT_SAVE_PARTITIONS" = "1" ]; then - get_partitions "/dev/$diskdev" bootdisk - - v "Extract boot sector from the image" - get_image_dd "$1" of=/tmp/image.bs count=63 bs=512b - - get_partitions /tmp/image.bs image - - #compare tables - diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)" - else - diff=1 - fi - - # Only change the partition table if sysupgrade -p is set, - # otherwise doing so could interfere with embedded "single storage" - # (e.g SoC boot from SD card) setups, as well as other user - # created storage (like uvol) - if [ -n "$diff" ] && [ "${UPGRADE_OPT_SAVE_PARTITIONS}" = "0" ]; then - # Need to remove partitions before dd, otherwise the partitions - # that are added after will have minor numbers offset - partx -d - "/dev/$diskdev" - - get_image_dd "$1" of="/dev/$diskdev" bs=4096 conv=fsync - - # Separate removal and addtion is necessary; otherwise, partition 1 - # will be missing if it overlaps with the old partition 2 - partx -a - "/dev/$diskdev" - - return 0 - fi - - #iterate over each partition from the image and write it to the boot disk - while read part start size; do - if export_partdevice partdev $part; then - v "Writing image to /dev/$partdev..." - if [ "$part" = "1" ]; then - platform_do_upgrade_efi_system_partition \ - $1 $partdev $start $size || return 1 - else - v "Normal partition, doing DD" - get_image_dd "$1" of="/dev/$partdev" ibs=512 obs=1M skip="$start" \ - count="$size" conv=fsync - fi - else - v "Unable to find partition $part device, skipped." - fi - done < /tmp/partmap.image - - local parttype=ext4 - - if (blkid > /dev/null) && export_partdevice partdev 1; then - part_magic_fat "/dev/$partdev" && parttype=vfat - mount -t $parttype -o rw,noatime "/dev/$partdev" /mnt - if export_partdevice partdev 2; then - THIS_PART_BLKID=$(blkid -o value -s PARTUUID "/dev/${partdev}") - v "Setting rootfs PARTUUID=${THIS_PART_BLKID}" - sed -i "s/\(PARTUUID=\)[a-f0-9-]\+/\1${THIS_PART_BLKID}/ig" \ - /mnt/efi/openwrt/grub.cfg - fi - umount /mnt - fi - # Provide time for the storage medium to flush before system reset - # (despite the sync/umount it appears NVMe etc. do it in the background) - sleep 5 -} diff --git a/target/linux/armvirt/config-6.1 b/target/linux/armvirt/config-6.1 deleted file mode 100644 index a48af89b87..0000000000 --- a/target/linux/armvirt/config-6.1 +++ /dev/null @@ -1,336 +0,0 @@ -CONFIG_64BIT=y -CONFIG_9P_FS=y -# CONFIG_9P_FS_POSIX_ACL is not set -# CONFIG_9P_FS_SECURITY is not set -# CONFIG_A64FX_DIAG is not set -CONFIG_ACPI=y -CONFIG_ACPI_AC=y -CONFIG_ACPI_APEI=y -CONFIG_ACPI_APEI_EINJ=y -# CONFIG_ACPI_APEI_ERST_DEBUG is not set -CONFIG_ACPI_APEI_GHES=y -CONFIG_ACPI_APEI_MEMORY_FAILURE=y -CONFIG_ACPI_APEI_PCIEAER=y -CONFIG_ACPI_BATTERY=y -# CONFIG_ACPI_BGRT is not set -CONFIG_ACPI_CCA_REQUIRED=y -CONFIG_ACPI_CONTAINER=y -CONFIG_ACPI_CPPC_CPUFREQ=y -# CONFIG_ACPI_DEBUG is not set -# CONFIG_ACPI_DEBUGGER is not set -# CONFIG_ACPI_DOCK is not set -# CONFIG_ACPI_EC_DEBUGFS is not set -CONFIG_ACPI_FAN=y -CONFIG_ACPI_GENERIC_GSI=y -CONFIG_ACPI_GTDT=y -CONFIG_ACPI_HOTPLUG_CPU=y -CONFIG_ACPI_I2C_OPREGION=y -CONFIG_ACPI_IORT=y -CONFIG_ACPI_MCFG=y -# CONFIG_ACPI_PCI_SLOT is not set -# CONFIG_ACPI_PFRUT is not set -CONFIG_ACPI_PPTT=y -CONFIG_ACPI_PRMT=y -CONFIG_ACPI_PROCESSOR=y -CONFIG_ACPI_PROCESSOR_IDLE=y -CONFIG_ACPI_REDUCED_HARDWARE_ONLY=y -CONFIG_ACPI_SPCR_TABLE=y -CONFIG_ACPI_THERMAL=y -# CONFIG_ACPI_TINY_POWER_BUTTON is not set -# CONFIG_ALIBABA_UNCORE_DRW_PMU is not set -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_FORCE_MAX_ORDER=11 -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_KEEP_MEMBLOCK=y -CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y -CONFIG_ARCH_MMAP_RND_BITS=18 -CONFIG_ARCH_MMAP_RND_BITS_MAX=24 -CONFIG_ARCH_MMAP_RND_BITS_MIN=18 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 -CONFIG_ARCH_PROC_KCORE_TEXT=y -CONFIG_ARCH_SPARSEMEM_ENABLE=y -CONFIG_ARCH_STACKWALK=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WANTS_NO_INSTR=y -CONFIG_ARM64=y -CONFIG_ARM64_4K_PAGES=y -# CONFIG_ARM64_ACPI_PARKING_PROTOCOL is not set -CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y -CONFIG_ARM64_PAGE_SHIFT=12 -CONFIG_ARM64_PA_BITS=48 -CONFIG_ARM64_PA_BITS_48=y -CONFIG_ARM64_TAGGED_ADDR_ABI=y -CONFIG_ARM64_VA_BITS=39 -CONFIG_ARM64_VA_BITS_39=y -CONFIG_ARM_AMBA=y -CONFIG_ARM_ARCH_TIMER=y -CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y -CONFIG_ARM_GIC=y -CONFIG_ARM_GIC_V2M=y -CONFIG_ARM_GIC_V3=y -CONFIG_ARM_GIC_V3_ITS=y -CONFIG_ARM_GIC_V3_ITS_PCI=y -CONFIG_ARM_PSCI_FW=y -# CONFIG_ARM_SMMU_V3_PMU is not set -CONFIG_ATA=y -CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y -CONFIG_BALLOON_COMPACTION=y -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_NVME=y -CONFIG_BLK_DEV_SD=y -CONFIG_BLK_MQ_PCI=y -CONFIG_BLK_MQ_VIRTIO=y -CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_COMMON_CLK=y -# CONFIG_COMPAT_32BIT_TIME is not set -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_CPU_IDLE=y -CONFIG_CPU_IDLE_GOV_LADDER=y -CONFIG_CPU_PM=y -CONFIG_CPU_RMAP=y -CONFIG_CRC16=y -CONFIG_CRYPTO_CRC32=y -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y -CONFIG_CRYPTO_RNG2=y -CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_DEBUG_BUGVERBOSE=y -CONFIG_DMADEVICES=y -CONFIG_DMA_ACPI=y -CONFIG_DMA_DIRECT_REMAP=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y -CONFIG_DMA_REMAP=y -CONFIG_DMI=y -CONFIG_DMIID=y -CONFIG_DMI_SYSFS=y -CONFIG_DTC=y -CONFIG_EDAC_SUPPORT=y -CONFIG_EFI=y -CONFIG_EFIVAR_FS=y -CONFIG_EFI_ARMSTUB_DTB_LOADER=y -# CONFIG_EFI_BOOTLOADER_CONTROL is not set -# CONFIG_EFI_CAPSULE_LOADER is not set -# CONFIG_EFI_COCO_SECRET is not set -# CONFIG_EFI_CUSTOM_SSDT_OVERLAYS is not set -# CONFIG_EFI_DISABLE_PCI_DMA is not set -# CONFIG_EFI_DISABLE_RUNTIME is not set -CONFIG_EFI_EARLYCON=y -CONFIG_EFI_ESRT=y -CONFIG_EFI_GENERIC_STUB=y -# CONFIG_EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER is not set -CONFIG_EFI_PARAMS_FROM_FDT=y -CONFIG_EFI_RUNTIME_WRAPPERS=y -CONFIG_EFI_STUB=y -# CONFIG_EFI_TEST is not set -# CONFIG_EFI_ZBOOT is not set -CONFIG_EXT4_FS=y -CONFIG_F2FS_FS=y -CONFIG_FAILOVER=y -CONFIG_FB_EFI=y -CONFIG_FIX_EARLYCON_MEM=y -CONFIG_FONT_8x16=y -CONFIG_FONT_AUTOSELECT=y -CONFIG_FONT_SUPPORT=y -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y -# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set -CONFIG_FRAME_POINTER=y -CONFIG_FS_IOMAP=y -CONFIG_FS_MBCACHE=y -CONFIG_FW_LOADER_PAGED_BUF=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_ARCH_TOPOLOGY=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_CPU_VULNERABILITIES=y -CONFIG_GENERIC_CSUM=y -CONFIG_GENERIC_EARLY_IOREMAP=y -CONFIG_GENERIC_FIND_FIRST_BIT=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_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_MSI_IRQ_DOMAIN=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_GENERIC_TIME_VSYSCALL=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_GPIO_ACPI=y -CONFIG_GPIO_CDEV=y -# CONFIG_GPIO_HISI is not set -CONFIG_GPIO_PL061=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_HID=y -CONFIG_HID_GENERIC=y -CONFIG_HOTPLUG_CPU=y -CONFIG_HOTPLUG_PCI_ACPI=y -CONFIG_HVC_DRIVER=y -CONFIG_HZ_PERIODIC=y -# CONFIG_I2C_AMD_MP2 is not set -CONFIG_I2C_HID_ACPI=y -# CONFIG_I2C_HISI is not set -# CONFIG_I2C_SLAVE_TESTUNIT is not set -CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 -# CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT is not set -CONFIG_INITRAMFS_SOURCE="" -CONFIG_INPUT_KEYBOARD=y -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -# CONFIG_ISCSI_IBFT is not set -CONFIG_JBD2=y -CONFIG_LIBFDT=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_LOCK_SPIN_ON_OWNER=y -CONFIG_MEMFD_CREATE=y -CONFIG_MEMORY_BALLOON=y -CONFIG_MIGRATION=y -# CONFIG_MLXBF_GIGE is not set -CONFIG_MMC_SDHCI_ACPI=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_MVMDIO=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_NET_9P=y -# CONFIG_NET_9P_DEBUG is not set -# CONFIG_NET_9P_FD is not set -CONFIG_NET_9P_VIRTIO=y -CONFIG_NET_FAILOVER=y -CONFIG_NET_FLOW_LIMIT=y -CONFIG_NLS=y -CONFIG_NR_CPUS=256 -CONFIG_NVMEM=y -CONFIG_NVME_CORE=y -# CONFIG_NVME_MULTIPATH is not set -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_PADATA=y -CONFIG_PAGE_REPORTING=y -CONFIG_PARTITION_PERCPU=y -CONFIG_PCI=y -# CONFIG_PCIE_HISI_ERR is not set -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DOMAINS_GENERIC=y -CONFIG_PCI_ECAM=y -CONFIG_PCI_HOST_COMMON=y -CONFIG_PCI_HOST_GENERIC=y -CONFIG_PCI_LABEL=y -CONFIG_PCI_MSI=y -CONFIG_PCI_MSI_IRQ_DOMAIN=y -CONFIG_PGTABLE_LEVELS=3 -CONFIG_PHYS_ADDR_T_64BIT=y -# CONFIG_PMIC_OPREGION is not set -CONFIG_PNP=y -CONFIG_PNPACPI=y -CONFIG_PNP_DEBUG_MESSAGES=y -CONFIG_POWER_RESET=y -CONFIG_POWER_SUPPLY=y -CONFIG_PTP_1588_CLOCK_OPTIONAL=y -CONFIG_QUEUED_RWLOCKS=y -CONFIG_QUEUED_SPINLOCKS=y -CONFIG_RATIONAL=y -# CONFIG_RESET_ATTACK_MITIGATION is not set -CONFIG_RFS_ACCEL=y -CONFIG_RODATA_FULL_DEFAULT_ENABLED=y -CONFIG_RPS=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_DRV_EFI=y -CONFIG_RTC_DRV_PL031=y -CONFIG_RWSEM_SPIN_ON_OWNER=y -CONFIG_SATA_AHCI=y -CONFIG_SATA_AHCI_PLATFORM=y -CONFIG_SATA_HOST=y -CONFIG_SCSI=y -CONFIG_SCSI_COMMON=y -CONFIG_SCSI_VIRTIO=y -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y -CONFIG_SERIAL_8250_EXTENDED=y -CONFIG_SERIAL_8250_FSL=y -CONFIG_SERIAL_8250_NR_UARTS=4 -CONFIG_SERIAL_8250_PNP=y -CONFIG_SERIAL_8250_RUNTIME_UARTS=4 -CONFIG_SERIAL_8250_SHARE_IRQ=y -CONFIG_SERIAL_AMBA_PL011=y -CONFIG_SERIAL_AMBA_PL011_CONSOLE=y -CONFIG_SERIAL_EARLYCON=y -CONFIG_SERIAL_MCTRL_GPIO=y -CONFIG_SERIAL_OF_PLATFORM=y -CONFIG_SG_POOL=y -CONFIG_SMP=y -CONFIG_SOCK_RX_QUEUE_MAPPING=y -CONFIG_SPARSEMEM=y -CONFIG_SPARSEMEM_EXTREME=y -CONFIG_SPARSEMEM_VMEMMAP=y -CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y -CONFIG_SPARSE_IRQ=y -CONFIG_SRCU=y -# CONFIG_SURFACE_PLATFORMS is not set -CONFIG_SWIOTLB=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_SYSFB=y -# CONFIG_SYSFB_SIMPLEFB 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_OF=y -CONFIG_THREAD_INFO_IN_TASK=y -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TIMER_ACPI=y -CONFIG_TIMER_OF=y -CONFIG_TIMER_PROBE=y -CONFIG_TREE_RCU=y -CONFIG_TREE_SRCU=y -# CONFIG_UACCE is not set -CONFIG_UCS2_STRING=y -CONFIG_UNMAP_KERNEL_AT_EL0=y -CONFIG_USB=y -CONFIG_USB_HID=y -CONFIG_USB_HIDDEV=y -CONFIG_USB_PCI=y -CONFIG_USB_STORAGE=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_XHCI_HCD=y -CONFIG_USB_XHCI_PCI=y -CONFIG_VIRTIO=y -CONFIG_VIRTIO_BALLOON=y -CONFIG_VIRTIO_BLK=y -CONFIG_VIRTIO_CONSOLE=y -CONFIG_VIRTIO_MMIO=y -CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y -CONFIG_VIRTIO_NET=y -CONFIG_VIRTIO_PCI=y -CONFIG_VIRTIO_PCI_LEGACY=y -CONFIG_VIRTIO_PCI_LIB=y -CONFIG_VMAP_STACK=y -CONFIG_WATCHDOG_CORE=y -CONFIG_VT=y -CONFIG_VT_CONSOLE=y -# CONFIG_VT_HW_CONSOLE_BINDING is not set -CONFIG_XPS=y -CONFIG_ZONE_DMA32=y diff --git a/target/linux/armvirt/image/Makefile b/target/linux/armvirt/image/Makefile deleted file mode 100644 index 8642c88a49..0000000000 --- a/target/linux/armvirt/image/Makefile +++ /dev/null @@ -1,117 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2016-2017 Yousong Zhou - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -GRUB2_VARIANT = -GRUB_TERMINALS = -GRUB_SERIAL_CONFIG = -GRUB_TERMINAL_CONFIG = -GRUB_CONSOLE_CMDLINE = earlycon - -ifneq ($(CONFIG_GRUB_CONSOLE),) - GRUB_TERMINALS += console -endif - -GRUB_SERIAL:=$(call qstrip,$(CONFIG_GRUB_SERIAL)) - -ifneq ($(GRUB_SERIAL),) - GRUB_SERIAL_CONFIG := serial --unit=0 --speed=$(CONFIG_GRUB_BAUDRATE) --word=8 --parity=no --stop=1 --rtscts=$(if $(CONFIG_GRUB_FLOWCONTROL),on,off) - GRUB_TERMINALS += serial -endif - -ifneq ($(GRUB_TERMINALS),) - GRUB_TERMINAL_CONFIG := terminal_input $(GRUB_TERMINALS); terminal_output $(GRUB_TERMINALS) -endif - -ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME)) -ROOTPART:=$(if $(ROOTPART),$(ROOTPART),PARTUUID=$(IMG_PART_SIGNATURE)-02) -GPT_ROOTPART:=$(call qstrip,$(CONFIG_TARGET_ROOTFS_PARTNAME)) -GPT_ROOTPART:=$(if $(GPT_ROOTPART),$(GPT_ROOTPART),PARTUUID=$(shell echo $(IMG_PART_DISKGUID) | sed 's/00$$/02/')) - -GRUB_TIMEOUT:=$(call qstrip,$(CONFIG_GRUB_TIMEOUT)) -GRUB_TITLE:=$(call qstrip,$(CONFIG_GRUB_TITLE)) - -BOOTOPTS:=$(call qstrip,$(CONFIG_GRUB_BOOTOPTS)) - -define Build/combined - $(INSTALL_DIR) $@.boot/ - $(CP) $(KDIR)/$(KERNEL_NAME) $@.boot/efi/openwrt/ - -$(CP) $(STAGING_DIR_ROOT)/boot/. $@.boot/boot/ - $(if $(filter $(1),efi), - $(INSTALL_DIR) $@.boot/efi/boot - $(CP) $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi $@.boot/efi/openwrt/ - $(CP) $(STAGING_DIR_IMAGE)/grub2/boot$(if $(CONFIG_aarch64),aa64,arm).efi $@.boot/efi/boot/ - ) - KERNELPARTTYPE=ef FAT_TYPE="32" PADDING="1" SIGNATURE="$(IMG_PART_SIGNATURE)" \ - $(if $(filter $(1),efi),GUID="$(IMG_PART_DISKGUID)") $(SCRIPT_DIR)/gen_image_generic.sh \ - $@ \ - $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \ - $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \ - 256 -endef - -define Build/grub-config - rm -fR $@.boot - $(INSTALL_DIR) $@.boot/efi/openwrt/ - sed \ - -e 's#@SERIAL_CONFIG@#$(strip $(GRUB_SERIAL_CONFIG))#g' \ - -e 's#@TERMINAL_CONFIG@#$(strip $(GRUB_TERMINAL_CONFIG))#g' \ - -e 's#@ROOTPART@#root=$(ROOTPART) rootwait#g' \ - -e 's#@GPT_ROOTPART@#root=$(GPT_ROOTPART) rootwait#g' \ - -e 's#@CMDLINE@#$(BOOTOPTS) $(GRUB_CONSOLE_CMDLINE)#g' \ - -e 's#@TIMEOUT@#$(GRUB_TIMEOUT)#g' \ - -e 's#@TITLE@#$(GRUB_TITLE)#g' \ - -e 's#@KERNEL_NAME@#$(KERNEL_NAME)#g' \ - ./grub-$(1).cfg > $@.boot/efi/openwrt/grub.cfg -endef - -define Build/grub-install - rm -fR $@.grub2 - $(INSTALL_DIR) $@.grub2 -endef - -DEVICE_VARS += GRUB2_VARIANT -define Device/efi-default - IMAGE/rootfs.img := append-rootfs | pad-to $(ROOTFS_PARTSIZE) - IMAGE/rootfs.img.gz := append-rootfs | pad-to $(ROOTFS_PARTSIZE) | gzip - IMAGE/combined.img := grub-config efi | combined efi | grub-install efi | append-metadata - IMAGE/combined.img.gz := grub-config efi | combined efi | grub-install efi | gzip | append-metadata - IMAGE/combined.vmdk := grub-config efi | combined efi | grub-install efi | qemu-image vmdk - ifeq ($(CONFIG_TARGET_IMAGES_GZIP),y) - IMAGES-y := rootfs.img.gz - IMAGES-y += combined.img.gz - else - IMAGES-y := rootfs.img - IMAGES-y += combined.img - endif - ifeq ($(CONFIG_VMDK_IMAGES),y) - IMAGES-y += combined.vmdk - endif - KERNEL := kernel-bin - KERNEL_INSTALL := 1 - IMAGES := $$(IMAGES-y) - ARTIFACTS := $$(ARTIFACTS-y) - SUPPORTED_DEVICES := - ifeq ($(CONFIG_arm),y) - KERNEL_NAME = zImage - endif -endef - -define Device/generic - $(call Device/efi-default) - DEVICE_TITLE := Generic EFI Boot - GRUB2_VARIANT := generic - FILESYSTEMS := ext4 squashfs - DEVICE_PACKAGES += kmod-amazon-ena kmod-e1000e kmod-vmxnet3 kmod-rtc-rx8025 \ - kmod-i2c-mux-pca954x kmod-gpio-pca953x partx-utils kmod-wdt-sp805 \ - kmod-mvneta kmod-mvpp2 kmod-fsl-dpaa1-net kmod-fsl-dpaa2-net \ - kmod-fsl-enetc-net kmod-dwmac-imx kmod-fsl-fec kmod-thunderx-net \ - kmod-dwmac-rockchip kmod-dwmac-sun8i kmod-phy-aquantia kmod-phy-broadcom \ - kmod-phy-marvell kmod-phy-marvell-10g kmod-sfp kmod-atlantic -endef -TARGET_DEVICES += generic - -$(eval $(call BuildImage)) diff --git a/target/linux/armvirt/image/grub-efi.cfg b/target/linux/armvirt/image/grub-efi.cfg deleted file mode 100644 index fd329e41e0..0000000000 --- a/target/linux/armvirt/image/grub-efi.cfg +++ /dev/null @@ -1,14 +0,0 @@ -@SERIAL_CONFIG@ -@TERMINAL_CONFIG@ - -set default="0" -set timeout="@TIMEOUT@" - -menuentry "@TITLE@" { - search --set=root --label kernel - linux /efi/openwrt/@KERNEL_NAME@ @GPT_ROOTPART@ @CMDLINE@ noinitrd -} -menuentry "@TITLE@ (failsafe)" { - search --set=root --label kernel - linux /efi/openwrt/@KERNEL_NAME@ failsafe=true @GPT_ROOTPART@ @CMDLINE@ noinitrd -} diff --git a/target/linux/armvirt/modules.mk b/target/linux/armvirt/modules.mk deleted file mode 100644 index c59301aae7..0000000000 --- a/target/linux/armvirt/modules.mk +++ /dev/null @@ -1,292 +0,0 @@ -define KernelPackage/acpi-mdio - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=ACPI MDIO support - DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-mdio-devres - KCONFIG:=CONFIG_ACPI_MDIO - FILES:=$(LINUX_DIR)/drivers/net/mdio/acpi_mdio.ko - AUTOLOAD:=$(call AutoLoad,11,acpi_mdio) -endef - -define KernelPackage/acpi-mdio/description - Kernel driver for ACPI MDIO support -endef - -$(eval $(call KernelPackage,acpi-mdio)) - -define KernelPackage/fsl-pcs-lynx - SUBMENU=$(NETWORK_DEVICES_MENU) - DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-phylink - TITLE:=NXP (Freescale) Lynx PCS - HIDDEN:=1 - KCONFIG:=CONFIG_PCS_LYNX - FILES=$(LINUX_DIR)/drivers/net/pcs/pcs-lynx.ko - AUTOLOAD=$(call AutoLoad,30,pcs-lynx) -endef - -$(eval $(call KernelPackage,fsl-pcs-lynx)) - -define KernelPackage/pcs-xpcs - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Synopsis DesignWare PCS driver - DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink - KCONFIG:=CONFIG_PCS_XPCS - FILES:=$(LINUX_DIR)/drivers/net/pcs/pcs_xpcs.ko - AUTOLOAD:=$(call AutoLoad,20,pcs_xpcs) -endef - -$(eval $(call KernelPackage,pcs-xpcs)) - -define KernelPackage/fsl-fec - SUBMENU:=$(NETWORK_DEVICES_MENU) - DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio \ - +kmod-ptp +kmod-net-selftests - TITLE:=NXP (Freescale) FEC Ethernet controller (i.MX) - KCONFIG:=CONFIG_FEC - FILES:=$(LINUX_DIR)/drivers/net/ethernet/freescale/fec.ko - AUTOLOAD:=$(call AutoLoad,35,fec) -endef - -$(eval $(call KernelPackage,fsl-fec)) - -define KernelPackage/fsl-xgmac-mdio - SUBMENU=$(NETWORK_DEVICES_MENU) - DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio - TITLE:=NXP (Freescale) MDIO bus - KCONFIG:=CONFIG_FSL_XGMAC_MDIO - FILES=$(LINUX_DIR)/drivers/net/ethernet/freescale/xgmac_mdio.ko - AUTOLOAD=$(call AutoLoad,30,xgmac_mdio) -endef - -$(eval $(call KernelPackage,fsl-xgmac-mdio)) - -define KernelPackage/fsl-mc-dpio - SUBMENU:=$(OTHER_MENU) - TITLE:=NXP DPAA2 DPIO (Data Path IO) driver - HIDDEN:=1 - KCONFIG:=CONFIG_FSL_MC_BUS=y \ - CONFIG_FSL_MC_DPIO - FILES:=$(LINUX_DIR)/drivers/soc/fsl/dpio/fsl-mc-dpio.ko - AUTOLOAD=$(call AutoLoad,30,fsl-mc-dpio) -endef - -$(eval $(call KernelPackage,fsl-mc-dpio)) - -define KernelPackage/fsl-enetc-net - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=:NXP ENETC (LS1028A) Ethernet - DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink +kmod-fsl-pcs-lynx - KCONFIG:= \ - CONFIG_FSL_ENETC \ - CONFIG_FSL_ENETC_VF \ - CONFIG_FSL_ENETC_QOS - FILES:= \ - $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc.ko \ - $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-vf.ko \ - $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-mdio.ko \ - $(LINUX_DIR)/drivers/net/ethernet/freescale/enetc/fsl-enetc-ierb.ko - AUTOLOAD=$(call AutoLoad,35,fsl-enetc) -endef - -$(eval $(call KernelPackage,fsl-enetc-net)) - -define KernelPackage/fsl-dpaa1-net - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=NXP DPAA1 (LS1043/LS1046) Ethernet - DEPENDS:=@(TARGET_armvirt_64) +kmod-fsl-xgmac-mdio +kmod-libphy +kmod-crypto-crc32 - KCONFIG:= \ - CONFIG_FSL_DPAA=y \ - CONFIG_FSL_DPAA_ETH \ - CONFIG_FSL_FMAN \ - CONFIG_FSL_DPAA_CHECKING=n \ - CONFIG_FSL_BMAN_TEST=n \ - CONFIG_FSL_QMAN_TEST=n - MODULES:= \ - $(LINUX_DIR)/drivers/net/ethernet/freescale/dpaa/fsl_dpa.ko \ - $(LINUX_DIR)/drivers/net/ethernet/freescale/fman/fsl_dpaa_fman.ko \ - $(LINUX_DIR)/drivers/net/ethernet/freescale/fman/fsl_dpaa_mac.ko - AUTOLOAD=$(call AutoLoad,35,fsl-dpa) -endef - -$(eval $(call KernelPackage,fsl-dpaa1-net)) - -define KernelPackage/fsl-dpaa2-net - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=NXP DPAA2 Ethernet - DEPENDS:=@(TARGET_armvirt_64) +kmod-fsl-xgmac-mdio +kmod-phylink \ - +kmod-fsl-pcs-lynx +kmod-fsl-mc-dpio - KCONFIG:= \ - CONFIG_FSL_MC_UAPI_SUPPORT=y \ - CONFIG_FSL_DPAA2_ETH - FILES:= \ - $(LINUX_DIR)/drivers/net/ethernet/freescale/dpaa2/fsl-dpaa2-eth.ko - AUTOLOAD=$(call AutoLoad,35,fsl-dpaa2-eth) -endef - -$(eval $(call KernelPackage,fsl-dpaa2-net)) - -define KernelPackage/fsl-dpaa2-console - SUBMENU:=$(OTHER_MENU) - TITLE:=NXP DPAA2 Debug console - DEPENDS:=@(TARGET_armvirt_64) - KCONFIG:=CONFIG_DPAA2_CONSOLE - FILES=$(LINUX_DIR)/drivers/soc/fsl/dpaa2-console.ko - AUTOLOAD=$(call AutoLoad,40,dpaa2-console) -endef - -define KernelPackage/fsl-dpaa2-console/description - Kernel modules for the NXP DPAA2 debug consoles - (Management Complex and AIOP). -endef - -$(eval $(call KernelPackage,fsl-dpaa2-console)) - -define KernelPackage/marvell-mdio - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Marvell Armada platform MDIO driver - DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy +kmod-of-mdio +kmod-acpi-mdio - KCONFIG:=CONFIG_MVMDIO - FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvmdio.ko - AUTOLOAD=$(call AutoLoad,30,marvell-mdio) -endef - -$(eval $(call KernelPackage,marvell-mdio)) - -define KernelPackage/phy-marvell-10g - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Marvell Alaska 10G PHY driver - DEPENDS:=@(TARGET_armvirt_64) +kmod-libphy - KCONFIG:=CONFIG_MARVELL_10G_PHY - FILES=$(LINUX_DIR)/drivers/net/phy/marvell10g.ko - AUTOLOAD=$(call AutoLoad,35,marvell10g) -endef - -$(eval $(call KernelPackage,phy-marvell-10g)) - -define KernelPackage/mvneta - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Marvell Armada 370/38x/XP/37xx network driver - DEPENDS:=@(TARGET_armvirt_64) +kmod-marvell-mdio +kmod-phylink - KCONFIG:=CONFIG_MVNETA - FILES:=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvneta.ko - AUTOLOAD=$(call AutoLoad,30,mvneta) -endef - -$(eval $(call KernelPackage,mvneta)) - -define KernelPackage/mvpp2 - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Marvell Armada 375/7K/8K network driver - DEPENDS:=@(TARGET_armvirt_64) +kmod-marvell-mdio +kmod-phylink - KCONFIG:=CONFIG_MVPP2 \ - CONFIG_MVPP2_PTP=n - FILES=$(LINUX_DIR)/drivers/net/ethernet/marvell/mvpp2/mvpp2.ko - AUTOLOAD=$(call AutoLoad,40,mvpp2) -endef - -$(eval $(call KernelPackage,mvpp2)) - -define KernelPackage/imx2-wdt - SUBMENU:=$(OTHER_MENU) - TITLE:=NXP (Freescale) i.MX2+ and Layerscape watchdog driver - KCONFIG:=CONFIG_IMX2_WDT - FILES=$(LINUX_DIR)/drivers/watchdog/imx2_wdt.ko - AUTOLOAD=$(call AutoLoad,60,imx2_wdt) -endef - -$(eval $(call KernelPackage,imx2-wdt)) - -define KernelPackage/imx7-ulp-wdt - SUBMENU:=$(OTHER_MENU) - TITLE:=NXP (Freescale) i.MX7ULP and later watchdog - KCONFIG:=CONFIG_IMX7ULP_WDT - FILES=$(LINUX_DIR)/drivers/watchdog/imx7ulp_wdt.ko - AUTOLOAD=$(call AutoLoad,60,imx7ulp_wdt) -endef - -$(eval $(call KernelPackage,imx7-ulp-wdt)) - -define KernelPackage/stmmac-core - SUBMENU=$(NETWORK_DEVICES_MENU) - TITLE:=Synopsis Ethernet Controller core (NXP,STMMicro,others) - DEPENDS:=@(TARGET_armvirt_64) +kmod-pcs-xpcs +kmod-ptp \ - +kmod-of-mdio - KCONFIG:=CONFIG_STMMAC_ETH \ - CONFIG_STMMAC_SELFTESTS=n \ - CONFIG_STMMAC_PLATFORM \ - CONFIG_CONFIG_DWMAC_DWC_QOS_ETH=n \ - CONFIG_DWMAC_GENERIC - FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/stmmac.ko \ - $(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/stmmac-platform.ko \ - $(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-generic.ko - AUTOLOAD=$(call AutoLoad,40,stmmac stmmac-platform dwmac-generic) -endef - -$(eval $(call KernelPackage,stmmac-core)) - -define KernelPackage/dwmac-imx - SUBMENU=$(NETWORK_DEVICES_MENU) - TITLE:=NXP i.MX8 Ethernet controller - DEPENDS:=+kmod-stmmac-core - KCONFIG:=CONFIG_DWMAC_IMX8 - FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.ko - AUTOLOAD=$(call AutoLoad,45,dwmac-imx) -endef - -$(eval $(call KernelPackage,dwmac-imx)) - -define KernelPackage/dwmac-sun8i - SUBMENU=$(NETWORK_DEVICES_MENU) - TITLE:=Allwinner H3/A83T/A64 (sun8i) Ethernet - DEPENDS:=+kmod-stmmac-core +kmod-mdio-bus-mux - KCONFIG:=CONFIG_DWMAC_SUN8I - FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.ko - AUTOLOAD=$(call AutoLoad,45,dwmac-sun8i) -endef - -$(eval $(call KernelPackage,dwmac-sun8i)) - -define KernelPackage/dwmac-rockchip - SUBMENU=$(NETWORK_DEVICES_MENU) - TITLE:=Rockchip RK3328/RK3399/RK3568 Ethernet - DEPENDS:=+kmod-stmmac-core +kmod-mdio-bus-mux - KCONFIG:=CONFIG_DWMAC_ROCKCHIP - FILES=$(LINUX_DIR)/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.ko - AUTOLOAD=$(call AutoLoad,45,dwmac-rk) -endef - -$(eval $(call KernelPackage,dwmac-rockchip)) - -define KernelPackage/thunderx-net - SUBMENU:=$(NETWORK_DEVICES_MENU) - TITLE:=Marvell (Cavium) ThunderX/2 network drivers - DEPENDS:=@(TARGET_armvirt_64) +kmod-phylink +kmod-of-mdio - KCONFIG:=CONFIG_NET_VENDOR_CAVIUM \ - CONFIG_THUNDER_NIC_PF \ - CONFIG_THUNDER_NIC_VF \ - CONFIG_THUNDER_NIC_BGX \ - CONFIG_THUNDER_NIC_RGX - FILES=$(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/nicvf.ko \ - $(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/nicpf.ko \ - $(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/thunder_xcv.ko \ - $(LINUX_DIR)/drivers/net/ethernet/cavium/thunder/thunder_bgx.ko - AUTOLOAD=$(call AutoLoad,40,nicpf nicvf thunder_xcv thunder_bgx) -endef - -$(eval $(call KernelPackage,thunderx-net)) - -define KernelPackage/wdt-sp805 - SUBMENU:=$(OTHER_MENU) - TITLE:=ARM SP805 Watchdog - KCONFIG:=CONFIG_ARM_SP805_WATCHDOG - FILES=$(LINUX_DIR)/drivers/watchdog/sp805_wdt.ko - AUTOLOAD=$(call AutoLoad,50,sp805_wdt) -endef - -define KernelPackage/wdt-sp805/description - Support for the ARM SP805 wathchdog module. - This is present in the NXP Layerscape family, - HiSilicon HI3660 among others. -endef - -$(eval $(call KernelPackage,wdt-sp805)) - diff --git a/target/linux/armvirt/patches-6.1/221-armvirt-disable-gc_sections.patch b/target/linux/armvirt/patches-6.1/221-armvirt-disable-gc_sections.patch deleted file mode 100644 index cb124c1cf8..0000000000 --- a/target/linux/armvirt/patches-6.1/221-armvirt-disable-gc_sections.patch +++ /dev/null @@ -1,23 +0,0 @@ -From b77c0ecdc7915e5c5c515da1aa6cfaf6f4eb8351 Mon Sep 17 00:00:00 2001 -From: Mathew McBride -Date: Wed, 28 Sep 2022 16:39:31 +1000 -Subject: [PATCH] arm: disable code size reduction measures - (gc-sections,-f*-sections) - -This interferes with the EFI boot stub on armv7l. - -Signed-off-by: Mathew McBride ---- - arch/arm/Kconfig | 1 - - 1 file changed, 1 deletion(-) - ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -122,7 +122,6 @@ config ARM - select HAVE_UID16 - select HAVE_VIRT_CPU_ACCOUNTING_GEN - select IRQ_FORCED_THREADING -- select HAVE_LD_DEAD_CODE_DATA_ELIMINATION - select MODULES_USE_ELF_REL - select NEED_DMA_MAP_STATE - select OF_EARLY_FLATTREE if OF diff --git a/target/linux/armvirt/patches-6.1/701-v6.2-0001-net-dpaa2-eth-don-t-use-ENOTSUPP-error-code.patch b/target/linux/armvirt/patches-6.1/701-v6.2-0001-net-dpaa2-eth-don-t-use-ENOTSUPP-error-code.patch deleted file mode 100644 index 6238c0a903..0000000000 --- a/target/linux/armvirt/patches-6.1/701-v6.2-0001-net-dpaa2-eth-don-t-use-ENOTSUPP-error-code.patch +++ /dev/null @@ -1,44 +0,0 @@ -From f3763a0c1b07273218cbf5886bdf8df9df501111 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Tue, 29 Nov 2022 16:12:10 +0200 -Subject: [PATCH 03/14] net: dpaa2-eth: don't use -ENOTSUPP error code - -dpaa2_eth_setup_dpni() is called from the probe path and -dpaa2_eth_set_link_ksettings() is propagated to user space. - -include/linux/errno.h says that ENOTSUPP is "Defined for the NFSv3 -protocol". Conventional wisdom has it to not use it in networking -drivers. Replace it with -EOPNOTSUPP. - -Signed-off-by: Vladimir Oltean -Reviewed-by: Andrew Lunn -Reviewed-by: Ioana Ciornei -Tested-by: Ioana Ciornei -Signed-off-by: Paolo Abeni ---- - drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 +- - drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c -@@ -3613,7 +3613,7 @@ static int dpaa2_eth_setup_dpni(struct f - dev_err(dev, "DPNI version %u.%u not supported, need >= %u.%u\n", - priv->dpni_ver_major, priv->dpni_ver_minor, - DPNI_VER_MAJOR, DPNI_VER_MINOR); -- err = -ENOTSUPP; -+ err = -EOPNOTSUPP; - goto close; - } - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c -@@ -118,7 +118,7 @@ dpaa2_eth_set_link_ksettings(struct net_ - struct dpaa2_eth_priv *priv = netdev_priv(net_dev); - - if (!dpaa2_eth_is_type_phy(priv)) -- return -ENOTSUPP; -+ return -EOPNOTSUPP; - - return phylink_ethtool_ksettings_set(priv->mac->phylink, link_settings); - } diff --git a/target/linux/armvirt/patches-6.1/701-v6.2-0002-net-dpaa2-replace-dpaa2_mac_is_type_fixed-with-dpaa2.patch b/target/linux/armvirt/patches-6.1/701-v6.2-0002-net-dpaa2-replace-dpaa2_mac_is_type_fixed-with-dpaa2.patch deleted file mode 100644 index 501eaf42ff..0000000000 --- a/target/linux/armvirt/patches-6.1/701-v6.2-0002-net-dpaa2-replace-dpaa2_mac_is_type_fixed-with-dpaa2.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 022a11062261dc4703da846d3bf4d194ef6bebf5 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Tue, 29 Nov 2022 16:12:11 +0200 -Subject: [PATCH 04/14] net: dpaa2: replace dpaa2_mac_is_type_fixed() with - dpaa2_mac_is_type_phy() - -dpaa2_mac_is_type_fixed() is a header with no implementation and no -callers, which is referenced from the documentation though. It can be -deleted. - -On the other hand, it would be useful to reuse the code between -dpaa2_eth_is_type_phy() and dpaa2_switch_port_is_type_phy(). That common -code should be called dpaa2_mac_is_type_phy(), so let's create that. - -The removal and the addition are merged into the same patch because, -in fact, is_type_phy() is the logical opposite of is_type_fixed(). - -Signed-off-by: Vladimir Oltean -Reviewed-by: Andrew Lunn -Reviewed-by: Ioana Ciornei -Tested-by: Ioana Ciornei -Signed-off-by: Paolo Abeni ---- - .../ethernet/freescale/dpaa2/mac-phy-support.rst | 9 ++++++--- - drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h | 7 +------ - drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h | 10 ++++++++-- - drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h | 7 +------ - 4 files changed, 16 insertions(+), 17 deletions(-) - ---- a/Documentation/networking/device_drivers/ethernet/freescale/dpaa2/mac-phy-support.rst -+++ b/Documentation/networking/device_drivers/ethernet/freescale/dpaa2/mac-phy-support.rst -@@ -181,10 +181,13 @@ when necessary using the below listed AP - - int dpaa2_mac_connect(struct dpaa2_mac *mac); - - void dpaa2_mac_disconnect(struct dpaa2_mac *mac); - --A phylink integration is necessary only when the partner DPMAC is not of TYPE_FIXED. --One can check for this condition using the below API:: -+A phylink integration is necessary only when the partner DPMAC is not of -+``TYPE_FIXED``. This means it is either of ``TYPE_PHY``, or of -+``TYPE_BACKPLANE`` (the difference being the two that in the ``TYPE_BACKPLANE`` -+mode, the MC firmware does not access the PCS registers). One can check for -+this condition using the following helper:: - -- - bool dpaa2_mac_is_type_fixed(struct fsl_mc_device *dpmac_dev,struct fsl_mc_io *mc_io); -+ - static inline bool dpaa2_mac_is_type_phy(struct dpaa2_mac *mac); - - Before connection to a MAC, the caller must allocate and populate the - dpaa2_mac structure with the associated net_device, a pointer to the MC portal ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h -@@ -733,12 +733,7 @@ static inline unsigned int dpaa2_eth_rx_ - - static inline bool dpaa2_eth_is_type_phy(struct dpaa2_eth_priv *priv) - { -- if (priv->mac && -- (priv->mac->attr.link_type == DPMAC_LINK_TYPE_PHY || -- priv->mac->attr.link_type == DPMAC_LINK_TYPE_BACKPLANE)) -- return true; -- -- return false; -+ return dpaa2_mac_is_type_phy(priv->mac); - } - - static inline bool dpaa2_eth_has_mac(struct dpaa2_eth_priv *priv) ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.h -@@ -30,8 +30,14 @@ struct dpaa2_mac { - struct phy *serdes_phy; - }; - --bool dpaa2_mac_is_type_fixed(struct fsl_mc_device *dpmac_dev, -- struct fsl_mc_io *mc_io); -+static inline bool dpaa2_mac_is_type_phy(struct dpaa2_mac *mac) -+{ -+ if (!mac) -+ return false; -+ -+ return mac->attr.link_type == DPMAC_LINK_TYPE_PHY || -+ mac->attr.link_type == DPMAC_LINK_TYPE_BACKPLANE; -+} - - int dpaa2_mac_open(struct dpaa2_mac *mac); - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h -@@ -230,12 +230,7 @@ static inline bool dpaa2_switch_supports - static inline bool - dpaa2_switch_port_is_type_phy(struct ethsw_port_priv *port_priv) - { -- if (port_priv->mac && -- (port_priv->mac->attr.link_type == DPMAC_LINK_TYPE_PHY || -- port_priv->mac->attr.link_type == DPMAC_LINK_TYPE_BACKPLANE)) -- return true; -- -- return false; -+ return dpaa2_mac_is_type_phy(port_priv->mac); - } - - static inline bool dpaa2_switch_port_has_mac(struct ethsw_port_priv *port_priv) diff --git a/target/linux/armvirt/patches-6.1/701-v6.2-0003-net-dpaa2-mac-absorb-phylink_start-call-into-dpaa2_m.patch b/target/linux/armvirt/patches-6.1/701-v6.2-0003-net-dpaa2-mac-absorb-phylink_start-call-into-dpaa2_m.patch deleted file mode 100644 index e84195f3cd..0000000000 --- a/target/linux/armvirt/patches-6.1/701-v6.2-0003-net-dpaa2-mac-absorb-phylink_start-call-into-dpaa2_m.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 97c07369ab8bf9895e05d4b468f18e6567263154 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Tue, 29 Nov 2022 16:12:12 +0200 -Subject: [PATCH 05/14] net: dpaa2-mac: absorb phylink_start() call into - dpaa2_mac_start() - -The phylink handling is intended to be hidden inside the dpaa2_mac -object. Move the phylink_start() call into dpaa2_mac_start(), and -phylink_stop() into dpaa2_mac_stop(). - -Signed-off-by: Vladimir Oltean -Reviewed-by: Andrew Lunn -Reviewed-by: Ioana Ciornei -Tested-by: Ioana Ciornei -Signed-off-by: Paolo Abeni ---- - drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 5 +---- - drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 8 ++++++++ - drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 5 +---- - 3 files changed, 10 insertions(+), 8 deletions(-) - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c -@@ -2082,10 +2082,8 @@ static int dpaa2_eth_open(struct net_dev - goto enable_err; - } - -- if (dpaa2_eth_is_type_phy(priv)) { -+ if (dpaa2_eth_is_type_phy(priv)) - dpaa2_mac_start(priv->mac); -- phylink_start(priv->mac->phylink); -- } - - return 0; - -@@ -2159,7 +2157,6 @@ static int dpaa2_eth_stop(struct net_dev - int retries = 10; - - if (dpaa2_eth_is_type_phy(priv)) { -- phylink_stop(priv->mac->phylink); - dpaa2_mac_stop(priv->mac); - } else { - netif_tx_stop_all_queues(net_dev); ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c -@@ -336,12 +336,20 @@ static void dpaa2_mac_set_supported_inte - - void dpaa2_mac_start(struct dpaa2_mac *mac) - { -+ ASSERT_RTNL(); -+ - if (mac->serdes_phy) - phy_power_on(mac->serdes_phy); -+ -+ phylink_start(mac->phylink); - } - - void dpaa2_mac_stop(struct dpaa2_mac *mac) - { -+ ASSERT_RTNL(); -+ -+ phylink_stop(mac->phylink); -+ - if (mac->serdes_phy) - phy_power_off(mac->serdes_phy); - } ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c -@@ -703,10 +703,8 @@ static int dpaa2_switch_port_open(struct - - dpaa2_switch_enable_ctrl_if_napi(ethsw); - -- if (dpaa2_switch_port_is_type_phy(port_priv)) { -+ if (dpaa2_switch_port_is_type_phy(port_priv)) - dpaa2_mac_start(port_priv->mac); -- phylink_start(port_priv->mac->phylink); -- } - - return 0; - } -@@ -718,7 +716,6 @@ static int dpaa2_switch_port_stop(struct - int err; - - if (dpaa2_switch_port_is_type_phy(port_priv)) { -- phylink_stop(port_priv->mac->phylink); - dpaa2_mac_stop(port_priv->mac); - } else { - netif_tx_stop_all_queues(netdev); diff --git a/target/linux/armvirt/patches-6.1/701-v6.2-0004-net-dpaa2-mac-remove-defensive-check-in-dpaa2_mac_di.patch b/target/linux/armvirt/patches-6.1/701-v6.2-0004-net-dpaa2-mac-remove-defensive-check-in-dpaa2_mac_di.patch deleted file mode 100644 index c3028357fe..0000000000 --- a/target/linux/armvirt/patches-6.1/701-v6.2-0004-net-dpaa2-mac-remove-defensive-check-in-dpaa2_mac_di.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 095ef388f714d622aa503fcccf20dc4095b72762 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Tue, 29 Nov 2022 16:12:13 +0200 -Subject: [PATCH 06/14] net: dpaa2-mac: remove defensive check in - dpaa2_mac_disconnect() - -dpaa2_mac_disconnect() will only be called with a NULL mac->phylink if -dpaa2_mac_connect() failed, or was never called. - -The callers are these: - -dpaa2_eth_disconnect_mac(): - - if (dpaa2_eth_is_type_phy(priv)) - dpaa2_mac_disconnect(priv->mac); - -dpaa2_switch_port_disconnect_mac(): - - if (dpaa2_switch_port_is_type_phy(port_priv)) - dpaa2_mac_disconnect(port_priv->mac); - -priv->mac can be NULL, but in that case, dpaa2_eth_is_type_phy() returns -false, and dpaa2_mac_disconnect() is never called. Similar for -dpaa2-switch. - -When priv->mac is non-NULL, it means that dpaa2_mac_connect() returned -zero (success), and therefore, priv->mac->phylink is also a valid -pointer. - -Signed-off-by: Vladimir Oltean -Reviewed-by: Andrew Lunn -Reviewed-by: Ioana Ciornei -Tested-by: Ioana Ciornei -Signed-off-by: Paolo Abeni ---- - drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 3 --- - 1 file changed, 3 deletions(-) - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c -@@ -446,9 +446,6 @@ err_pcs_destroy: - - void dpaa2_mac_disconnect(struct dpaa2_mac *mac) - { -- if (!mac->phylink) -- return; -- - phylink_disconnect_phy(mac->phylink); - phylink_destroy(mac->phylink); - dpaa2_pcs_destroy(mac); diff --git a/target/linux/armvirt/patches-6.1/701-v6.2-0005-net-dpaa2-eth-assign-priv-mac-after-dpaa2_mac_connec.patch b/target/linux/armvirt/patches-6.1/701-v6.2-0005-net-dpaa2-eth-assign-priv-mac-after-dpaa2_mac_connec.patch deleted file mode 100644 index 8c7ed6c793..0000000000 --- a/target/linux/armvirt/patches-6.1/701-v6.2-0005-net-dpaa2-eth-assign-priv-mac-after-dpaa2_mac_connec.patch +++ /dev/null @@ -1,101 +0,0 @@ -From 06efc9b8a1360cad83cae6e71558e5458cc1fbf3 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Tue, 29 Nov 2022 16:12:14 +0200 -Subject: [PATCH 07/14] net: dpaa2-eth: assign priv->mac after - dpaa2_mac_connect() call - -There are 2 requirements for correct code: - -- Any time the driver accesses the priv->mac pointer at runtime, it - either holds NULL to indicate a DPNI-DPNI connection (or unconnected - DPNI), or a struct dpaa2_mac whose phylink instance was fully - initialized (created and connected to the PHY). No changes are made to - priv->mac while it is being used. Currently, rtnl_lock() watches over - the call to dpaa2_eth_connect_mac(), so it serves the purpose of - serializing this with all readers of priv->mac. - -- dpaa2_mac_connect() should run unlocked, because inside it are 2 - phylink calls with incompatible locking requirements: phylink_create() - requires that the rtnl_mutex isn't held, and phylink_fwnode_phy_connect() - requires that the rtnl_mutex is held. The only way to solve those - contradictory requirements is to let dpaa2_mac_connect() take - rtnl_lock() when it needs to. - -To solve both requirements, we need to identify the writer side of the -priv->mac pointer, which can be wrapped in a mutex private to the driver -in a future patch. The dpaa2_mac_connect() cannot be part of the writer -side critical section, because of an AB/BA deadlock with rtnl_lock(). - -So the strategy needs to be that where we prepare the DPMAC by calling -dpaa2_mac_connect(), and only make priv->mac point to it once it's fully -prepared. This ensures that the writer side critical section has the -absolute minimum surface it can. - -The reverse strategy is adopted in the dpaa2_eth_disconnect_mac() code -path. This makes sure that priv->mac is NULL when we start tearing down -the DPMAC that we disconnected from, and concurrent code will simply not -see it. - -No locking changes in this patch (concurrent code is still blocked by -the rtnl_mutex). - -Signed-off-by: Vladimir Oltean -Reviewed-by: Ioana Ciornei -Tested-by: Ioana Ciornei -Signed-off-by: Paolo Abeni ---- - .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 21 +++++++++++-------- - 1 file changed, 12 insertions(+), 9 deletions(-) - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c -@@ -4443,9 +4443,8 @@ static int dpaa2_eth_connect_mac(struct - err = dpaa2_mac_open(mac); - if (err) - goto err_free_mac; -- priv->mac = mac; - -- if (dpaa2_eth_is_type_phy(priv)) { -+ if (dpaa2_mac_is_type_phy(mac)) { - err = dpaa2_mac_connect(mac); - if (err && err != -EPROBE_DEFER) - netdev_err(priv->net_dev, "Error connecting to the MAC endpoint: %pe", -@@ -4454,11 +4453,12 @@ static int dpaa2_eth_connect_mac(struct - goto err_close_mac; - } - -+ priv->mac = mac; -+ - return 0; - - err_close_mac: - dpaa2_mac_close(mac); -- priv->mac = NULL; - err_free_mac: - kfree(mac); - return err; -@@ -4466,15 +4466,18 @@ err_free_mac: - - static void dpaa2_eth_disconnect_mac(struct dpaa2_eth_priv *priv) - { -- if (dpaa2_eth_is_type_phy(priv)) -- dpaa2_mac_disconnect(priv->mac); -+ struct dpaa2_mac *mac = priv->mac; -+ -+ priv->mac = NULL; - -- if (!dpaa2_eth_has_mac(priv)) -+ if (!mac) - return; - -- dpaa2_mac_close(priv->mac); -- kfree(priv->mac); -- priv->mac = NULL; -+ if (dpaa2_mac_is_type_phy(mac)) -+ dpaa2_mac_disconnect(mac); -+ -+ dpaa2_mac_close(mac); -+ kfree(mac); - } - - static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg) diff --git a/target/linux/armvirt/patches-6.1/701-v6.2-0006-net-dpaa2-switch-assign-port_priv-mac-after-dpaa2_ma.patch b/target/linux/armvirt/patches-6.1/701-v6.2-0006-net-dpaa2-switch-assign-port_priv-mac-after-dpaa2_ma.patch deleted file mode 100644 index e63654984a..0000000000 --- a/target/linux/armvirt/patches-6.1/701-v6.2-0006-net-dpaa2-switch-assign-port_priv-mac-after-dpaa2_ma.patch +++ /dev/null @@ -1,73 +0,0 @@ -From a5e7f7e277bd4403c45c1c7922d56d0eb08dbc7c Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Tue, 29 Nov 2022 16:12:15 +0200 -Subject: [PATCH 08/14] net: dpaa2-switch: assign port_priv->mac after - dpaa2_mac_connect() call - -The dpaa2-switch has the exact same locking requirements when connected -to a DPMAC, so it needs port_priv->mac to always point either to NULL, -or to a DPMAC with a fully initialized phylink instance. - -Make the same preparatory change in the dpaa2-switch driver as in the -dpaa2-eth one. - -Signed-off-by: Vladimir Oltean -Reviewed-by: Ioana Ciornei -Tested-by: Ioana Ciornei -Signed-off-by: Paolo Abeni ---- - .../ethernet/freescale/dpaa2/dpaa2-switch.c | 21 +++++++++++-------- - 1 file changed, 12 insertions(+), 9 deletions(-) - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c -@@ -1450,9 +1450,8 @@ static int dpaa2_switch_port_connect_mac - err = dpaa2_mac_open(mac); - if (err) - goto err_free_mac; -- port_priv->mac = mac; - -- if (dpaa2_switch_port_is_type_phy(port_priv)) { -+ if (dpaa2_mac_is_type_phy(mac)) { - err = dpaa2_mac_connect(mac); - if (err) { - netdev_err(port_priv->netdev, -@@ -1462,11 +1461,12 @@ static int dpaa2_switch_port_connect_mac - } - } - -+ port_priv->mac = mac; -+ - return 0; - - err_close_mac: - dpaa2_mac_close(mac); -- port_priv->mac = NULL; - err_free_mac: - kfree(mac); - return err; -@@ -1474,15 +1474,18 @@ err_free_mac: - - static void dpaa2_switch_port_disconnect_mac(struct ethsw_port_priv *port_priv) - { -- if (dpaa2_switch_port_is_type_phy(port_priv)) -- dpaa2_mac_disconnect(port_priv->mac); -+ struct dpaa2_mac *mac = port_priv->mac; -+ -+ port_priv->mac = NULL; - -- if (!dpaa2_switch_port_has_mac(port_priv)) -+ if (!mac) - return; - -- dpaa2_mac_close(port_priv->mac); -- kfree(port_priv->mac); -- port_priv->mac = NULL; -+ if (dpaa2_mac_is_type_phy(mac)) -+ dpaa2_mac_disconnect(mac); -+ -+ dpaa2_mac_close(mac); -+ kfree(mac); - } - - static irqreturn_t dpaa2_switch_irq0_handler_thread(int irq_num, void *arg) diff --git a/target/linux/armvirt/patches-6.1/701-v6.2-0007-net-dpaa2-publish-MAC-stringset-to-ethtool-S-even-if.patch b/target/linux/armvirt/patches-6.1/701-v6.2-0007-net-dpaa2-publish-MAC-stringset-to-ethtool-S-even-if.patch deleted file mode 100644 index c790ba1bd5..0000000000 --- a/target/linux/armvirt/patches-6.1/701-v6.2-0007-net-dpaa2-publish-MAC-stringset-to-ethtool-S-even-if.patch +++ /dev/null @@ -1,111 +0,0 @@ -From ce44b6ed9ee65efa9b3025552c513842eabcab88 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Tue, 29 Nov 2022 16:12:16 +0200 -Subject: [PATCH 09/14] net: dpaa2: publish MAC stringset to ethtool -S even if - MAC is missing - -DPNIs and DPSW objects can connect and disconnect at runtime from DPMAC -objects on the same fsl-mc bus. The DPMAC object also holds "ethtool -S" -unstructured counters. Those counters are only shown for the entity -owning the netdev (DPNI, DPSW) if it's connected to a DPMAC. - -The ethtool stringset code path is split into multiple callbacks, but -currently, connecting and disconnecting the DPMAC takes the rtnl_lock(). -This blocks the entire ethtool code path from running, see -ethnl_default_doit() -> rtnl_lock() -> ops->prepare_data() -> -strset_prepare_data(). - -This is going to be a problem if we are going to no longer require -rtnl_lock() when connecting/disconnecting the DPMAC, because the DPMAC -could appear between ops->get_sset_count() and ops->get_strings(). -If it appears out of the blue, we will provide a stringset into an array -that was dimensioned thinking the DPMAC wouldn't be there => array -accessed out of bounds. - -There isn't really a good way to work around that, and I don't want to -put too much pressure on the ethtool framework by playing locking games. -Just make the DPMAC counters be always available. They'll be zeroes if -the DPNI or DPSW isn't connected to a DPMAC. - -Signed-off-by: Vladimir Oltean -Reviewed-by: Andrew Lunn -Reviewed-by: Ioana Ciornei -Tested-by: Ioana Ciornei -Signed-off-by: Paolo Abeni ---- - drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c | 12 +++--------- - .../ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c | 11 ++--------- - 2 files changed, 5 insertions(+), 18 deletions(-) - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c -@@ -186,7 +186,6 @@ static int dpaa2_eth_set_pauseparam(stru - static void dpaa2_eth_get_strings(struct net_device *netdev, u32 stringset, - u8 *data) - { -- struct dpaa2_eth_priv *priv = netdev_priv(netdev); - u8 *p = data; - int i; - -@@ -200,22 +199,17 @@ static void dpaa2_eth_get_strings(struct - strscpy(p, dpaa2_ethtool_extras[i], ETH_GSTRING_LEN); - p += ETH_GSTRING_LEN; - } -- if (dpaa2_eth_has_mac(priv)) -- dpaa2_mac_get_strings(p); -+ dpaa2_mac_get_strings(p); - break; - } - } - - static int dpaa2_eth_get_sset_count(struct net_device *net_dev, int sset) - { -- int num_ss_stats = DPAA2_ETH_NUM_STATS + DPAA2_ETH_NUM_EXTRA_STATS; -- struct dpaa2_eth_priv *priv = netdev_priv(net_dev); -- - switch (sset) { - case ETH_SS_STATS: /* ethtool_get_stats(), ethtool_get_drvinfo() */ -- if (dpaa2_eth_has_mac(priv)) -- num_ss_stats += dpaa2_mac_get_sset_count(); -- return num_ss_stats; -+ return DPAA2_ETH_NUM_STATS + DPAA2_ETH_NUM_EXTRA_STATS + -+ dpaa2_mac_get_sset_count(); - default: - return -EOPNOTSUPP; - } ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c -@@ -145,14 +145,9 @@ dpaa2_switch_set_link_ksettings(struct n - static int - dpaa2_switch_ethtool_get_sset_count(struct net_device *netdev, int sset) - { -- struct ethsw_port_priv *port_priv = netdev_priv(netdev); -- int num_ss_stats = DPAA2_SWITCH_NUM_COUNTERS; -- - switch (sset) { - case ETH_SS_STATS: -- if (port_priv->mac) -- num_ss_stats += dpaa2_mac_get_sset_count(); -- return num_ss_stats; -+ return DPAA2_SWITCH_NUM_COUNTERS + dpaa2_mac_get_sset_count(); - default: - return -EOPNOTSUPP; - } -@@ -161,7 +156,6 @@ dpaa2_switch_ethtool_get_sset_count(stru - static void dpaa2_switch_ethtool_get_strings(struct net_device *netdev, - u32 stringset, u8 *data) - { -- struct ethsw_port_priv *port_priv = netdev_priv(netdev); - u8 *p = data; - int i; - -@@ -172,8 +166,7 @@ static void dpaa2_switch_ethtool_get_str - ETH_GSTRING_LEN); - p += ETH_GSTRING_LEN; - } -- if (port_priv->mac) -- dpaa2_mac_get_strings(p); -+ dpaa2_mac_get_strings(p); - break; - } - } diff --git a/target/linux/armvirt/patches-6.1/701-v6.2-0008-net-dpaa2-switch-replace-direct-MAC-access-with-dpaa.patch b/target/linux/armvirt/patches-6.1/701-v6.2-0008-net-dpaa2-switch-replace-direct-MAC-access-with-dpaa.patch deleted file mode 100644 index 0663bf6fb1..0000000000 --- a/target/linux/armvirt/patches-6.1/701-v6.2-0008-net-dpaa2-switch-replace-direct-MAC-access-with-dpaa.patch +++ /dev/null @@ -1,28 +0,0 @@ -From c838d9fd7e6ba9ddd6006bf0a296396266e9f121 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Tue, 29 Nov 2022 16:12:17 +0200 -Subject: [PATCH 10/14] net: dpaa2-switch replace direct MAC access with - dpaa2_switch_port_has_mac() - -The helper function will gain a lockdep annotation in a future patch. -Make sure to benefit from it. - -Signed-off-by: Vladimir Oltean -Reviewed-by: Ioana Ciornei -Tested-by: Ioana Ciornei -Signed-off-by: Paolo Abeni ---- - drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c -@@ -189,7 +189,7 @@ static void dpaa2_switch_ethtool_get_sta - dpaa2_switch_ethtool_counters[i].name, err); - } - -- if (port_priv->mac) -+ if (dpaa2_switch_port_has_mac(port_priv)) - dpaa2_mac_get_ethtool_stats(port_priv->mac, data + i); - } - diff --git a/target/linux/armvirt/patches-6.1/701-v6.2-0009-net-dpaa2-eth-connect-to-MAC-before-requesting-the-e.patch b/target/linux/armvirt/patches-6.1/701-v6.2-0009-net-dpaa2-eth-connect-to-MAC-before-requesting-the-e.patch deleted file mode 100644 index 37831f264b..0000000000 --- a/target/linux/armvirt/patches-6.1/701-v6.2-0009-net-dpaa2-eth-connect-to-MAC-before-requesting-the-e.patch +++ /dev/null @@ -1,93 +0,0 @@ -From e0ea63162cb5f1ca7f844d6ef5fc4079448ee2d5 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Tue, 29 Nov 2022 16:12:18 +0200 -Subject: [PATCH 11/14] net: dpaa2-eth: connect to MAC before requesting the - "endpoint changed" IRQ - -dpaa2_eth_connect_mac() is called both from dpaa2_eth_probe() and from -dpni_irq0_handler_thread(). - -It could happen that the DPNI gets connected to a DPMAC on the fsl-mc -bus exactly during probe, as soon as the "endpoint change" interrupt is -requested in dpaa2_eth_setup_irqs(). This will cause the -dpni_irq0_handler_thread() to register a phylink instance for that DPMAC. - -Then, the probing function will also try to register a phylink instance -for the same DPMAC, operation which should fail (and this will fail the -probing of the driver). - -Reorder dpaa2_eth_setup_irqs() and dpaa2_eth_connect_mac(), such that -dpni_irq0_handler_thread() never races with the DPMAC-related portion of -the probing path. - -Also reorder dpaa2_eth_disconnect_mac() to be in the mirror position of -dpaa2_eth_connect_mac() in the teardown path. - -Signed-off-by: Vladimir Oltean -Reviewed-by: Ioana Ciornei -Tested-by: Ioana Ciornei -Signed-off-by: Paolo Abeni ---- - .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 18 +++++++++--------- - 1 file changed, 9 insertions(+), 9 deletions(-) - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c -@@ -4710,6 +4710,10 @@ static int dpaa2_eth_probe(struct fsl_mc - } - #endif - -+ err = dpaa2_eth_connect_mac(priv); -+ if (err) -+ goto err_connect_mac; -+ - err = dpaa2_eth_setup_irqs(dpni_dev); - if (err) { - netdev_warn(net_dev, "Failed to set link interrupt, fall back to polling\n"); -@@ -4722,10 +4726,6 @@ static int dpaa2_eth_probe(struct fsl_mc - priv->do_link_poll = true; - } - -- err = dpaa2_eth_connect_mac(priv); -- if (err) -- goto err_connect_mac; -- - err = dpaa2_eth_dl_alloc(priv); - if (err) - goto err_dl_register; -@@ -4759,13 +4759,13 @@ err_dl_port_add: - err_dl_trap_register: - dpaa2_eth_dl_free(priv); - err_dl_register: -- dpaa2_eth_disconnect_mac(priv); --err_connect_mac: - if (priv->do_link_poll) - kthread_stop(priv->poll_thread); - else - fsl_mc_free_irqs(dpni_dev); - err_poll_thread: -+ dpaa2_eth_disconnect_mac(priv); -+err_connect_mac: - dpaa2_eth_free_rings(priv); - err_alloc_rings: - err_csum: -@@ -4813,9 +4813,6 @@ static int dpaa2_eth_remove(struct fsl_m - #endif - - unregister_netdev(net_dev); -- rtnl_lock(); -- dpaa2_eth_disconnect_mac(priv); -- rtnl_unlock(); - - dpaa2_eth_dl_port_del(priv); - dpaa2_eth_dl_traps_unregister(priv); -@@ -4826,6 +4823,9 @@ static int dpaa2_eth_remove(struct fsl_m - else - fsl_mc_free_irqs(ls_dev); - -+ rtnl_lock(); -+ dpaa2_eth_disconnect_mac(priv); -+ rtnl_unlock(); - dpaa2_eth_free_rings(priv); - free_percpu(priv->fd); - free_percpu(priv->sgt_cache); diff --git a/target/linux/armvirt/patches-6.1/701-v6.2-0010-net-dpaa2-eth-serialize-changes-to-priv-mac-with-a-m.patch b/target/linux/armvirt/patches-6.1/701-v6.2-0010-net-dpaa2-eth-serialize-changes-to-priv-mac-with-a-m.patch deleted file mode 100644 index 89f58412d4..0000000000 --- a/target/linux/armvirt/patches-6.1/701-v6.2-0010-net-dpaa2-eth-serialize-changes-to-priv-mac-with-a-m.patch +++ /dev/null @@ -1,320 +0,0 @@ -From 5e448a17dfa2e95166534df7f677a3694ef6187d Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Tue, 29 Nov 2022 16:12:19 +0200 -Subject: [PATCH 12/14] net: dpaa2-eth: serialize changes to priv->mac with a - mutex - -The dpaa2 architecture permits dynamic connections between objects on -the fsl-mc bus, specifically between a DPNI object (represented by a -struct net_device) and a DPMAC object (represented by a struct phylink). - -The DPNI driver is notified when those connections are created/broken -through the dpni_irq0_handler_thread() method. To ensure that ethtool -operations, as well as netdev up/down operations serialize with the -connection/disconnection of the DPNI with a DPMAC, -dpni_irq0_handler_thread() takes the rtnl_lock() to block those other -operations from taking place. - -There is code called by dpaa2_mac_connect() which wants to acquire the -rtnl_mutex once again, see phylink_create() -> phylink_register_sfp() -> -sfp_bus_add_upstream() -> rtnl_lock(). So the strategy doesn't quite -work out, even though it's fairly simple. - -Create a different strategy, where all code paths in the dpaa2-eth -driver access priv->mac only while they are holding priv->mac_lock. -The phylink instance is not created or connected to the PHY under the -priv->mac_lock, but only assigned to priv->mac then. This will eliminate -the reliance on the rtnl_mutex. - -Add lockdep annotations and put comments where holding the lock is not -necessary, and priv->mac can be dereferenced freely. - -Signed-off-by: Vladimir Oltean -Reviewed-by: Ioana Ciornei -Tested-by: Ioana Ciornei -Signed-off-by: Paolo Abeni ---- - .../net/ethernet/freescale/dpaa2/dpaa2-eth.c | 43 ++++++++++++-- - .../net/ethernet/freescale/dpaa2/dpaa2-eth.h | 6 ++ - .../ethernet/freescale/dpaa2/dpaa2-ethtool.c | 58 +++++++++++++++---- - 3 files changed, 91 insertions(+), 16 deletions(-) - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c -@@ -2020,8 +2020,11 @@ static int dpaa2_eth_link_state_update(s - - /* When we manage the MAC/PHY using phylink there is no need - * to manually update the netif_carrier. -+ * We can avoid locking because we are called from the "link changed" -+ * IRQ handler, which is the same as the "endpoint changed" IRQ handler -+ * (the writer to priv->mac), so we cannot race with it. - */ -- if (dpaa2_eth_is_type_phy(priv)) -+ if (dpaa2_mac_is_type_phy(priv->mac)) - goto out; - - /* Chech link state; speed / duplex changes are not treated yet */ -@@ -2060,6 +2063,8 @@ static int dpaa2_eth_open(struct net_dev - priv->dpbp_dev->obj_desc.id, priv->bpid); - } - -+ mutex_lock(&priv->mac_lock); -+ - if (!dpaa2_eth_is_type_phy(priv)) { - /* We'll only start the txqs when the link is actually ready; - * make sure we don't race against the link up notification, -@@ -2078,6 +2083,7 @@ static int dpaa2_eth_open(struct net_dev - - err = dpni_enable(priv->mc_io, 0, priv->mc_token); - if (err < 0) { -+ mutex_unlock(&priv->mac_lock); - netdev_err(net_dev, "dpni_enable() failed\n"); - goto enable_err; - } -@@ -2085,6 +2091,8 @@ static int dpaa2_eth_open(struct net_dev - if (dpaa2_eth_is_type_phy(priv)) - dpaa2_mac_start(priv->mac); - -+ mutex_unlock(&priv->mac_lock); -+ - return 0; - - enable_err: -@@ -2156,6 +2164,8 @@ static int dpaa2_eth_stop(struct net_dev - int dpni_enabled = 0; - int retries = 10; - -+ mutex_lock(&priv->mac_lock); -+ - if (dpaa2_eth_is_type_phy(priv)) { - dpaa2_mac_stop(priv->mac); - } else { -@@ -2163,6 +2173,8 @@ static int dpaa2_eth_stop(struct net_dev - netif_carrier_off(net_dev); - } - -+ mutex_unlock(&priv->mac_lock); -+ - /* On dpni_disable(), the MC firmware will: - * - stop MAC Rx and wait for all Rx frames to be enqueued to software - * - cut off WRIOP dequeues from egress FQs and wait until transmission -@@ -2488,12 +2500,20 @@ static int dpaa2_eth_ts_ioctl(struct net - static int dpaa2_eth_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) - { - struct dpaa2_eth_priv *priv = netdev_priv(dev); -+ int err; - - if (cmd == SIOCSHWTSTAMP) - return dpaa2_eth_ts_ioctl(dev, rq, cmd); - -- if (dpaa2_eth_is_type_phy(priv)) -- return phylink_mii_ioctl(priv->mac->phylink, rq, cmd); -+ mutex_lock(&priv->mac_lock); -+ -+ if (dpaa2_eth_is_type_phy(priv)) { -+ err = phylink_mii_ioctl(priv->mac->phylink, rq, cmd); -+ mutex_unlock(&priv->mac_lock); -+ return err; -+ } -+ -+ mutex_unlock(&priv->mac_lock); - - return -EOPNOTSUPP; - } -@@ -4453,7 +4473,9 @@ static int dpaa2_eth_connect_mac(struct - goto err_close_mac; - } - -+ mutex_lock(&priv->mac_lock); - priv->mac = mac; -+ mutex_unlock(&priv->mac_lock); - - return 0; - -@@ -4466,9 +4488,12 @@ err_free_mac: - - static void dpaa2_eth_disconnect_mac(struct dpaa2_eth_priv *priv) - { -- struct dpaa2_mac *mac = priv->mac; -+ struct dpaa2_mac *mac; - -+ mutex_lock(&priv->mac_lock); -+ mac = priv->mac; - priv->mac = NULL; -+ mutex_unlock(&priv->mac_lock); - - if (!mac) - return; -@@ -4487,6 +4512,7 @@ static irqreturn_t dpni_irq0_handler_thr - struct fsl_mc_device *dpni_dev = to_fsl_mc_device(dev); - struct net_device *net_dev = dev_get_drvdata(dev); - struct dpaa2_eth_priv *priv = netdev_priv(net_dev); -+ bool had_mac; - int err; - - err = dpni_get_irq_status(dpni_dev->mc_io, 0, dpni_dev->mc_handle, -@@ -4504,7 +4530,12 @@ static irqreturn_t dpni_irq0_handler_thr - dpaa2_eth_update_tx_fqids(priv); - - rtnl_lock(); -- if (dpaa2_eth_has_mac(priv)) -+ /* We can avoid locking because the "endpoint changed" IRQ -+ * handler is the only one who changes priv->mac at runtime, -+ * so we are not racing with anyone. -+ */ -+ had_mac = !!priv->mac; -+ if (had_mac) - dpaa2_eth_disconnect_mac(priv); - else - dpaa2_eth_connect_mac(priv); -@@ -4605,6 +4636,8 @@ static int dpaa2_eth_probe(struct fsl_mc - priv = netdev_priv(net_dev); - priv->net_dev = net_dev; - -+ mutex_init(&priv->mac_lock); -+ - priv->iommu_domain = iommu_get_domain_for_dev(dev); - - priv->tx_tstamp_type = HWTSTAMP_TX_OFF; ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.h -@@ -580,6 +580,8 @@ struct dpaa2_eth_priv { - #endif - - struct dpaa2_mac *mac; -+ /* Serializes changes to priv->mac */ -+ struct mutex mac_lock; - struct workqueue_struct *dpaa2_ptp_wq; - struct work_struct tx_onestep_tstamp; - struct sk_buff_head tx_skbs; -@@ -733,11 +735,15 @@ static inline unsigned int dpaa2_eth_rx_ - - static inline bool dpaa2_eth_is_type_phy(struct dpaa2_eth_priv *priv) - { -+ lockdep_assert_held(&priv->mac_lock); -+ - return dpaa2_mac_is_type_phy(priv->mac); - } - - static inline bool dpaa2_eth_has_mac(struct dpaa2_eth_priv *priv) - { -+ lockdep_assert_held(&priv->mac_lock); -+ - return priv->mac ? true : false; - } - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-ethtool.c -@@ -86,11 +86,16 @@ static void dpaa2_eth_get_drvinfo(struct - static int dpaa2_eth_nway_reset(struct net_device *net_dev) - { - struct dpaa2_eth_priv *priv = netdev_priv(net_dev); -+ int err = -EOPNOTSUPP; -+ -+ mutex_lock(&priv->mac_lock); - - if (dpaa2_eth_is_type_phy(priv)) -- return phylink_ethtool_nway_reset(priv->mac->phylink); -+ err = phylink_ethtool_nway_reset(priv->mac->phylink); -+ -+ mutex_unlock(&priv->mac_lock); - -- return -EOPNOTSUPP; -+ return err; - } - - static int -@@ -98,10 +103,18 @@ dpaa2_eth_get_link_ksettings(struct net_ - struct ethtool_link_ksettings *link_settings) - { - struct dpaa2_eth_priv *priv = netdev_priv(net_dev); -+ int err; - -- if (dpaa2_eth_is_type_phy(priv)) -- return phylink_ethtool_ksettings_get(priv->mac->phylink, -- link_settings); -+ mutex_lock(&priv->mac_lock); -+ -+ if (dpaa2_eth_is_type_phy(priv)) { -+ err = phylink_ethtool_ksettings_get(priv->mac->phylink, -+ link_settings); -+ mutex_unlock(&priv->mac_lock); -+ return err; -+ } -+ -+ mutex_unlock(&priv->mac_lock); - - link_settings->base.autoneg = AUTONEG_DISABLE; - if (!(priv->link_state.options & DPNI_LINK_OPT_HALF_DUPLEX)) -@@ -116,11 +129,17 @@ dpaa2_eth_set_link_ksettings(struct net_ - const struct ethtool_link_ksettings *link_settings) - { - struct dpaa2_eth_priv *priv = netdev_priv(net_dev); -+ int err = -EOPNOTSUPP; - -- if (!dpaa2_eth_is_type_phy(priv)) -- return -EOPNOTSUPP; -+ mutex_lock(&priv->mac_lock); -+ -+ if (dpaa2_eth_is_type_phy(priv)) -+ err = phylink_ethtool_ksettings_set(priv->mac->phylink, -+ link_settings); - -- return phylink_ethtool_ksettings_set(priv->mac->phylink, link_settings); -+ mutex_unlock(&priv->mac_lock); -+ -+ return err; - } - - static void dpaa2_eth_get_pauseparam(struct net_device *net_dev, -@@ -129,11 +148,16 @@ static void dpaa2_eth_get_pauseparam(str - struct dpaa2_eth_priv *priv = netdev_priv(net_dev); - u64 link_options = priv->link_state.options; - -+ mutex_lock(&priv->mac_lock); -+ - if (dpaa2_eth_is_type_phy(priv)) { - phylink_ethtool_get_pauseparam(priv->mac->phylink, pause); -+ mutex_unlock(&priv->mac_lock); - return; - } - -+ mutex_unlock(&priv->mac_lock); -+ - pause->rx_pause = dpaa2_eth_rx_pause_enabled(link_options); - pause->tx_pause = dpaa2_eth_tx_pause_enabled(link_options); - pause->autoneg = AUTONEG_DISABLE; -@@ -152,9 +176,17 @@ static int dpaa2_eth_set_pauseparam(stru - return -EOPNOTSUPP; - } - -- if (dpaa2_eth_is_type_phy(priv)) -- return phylink_ethtool_set_pauseparam(priv->mac->phylink, -- pause); -+ mutex_lock(&priv->mac_lock); -+ -+ if (dpaa2_eth_is_type_phy(priv)) { -+ err = phylink_ethtool_set_pauseparam(priv->mac->phylink, -+ pause); -+ mutex_unlock(&priv->mac_lock); -+ return err; -+ } -+ -+ mutex_unlock(&priv->mac_lock); -+ - if (pause->autoneg) - return -EOPNOTSUPP; - -@@ -309,8 +341,12 @@ static void dpaa2_eth_get_ethtool_stats( - } - *(data + i++) = buf_cnt; - -+ mutex_lock(&priv->mac_lock); -+ - if (dpaa2_eth_has_mac(priv)) - dpaa2_mac_get_ethtool_stats(priv->mac, data + i); -+ -+ mutex_unlock(&priv->mac_lock); - } - - static int dpaa2_eth_prep_eth_rule(struct ethhdr *eth_value, struct ethhdr *eth_mask, diff --git a/target/linux/armvirt/patches-6.1/701-v6.2-0011-net-dpaa2-switch-serialize-changes-to-priv-mac-with.patch b/target/linux/armvirt/patches-6.1/701-v6.2-0011-net-dpaa2-switch-serialize-changes-to-priv-mac-with.patch deleted file mode 100644 index 7ea446516b..0000000000 --- a/target/linux/armvirt/patches-6.1/701-v6.2-0011-net-dpaa2-switch-serialize-changes-to-priv-mac-with.patch +++ /dev/null @@ -1,203 +0,0 @@ -From 80d12452a5f160c39d63efc1be07df36f9d07133 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Tue, 29 Nov 2022 16:12:20 +0200 -Subject: [PATCH 13/14] net: dpaa2-switch: serialize changes to priv->mac with - a mutex - -The dpaa2-switch driver uses a DPMAC in the same way as the dpaa2-eth -driver, so we need to duplicate the locking solution established by the -previous change to the switch driver as well. - -Signed-off-by: Vladimir Oltean -Reviewed-by: Ioana Ciornei -Tested-by: Ioana Ciornei -Signed-off-by: Paolo Abeni ---- - .../freescale/dpaa2/dpaa2-switch-ethtool.c | 32 +++++++++++++++---- - .../ethernet/freescale/dpaa2/dpaa2-switch.c | 31 ++++++++++++++++-- - .../ethernet/freescale/dpaa2/dpaa2-switch.h | 2 ++ - 3 files changed, 55 insertions(+), 10 deletions(-) - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-ethtool.c -@@ -60,11 +60,18 @@ dpaa2_switch_get_link_ksettings(struct n - { - struct ethsw_port_priv *port_priv = netdev_priv(netdev); - struct dpsw_link_state state = {0}; -- int err = 0; -+ int err; - -- if (dpaa2_switch_port_is_type_phy(port_priv)) -- return phylink_ethtool_ksettings_get(port_priv->mac->phylink, -- link_ksettings); -+ mutex_lock(&port_priv->mac_lock); -+ -+ if (dpaa2_switch_port_is_type_phy(port_priv)) { -+ err = phylink_ethtool_ksettings_get(port_priv->mac->phylink, -+ link_ksettings); -+ mutex_unlock(&port_priv->mac_lock); -+ return err; -+ } -+ -+ mutex_unlock(&port_priv->mac_lock); - - err = dpsw_if_get_link_state(port_priv->ethsw_data->mc_io, 0, - port_priv->ethsw_data->dpsw_handle, -@@ -99,9 +106,16 @@ dpaa2_switch_set_link_ksettings(struct n - bool if_running; - int err = 0, ret; - -- if (dpaa2_switch_port_is_type_phy(port_priv)) -- return phylink_ethtool_ksettings_set(port_priv->mac->phylink, -- link_ksettings); -+ mutex_lock(&port_priv->mac_lock); -+ -+ if (dpaa2_switch_port_is_type_phy(port_priv)) { -+ err = phylink_ethtool_ksettings_set(port_priv->mac->phylink, -+ link_ksettings); -+ mutex_unlock(&port_priv->mac_lock); -+ return err; -+ } -+ -+ mutex_unlock(&port_priv->mac_lock); - - /* Interface needs to be down to change link settings */ - if_running = netif_running(netdev); -@@ -189,8 +203,12 @@ static void dpaa2_switch_ethtool_get_sta - dpaa2_switch_ethtool_counters[i].name, err); - } - -+ mutex_lock(&port_priv->mac_lock); -+ - if (dpaa2_switch_port_has_mac(port_priv)) - dpaa2_mac_get_ethtool_stats(port_priv->mac, data + i); -+ -+ mutex_unlock(&port_priv->mac_lock); - } - - const struct ethtool_ops dpaa2_switch_port_ethtool_ops = { ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c -@@ -603,8 +603,11 @@ static int dpaa2_switch_port_link_state_ - - /* When we manage the MAC/PHY using phylink there is no need - * to manually update the netif_carrier. -+ * We can avoid locking because we are called from the "link changed" -+ * IRQ handler, which is the same as the "endpoint changed" IRQ handler -+ * (the writer to port_priv->mac), so we cannot race with it. - */ -- if (dpaa2_switch_port_is_type_phy(port_priv)) -+ if (dpaa2_mac_is_type_phy(port_priv->mac)) - return 0; - - /* Interrupts are received even though no one issued an 'ifconfig up' -@@ -684,6 +687,8 @@ static int dpaa2_switch_port_open(struct - struct ethsw_core *ethsw = port_priv->ethsw_data; - int err; - -+ mutex_lock(&port_priv->mac_lock); -+ - if (!dpaa2_switch_port_is_type_phy(port_priv)) { - /* Explicitly set carrier off, otherwise - * netif_carrier_ok() will return true and cause 'ip link show' -@@ -697,6 +702,7 @@ static int dpaa2_switch_port_open(struct - port_priv->ethsw_data->dpsw_handle, - port_priv->idx); - if (err) { -+ mutex_unlock(&port_priv->mac_lock); - netdev_err(netdev, "dpsw_if_enable err %d\n", err); - return err; - } -@@ -706,6 +712,8 @@ static int dpaa2_switch_port_open(struct - if (dpaa2_switch_port_is_type_phy(port_priv)) - dpaa2_mac_start(port_priv->mac); - -+ mutex_unlock(&port_priv->mac_lock); -+ - return 0; - } - -@@ -715,6 +723,8 @@ static int dpaa2_switch_port_stop(struct - struct ethsw_core *ethsw = port_priv->ethsw_data; - int err; - -+ mutex_lock(&port_priv->mac_lock); -+ - if (dpaa2_switch_port_is_type_phy(port_priv)) { - dpaa2_mac_stop(port_priv->mac); - } else { -@@ -722,6 +732,8 @@ static int dpaa2_switch_port_stop(struct - netif_carrier_off(netdev); - } - -+ mutex_unlock(&port_priv->mac_lock); -+ - err = dpsw_if_disable(port_priv->ethsw_data->mc_io, 0, - port_priv->ethsw_data->dpsw_handle, - port_priv->idx); -@@ -1461,7 +1473,9 @@ static int dpaa2_switch_port_connect_mac - } - } - -+ mutex_lock(&port_priv->mac_lock); - port_priv->mac = mac; -+ mutex_unlock(&port_priv->mac_lock); - - return 0; - -@@ -1474,9 +1488,12 @@ err_free_mac: - - static void dpaa2_switch_port_disconnect_mac(struct ethsw_port_priv *port_priv) - { -- struct dpaa2_mac *mac = port_priv->mac; -+ struct dpaa2_mac *mac; - -+ mutex_lock(&port_priv->mac_lock); -+ mac = port_priv->mac; - port_priv->mac = NULL; -+ mutex_unlock(&port_priv->mac_lock); - - if (!mac) - return; -@@ -1495,6 +1512,7 @@ static irqreturn_t dpaa2_switch_irq0_han - struct ethsw_port_priv *port_priv; - u32 status = ~0; - int err, if_id; -+ bool had_mac; - - err = dpsw_get_irq_status(ethsw->mc_io, 0, ethsw->dpsw_handle, - DPSW_IRQ_INDEX_IF, &status); -@@ -1513,7 +1531,12 @@ static irqreturn_t dpaa2_switch_irq0_han - - if (status & DPSW_IRQ_EVENT_ENDPOINT_CHANGED) { - rtnl_lock(); -- if (dpaa2_switch_port_has_mac(port_priv)) -+ /* We can avoid locking because the "endpoint changed" IRQ -+ * handler is the only one who changes priv->mac at runtime, -+ * so we are not racing with anyone. -+ */ -+ had_mac = !!port_priv->mac; -+ if (had_mac) - dpaa2_switch_port_disconnect_mac(port_priv); - else - dpaa2_switch_port_connect_mac(port_priv); -@@ -3256,6 +3279,8 @@ static int dpaa2_switch_probe_port(struc - port_priv->netdev = port_netdev; - port_priv->ethsw_data = ethsw; - -+ mutex_init(&port_priv->mac_lock); -+ - port_priv->idx = port_idx; - port_priv->stp_state = BR_STATE_FORWARDING; - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.h -@@ -161,6 +161,8 @@ struct ethsw_port_priv { - - struct dpaa2_switch_filter_block *filter_block; - struct dpaa2_mac *mac; -+ /* Protects against changes to port_priv->mac */ -+ struct mutex mac_lock; - }; - - /* Switch data */ diff --git a/target/linux/armvirt/patches-6.1/701-v6.2-0012-net-dpaa2-mac-move-rtnl_lock-only-around-phylink.patch b/target/linux/armvirt/patches-6.1/701-v6.2-0012-net-dpaa2-mac-move-rtnl_lock-only-around-phylink.patch deleted file mode 100644 index 976c2a0335..0000000000 --- a/target/linux/armvirt/patches-6.1/701-v6.2-0012-net-dpaa2-mac-move-rtnl_lock-only-around-phylink.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 4ea2faf5bb13d9ba9f07e996d495c4cbe34a4236 Mon Sep 17 00:00:00 2001 -From: Vladimir Oltean -Date: Tue, 29 Nov 2022 16:12:21 +0200 -Subject: [PATCH 14/14] net: dpaa2-mac: move rtnl_lock() only around - phylink_{,dis}connect_phy() - -After the introduction of a private mac_lock that serializes access to -priv->mac (and port_priv->mac in the switch), the only remaining purpose -of rtnl_lock() is to satisfy the locking requirements of -phylink_fwnode_phy_connect() and phylink_disconnect_phy(). - -But the functions these live in, dpaa2_mac_connect() and -dpaa2_mac_disconnect(), have contradictory locking requirements. -While phylink_fwnode_phy_connect() wants rtnl_lock() to be held, -phylink_create() wants it to not be held. - -Move the rtnl_lock() from top-level (in the dpaa2-eth and dpaa2-switch -drivers) to only surround the phylink calls that require it, in the -dpaa2-mac library code. - -This is possible because dpaa2_mac_connect() and dpaa2_mac_disconnect() -run unlocked, and there isn't any danger of an AB/BA deadlock between -the rtnl_mutex and other private locks. - -Signed-off-by: Vladimir Oltean -Reviewed-by: Ioana Ciornei -Tested-by: Ioana Ciornei -Signed-off-by: Paolo Abeni ---- - drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ---- - drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 5 +++++ - drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c | 4 ---- - 3 files changed, 5 insertions(+), 8 deletions(-) - ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c -@@ -4529,7 +4529,6 @@ static irqreturn_t dpni_irq0_handler_thr - dpaa2_eth_set_mac_addr(netdev_priv(net_dev)); - dpaa2_eth_update_tx_fqids(priv); - -- rtnl_lock(); - /* We can avoid locking because the "endpoint changed" IRQ - * handler is the only one who changes priv->mac at runtime, - * so we are not racing with anyone. -@@ -4539,7 +4538,6 @@ static irqreturn_t dpni_irq0_handler_thr - dpaa2_eth_disconnect_mac(priv); - else - dpaa2_eth_connect_mac(priv); -- rtnl_unlock(); - } - - return IRQ_HANDLED; -@@ -4856,9 +4854,7 @@ static int dpaa2_eth_remove(struct fsl_m - else - fsl_mc_free_irqs(ls_dev); - -- rtnl_lock(); - dpaa2_eth_disconnect_mac(priv); -- rtnl_unlock(); - dpaa2_eth_free_rings(priv); - free_percpu(priv->fd); - free_percpu(priv->sgt_cache); ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c -@@ -428,7 +428,9 @@ int dpaa2_mac_connect(struct dpaa2_mac * - } - mac->phylink = phylink; - -+ rtnl_lock(); - err = phylink_fwnode_phy_connect(mac->phylink, dpmac_node, 0); -+ rtnl_unlock(); - if (err) { - netdev_err(net_dev, "phylink_fwnode_phy_connect() = %d\n", err); - goto err_phylink_destroy; -@@ -446,7 +448,10 @@ err_pcs_destroy: - - void dpaa2_mac_disconnect(struct dpaa2_mac *mac) - { -+ rtnl_lock(); - phylink_disconnect_phy(mac->phylink); -+ rtnl_unlock(); -+ - phylink_destroy(mac->phylink); - dpaa2_pcs_destroy(mac); - of_phy_put(mac->serdes_phy); ---- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c -+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c -@@ -1530,7 +1530,6 @@ static irqreturn_t dpaa2_switch_irq0_han - } - - if (status & DPSW_IRQ_EVENT_ENDPOINT_CHANGED) { -- rtnl_lock(); - /* We can avoid locking because the "endpoint changed" IRQ - * handler is the only one who changes priv->mac at runtime, - * so we are not racing with anyone. -@@ -1540,7 +1539,6 @@ static irqreturn_t dpaa2_switch_irq0_han - dpaa2_switch_port_disconnect_mac(port_priv); - else - dpaa2_switch_port_connect_mac(port_priv); -- rtnl_unlock(); - } - - out: -@@ -2958,9 +2956,7 @@ static void dpaa2_switch_remove_port(str - { - struct ethsw_port_priv *port_priv = ethsw->ports[port_idx]; - -- rtnl_lock(); - dpaa2_switch_port_disconnect_mac(port_priv); -- rtnl_unlock(); - free_netdev(port_priv->netdev); - ethsw->ports[port_idx] = NULL; - }